Outcomes and probability

Probability measures how likely something is, on a scale from 0 (impossible) to 1 (certain).

Sample space and events

An experiment has possible outcomes. The set of all of them is the sample space. An event is a set of outcomes we care about.

Rolling two dice: each die shows 1 to 6, so there are 6 × 6 = 36 outcomes, all equally likely. The event "the sum is 7" contains (1, 6), (2, 5), (3, 4), (4, 3), (5, 2) and (6, 1).

When every outcome is equally likely:

P(event) = favourable outcomes ÷ all outcomes

So P(sum is 7) = 6 ÷ 36 = 1/6. The example counts the outcomes instead of trusting our memory.

from fractions import Fraction

count = 0
for a in range(1, 7):
    for b in range(1, 7):
        if a + b == 7:
            count += 1
print("ways to roll 7:", count)
print("P(sum = 7) =", Fraction(count, 36))
Open in compiler

Python's Fraction keeps the answer exact: 1/6, not 0.16666….

Common mistakes

  • Counting outcomes that are not equally likely. The sums 2 to 12 are 11 results, but P(sum is 7) is not 1/11: a 7 can happen six ways, a 2 only one way. Count the equally likely outcomes (the 36 pairs), not the results.
  • Forgetting that (2, 5) and (5, 2) are different outcomes: the two dice are different dice.

Quick check

1. A coin is tossed twice. How many outcomes are in the sample space?
2. What is P(sum = 2) with two dice?
3. A probability of 1 means…

Practice problems for this lesson

My notes

Write down what you want to remember from this lesson. Notes are saved on this device as you type, and appear on your dashboard.