dice_combinations <- expand.grid(d1=1:6,d2=1:6,d3=1:6)
#print(dice_combinations)
dice_sums <- rowSums(dice_combinations)
probability <- mean(dice_sums==12)
print(probability)
## [1] 0.1157407
mat <- matrix(
c(200,300,
200,100,
100,200,
200,100,
200,100),
nrow = 5,
ncol = 2,
byrow = TRUE,
dimnames = list(
c("Apartment","Dorm","With Parent(s)","Sorority/Fraternity House","Other"),
c("Males","Females")
)
)
# print(mat)
#rowSums(mat)
#colSums(mat)
# 2.Total number of residents
total_residents <- sum(colSums(mat))
# 3. Total number of residents in the "Other" row
other_sum <- rowSums(mat)["Other"]
# 4. Calculate the final probability
probability <- other_sum / total_residents
print(probability)
## Other
## 0.1764706
# 13 diamond cards in a 52 card deck
first_diamond <- 13/52
# one less diamond card in deck
second_diamond <- 12/51
both_diamonds <- first_diamond * second_diamond
both_diamonds
## [1] 0.05882353
# Combination of 10 songs out of a list of 20
song_combination <- factorial(20)/ (factorial(10)*(factorial(20-10)))
song_combination
## [1] 184756
choose(n=20,k=10)
## [1] 184756
tv <- 20
sound_system <- 20
dvd_player <-18
# counting principle
total_theater_systems <- tv* sound_system * dvd_player
total_theater_systems
## [1] 7200
# number of ways the doctor can visit 10 patients
factorial(10)
## [1] 3628800
# counting method
coin_toss <- 2^7
die_roll <- 6^3
cards_drawn <- choose(n=52,k=4)
possible_outcomes <- coin_toss * die_roll * cards_drawn
possible_outcomes
## [1] 7485004800
women_seated <- factorial(4)
men_seated <- factorial(4)
ways_seated <- women_seated * men_seated
ways_seated
## [1] 576
p_pos_user <- 0.95
p_neg_notUser <- 0.99
#complement
p_pos_notUser <- 1-p_neg_notUser
p_user <- 0.03
p_notUser <- 1-p_user
p_user_pos <- (p_pos_user*p_user)/((p_pos_user*p_user)+(p_pos_notUser*p_notUser))
p_user_pos
## [1] 0.7460733
The probability of the other side to be brown is 2/3, meaning 67%. Given the fact that the observed side of the pancake is brown, changes our initial probability of getting a brown side. It eliminates that pancake that is golden on both sides. The pancake that is brown on both sides in twice likely to show up as the picked brown side pancake, making a brown side to show up 2 out of 3 options to observe a brown side.