Probability and decisions

Print the chapter

Every lesson of the chapter, ready for paper. Exercise sets are lettered A, B, C… and answered at the end.

To save a PDF, choose “Save as PDF” in the print dialog.

1. Discrete random variables and their distributions

Warm-up

Three quick questions from earlier lessons.

Discover

X is the number of heads in two coin tosses. Its values are 0, 1, 2. Which list gives their probabilities?

  1. 14,12,14\tfrac{1}{4}, \tfrac{1}{2}, \tfrac{1}{4}
  2. 13,13,13\tfrac{1}{3}, \tfrac{1}{3}, \tfrac{1}{3}

Key idea

A random variable assigns a number to each outcome.

A discrete random variable XX has a list of values with probabilities P(X=x)P(X = x). Every probability is between 0 and 1, and they sum to 1. Probabilities of events such as X≥2X \ge 2 add the matching values.

Worked example

P(X=0)=0.2P(X = 0) = 0.2, P(X=1)=0.5P(X = 1) = 0.5, XX takes only 0, 1, 2.

P(X=2)=1−0.2−0.5=0.3P(X = 2) = 1 - 0.2 - 0.5 = 0.3
Sum to 1.
P(X≥1)=0.8P(X \ge 1) = 0.8
Everything but 0.

Your turn, guided

Your turn: P(X=0)=0.1P(X = 0) = 0.1, P(X=1)=0.6P(X = 1) = 0.6. Find P(X=2)P(X = 2).

0.30.3
1 − 0.1 − 0.6.

Practice ★

  1. A random variable X takes the values 0, 1 and 2, with P(X = 0) = 29/100 and P(X = 1) = 13/100. Find P(X = 2).
  2. A random variable X takes the values 0, 1 and 2, with P(X = 0) = 14/100 and P(X = 1) = 18/100. Find P(X = 2).
  1. Which list could be the probabilities of a random variable with three values?
    1. 0.1, 0.5 and 4/10
    2. 0.5, 0.5 and 0.1
    3. 0.8, 0.4 and −0.2

Watch out!

Practice ★★

  1. X takes the values 0, 1, 2 with P(X = 0) = 25/100 and P(X = 1) = 15/100. Find P(X ≥ 1).
  2. X takes the values 0, 1, 2 with P(X = 0) = 34/100 and P(X = 1) = 15/100. Find P(X ≥ 1).

Exit ticket

Three questions to check you have got it.

  1. A random variable X takes the values 0, 1 and 2, with P(X = 0) = 29/100 and P(X = 1) = 13/100. Find P(X = 2).
  2. A random variable X takes the values 0, 1 and 2, with P(X = 0) = 14/100 and P(X = 1) = 18/100. Find P(X = 2).
  3. A random variable X takes the values 0, 1 and 2, with P(X = 0) = 18/100 and P(X = 1) = 23/100. Find P(X = 2).

Summary card

Discrete distributions

  • Values with probabilities in [0,1][0, 1] summing to 1.
  • Add probabilities for events.

Watch out: values are not automatically equally likely.

2. Expected value and standard deviation of a random variable

Warm-up

Three quick questions from earlier lessons.

Discover

A raffle ticket wins 10 dollars with probability 0.1 and nothing otherwise. What is the average win per ticket over many tickets?

  1. 1 dollar
  2. 5 dollars

Key idea

The mean and SD of a random variable.

E(X)=μX=∑x P(x)E(X) = \mu_X = \sum x\,P(x), the long-run average. Var(X)=∑(x−μ)2P(x)\text{Var}(X) = \sum (x - \mu)^2 P(x) and SD(X)=Var(X)\text{SD}(X) = \sqrt{\text{Var}(X)}. For XX equal to 1 with probability pp and 0 otherwise: μ=p\mu = p, Var=p(1−p)\text{Var} = p(1 - p).

Worked example

XX: 0, 1, 2 with probabilities 0.3, 0.4, 0.3.

E(X)=0+0.4+0.6=1E(X) = 0 + 0.4 + 0.6 = 1
Σ x P(x).
Var(X)=0.3+0+0.3=0.6\text{Var}(X) = 0.3 + 0 + 0.3 = 0.6
Σ (x − 1)² P(x).
SD(X)=0.6≈0.77\text{SD}(X) = \sqrt{0.6} \approx 0.77
Square root.

Your turn, guided

Your turn: XX = 0, 5 with probabilities 0.6, 0.4. E(X)E(X).

22
5 × 0.4.

Practice ★

  1. X takes the values 0, 1, 2 with probabilities 51/100, 15/100 and 34/100. Find E(X).
  2. X takes the values 0, 1, 2 with probabilities 56/100, 25/100 and 19/100. Find E(X).
  1. A game costs 1 dollar. You win 9 dollars (net) with probability 1/7; otherwise you lose your dollar. Find your expected net gain, in dollars.

Watch out!

Practice ★★

  1. X = 1 with probability 7/10 and X = 0 otherwise. Find the standard deviation of X.
  2. X = 1 with probability 9/10 and X = 0 otherwise. Find the standard deviation of X.

Exit ticket

Three questions to check you have got it.

  1. X takes the values 0, 1, 2 with probabilities 51/100, 15/100 and 34/100. Find E(X).
  2. X takes the values 0, 1, 2 with probabilities 56/100, 25/100 and 19/100. Find E(X).
  3. X takes the values 0, 1, 2 with probabilities 77/100, 10/100 and 13/100. Find E(X).

Summary card

Expected value and SD

E(X)=∑xP(x)E(X) = \sum x P(x); SD=∑(x−μ)2P(x)\text{SD} = \sqrt{\sum (x - \mu)^2 P(x)}.

Watch out: weight by probabilities; include losses.

3. Long-run frequency and simulation

Warm-up

Three quick questions from earlier lessons.

Discover

A fair coin gave 7 heads in 10 tosses. If you toss it 10,000 times, what do you expect?

  1. A proportion of heads close to 0.5
  2. More tails than heads, to make up for the 7 heads

Run 10 tosses a few times, then 1,000. What happens to the proportion of heads?

  1. It gets close to 0.5
  2. It swings further from 0.5 to make up for streaks

Key idea

Probability is a long-run relative frequency.

Law of large numbers: as a random process is repeated many times, the proportion of times an event occurs gets close to its probability. Independent trials have no memory. A simulation imitates a random process with random numbers to estimate probabilities.

Worked example

Simulate a 30% chance with random digits.

Let 0, 1, 2 mean "success"
Each digit has probability 0.1.
Read 1,000 random digits; count successes
Repeat many times.
About 300 successes expected
Relative frequency.

Your turn, guided

Your turn: how many digits for a 60% chance?

66
0.6 ÷ 0.1.

Practice ★

  1. A fair coin lands heads 7 times in a row. What is the probability of heads on the next toss?
    1. 1/2: the coin has no memory
    2. Less than 1/2: tails is due
    3. More than 1/2: heads is on a streak
  1. What does it mean that the probability of rain tomorrow is 0.7?
    1. On many days like tomorrow, it rains on about 70% of them
    2. It will rain for 70% of the day
    3. It will rain if the probability is above 0.5

Watch out!

Practice ★★

  1. To simulate a free throw made with probability 0.6 using random digits 0–9, how many of the ten digits should stand for 'made'?
  2. To simulate a free throw made with probability 0.4 using random digits 0–9, how many of the ten digits should stand for 'made'?

Exit ticket

Three questions to check you have got it.

  1. A fair coin lands heads 7 times in a row. What is the probability of heads on the next toss?
    1. 1/2: the coin has no memory
    2. Less than 1/2: tails is due
    3. More than 1/2: heads is on a streak
  2. A fair coin lands heads 5 times in a row. What is the probability of heads on the next toss?
    1. 1/2: the coin has no memory
    2. Less than 1/2: tails is due
    3. More than 1/2: heads is on a streak
  3. A fair coin lands heads 10 times in a row. What is the probability of heads on the next toss?
    1. 1/2: the coin has no memory
    2. Less than 1/2: tails is due
    3. More than 1/2: heads is on a streak

Summary card

Long run

  • Probability = long-run relative frequency.
  • Simulate with random numbers.

Watch out: no memory, no "due" outcomes.

4. Tree diagrams and reverse conditioning

Warm-up

Three quick questions from earlier lessons.

Discover

1% of people have a condition. A test is positive for 95% of them, and for 5% of healthy people. Of 10,000 people, about how many test positive in total?

  1. About 590
  2. About 5,000

Key idea

A tree organizes conditional probabilities.

First branches: P(A)P(A) and P(not A)P(\text{not } A); second branches: conditional probabilities. Multiply along a path; add the paths that end in BB to get P(B)P(B). Then P(A∣B)=P(A and B)P(B)P(A \mid B) = \dfrac{P(A \text{ and } B)}{P(B)} (reverse conditioning, Bayes' rule).

Worked example

With the numbers above: P(condition | positive).

0.01×0.95=0.00950.01 \times 0.95 = 0.0095
Path: condition, positive.
P(+)=0.0095+0.99×0.05=0.059P(+) = 0.0095 + 0.99 \times 0.05 = 0.059
Both paths to positive.
P(condition∣+)=0.00950.059≈0.16P(\text{condition} \mid +) = \tfrac{0.0095}{0.059} \approx 0.16
Divide.

Your turn, guided

Your turn: P(A) = 0.2, P(B | A) = 0.5, P(B | not A) = 0.25. Find P(B).

0.30.3
0.2 × 0.5 + 0.8 × 0.25.

Practice ★

  1. 12% of a population has a condition. A test is positive for 86% of people with the condition and for 11% of people without it. Find P(positive).
  2. 14% of a population has a condition. A test is positive for 94% of people with the condition and for 8% of people without it. Find P(positive).
  1. 22% of a population has a condition. A test is positive for 81% of people with the condition and for 12% of people without it. Find P(condition | positive).

Watch out!

Practice ★★

  1. A disease affects 1 in 1,000 people. A test is 93% accurate for both sick and healthy people. Your test is positive. What is most likely?
    1. You are still more likely healthy: false positives from the many healthy people outnumber the true positives
    2. You are about 93% likely to be sick
    3. You are certainly sick
  1. Boss problem. 5% of people have a disease. A test is positive for 90% of people with the disease and for 7% of people without it.

Exit ticket

Three questions to check you have got it.

  1. 12% of a population has a condition. A test is positive for 86% of people with the condition and for 11% of people without it. Find P(positive).
  2. 14% of a population has a condition. A test is positive for 94% of people with the condition and for 8% of people without it. Find P(positive).
  3. 28% of a population has a condition. A test is positive for 95% of people with the condition and for 14% of people without it. Find P(positive).

Summary card

Trees

  • Multiply along paths; add paths to the same end.
  • P(A∣B)=P(A and B)/P(B)P(A \mid B) = P(A \text{ and } B)/P(B).

Watch out: with rare events, most positives can be false.