x <- seq(1,6,1)
d1 <- expand.grid(x,x,x)
rowsum <- rowSums(d1)
sum(rowsum==12)/length(rowsum)
## [1] 0.1157407
The probability is 0.1157.
cust <- matrix(c(200,300,200,100,100,200,200,100,200,100),5,2,byrow = T)
(200+100)/sum(colSums(cust))
## [1] 0.1764706
The probability is 0.1765.
first <- 13/52
second <- (13/52)*(12/51)
second/first
## [1] 0.2352941
The probability is 0.2353.
#install.packages('gtools')
library(gtools)
factorial(20)/factorial(10)/factorial(10)
## [1] 184756
There are 184756 possible lineups.
choose(20,1)*choose(20,1)*choose(18,1)
## [1] 7200
There are 7200 choices
factorial(10)
## [1] 3628800
The doctor has 3628800 ways.
coin <- 2^7
die <- 6^3
card <- choose(52,4)
coin*die*card
## [1] 7485004800
There are 7485004800 outcomes.
factorial(4)*factorial(3)
## [1] 144
There are 144 ways.
10.
PAB <- 1/3
# PAB is P(AB)
PA<- 3/6
#PA is P(A)
Q10 <- PAB/PA
print(Q10)
## [1] 0.6666667
P(B|A) = P(AB)/P(A)
P(AB) = Take one pancake out after it has browned on both sides