Question 1

The vectors \(\vec{u_1} = \frac{1}{3} \begin{pmatrix} 2 \\ 1 \\ 2 \end{pmatrix}\) and \(\vec{u_2} = \frac{1}{3} \begin{pmatrix} -2 \\ 2 \\ 1 \end{pmatrix}\) form an orthonormal set. What vector \(\vec{u_3}\) completes the set to form an orthonormal basis for \(\mathbb{R}^3\)?

# install.packages("pracma")
library(pracma)
u1 <- (1/3) * c(2,1,2)
u2 <- (1/3) * c(-2,2,1)
u1u2 <- cbind(u1,u2)
orth(u1u2)
##            [,1]       [,2]
## [1,] -0.6666667  0.6666667
## [2,] -0.3333333 -0.6666667
## [3,] -0.6666667 -0.3333333

Question 2

The diagram shows two special dice in the shape of octagonal prisms. Each die has eight rectangular faces, each with a number, and two octagonal faces at the ends. Timothy rolls the two dice on a flat surface until they settle with numbers on the top faces. He then notes down whether or not the two numbers on the top face are both prime. What is the probability both numbers are prime?

# install.packages("pracma")
library(pracma)
die1 <- 1:8
die2 <- 1:8
counter <- 0
N <- 1e5 # 100,000 trials
for (i in 1:N) {
  roll1 <- sample(x = die1,size = 1,replace = T)
  roll2 <- sample(x = die2,size = 1,replace = T)
  if (isprime(roll1) == TRUE & isprime(roll2) == TRUE) {
    counter <- counter + 1
  }
}
probability <- counter / N
cat("The probability both numbers are prime is:",probability,"\n")
## The probability both numbers are prime is: 0.24774