insideout Get Pro

02 · Probability is counting

Free

Probability, lesson 2

Probability is counting

Favourable outcomes over possible ones, and when that rule breaks.

The last lesson counted how many ways something can happen. This one turns those counts into chances, and shows the one condition that makes that work. You need the multiplication rule and C(n, k) from the last lesson.

By the end, you can:

  1. Find a chance by counting equally likely outcomes.
  2. Spot outcomes that aren't equally likely, and weigh them.
  3. Find an "at least one" chance by counting the opposite.

Part 1. A chance is a share of outcomes

Find a chance by counting equally likely outcomes.

Roll two dice, one red and one blue. The red die can land 6 ways, and for each of those the blue die can land 6 ways: 6 × 6 = 36, the multiplication rule from the last lesson. Each of the 36 is one way the roll can come out, such as red 2 and blue 5.

Example 1.1

A total of 7

Roll a red die and a blue die. What's the chance the two add up to 7?

  1. Count every outcome6 × 6 = 36

    Draw them as a grid, red die down the side and blue across the top. Each square is one outcome.

  2. Count the outcomes you want6

    1 + 6, 2 + 5, 3 + 4, 4 + 3, 5 + 2 and 6 + 1, red die first.

  3. Divide6 / 36 = 1/6

    Every square is as likely as any other, so the share of squares is the chance.

Answer1/6, about 17%.

23456 734 567 8456 789 567 89106 789 10117 891011 12 11223 3445 566 blue die red die Total of 7 6 squares 6 / 36 = 1/6
2345 673 456 784 567 8956 789 1067 891011 789 101112 11223 3445 566 blue die red die Total of 7: 6 squares 6 / 36 = 1/6
Figure 1Every way two dice can land, with its total. The six squares that total 7 run corner to corner. A total of 2 or 12 has just one square.

Why does dividing give the chance? Fair dice have no favourite face, so no square is more likely than another. The 36 squares share all the chance between them, 1/36 each, and the six 7s get 6/36.

A chance of 1/6 promises nothing about a single roll. It describes the long run: roll the pair 600 times and about 100 rolls total 7. You'll rarely get exactly 100, but the share of 7s settles toward 1/6 the longer you keep rolling.

Sample space and event

The sample space is every outcome that can happen: the 36 squares. An event is a set of outcomes you care about, such as "the total is 7". If every outcome is equally likely, P(A), read "the probability of A", is A's share of them:

P(A) = (outcomes in A) / (all outcomes)

The rule turns the last lesson's counts into chances. A well-shuffled deck makes every five-card hand equally likely, so a full house has chance 3,744 / 2,598,960, about 0.14%. With cards, the hard part is always the count.

Your turn

Roll a red die and a blue die. What's the chance the total is 9?

Four squares total 9: 3 + 6, 4 + 5, 5 + 4 and 6 + 3. That's 4/36 = 1/9. The answer 1/18 counts 3 + 6 and 6 + 3 as one outcome, and 1/11 treats the 11 totals as equally likely.

Part 2. Outcomes that aren't equally likely

Spot outcomes that aren't equally likely, and weigh them.

Guess first

Flip two fair coins. What's the chance of one head and one tail?

List the equally likely outcomes: HH, HT, TH, TT. One of each happens two ways, HT and TH, so it's 2/4 = 1/2. Counting "one of each" as a single outcome is a famous mistake: those three outcomes aren't equally likely.

If you said 1/3, you treated "two heads", "two tails" and "one of each" as equally likely. "One of each" happens two ways, so it's twice as likely as either other. Dice that look alike set the same trap.

Example 2.1

Doubles with dice that look alike

Roll two identical white dice. You can't tell 2 and 5 from 5 and 2, so you see 21 outcomes: 6 doubles and 15 mixed pairs. What's the chance of a double?

  1. Tell the dice apart6 × 6 = 36

    Mark one die in your head. The dice land the same way whether you can tell them apart or not.

  2. Count the squares of each outcome6 × 1 + 15 × 2 = 36

    A double like 3 and 3 is one square. A mixed pair like 2 and 5 is two squares, since either die can show the 2.

  3. Divide6 / 36 = 1/6

    Not 6/21, about 29%. The 21 outcomes aren't equally likely, so they can't go on the bottom.

Answer1/6, about 17%.

12 12 21 222 12 222 12 222 21 11223 3445 566 squares each outcome covers 6 doubles × 1 15 mixed × 2 6 + 30 = 36
12 12 21 222 12 222 12 222 21 11223 3445 566 squares each outcome covers 6 doubles × 1 + 15 mixed × 2 6 + 30 = 36
Figure 2The 21 outcomes you can tell apart, and how many of the 36 squares each one covers. A mixed pair covers 2, a double 1, so a mixed pair is twice as likely.

Not being able to tell the dice apart is about you, not the dice. They still land like a red die and a blue one. So count in outcomes that are equally likely, the squares, and group them afterwards.

Equally likely

Outcomes are equally likely when none is favoured over another, like the 36 squares of two fair dice. Only then is a chance a count over a count. Otherwise, add up the chance of each outcome in the event:

P(A) = sum of the chances of the outcomes in A

Some outcomes really aren't equally likely. Say a die is loaded so a six comes up 1/4 of the time and each other face 3/20. An even number then has chance 3/20 + 3/20 + 1/4 = 0.55, not 0.5. Counting is the special case where every outcome has the same weight.

Your turn

Toss three identical coins. You only see how many heads there are: 0, 1, 2 or 3. What's the chance of exactly 2 heads?

Tell the coins apart and there are 2 × 2 × 2 = 8 equally likely outcomes. Exactly 2 heads is HHT, HTH or THH: 3/8. The answer 1/4 treats the four head counts as equally likely, and 1/8 counts only one order.

Part 3. Counting the opposite

Find an "at least one" chance by counting the opposite.

Roll one die four times. Is at least one six more likely than not? Counting it head-on means adding up the sequences with exactly one, two, three and four sixes. The other side takes one step: count the sequences with no six at all.

Example 3.1

At least one six in four rolls

Roll a die four times. What's the chance of at least one six?

  1. Count every outcome6 × 6 × 6 × 6 = 1,296

    Four rolls with 6 faces each, every sequence equally likely.

  2. Count the outcomes with no six5 × 5 × 5 × 5 = 625

    Each roll has 5 faces that aren't a six.

  3. Take them away1,296 − 625 = 671

    Every other sequence has at least one six.

  4. Divide671 / 1,296 ≈ 0.518

    Just better than even.

AnswerAbout 51.8%, so yes, just.

1,62,63,6 4,65,66,1 6,26,36,4 6,56,6 11223 3445 566 blue die red die no six 5 × 5 = 25 At least one six 36 − 25 = 11 Adding 6 + 6 = 12 counts the corner twice
1,62,63,6 4,65,66,1 6,26,36,4 6,56,6 11223 3445 566 blue die red die no six 5 × 5 = 25 At least one six: 36 − 25 = 11 6 + 6 = 12 counts the corner twice
Figure 3Two rolls, where the grid can be drawn. The 25 squares with no six fill the top left, and the other 11 have at least one. Adding 6 squares with a first six to 6 with a second six counts the corner twice.

Why does it work? Every sequence either has a six or it doesn't, never both. So the two groups split all 1,296 sequences between them, and their chances add up to 1.

Complement

The complement of an event is everything else: "no six" is the complement of "at least one six". P(not A), read "the chance A doesn't happen", is one minus the chance it does:

P(not A) = 1 − P(A)

The tempting shortcut adds: each roll has a 1/6 chance of a six, so four rolls give 4/6. By that sum, seven rolls would give 7/6, more than certain. Adding chances only works for events that can't happen together. A six on the first roll and a six on the second can, so the sum counts some sequences twice.

This bet is old. In a letter of 29 July 1654, Blaise Pascal told Pierre de Fermat that the Chevalier de Méré knew four rolls for a six won 671 to 625. De Méré expected 24 rolls of two dice for a double six to win too, because 24 is to 36 as 4 is to 6.

Your turn

Now roll two dice 24 times. Is at least one double six more likely than not?

A double six has chance 1/36, so none in 24 rolls has chance (35/36)²⁴ = 0.509, and at least one has 1 − 0.509 = 49.1%. The tempting shortcut, 24 × 1/36 = 2/3, adds chances that overlap.

Where you'll meet it

In interviews

Dice and card chances come up often in quant trading interviews, usually with fresh numbers: a total of 9 with two dice, at least one ace in three cards, at least one head in ten flips. Two habits get most of them right. Count outcomes that are equally likely, squares and not totals. Count "at least one" through its complement.

On the job

Historical simulation, a standard way to estimate a portfolio's risk, is counting. Replay each of the last 500 days of market moves on today's positions, and count the days that would have lost more than 1 million dollars. If 5 would have, the estimated chance of such a loss tomorrow is 5 / 500 = 1%. A kind of day the window never saw gets a chance of zero.

Check your chances in Python
from fractions import Fraction
from itertools import product

squares = list(product(range(1, 7), repeat=2))  # the 36 ways two dice land
sevens = [s for s in squares if sum(s) == 7]
print(Fraction(len(sevens), len(squares)))       # 1/6

look_alike = {tuple(sorted(s)) for s in squares}
doubles = [s for s in squares if s[0] == s[1]]
print(len(look_alike), Fraction(len(doubles), 36))  # 21 1/6

no_six = Fraction(5, 6) ** 4
print(1 - no_six, round(float(1 - no_six), 3))   # 671/1296 0.518
print(round(1 - (35 / 36) ** 24, 3))             # 0.491

Python prints the 21 look-alike outcomes without complaint. It can list outcomes for you, but it can't tell you which ones are equally likely. That part is yours.

Check yourself

Four questions from across the lesson. Try each one before you look back.

1

Someone says: "There are 11 totals, so a 12 has chance 1/11." What's the real chance?

Only one square of 36 totals 12: six and six. Their 1/11 treats a 12 as just as likely as a 7, which has 6 squares.

2

Deal three cards from a shuffled deck. What's the chance at least one is an ace?

Count the opposite. Hands with no ace are groups of 3 from the 48 other cards: C(48, 3) = 17,296 of C(52, 3) = 22,100. So 1 − 17,296 / 22,100 = 21.7%. Adding 4/52 three times counts hands with two aces more than once, and (48/52)³ would need each card put back.

3

A team of 2 is picked at random from 4 analysts and 6 engineers. What's the chance both are analysts?

Every team of 2 is equally likely, and there are C(10, 2) = 45. Teams of two analysts: C(4, 2) = 6. So 6/45 = 2/15. The answer 4/25 is 4/10 × 4/10, as if the first analyst could be picked again.

4

A die is loaded so a 6 comes up half the time and each other face 1/10 of the time. What's the chance of a 5 or a 6?

The faces aren't equally likely, so add their chances: 1/10 + 1/2 = 3/5. Counting 2 faces of 6 gives 1/3, which is right only for a fair die. The weights check out: 5 × 1/10 + 1/2 = 1.

What to remember

  1. 1A chance is a share of outcomes

    When every outcome is equally likely, a chance is a count over a count: 6 of the 36 squares total 7, so the chance is 1/6.

  2. 2Outcomes that aren't equally likely

    Count in outcomes that are equally likely. Two dice that look alike still land 36 ways, so a double is 6/36, not 6/21.

  3. 2Outcomes that aren't equally likely

    When outcomes aren't equally likely, add their chances: on the loaded die, an even number is 3/20 + 3/20 + 1/4 = 0.55.

  4. 3Counting the opposite

    For "at least one", count the opposite: at least one six in four rolls is 1 − (5/6)⁴ = 671/1,296, about 51.8%.

  5. 3Counting the opposite

    Add chances only for events that can't happen together. Four rolls at 1/6 each don't make 4/6, because the sum counts some sequences twice.

Probability overviewSpotted a mistake? Tell us.