insideout Get Pro

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.

MethodUse it whenProblems here
CountingEvery outcome is equally likelyTwo aces, a shared birthday
ConditioningYou learn something, or the problem splits into casesThe two-headed coin
Working backwardsYou make choices along the wayRolling up to three times
Linearity of expectationYou want the average of a totalHats returned, every face of a die
First-step analysisSomething repeats until it stopsThe 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?

  1. First card4/52

    4 of the 52 cards are aces.

  2. Second card, given the first was an ace3/51

    3 aces are left among 51 cards.

  3. 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?

  1. 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.

  2. Multiply it out≈ 0.493

    Each new person must miss everyone already in the room.

  3. 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?

  1. 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.

  2. 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.

  3. 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?

  1. With no re-rolls left3.5

    You take whatever comes up.

  2. 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.

  3. 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?

  1. Split the total into piecesmatches = X1 + X2 + … + Xn

    Xi is 1 if person i gets their own hat, and 0 if not.

  2. 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.

  3. 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?

  1. Split the wait into stagesstage k: waiting for a new face when k − 1 are seen

    Six stages, one for each new face.

  2. 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.

  3. 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?

  1. 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.

  2. 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?

  1. Name the statesE from the start, H just after one head

    Flipping tails always sends you back to the start.

  2. From the startE = 1 + 1/2 × H + 1/2 × E

    Heads moves you to H; tails leaves you at the start.

  3. After one headH = 1 + 1/2 × 0 + 1/2 × E

    Heads finishes; tails sends you back.

  4. 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?

  1. Name the chancesp1 from $1, p2 from $2; p0 = 0, p3 = 1
  2. First step from $1p1 = 1/2 × p2 + 1/2 × 0
  3. First step from $2p2 = 1/2 × 1 + 1/2 × p1
  4. 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?

  1. 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.

  2. Draw the outcomesbreak points x and y fill a 1 × 1 square

    Every point in the square is equally likely.

  3. 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.

  4. 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.

python
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.25

How to practise

Recognise the method within a minute.

  1. Try each problem for five minutes before you read any steps.
  2. Say the method out loud before you calculate: count, condition, work backwards, split, or first step.
  3. Keep fractions while you work, and turn them into decimals only at the end.
  4. Check the size of every answer.
  5. 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

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.