Each answer here was worked out by hand, without RatMath, before the RatMath code was written. Where the arithmetic is long, the working says how it was checked.
1.Addition rule
P(A)=0.5, P(B)=0.4, P(A∩B)=0.2. Find P(A∪B) and P(A∣B).
Answer
0.5+0.4−0.2=0.7; 0.2/0.4=0.5.
2.Birthday problem
In a group of 23 people, what is the probability that two share a birthday (365 equally likely days)?
Answer
1−36523365⋅364⋯343≈0.5073.
3.Hypergeometric
A box has 8 red and 12 blue balls. Five are drawn without replacement. Find P(exactly 2 red).
Answer
(520)(28)(312)=1550428⋅220=969385.
4.Poisson
Calls arrive at 3 per minute (Poisson). Find P(X=2) and P(X≥1) in one minute.
Answer
29e−3≈0.22404; 1−e−3≈0.95021.
5.Geometric
A die is rolled until the first 6. Find the expected number of rolls and the probability the first 6 is on roll 4.
Answer
E=6; (5/6)3(1/6)=125/1296.
6.Sum of two dice
Find the mean and variance of the sum of two fair dice.
Roll a die. If it is even, flip two coins; otherwise flip one. What is the expected number of heads?
Answer
21⋅1+21⋅21=43.
13.Bayes with urns
Urn 1 has 3 red and 2 blue balls, urn 2 has 1 red and 4 blue. An urn is chosen at random and a red ball drawn. What is the probability it came from urn 1?
Answer
21⋅53+21⋅5121⋅53=43.
14.Stationary distribution
Find the stationary distribution of the chain with transition matrix (0.90.50.10.5).
Answer
0.1π1=0.5π2: π=(65,61).
15.Gambler's ruin
A gambler with \$3 bets \$1 at a time, winning each bet with probability 0.4, until reaching \$10 or \$0. What is the probability of reaching \$10?
Answer
r=q/p=1.5: 1−1.5101−1.53=56.6652.375≈0.04191.
16.Moment generating function
The MGF of a Poisson(λ) variable is M(t)=eλ(et−1). Use it to find E[X2].
Answer
M′′(0)=λ+λ2.
17.A transformed variable
X is uniform on (0,1) and Y=X2. Find the density of Y and P(Y≤41).
Answer
FY(y)=y, so fY(y)=2y1 on (0,1); P(Y≤41)=21.
18.Order statistics
Find the expected maximum of three independent uniform (0,1) variables.
Answer
Fmax(x)=x3, E=∫013x3dx=43.
19.Coupon collector
How many rolls of a die are expected before every face has appeared?
Answer
6(1+21+⋯+61)=6⋅2049=14.7.
20.Matching problem
Ten letters go into ten envelopes at random. Find the expected number in the right envelope and the probability that none is.