die <- 1:6
dice <- expand.grid(
first = die,
second = die,
third = die
)
dice_sums <- rowSums(dice)
round(length(dice_sums[dice_sums == 12])/length(dice_sums), digits = 4)
## [1] 0.1157
df <- data.frame(
Residence = c("Apartment", "Dorm", "With Parent(s)", "Sorority/Fraternity House", "Other"),
Males = c(200, 200, 100, 200, 200),
Females = c(300, 100, 200, 100, 100)
)
other <- rowSums(df[,2:3])[5]
total <- sum(colSums(df[,2:3]))
round(other / total, 4)
## [1] 0.1765
The probability of drawing two cards from a deck is the probability of drawing the first card multiplied by the probability of drawing the second card.
P_dia_1 = 13/52
P_dia_2 = 12/51
round(P_dia_1 * P_dia_2, 4)
## [1] 0.0588
Order matters, so we’re calculating a permutation. We should assume from the language of the question that repeats aren’t allowed in the list.
factorial(20)/factorial(20-10)
## [1] 670442572800
If a home theater system consists of one item from each type, that means we have 20 options for the first item, 20 options for the second item, and 18 options for the third item.
20 * 20 * 18
## [1] 7200
There are 10 different patients the doctor can visit first, which means there are 9 patients the doctor can visit second, 8 patients she can visit third, and so on. This is a factorial problem.
factorial(10)
## [1] 3628800
A coin flip has two possible outcomes, and six-sided die has six possible outcomes, and a deck has 52 outcomes for the first card, 51 outcomes for the second card, 50 outcomes for the third card, and 49 outcomes for the fourth card.
2^7 * 6^3 * 52 * 51 * 50 * 49
## [1] 179640115200
The first seat can have either a man or a woman. In either case, there are four options. In the next chair, there will also be four options for whichever gender wasn’t seated first. The third and fourth chairs will each have three options, and so on. This is a square of factorials.
factorial(4)^2
## [1] 576
\[ P(+ \mid \text{User}) = 0.95 \\ P(- \mid \text{User}^c) = 0.99 \\ P(\text{User}) = 0.03 \\ P(\text{User} \mid +) = \frac{P(+ \mid \text{User}) P(\text{User})}{P(+)} \\ P(+) = P(+ \mid \text{User}) P(\text{User}) + P(+ \mid \text{User}^c) P(\text{User}^c) \]
For the purposes of writing variable names in R, I will use the following conventions: - p denotes probability - u denotes user - n denotes non-user - o denotes a positive test result - m denotes a negative (minus) test result - g denotes given
pogu <- 0.95
pmgn <- 0.99
pogn <- 1-pmgn
pu <- 0.03
pn <- 1-pu
po <- pogu*pu+pn*pogn
pugo <- round(pogu*pu/po, 4)
pugo
## [1] 0.7461
\(P(User \mid +) = 0.7461\)
There are a total of six sides across three pancakes - three brown, three gold. If we see one brown side, we know right away that we are looking at one of the two pancakes that has at least one brown side (called BG and BB). The reveal that we are looking at a brown side reduces our total possibilities down to three - we’re either looking at BB side 1, BB side 2, or the brown side of BG. If the pancake is BG, the other side cannot be brown, but if the pancake is BB we have two scenarios where the other side could be brown. Therefore, the probability that the other side is brown is \(\frac{2}{3}=0.\overline{6}\).