Question 1

Determine whether or not the series converges or diverges.

\[\sum_{n = 0}^{\infty} \frac{(n + 2)^2}{5^n \sqrt{n + 1}}\]

total <- 0
series <- function(n) {
  (n + 2)^2 / ((5)^n * sqrt(n + 1))
}
for (x in 0:1e5) {
  total <- total + series(x)
}
total
## [1] 5.776483

We find that the series converges to a value of 5.78.

Question 2

Find the inverse of \(A = \begin{pmatrix} 1 & 2 \\ 3 & 5 \end{pmatrix}\).

# install.packages("matrixcalc")
library(matrixcalc)
## Warning: package 'matrixcalc' was built under R version 4.5.2
A <- matrix(data = c(1,2,3,5),nrow = 2,ncol = 2,byrow = T)
if (det(A) == 0) {
  cat("The inverse of matrix A does not exist.")
} else {
  matrix.inverse(A)
}
##      [,1] [,2]
## [1,]   -5    2
## [2,]    3   -1

Question 3

Which number cannot be divisible by 11?

A. 8073

B. 8129

C. 8151

D. 8294

# install.packages("tidyverse")
library(tidyverse)
## Warning: package 'lubridate' was built under R version 4.5.2
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.1     ✔ stringr   1.5.2
## ✔ ggplot2   4.0.0     ✔ tibble    3.3.0
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.1.0     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
q3_data <- data.frame(Choice = LETTERS[1:4],
                      Number = c(8073,8129,8151,8294))
correct_answer <- q3_data %>%
  mutate(Divisible.by.11 = Number %% 11 != 0) %>%
  filter(Divisible.by.11 == TRUE) %>%
  pull(Choice)
cat("The correct answer is:",correct_answer,"\n")
## The correct answer is: A

Question 4

Consider the spinner below. Use a Monte Carlo simulation to find the probability that the spinner score is greater than 3.

\[\text{Spinner} = [1,5,3,5,2,1,5,3]\]

Spinner <- c(1,5,3,5,2,1,5,3)
N <- 1e5
Counter <- 0
for (i in 1:N) {
  spin <- sample(x = Spinner,size = 1,replace = T)
  if (spin > 3) {
    Counter <- Counter + 1
  }
}
Probability <- Counter / N
cat("The probability that the spinner score is greater than 3 is:",Probability,"\n")
## The probability that the spinner score is greater than 3 is: 0.37507