Lessons and exercises follow the school system and stay in its language.Les leçons et les exercices suivent le système scolaire et restent dans sa langue.Lektionen und Übungen folgen dem Schulsystem und bleiben in seiner Sprache.

Random variables

Print Algebra II only

The lessons of this topic taught in Algebra II, ready for paper.

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.

  1. Two fair dice are rolled. Find the probability that the sum is 2.
  2. A fair die is rolled 2 times. Find the probability of at least one six.
  3. The probability that a flight is late is 0.78. Find the probability that it is not late.

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.

One more step is optional: a challenge. Try it, or finish the lesson now.

Challenge ★★★

  1. X is equally likely to be any whole number from 1 to 9. Find P(X ≥ 3).

2. Expected value and standard deviation of a random variable

Warm-up

Three quick questions from earlier lessons.

  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. X takes the values 0, 1, 2 with P(X = 0) = 25/100 and P(X = 1) = 15/100. Find P(X ≥ 1).
  3. 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

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 4 dollars (net) with probability 1/3; 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.

One more step is optional: a challenge. Try it, or finish the lesson now.

Challenge ★★★

  1. A game costs 1 dollar. With probability 15\dfrac{1}{ 5 } you win ww dollars net; otherwise your dollar is lost. For which ww is the game fair (expected value 0)?

3. Waiting for a first success

Discover

You roll a fair die until you get a six. On average, how many rolls does it take?

  1. 6 rolls
  2. 3.5 rolls

Key idea

Waiting for a first success.

If each try succeeds with probability pp, independently, the expected number of tries until the first success is

E=1pE = \dfrac{1}{p}.

Worked example

A spinner lands on red with probability 14\tfrac{1}{4}. How many spins do you expect until the first red?

E=11/4E = \dfrac{1}{1/4}
p=14p = \tfrac{1}{4}.
E=4E = 4 spins
11/4=4\dfrac{1}{1/4} = 4.

Your turn, guided

Your turn: each try succeeds with probability 110\tfrac{1}{10}. How many tries do you expect?

1010
11/10\dfrac{1}{1/10}.

Practice ★

  1. Each try succeeds with probability 111\tfrac{1}{ 11 }, independently. How many tries do you expect until the first success?
  2. Each try succeeds with probability 115\tfrac{1}{ 15 }, independently. How many tries do you expect until the first success?
  3. Each try succeeds with probability 12\tfrac{1}{ 2 }, independently. How many tries do you expect until the first success?

Practice ★★

  1. A machine part fails on a given day with probability 160\tfrac{ 1 }{ 60 }. On average, how many days pass until its first failure?
  2. A machine part fails on a given day with probability 150\tfrac{ 1 }{ 50 }. On average, how many days pass until its first failure?

Exit ticket

Two questions to check.

  1. Each try succeeds with probability 111\tfrac{1}{ 11 }, independently. How many tries do you expect until the first success?
  2. Each try succeeds with probability 115\tfrac{1}{ 15 }, independently. How many tries do you expect until the first success?

Summary card

Waiting time

  • Expected waiting time =1p= \dfrac{1}{p}.
  • Rare events: long waits on average.

Engineers use it for the expected time between failures of a machine.

4. History: Bernoulli, de Moivre and the law of large numbers

Discover

Toss a fair coin 10 times: you may well get 7 heads. Toss it 10,000 times: the share of heads is almost always very close to 12\tfrac{1}{2}. Who first proved that this must happen?

  1. Jacob Bernoulli, with his law of large numbers
  2. Nobody: it is only an observation

Key idea

From one throw to many.

17001710172017301740175017601713Bernoulli1713Bernoulli
  1. Step 117001710172017301740175017601713Bernoulli1713BernoulliJacob Bernoulli 1655–1705Niklaus Bernoulli (1662-1716), 1687. Public domain1713: Jacob Bernoulli's Ars Conjectandi is printed, eight years after his death. It proves the law of large numbers.
  2. Step 217001710172017301740175017601713Bernoulli1718de Moivre1713Bernoulli1718de MoivreAbraham de Moivre 1667–1754Joseph Highmore, 1736. Public domain1718: de Moivre's book The Doctrine of Chances.
  3. Step 317001710172017301740175017601713Bernoulli1718de Moivre1733de Moivre1713Bernoulli1718de Moivre1733de MoivreAbraham de Moivre 1667–1754Joseph Highmore, 1736. Public domain13 November 1733: de Moivre approximates the binomial distribution by the bell curve.

Jacob Bernoulli's Ars Conjectandi (printed in 1713, eight years after his death) contains the law of large numbers. On 13 November 1733 Abraham de Moivre showed that for many trials the binomial distribution looks like the bell curve, today's normal distribution.

Worked example

With nn tosses of a fair coin, the number of heads XX has mean n2\tfrac{n}{2} and standard deviation n2\tfrac{\sqrt{n}}{2}.

mean 50, standard deviation 5
For n=100n = 100:
0.0050.005: very close to 12\tfrac{1}{2}
For n=10 000n = 10\,000: the share of heads has standard deviation 5010 000\tfrac{50}{10\,000}.

Practice ★

  1. What does Jacob Bernoulli's law of large numbers (printed in 1713) say?
    1. Over many trials, the frequency gets close to the probability
    2. After many tails, heads becomes more likely
    3. Large numbers are more likely than small ones
  1. A fair coin is tossed 144 times. With σ=n2\sigma = \tfrac{\sqrt{n}}{2}, what is the standard deviation of the number of heads?
  2. A fair coin is tossed 196 times. With σ=n2\sigma = \tfrac{\sqrt{n}}{2}, what is the standard deviation of the number of heads?
  1. Ars Conjectandi was printed in 1713, eight years after Jacob Bernoulli's death. In which year did he die? Add 4 to that year.

Summary card

Random variables today

  • Polls: a sample of 1,000 people gives a share close to the true one.
  • Insurance and casinos rely on the law of large numbers.
  • Quality control counts faulty items with the binomial distribution.

Sources: MacTutor biographies of Jacob Bernoulli and Abraham de Moivre (see "Sources and credits").