Blog7 min read
Probability questions in quant interviews
Ten classic problems and the methods that crack them.
The short answer
Most probability questions in quant interviews give way to five methods: count the outcomes, condition on what you know, work backwards from the end, add up expectations piece by piece, and set up a first-step equation. Below are ten classic problems, each solved step by step under the method that cracks it. Try each one yourself before you read the steps.
Five methods
The toolkit behind almost every question.
| Method | Use it when | Problems here |
|---|---|---|
| Counting | Every outcome is equally likely | Two aces, a shared birthday |
| Conditioning | You learn something, or the problem splits into cases | The two-headed coin |
| Working backwards | You make choices along the way | Rolling up to three times |
| Linearity of expectation | You want the average of a total | Hats returned, every face of a die |
| First-step analysis | Something repeats until it stops | The first six, two heads in a row, a fair bet |
One more tool helps with problems on a continuous line: draw the possible outcomes as a shape and measure the part that works. The broken stick at the end uses it.
Two habits help in every problem. Say which method you'll use before you start. And check the size of the answer at the end: a probability must lie between 0 and 1, and an average wait can't be shorter than one try.
Counting
Favourable outcomes over possible ones, counted carefully.
Example 2.1
Two aces
You draw two cards from a shuffled 52-card deck. What is the chance both are aces?
- First card4/52
4 of the 52 cards are aces.
- Second card, given the first was an ace3/51
3 aces are left among 51 cards.
- Multiply4/52 × 3/51 = 12/2,652 = 1/221
Check by counting pairs: C(4, 2) ÷ C(52, 2) = 6 ÷ 1,326 = 1/221.
Answer1/221, about 0.45%.
Example 2.2
A shared birthday
23 people are in a room. Ignore leap years and treat every birthday as equally likely. What is the chance that at least two share a birthday?
- Count the oppositeall different: 365/365 × 364/365 × … × 343/365
"At least two" has many cases. "All different" has one, so work that out and subtract.
- Multiply it out≈ 0.493
Each new person must miss everyone already in the room.
- Subtract from 11 − 0.493 = 0.507
AnswerAbout 50.7%, just better than even.
Conditioning
Update the odds when you learn something.
Example 3.1
The two-headed coin
A bag holds two coins: one fair, one with heads on both sides. You pick one at random and flip it: heads. How likely is it that you hold the two-headed coin? And what is the chance the next flip of the same coin is heads?
- Chance of heads with each coinfair: 1/2 × 1/2 = 1/4; two-headed: 1/2 × 1 = 1/2
Pick the coin, then flip it.
- Condition on seeing heads1/2 ÷ (1/2 + 1/4) = 2/3
Of all the ways to see heads, two thirds come from the two-headed coin.
- The next flip2/3 × 1 + 1/3 × 1/2 = 5/6
Average over which coin you hold, using the updated odds.
Answer2/3 that it's the two-headed coin, and 5/6 that the next flip is heads.
The same move, weighing each explanation by how likely it makes what you saw, is Bayes' rule. Conditional probability builds it up from counts.
Working backwards
Solve the last decision first, then step back.
Example 4.1
Rolling up to three times
You roll a fair die and are paid its face value in dollars. You may re-roll up to two times, and you keep the last roll. Played well, what is the game worth?
- With no re-rolls left3.5
You take whatever comes up.
- With one re-roll leftkeep 4, 5 or 6: 1/2 × 5 + 1/2 × 3.5 = 4.25
Keep any roll that beats 3.5.
- With two re-rolls leftkeep 5 or 6: 2/6 × 5.5 + 4/6 × 4.25 ≈ 4.67
Now a 4 isn't good enough, because rolling on is worth 4.25.
Answer14/3, about $4.67.
Linearity of expectation
Split a total into pieces and add their averages.
Example 5.1
Hats returned at random
n people leave their hats at a cloakroom, and the hats come back in random order. On average, how many people get their own hat?
- Split the total into piecesmatches = X1 + X2 + … + Xn
Xi is 1 if person i gets their own hat, and 0 if not.
- Average of one pieceP(person i gets their own hat) = 1/n
Their hat is equally likely to go to any of the n people.
- Add the averagesn × 1/n = 1
The average of a total is the total of the averages, even when the pieces depend on each other.
Answer1, whatever the number of people.
Example 5.2
Every face of a die
On average, how many rolls of a fair die does it take to see all six faces?
- Split the wait into stagesstage k: waiting for a new face when k − 1 are seen
Six stages, one for each new face.
- Average wait for each stage6/6, 6/5, 6/4, 6/3, 6/2, 6/1
If something happens with chance p on each try, the average wait is 1/p.
- Add the stages1 + 1.2 + 1.5 + 2 + 3 + 6 = 14.7
Answer14.7 rolls.
First-step analysis
Write the answer in terms of itself after one step.
Example 6.1
Waiting for a six
On average, how many rolls of a fair die until the first six?
- Call the answer EE = 1 + 5/6 × E
You always spend one roll. With chance 5/6 it isn't a six, and you're back where you started.
- SolveE ÷ 6 = 1, so E = 6
Answer6 rolls.
Example 6.2
Two heads in a row
On average, how many flips of a fair coin until you see two heads in a row?
- Name the statesE from the start, H just after one head
Flipping tails always sends you back to the start.
- From the startE = 1 + 1/2 × H + 1/2 × E
Heads moves you to H; tails leaves you at the start.
- After one headH = 1 + 1/2 × 0 + 1/2 × E
Heads finishes; tails sends you back.
- SolveE = 2 + H and H = 1 + E/2, so E = 6
Answer6 flips. Heads then tails takes only 4 on average, because a failed try doesn't send you all the way back.
Example 6.3
A fair bet until you stop
You start with $1 and bet $1 on each flip of a fair coin. You stop when you have $0 or $3. What is the chance you reach $3?
- Name the chancesp1 from $1, p2 from $2; p0 = 0, p3 = 1
- First step from $1p1 = 1/2 × p2 + 1/2 × 0
- First step from $2p2 = 1/2 × 1 + 1/2 × p1
- Solvep1 = 1/4 + p1/4, so p1 = 1/3
Answer1/3. A shortcut: a fair game keeps your average wealth at $1, so 3 × p = 1.
Draw the outcomes
When the outcomes form a shape, measure the part that works.
Example 7.1
Breaking a stick
A stick is broken at two points chosen at random along its length. What is the chance that the three pieces can form a triangle?
- Turn the rule into numbersevery piece shorter than 1/2
Three lengths make a triangle when each is shorter than the other two together. With a total of 1, that means each is under 1/2.
- Draw the outcomesbreak points x and y fill a 1 × 1 square
Every point in the square is equally likely.
- Shade where it works, for x < yx < 1/2, y > 1/2, y − x < 1/2
A triangle of area 1/8. The half where y < x gives another 1/8.
- Add both halves1/8 + 1/8 = 1/4
Answer1/4.
If you can't see the shape, simulate. A few lines of Python that break a million sticks will land close to 0.25, and that's a fair check to mention in an interview.
import random
def triangle():
x, y = sorted((random.random(), random.random()))
return max(x, y - x, 1 - y) < 0.5
n = 1_000_000
print(sum(triangle() for _ in range(n)) / n) # close to 0.25How to practise
Recognise the method within a minute.
- Try each problem for five minutes before you read any steps.
- Say the method out loud before you calculate: count, condition, work backwards, split, or first step.
- Keep fractions while you work, and turn them into decimals only at the end.
- Check the size of every answer.
- Redo every miss three days later, without notes.
Probability practice gives you fresh problems in these patterns, and Puzzles and Brainteasers covers the logic questions that sit beside them. For the whole interview, read how to prepare for a quant interview.
Learn it properly
- Counting outcomesProbability · Lesson 01 Free
- Probability is countingProbability · Lesson 02 Free
- Conditional probabilityProbability · Lesson 03 Free
- A puzzle you've never seenPuzzles and Brainteasers · Lesson 01 Free
- Invariants and parityPuzzles and Brainteasers · Lesson 02 Free
- The pigeonhole principlePuzzles and Brainteasers · Lesson 03 Free
Questions
What probability topics come up in quant interviews?
Counting, conditional probability and Bayes' rule, expected value, common distributions such as the binomial and geometric, and processes that repeat until something happens. Some interviews add continuous problems like the broken stick.
How many practice problems should I do?
Enough that you recognise the method within a minute. For most people that means a few problems a day for several weeks, with every miss redone a few days later.
Can I use a calculator?
Usually not in phone or video rounds. Keep numbers as fractions while you work, and turn them into a decimal or percentage at the end.
What if I get stuck?
Say what you know, try a smaller case, or simulate in your head with a few outcomes. Interviewers often give a hint when they see you reasoning clearly.