A Practical Guide to Quantitative Finance Interviews
Contents

4.3 Conditional Probability and Bayes’ formula

Many financial transactions are responses to probability adjustments based on new—and most likely incomplete—information. Conditional probability surely is one of the most popular test subjects in quantitative interviews. So in this section, we focus on basic conditional probability definitions and theorems.

Conditional probability P(A∣B)P(A\mid B): If P(B)>0P(B)>0, then P(A∣B)=P(AB)P(B)P(A\mid B)=\dfrac{P(AB)}{P(B)} is the fraction of BB outcomes that are also AA outcomes.

Multiplication Rule: P(E1E2⋯En)=P(E1)P(E2∣E1)P(E3∣E1E2)⋯P(En∣E1⋯En−1)P(E_1E_2\cdots E_n)=P(E_1)P(E_2\mid E_1)P(E_3\mid E_1E_2)\cdots P(E_n\mid E_1\cdots E_{n-1}).

73

Law of total probability: for any mutually exclusive events {Fi}, i=1,2,⋯ ,n\{F_i\},\ i=1,2,\cdots,n, whose union is the entire sample space (Fi∩Fj=Φ, ∀i≠j; ⋃i=1nFi=ΩF_i\cap F_j=\Phi,\ \forall i\ne j;\ \bigcup_{i=1}^{n}F_i=\Omega), we have

P(E)=P(EF1)+P(EF2)+⋯+P(EFn)=∑i=1nP(E∣Fi)P(Fi)=P(E∣F1)P(F1)+P(E∣F2)P(F2)+⋯+P(E∣Fn)P(Fn)\begin{aligned}P(E)&=P(EF_1)+P(EF_2)+\cdots+P(EF_n)=\sum_{i=1}^{n}P(E\mid F_i)P(F_i)\\&=P(E\mid F_1)P(F_1)+P(E\mid F_2)P(F_2)+\cdots+P(E\mid F_n)P(F_n)\end{aligned}

Independent events: P(EF)=P(E)P(F)⇒P(EFC)=P(E)P(FC)P(EF)=P(E)P(F)\Rightarrow P(EF^C)=P(E)P(F^C).

Independence is a symmetric relation: X is independent of Y ⇔\Leftrightarrow Y is independent of X.

Bayes’ Formula: P(Fj∣E)=P(E∣Fj)P(Fj)∑i=1nP(E∣Fi)P(Fi)P(F_j\mid E)=\dfrac{P(E\mid F_j)P(F_j)}{\sum_{i=1}^{n}P(E\mid F_i)P(F_i)} if Fi, i=1,⋯ ,nF_i,\ i=1,\cdots,n, are mutually exclusive events whose union is the entire sample space.

As the following examples will demonstrate, not all conditional probability problems have intuitive solutions. Many demand logical analysis instead.

Boys and girls

Part A. A company is holding a dinner for working mothers with at least one son. Ms. Jackson, a mother with two children, is invited. What is the probability that both children are boys?

Solution: The sample space of two children is given by Ω={(b,b),(b,g),(g,b),(g,g)}\Omega=\{(b,b),(b,g),(g,b),(g,g)\} (e.g., (g,b)(g,b) means the older child is a girl and the younger child a boy), and each outcome has the same probability. Since Ms. Jackson is invited, she has at least one son. Let BB be the event that at least one of the children is a boy and AA be the event that both children are boys, we have

P(A∣B)=P(A∩B)P(B)=P({(b,b)})P({(b,b),(b,g),(g,b)})=1/43/4=13.P(A\mid B)=\frac{P(A\cap B)}{P(B)}=\frac{P(\{(b,b)\})}{P(\{(b,b),(b,g),(g,b)\})}=\frac{1/4}{3/4}=\frac13.

Part B. Your new colleague, Ms. Parker is known to have two children. If you see her walking with one of her children and that child is a boy, what is the probability that both children are boys?

74

Solution: the other child is equally likely to be a boy or a girl (independent of the boy you’ve seen), so the probability that both children are boys is 1/2.

Notice the subtle difference between part A and part B. In part A, the problem essentially asks given there is at least one boy in two children, what is the conditional probability that both children are boys. Part B asks that given one child is a boy, what is the conditional probability that the other child is also a boy. For both parts, we need to assume that each child is equal likely to be a boy or a girl.

All-girl world?

In a primitive society, every couple prefers to have a baby girl. There is a 50% chance that each child they have is a girl, and the genders of their children are mutually independent. If each couple insists on having more children until they get a girl and once they have a girl they will stop having more children, what will eventually happen to the fraction of girls in this society?

Solution: It was surprising that many interviewees—include many who studied probability—have the misconception that there will be more girls. Do not let the word “prefer” and a wrong intuition misguide you. The fraction of baby girls are driven by nature, or at least the X and Y chromosomes, not by the couples’ preference. You only need to look at the key information: 50% and independence. Every new-born child has equal probability of being a boy or a girl regardless of the gender of any other children. So the fraction of girls born is always 50% and the fractions of girls in the society will stay stable at 50%.

Unfair coin

You are given 1000 coins. Among them, 1 coin has heads on both sides. The other 999 coins are fair coins. You randomly choose a coin and toss it 10 times. Each time, the coin turns up heads. What is the probability that the coin you choose is the unfair one?

Solution: This is a classic conditional probability question that uses Bayes’ theorem. Let AA be the event that the chosen coin is the unfair one, then AcA^c is the event that the chosen coin is a fair one. Let BB be the event that all ten tosses turn up heads. Apply Bayes’ theorem we have P(A∣B)=P(B∣A)P(A)P(B)=P(B∣A)P(A)P(B∣A)P(A)+P(B∣Ac)P(Ac)P(A\mid B)=\dfrac{P(B\mid A)P(A)}{P(B)}=\dfrac{P(B\mid A)P(A)}{P(B\mid A)P(A)+P(B\mid A^c)P(A^c)}.

The priors are P(A)=1/1000P(A)=1/1000 and P(Ac)=999/1000P(A^c)=999/1000. If the coin is unfair, it always turns up heads, so P(B∣A)=1P(B\mid A)=1. If the coin is fair, each time it has 1/2 probability turning 75 up heads. So P(B∣Ac)=(1/2)10=1/1024P(B\mid A^c)=(1/2)^{10}=1/1024. Plug in all the available information and we have the answer:

P(A∣B)=P(B∣A)P(A)P(B∣A)P(A)+P(B∣Ac)P(Ac)=1/1000×11/1000×1+999/1000×1/1024≈0.5.P(A\mid B)=\frac{P(B\mid A)P(A)}{P(B\mid A)P(A)+P(B\mid A^c)P(A^c)}=\frac{1/1000\times1}{1/1000\times1+999/1000\times1/1024}\approx0.5.

Fair probability from an unfair coin

If you have an unfair coin, which may bias toward either heads or tails at an unknown probability, can you generate even odds using this coin?

Solution: Unlike fair coins, we clearly can not generate even odds with one toss using an unfair coin. How about using 2 tosses? Let pHp_H be the probability the coin will yield head, and pTp_T be the probability the coin will yield tails (pH+pT=1p_H+p_T=1). Consider two independent tosses. We have four possible outcomes HH, HT, THHH,\ HT,\ TH and TTTT with probabilities P(HH)=pHpH, P(HT)=pHpT, P(TH)=pTpH,P(HH)=p_Hp_H,\ P(HT)=p_Hp_T,\ P(TH)=p_Tp_H, and P(TT)=pTpTP(TT)=p_Tp_T. So we have P(HT)=P(TH)P(HT)=P(TH). By assigning HTHT to winning and THTH to losing, we can generate even odds.12

Dart game

Jason throws two darts at a dartboard, aiming for the center. The second dart lands farther from the center than the first. If Jason throws a third dart aiming for the center, what is the probability that the third throw is farther from the center than the first? Assume Jason's skillfulness is constant.

Solution: A standard answer directly applies the conditional probability by enumerating all possible outcomes. If we rank the three darts’ results from the best (A) to the worst (C), there are 6 possible outcomes with equal probability:

76
Outcome123456
1st throwABACBC
2nd throwBACACB
3rd throwCCBBAA

The information from the first two throws eliminates outcomes 2, 4 and 6. Conditioned on outcomes 1, 3, and 5, the outcomes that the 3rd throw is worse than the 1st throw are outcomes 1 and 3. So there is 2/3 probability that the third throw is farther from the center than the first.

This approach surely is reasonable. Nevertheless, it is not an efficient approach. When the number of darts is small, we can easily enumerate all outcomes. What if it is a more complex version of the original problem:

Jason throws nn (n≥5n\ge5) darts at a dartboard, aiming for the center. Each subsequent dart is farther from the center than the first dart. If Jason throws the (n+1)(n+1)th dart, what is the probability that it is also farther from the center than his first?

This question is equivalent to a simple question: what is the probability that the (n+1)(n+1)th throw is not the best among all (n+1)(n+1) throws? Since the 1st throw is the best among the first nn throws, essentially I am saying the event that the (n+1)(n+1)th throw is the best of all (n+1)(n+1) throws (let’s call it An+1A_{n+1}) is independent of the event that the 1st throw is the best of the first nn throws (let’s call it A1A_1). In fact, An+1A_{n+1} is independent of the order of the first nn throws. Are these two events really independent? The answer is a resounding yes. If it is not obvious to you that An+1A_{n+1} is independent of the order of the first nn throws, let’s look at it another way: the order of the first nn throws is independent of An+1A_{n+1}. Surely this claim is conspicuous. But independence is symmetric! Since the probability of An+1A_{n+1} is 1/(n+1)1/(n+1), the probability that (n+1)(n+1)th throw is not the best is n/(n+1)n/(n+1).13

For the original version, three darts are thrown independently, they each have a 1/3 chance of being the best throw. As long as the third dart is not the best throw, it will be worse than the first dart. Therefore the answer is 2/3.

Birthday line

At a movie theater, a whimsical manager announces that she will give a free ticket to the first person in line whose birthday is the same as someone who has already bought a ticket. You are given the opportunity to choose any position in line. Assuming that you 77 don’t know anyone else's birthday and all birthdays are distributed randomly throughout the year (assuming 365 days in a year), what position in line gives you the largest chance of getting the free ticket?14

Solution: If you have solved the problem that no two people have the same birthday in an nn-people group, this new problem is just a small extension. Assume that you choose to be the nn-th person in line. In order for you to get the free ticket, all of the first n−1n-1 individuals in line must have different birthdays and your birthday needs to be the same as one of those n−1n-1 individuals.

p(n)=p(first n−1 people have no same birthday)×p(yours among those n−1 birthdays)=365×364×⋯(365−n+2)365n−1×n−1365\begin{aligned}p(n)&=p(\text{first }n-1\text{ people have no same birthday})\times p(\text{yours among those }n-1\text{ birthdays})\\&=\frac{365\times364\times\cdots(365-n+2)}{365^{n-1}}\times\frac{n-1}{365}\end{aligned}

It is intuitive to argue that when nn is small, increasing nn will increase your chance of getting the free ticket since the increase of p(yours among those n−1 birthdays)p(\text{yours among those }n-1\text{ birthdays}) is more significant than the decrease in p(first n−1 people have no same birthday)p(\text{first }n-1\text{ people have no same birthday}). So when nn is small, we have P(n)>P(n−1)P(n)>P(n-1). As nn increases, gradually the negative impact of p(first n−1 people have no same birthday)p(\text{first }n-1\text{ people have no same birthday}) will catch up and at a certain point we will have P(n+1)<P(n)P(n+1)<P(n). So we need to find such an nn that satisfies P(n)>P(n−1)P(n)>P(n-1) and P(n)>P(n+1)P(n)>P(n+1).

P(n−1)=365365×364365×⋯×365−(n−3)365×n−2365P(n)=365365×364365×⋯×365−(n−2)365×n−1365P(n+1)=365365×364365×⋯×365−(n−2)365×365−(n−1)365×n365\begin{aligned}P(n-1)&=\frac{365}{365}\times\frac{364}{365}\times\cdots\times\frac{365-(n-3)}{365}\times\frac{n-2}{365}\\P(n)&=\frac{365}{365}\times\frac{364}{365}\times\cdots\times\frac{365-(n-2)}{365}\times\frac{n-1}{365}\\P(n+1)&=\frac{365}{365}\times\frac{364}{365}\times\cdots\times\frac{365-(n-2)}{365}\times\frac{365-(n-1)}{365}\times\frac n{365}\end{aligned}

Hence,

P(n)>P(n−1)⇒365−(n−2)365×n−1365>n−2365P(n)>P(n+1)⇒n−1365>365−(n−1)365×n365}⇒n2−3n−363<0n2−n−365>0}⇒n=20\left.\begin{aligned}P(n)>P(n-1)&\Rightarrow\frac{365-(n-2)}{365}\times\frac{n-1}{365}>\frac{n-2}{365}\\P(n)>P(n+1)&\Rightarrow\frac{n-1}{365}>\frac{365-(n-1)}{365}\times\frac n{365}\end{aligned}\right\}\Rightarrow\left.\begin{aligned}n^2-3n-363&<0\\n^2-n-365&>0\end{aligned}\right\}\Rightarrow n=20

You should be the 20th person in line.

78

Dice order

We throw 3 dice one by one. What is the probability that we obtain 3 points in strictly increasing order?15

Solution: To have 3 points in strictly increasing order, first all three points must be different numbers. Conditioned on three different numbers, the probability of strictly increasing order is simply 1/3!=1/61/3!=1/6 (one specific sequence out of all possible permutations). So we have

P=P(different numbers in all three throws)×P(increasing order∣3 different numbers)=(1×56×46)×16=5/54\begin{aligned}P&=P(\text{different numbers in all three throws})\times P(\text{increasing order}\mid\text{3 different numbers})\\&=(1\times\tfrac56\times\tfrac46)\times\tfrac16=5/54\end{aligned}

Monty Hall problem

Monty Hall problem is a probability puzzle based on an old American show Let’s Make a Deal. The problem is named after the show’s host. Suppose you're on the show now, and you're given the choice of 3 doors. Behind one door is a car; behind the other two, goats. You don’t know ahead of time what is behind each of the doors.

You pick one of the doors and announce it. As soon as you pick the door, Monty opens one of the other two doors that he knows has a goat behind it. Then he gives you the option to either keep your original choice or switch to the third door. Should you switch? What is the probability of winning a car if you switch?

Solution: If you don’t switch, whether you win or not is independent of Monty’s action of showing you a goat, so your probability of winning is 1/3. What if you switch? Many would argue that since there are only two doors left after Monty shows a door with goat, the probability of winning is 1/2. But is this argument correct?

If you look at the problem from a different perspective, the answer becomes clear. Using a switching strategy, you win the car if and only if you originally pick a door with a goat, which has a probability of 2/3 (You pick a door with a goat, Monty shows a door with another goat, so the one you switch to must have a car behind it). If you originally picked the door with the car, which has a probability of 1/3, you will lose by switching. So your probability of winning by switching is actually 2/3.

79

Amoeba population

There is a one amoeba in a pond. After every minute the amoeba may die, stay the same, split into two or split into three with equal probability. All its offspring, if it has any, will behave the same (and independent of other amoebas). What is the probability the amoeba population will die out?

Solution: This is just another standard conditional probability problem once you realize we need to derive the probability conditioned on what happens to the amoeba one minute later. Let P(E)P(E) be the probability that the amoeba population will die out and apply the law of total probability conditioned on what happens to the amoeba one minute later:

P(E)=P(E∣F1)P(F1)+P(E∣F2)P(F2)+⋯+P(E∣Fn)P(Fn).P(E)=P(E\mid F_1)P(F_1)+P(E\mid F_2)P(F_2)+\cdots+P(E\mid F_n)P(F_n).

For the original amoeba, as stated in the question, there are four possible mutually exclusive events each with probability 1/4. Let’s denote F1F_1 as the event the amoeba dies; F2F_2 as the event that it stays the same; F3F_3 as the event that it splits into two; F4F_4 as the event that it splits into three. For event F1, P(E∣F1)=1F_1,\ P(E\mid F_1)=1 since no amoeba is left. P(E∣F2)=P(E)P(E\mid F_2)=P(E) since the state is the same as the beginning. For F3F_3, there are two amoebas; either behaves the same as the original one. The total amoeba population will die only if both amoebas die out. Since they are independent, the probability that they both will die out is P(E)2P(E)^2. Similarly we have P(F4)=P(E)3P(F_4)=P(E)^3. Plug in all the numbers, the equation becomes P(E)=1/4×1+1/4×P(E)+1/4×P(E)2+1/4×P(E)3P(E)=1/4\times1+1/4\times P(E)+1/4\times P(E)^2+1/4\times P(E)^3. Solve this equation with the restriction 0<P(E)<10<P(E)<1, and we will get P(E)=2−1≈0.414P(E)=\sqrt2-1\approx0.414 (The other two roots of the equation are 1 and −2−1-\sqrt2-1).

Candies in a jar

You are taking out candies one by one from a jar that has 10 red candies, 20 blue candies, and 30 green candies in it. What is the probability that there are at least 1 blue candy and 1 green candy left in the jar when you have taken out all the red candies?16

Solution: At first look, this problem appears to be a combinatorial one. However, a conditional probability approach gives a much more intuitive answer. Let Tr,TbT_r,T_b and TgT_g 80 be the number that the last red, blue, and green candies are taken out respectively. To have at least 1 blue candy and 1 green candy left when all the red candies are taken out, we need to have Tr<TbT_r<T_b and Tr<TgT_r<T_g. In other words, we want to derive P(Tr<Tb∩Tr<Tg)P(T_r<T_b\cap T_r<T_g). There are two mutually exclusive events that satisfy Tr<TbT_r<T_b and Tr<Tg: Tr<Tb<TgT_r<T_g:\ T_r<T_b<T_g and Tr<Tg<TbT_r<T_g<T_b.

∴ P(Tr<Tb∩Tr<Tg)=P(Tr<Tb<Tg)+P(Tr<Tg<Tb)\therefore\ P(T_r<T_b\cap T_r<T_g)=P(T_r<T_b<T_g)+P(T_r<T_g<T_b)

Tr<Tb<TgT_r<T_b<T_g means that the last candy is green (Tg=60T_g=60). Since each of the 60 candies are equally likely to be the last candy and among them 30 are green ones, we have P(Tg=60)=3060P(T_g=60)=\dfrac{30}{60}. Conditioned on Tg=60T_g=60, we need P(Tr<Tb∣Tg=60)P(T_r<T_b\mid T_g=60). Among the 30 red and blue candies, each candy is again equally likely to be the last candy and there are 20 blue candies, so P(Tr<Tb∣Tg=60)=2030P(T_r<T_b\mid T_g=60)=\dfrac{20}{30} and P(Tr<Tb<Tg)=3060×2030P(T_r<T_b<T_g)=\dfrac{30}{60}\times\dfrac{20}{30}. Similarly, we have P(Tr<Tg<Tb)=2060×3040P(T_r<T_g<T_b)=\dfrac{20}{60}\times\dfrac{30}{40}.

Hence,

P(Tr<Tb∩Tr<Tg)=P(Tr<Tb<Tg)+P(Tr<Tg<Tb)=3060×2030+2060×3040=712.P(T_r<T_b\cap T_r<T_g)=P(T_r<T_b<T_g)+P(T_r<T_g<T_b)=\frac{30}{60}\times\frac{20}{30}+\frac{20}{60}\times\frac{30}{40}=\frac7{12}.

Coin toss game

Two players, AA and BB, alternatively toss a fair coin (AA tosses the coin first, then BB tosses the coin, then AA, then BB…). The sequence of heads and tails is recorded. If there is a head followed by a tail (HTHT subsequence), the game ends and the person who tosses the tail wins. What is the probability that AA wins the game?17

Solution: Let P(A)P(A) be the probability that AA wins; then the probability that BB wins is P(B)=1−P(A)P(B)=1-P(A). Let’s condition P(A)P(A) on AA’s first toss, which has 1/2 probability of HH (heads) and 1/2 probability of TT (tails).

P(A)=1/2P(A∣H)+1/2P(A∣T)P(A)=1/2P(A\mid H)+1/2P(A\mid T)

If AA’s first toss is TT, then B essentially becomes the first to toss (An HH is required for the HT subsequence). So we have P(A∣T)=P(B)=1−P(A)P(A\mid T)=P(B)=1-P(A).

If AA’s first toss ends in HH, let’s further condition on BB’s first toss. BB has 1/2 probability of getting TT, in that case AA loses. For the 1/2 probability that BB gets HH, BB essentially 81 becomes the first one to toss an HH. In that case, AA has (1−P(A∣H))(1-P(A\mid H)) probability of winning. So P(A∣H)=1/2×0+1/2(1−P(A∣H))⇒P(A∣H)=1/3P(A\mid H)=1/2\times0+1/2(1-P(A\mid H))\Rightarrow P(A\mid H)=1/3

Combining all the available information, we have

P(A)=1/2×1/3+1/2(1−P(A))⇒P(A)=4/9.P(A)=1/2\times1/3+1/2(1-P(A))\Rightarrow P(A)=4/9.

Sanity check: we can see that P(A)<1/2P(A)<1/2, which is reasonable since AA cannot win in his first toss, yet BB has 1/4 probability to win in her first toss.

Russian roulette series

Let’s play a traditional version of Russian roulette. A single bullet is put into a 6-chamber revolver. The barrel is randomly spun so that each chamber is equally likely to be under the hammer. Two players take turns to pull the trigger—with the gun unfortunately pointing at one’s own head—without further spinning until the gun goes off and the person who gets killed loses. If you, one of the players, can choose to go first or second, how will you choose? And what is your probability of loss?

Solution: Many people have the wrong impression that the first person has higher probability of loss. After all, the first player has a 1/6 chance of getting killed in the first round before the second player starts. Unfortunately, this is one of the few times that intuition is wrong. Once the barrel is spun, the position of the bullet is fixed. If you go first, you lose if and only if the bullet is in chamber 1, 3 and 5. So the probability that you lose is the same as the second player, 1/2. In that sense, whether to go first or second does not matter.

Now, let’s change the rule slightly. We will spin the barrel again after every trigger pull. Will you choose to be the first or the second player? And what is your probability of loss?

Solution: The difference is that each run now becomes independent. Assume that the first player’s probability of losing is pp, then the second player’s probability of losing is 1−p1-p. Let’s condition the probability on the first person’s first trigger pull. He has 1/6 probability of losing in this run. Otherwise, he essentially becomes the second player in the game with new (conditional) probability of losing 1−p1-p. That happens with probability 5/6. That gives us p=1×1/6+(1−p)×5/6⇒p=6/11p=1\times1/6+(1-p)\times5/6\Rightarrow p=6/11. So you should choose to be the second player and have 5/11 probability of losing.

If instead of one bullet, two bullets are randomly put in the chamber. Your opponent played the first and he was alive after the first trigger pull. You are given the option whether to spin the barrel. Should you spin the barrel?

82

Solution: if you spin the barrel, the probability that you will lose in this round is 2/6. If you don’t spin the barrel, there are only 5 chambers left and your probability of losing in this round (conditioned on that your opponent survived) is 2/5. So you should spin the barrel.

What if the two bullets are randomly put in two consecutive positions? If your opponent survived his first round, should you spin the barrel?

Solution: Now we have to condition our probability on the fact that the positions of the two bullets are consecutive. As shown in Figure 4.3, let’s label the empty chambers as 1, 2, 3 and 4; label the ones with bullets 5 and 6. Since your opponent survived the first round, the possible position he encountered is 1, 2, 3 or 4 with equal probability. With 1/4 chance, the next one is a bullet (the position was 4). So if you don’t spin, the chance of survival is 3/4. If you spin the barrel, each position has equal probability of being chosen, and your chance of survival is only 2/3. So you should not spin the barrel.

Six revolver chambers in circular order: empty chambers1,2,3,4 followed by consecutive bullet chambers5,6.
Figure 4.3 Russian roulette with two consecutive bullets.

Aces

Fifty-two cards are randomly distributed to 4 players with each player getting 13 cards. What is the probability that each of them will have an ace?

Solution: The problem can be answered using standard counting methods. To distribute 52 cards to 4 players with 13 cards each has 52!13!13!13!13!\dfrac{52!}{13!13!13!13!} permutations. If each player 83 needs to have one ace, we can distribute the aces first, which has 4!4! ways. Then we distribute the rest 48 cards to 4 players with 12 cards each, which has 48!12!12!12!12!\dfrac{48!}{12!12!12!12!} permutations. So the probability that each of them will have an Ace is

4!×48!12!12!12!12!÷52!13!13!13!13!=5252×3951×2650×1349.4!\times\frac{48!}{12!12!12!12!}\div\frac{52!}{13!13!13!13!}=\frac{52}{52}\times\frac{39}{51}\times\frac{26}{50}\times\frac{13}{49}.

The logic becomes clearer if we use a conditional probability approach. Let’s begin with any one of the four aces; it has probability 52/52=152/52=1 of belonging to a pile. The second ace can be any of the remaining 51 cards, among which 39 belong to a pile different from the first ace. So the probability that the second ace is not in the pile of the first ace is 39/51. Now there are 50 cards left, among which 26 belong to the other two piles. So the conditional probability that the third ace is in one of the other 2 piles given the first two aces are already in different piles is 26/50. Similarly, the conditional probability that the fourth ace is in the pile different from the first three aces given that the first three aces are in different piles is 13/49. So the probability that each pile has an ace is 1×3951×2650×13491\times\dfrac{39}{51}\times\dfrac{26}{50}\times\dfrac{13}{49}.

Gambler’s ruin problem

A gambler starts with an initial fortune of ii dollars. On each successive game, the gambler wins $1 with probability p, 0<p<1p,\ 0<p<1, or loses $1 with probability q=1−pq=1-p. He will stop if he either accumulates NN dollars or loses all his money. What is the probability that he will end up with NN dollars?

Solution: This is a classic textbook probability problem called the Gambler’s Ruin Problem. Interestingly, it is still widely used in quantitative interviews.

From any initial state ii (the dollars the gambler has), 0≤i≤N0\le i\le N, let PiP_i be the probability that the gambler’s fortune will reach NN instead of 0. The next state is either i+1i+1 with probability pp or i−1i-1 with probability qq. So we have

Pi=pPi+1+qPi−1⇒Pi+1−Pi=qp(Pi−Pi−1)=(qp)2(Pi−1−Pi−2)=⋯=(qp)i(P1−P0)P_i=pP_{i+1}+qP_{i-1}\Rightarrow P_{i+1}-P_i=\frac qp(P_i-P_{i-1})=\left(\frac qp\right)^2(P_{i-1}-P_{i-2})=\cdots=\left(\frac qp\right)^i(P_1-P_0)

We also have the boundary probabilities P0=0P_0=0 and PN=1P_N=1.

So starting from P2P_2, we can successively evaluate PiP_i as an expression of P1P_1:

84 P1=pP2+qP0⇒P2=1pP1=[1+qp]P1P3=[1+qp+(qp)2]P1⋯Pi=[1+qp+⋯+(qp)i−1]P1\begin{aligned}P_1=pP_2+qP_0&\Rightarrow P_2=\frac1pP_1=\left[1+\frac qp\right]P_1\\P_3&=\left[1+\frac qp+\left(\frac qp\right)^2\right]P_1\\&\cdots\\P_i&=\left[1+\frac qp+\cdots+\left(\frac qp\right)^{i-1}\right]P_1\end{aligned}

Extending this expression to PNP_N, we have

PN=1=[1+qp+⋯+(qp)N−1]P1={1−(q/p)N1−q/pP1,if q/p≠1NP1,if q/p=1P_N=1=\left[1+\frac qp+\cdots+\left(\frac qp\right)^{N-1}\right]P_1=\begin{cases}\dfrac{1-(q/p)^N}{1-q/p}P_1,&\text{if }q/p\ne1\\NP_1,&\text{if }q/p=1\end{cases} ⇒P1={1−q/p1−(q/p)N,if q/p≠11/N,if q/p=1⇒Pi={1−(q/p)i1−(q/p)NP1,if p≠1/2i/N,if p=1/2\Rightarrow P_1=\begin{cases}\dfrac{1-q/p}{1-(q/p)^N},&\text{if }q/p\ne1\\1/N,&\text{if }q/p=1\end{cases}\Rightarrow P_i=\begin{cases}\dfrac{1-(q/p)^i}{1-(q/p)^N}P_1,&\text{if }p\ne1/2\\i/N,&\text{if }p=1/2\end{cases}

Basketball scores

A basketball player is taking 100 free throws. She scores one point if the ball passes through the hoop and zero point if she misses. She has scored on her first throw and missed on her second. For each of the following throw the probability of her scoring is the fraction of throws she has made so far. For example, if she has scored 23 points after the 40th throw, the probability that she will score in the 41th throw is 23/40. After 100 throws (including the first and the second), what is the probability that she scores exactly 50 baskets?18

Solution: Let (n,k), 1≤k≤n(n,k),\ 1\le k\le n, be the event that the player scores kk baskets after nn throws and Pn,k=P((n,k))P_{n,k}=P((n,k)). The solution is surprisingly simple if we use an induction approach starting with n=3n=3. The third throw has 1/2 probability of scoring. So we have P3,1=1/2P_{3,1}=1/2 and P3,2=1/2P_{3,2}=1/2. For the case when n=4n=4, let’s apply the law of total probability

85 {P4,1=P((4,1)∣(3,1))×P3,1+P((4,1)∣(3,2))×P3,2=23×12+0×12=13P4,2=P((4,2)∣(3,1))×P3,1+P((4,2)∣(3,2))×P3,2=13×12+13×12=13P4,3=P((4,3)∣(3,1))×P3,1+P((4,3)∣(3,2))×P3,2=0×12+23×12=13\begin{cases}P_{4,1}=P((4,1)\mid(3,1))\times P_{3,1}+P((4,1)\mid(3,2))\times P_{3,2}=\dfrac23\times\dfrac12+0\times\dfrac12=\dfrac13\\P_{4,2}=P((4,2)\mid(3,1))\times P_{3,1}+P((4,2)\mid(3,2))\times P_{3,2}=\dfrac13\times\dfrac12+\dfrac13\times\dfrac12=\dfrac13\\P_{4,3}=P((4,3)\mid(3,1))\times P_{3,1}+P((4,3)\mid(3,2))\times P_{3,2}=0\times\dfrac12+\dfrac23\times\dfrac12=\dfrac13\end{cases}

The results indicate that Pn,k=1n−1, ∀k=1,2,⋯ ,n−1P_{n,k}=\dfrac1{n-1},\ \forall k=1,2,\cdots,n-1, and give the hint that the law of total probability can be used in the induction step.

Induction step: given that Pn,k=1n−1, ∀k=1,2,⋯ ,n−1P_{n,k}=\dfrac1{n-1},\ \forall k=1,2,\cdots,n-1, we need to prove Pn+1,k=1(n+1)−1=1n, ∀k=1,2,⋯ ,nP_{n+1,k}=\dfrac1{(n+1)-1}=\dfrac1n,\ \forall k=1,2,\cdots,n. To show it, simply apply the law of total probability:

Pn+1,k=P(miss∣(n,k))Pn,k+P(score∣(n,k−1))Pn,k−1=(1−kn)1n−1+k−1n1n−1=1n\begin{aligned}P_{n+1,k}&=P(\text{miss}\mid(n,k))P_{n,k}+P(\text{score}\mid(n,k-1))P_{n,k-1}\\&=\left(1-\frac kn\right)\frac1{n-1}+\frac{k-1}n\frac1{n-1}=\frac1n\end{aligned}

The equation is also applicable to the Pn+1,1P_{n+1,1} and Pn+1,nP_{n+1,n}, although in these cases k−1n=0\dfrac{k-1}n=0 and (1−kn)=0\left(1-\dfrac kn\right)=0, respectively. So we have Pn,k=1n−1, ∀k=1,2,⋯ ,n−1P_{n,k}=\dfrac1{n-1},\ \forall k=1,2,\cdots,n-1 and ∀n≥2\forall n\ge2. Hence, P100,50=1/99P_{100,50}=1/99.

Cars on road

If the probability of observing at least one car on a highway during any 20-minute time interval is 609/625, then what is the probability of observing at least one car during any 5-minute time interval? Assume that the probability of seeing a car at any moment is uniform (constant) for the entire 20 minutes.

Solution: We can break down the 20-minute interval into a sequence of 4 non-overlapping 5-minute intervals. Because of constant default probability (of observing a car), the probability of observing a car in any 5-minute interval is constant. Let’s denote the probability to be pp, then the probability that in any 5-minute interval we do not observe a car is 1−p1-p.

86

The probability that we do not observe any car in all four of such independent 5-minute intervals is (1−p)4=1−609/625=16/625(1-p)^4=1-609/625=16/625, which gives p=3/5p=3/5.