M5.7.1 Chapter 1

Random variables

If you throw two dice and add the scores, which total comes up most often, and what total should you expect?

Your guess

Pick one before you read on. It is fine to be wrong.

Your guess
  • You picked A. Read on. At the end, the chapter comes back to your guess.

  • You picked B. Read on. At the end, the chapter comes back to your guess.

  • You picked C. Read on. At the end, the chapter comes back to your guess.

By the end you can

  • Make a probability table for a discrete random variable
  • Find the expected value of a random variable
  • Say why an expected value is a balance point and not a likely value

Chance gives us a number in many places. It may be the total of two dice, the number of seeds out of ten that grow, or the number of buses that pass in an hour. Each of these is a random variable. We name it with a capital letter such as X. A small letter x stands for one of the values it may take.

A random variable is discrete when its values can be listed one by one, such as 0, 1, 2, 3. The number of heads in three tosses is discrete. A waiting time is not, because it can take any value along a stretch of the number line. Chapter 4 meets that kind. Until then every variable here is discrete.

The probability distribution of X lists every value x with its probability P(X = x). Two rules always hold. Each probability is from 0 to 1. And all the probabilities add up to 1, because X must take one of its values.

Draw it first

Draw the distribution of the total of two dice

  1. A bar chart. The bars stand on the totals 2 to 12 of two dice, with the heading total of two dice under them, and the heading P(X = x) above the left axis. Step 1 draws every bar, rising from the total 2 up to the total 7 and falling to the total 12. Step 2 hatches the bar at 7, the tallest, and names it P(X = 7).P(X = x)00.050.10.150.224681012total of two dice

    1 Put each total, 2 to 12, under its own bar. Each bar is as high as its probability, from 1/36 for the total 2 up to 6/36 for the total 7.

  2. A bar chart. The bars stand on the totals 2 to 12 of two dice, with the heading total of two dice under them, and the heading P(X = x) above the left axis. Step 1 draws every bar, rising from the total 2 up to the total 7 and falling to the total 12. Step 2 hatches the bar at 7, the tallest, and names it P(X = 7).P(X = x)P(X = 7)00.050.10.150.224681012total of two dice

    2 The bar for 7 is the tallest. Six of the 36 equally likely pairs of scores make 7, so P(X = 7) = 6/36 = 1/6.

To make a table, list the values and find the probability of each. Let X be the number of heads in three tosses of a fair coin. The tree shows all 8 outcomes. They are equally likely, so each has probability 1/8. The hatched ends are the outcomes with X = 2.

A tree diagram of three tosses of a fair coin. Each toss has two branches, H and T, each marked 1/2. There are eight ends, from HHH to TTT, each marked with its outcome and 1/8. The three ends with exactly two heads, HHT, HTH and THH, are hatched.H1/2H1/2H1/2T1/2T1/2H1/2T1/2T1/2H1/2H1/2T1/2T1/2H1/2T1/2HHH: 1/8HHT: 1/8HTH: 1/8HTT: 1/8THH: 1/8THT: 1/8TTH: 1/8TTT: 1/8
Eight equally likely outcomes. Three of them have exactly two heads.

Worked example

X is the number of heads in three tosses of a fair coin. Make a probability table for X.

  1. X can be 0, 1, 2 or 3.
  2. The tree has 2 × 2 × 2 = 8 ends. Each end has probability 1/2 × 1/2 × 1/2 = 1/8.
  3. Count the ends for each value. X = 0 only for TTT. X = 1 for HTT, THT and TTH. X = 2 for HHT, HTH and THH. X = 3 only for HHH.
  4. So the probabilities are 1/8, 3/8, 3/8 and 1/8.
  5. Check that they add to 1: 1/8 + 3/8 + 3/8 + 1/8 = 8/8 = 1.

Answer: For x = 0, 1, 2, 3 the probabilities are 1/8, 3/8, 3/8 and 1/8.

A bar chart for the number of heads in three tosses. The bars stand on 0, 1, 2 and 3, with the heading number of heads under them and the heading P(X = x) above the left axis. Each bar is written with its probability: 0.125, 0.375, 0.375 and 0.125.P(X = x)00.10.20.30.40.500.12510.37520.37530.125number of heads
The probabilities of the table as bars. The two middle bars are three times as tall as the two outer bars.

The rule that the probabilities add to 1 lets you find one that is missing. Sometimes a rule gives the probabilities, with an unknown number in it. Add the probabilities, put the sum equal to 1, and solve for the unknown.

Worked example

The chance that X takes each of the values 1, 2, 3 and 4 is in proportion to the value. So P(X = x) = kx for some number k. Find k.

  1. The probabilities are k, 2k, 3k and 4k.
  2. They add to 1, so k + 2k + 3k + 4k = 1.
  3. That is 10k = 1, so k = 1 ÷ 10 = 0.1.
  4. So P(X = 1) = 0.1, P(X = 2) = 0.2, P(X = 3) = 0.3 and P(X = 4) = 0.4.
  5. Check: 0.1 + 0.2 + 0.3 + 0.4 = 1.

Answer: k = 0.1

Now the expected value. Suppose you could repeat the chance a very large number of times and take the mean of all the values of X. That mean settles down to a fixed number, the expected value E(X), also called the mean of X and written μ. To find it, multiply each value by its probability and add: E(X) = Σ x P(X = x).

Worked example

X takes the values 1, 2, 3 and 4 with probabilities 0.1, 0.2, 0.3 and 0.4. Find E(X).

  1. Multiply each value by its probability: 1 × 0.1 = 0.1, 2 × 0.2 = 0.4, 3 × 0.3 = 0.9 and 4 × 0.4 = 1.6.
  2. Add the four products: 0.1 + 0.4 + 0.9 + 1.6 = 3.
  3. So E(X) = 3.

Answer: E(X) = 3

A bar chart for X with the values 1, 2, 3 and 4. The heading x is under the bars and the heading P(X = x) is above the left axis. The bars are 0.1, 0.2, 0.3 and 0.4 high, read from the left axis. A dashed line with a marker at the top, named mean 3, stands on the bar for 3.P(X = x)00.10.20.30.40.50.61234xmean 3
The bars balance at the mean. The tall bar at 4 pulls the balance point to the right of the middle of 1 to 4, which is 2.5.

Think of each bar as a weight on a beam, with the beam resting on one point. The beam balances where the mean is. That is why E(X) is not always the middle value: a heavy bar far out pulls the balance point towards it.

Worked example

X is the score on one throw of a fair die. Find E(X). Can the die show this value?

  1. Each score from 1 to 6 has probability 1/6.
  2. E(X) = 1 × 1/6 + 2 × 1/6 + 3 × 1/6 + 4 × 1/6 + 5 × 1/6 + 6 × 1/6 = (1 + 2 + 3 + 4 + 5 + 6) × 1/6.
  3. The scores add to 21, so E(X) = 21 ÷ 6 = 3.5.
  4. No throw scores 3.5. The expected value is a mean over many throws. It does not have to be a score you can get.

Answer: E(X) = 3.5. The die cannot show this value.

A bar chart for the score on one fair die. The bars stand on 1 to 6, with the heading score under them and the heading P(X = x) above the left axis. All six bars are the same height, about 0.17, read from the left axis. A dashed line with a marker at the top, named mean 3.5, stands between the bars for 3 and 4.P(X = x)00.10.20.3123456scoremean 3.5
Six equal bars balance at the middle, 3.5. There is no bar at 3.5.

See it three ways

With things

A bag holds 10 stones. One stone is marked 1, two are marked 2, three are marked 3 and four are marked 4. Pick one without looking. The mark on it is X.

As a picture

A table with the heads mark, stones and chance. The rows read 1 and 1 and 0.1, 2 and 2 and 0.2, 3 and 3 and 0.3, 4 and 4 and 0.4.markstoneschance110.1220.2330.3440.4

In words

A probability distribution lists every value of X with its chance. The chances add to 1.

In symbols

P(X = x) = x/10 for x = 1, 2, 3, 4, and 0.1 + 0.2 + 0.3 + 0.4 = 1. E(X) = Σ x P(X = x) = 3.

Try it

Add the scores of two bags

You need: 12 small slips of paper, two bags or two cups, a pencil.

  1. Write the numbers 1 to 6 on six slips and put them in one bag. Do the same for the other bag.
  2. Take one slip from each bag, add the two numbers, and put the slips back. Mark the total with a tally stroke.
  3. Do this 36 times. Then look at which totals have the most strokes.
  4. Compare your strokes with the table of pairs. The total 7 should be the tallest, and 2 and 12 the shortest.

What you will see: Your counts will not match the table exactly, because the draws are random. The more draws you make, the closer the strokes come to the shape of the table.

If you cannot try it, this is what happens.
A table with the heads total and pairs of scores. The rows read 2 and 1, 3 and 2, 4 and 3, 5 and 4, 6 and 5, 7 and 6, 8 and 5, 9 and 4, 10 and 3, 11 and 2, 12 and 1.totalpairs of scores2132435465768594103112121

A wrong idea many people have

The expected value is the value that X is most likely to take.

Why it feels right: In everyday speech, "expect" means "think will happen". So E(X) sounds like the best guess for the next result.

The test that breaks it: Take X as the number of heads in three tosses. E(X) = 0 × 1/8 + 1 × 3/8 + 2 × 3/8 + 3 × 1/8 = 12/8 = 1.5. But P(X = 1.5) = 0, because X can only be 0, 1, 2 or 3.

What is true: The expected value is the mean of many results, and the balance point of the bars. It can be a value that X can never take. The most likely value is a different thing, called the mode.

A wrong idea many people have

Any list of numbers between 0 and 1 is a probability distribution.

Why it feels right: A probability must be from 0 to 1, so a list of such numbers looks fine.

The test that breaks it: Take the probabilities 0.6, 0.7 and 0.5 for the values 1, 2 and 3. Each is from 0 to 1. But 0.6 + 0.7 + 0.5 = 1.8, so X would take one of its values with probability 1.8.

What is true: Each probability must be from 0 to 1 and the probabilities must add to exactly 1. Always add them as a check.

Key words

random variable
a number that depends on chance, such as the total of two dice. It is named with a capital letter, X.
discrete
a variable whose values can be listed one by one, such as 0, 1, 2, 3.
probability distribution
a list of every value of X with its probability. The probabilities add to 1.
expected value
the mean of X over very many repeats, E(X) = Σ x P(X = x). It is the balance point of the bars.

Back to your guess

The answer is C: The total 7 is the most likely, because more pairs of scores make it.

The total 7 comes up most often. Six of the 36 equally likely pairs of scores make it: 1 and 6, 2 and 5, 3 and 4, and the same three the other way round. The totals 2 and 12 are made by only one pair each. The expected total is also 7, because the bars are symmetric about 7. A list of every total with its chance is a probability distribution.

Check yourself

Try each one before you look. A wrong answer tells you where to go next.

  1. X takes the values 1, 2, 3 and 4 with the probabilities in the table. One probability is hidden by c. Find c.

    A table with the heads x and P(X = x). The rows read 1 and 0.1, 2 and 0.35, 3 and c, 4 and 0.25.xP(X = x)10.120.353c40.25
    Tap your answer.
    1. Not this one. You added the three given probabilities, and 0.1 + 0.35 + 0.25 = 0.7. That is the total they already use. The hidden probability is what is left to reach 1. Read this page again. Try another.

    2. Not this one. That is the probability of the first value. The hidden one is 1 minus the sum of the others. Read this page again. Try another.

    3. Not this one. You added the given probabilities to 1. A probability cannot be above 1. Take them away from 1. Read this page again. Try another.

    4. Yes, that is right. The probabilities add to 1, so c = 1 − (0.1 + 0.35 + 0.25) = 1 − 0.7 = 0.3.

    See the answer

    0.3

    The probabilities add to 1, so c = 1 − (0.1 + 0.35 + 0.25) = 1 − 0.7 = 0.3.

    • If you chose A: You added the three given probabilities, and 0.1 + 0.35 + 0.25 = 0.7. That is the total they already use. The hidden probability is what is left to reach 1. Read this page again.
    • If you chose B: That is the probability of the first value. The hidden one is 1 minus the sum of the others. Read this page again.
    • If you chose C: You added the given probabilities to 1. A probability cannot be above 1. Take them away from 1. Read this page again.
  2. X takes the values 1, 2 and 3 with probabilities 0.5, 0.3 and 0.2. What is E(X)?

    Tap your answer.
    1. Yes, that is right. E(X) = 1 × 0.5 + 2 × 0.3 + 3 × 0.2 = 0.5 + 0.6 + 0.6 = 1.7.

    2. Not this one. That is the mean of the three values, 1, 2 and 3, as if each were equally likely. The probabilities are not equal, so each value must be weighted by its probability. Read this page again. Try another.

    3. Not this one. You added the values. Multiply each value by its probability first, then add. Read this page again. Try another.

    See the answer

    1.7

    E(X) = 1 × 0.5 + 2 × 0.3 + 3 × 0.2 = 0.5 + 0.6 + 0.6 = 1.7.

    • If you chose B: That is the mean of the three values, 1, 2 and 3, as if each were equally likely. The probabilities are not equal, so each value must be weighted by its probability. Read this page again.
    • If you chose C: You added the values. Multiply each value by its probability first, then add. Read this page again.
  3. Which of these lists could be the probabilities of the four values of a random variable?

    Tap your answer.
    1. Not this one. Each is from 0 to 1, but the four add to 1.2. They must add to 1. Read this page again. Try another.

    2. Yes, that is right. The probabilities must each be from 0 to 1 and add to 1. Only 0.4 + 0.3 + 0.2 + 0.1 = 1 does both.

    3. Not this one. These add to 1, but a probability cannot be negative. Read this page again. Try another.

    4. Not this one. This list has only three numbers, and they add to 0.75. Four values need four probabilities that add to 1. Read this page again. Try another.

    See the answer

    0.4, 0.3, 0.2, 0.1

    The probabilities must each be from 0 to 1 and add to 1. Only 0.4 + 0.3 + 0.2 + 0.1 = 1 does both.

    • If you chose A: Each is from 0 to 1, but the four add to 1.2. They must add to 1. Read this page again.
    • If you chose C: These add to 1, but a probability cannot be negative. Read this page again.
    • If you chose D: This list has only three numbers, and they add to 0.75. Four values need four probabilities that add to 1. Read this page again.
  4. For one fair die, E(X) = 3.5. What does that tell us?

    Tap your answer.
    1. Not this one. A die cannot show 3.5. Its scores are 1 to 6. Read this page again. Try another.

    2. Not this one. The expected value says nothing sure about one throw. Any score from 1 to 6 may come. Read this page again. Try another.

    3. Yes, that is right. The expected value is the long run mean. Single throws vary, but their mean over many throws settles near 3.5.

    See the answer

    The mean of very many throws will be close to 3.5.

    The expected value is the long run mean. Single throws vary, but their mean over many throws settles near 3.5.

    • If you chose A: A die cannot show 3.5. Its scores are 1 to 6. Read this page again.
    • If you chose B: The expected value says nothing sure about one throw. Any score from 1 to 6 may come. Read this page again.
  5. X is the number of heads in three tosses of a fair coin. What is P(X = 2)?

    Tap your answer.
    1. Yes, that is right. Three of the 8 equally likely outcomes have exactly two heads: HHT, HTH and THH. Each has probability 1/8, so P(X = 2) = 3/8.

    2. Not this one. That is the chance of one outcome such as HHT. Two heads in three tosses can happen as HHT, HTH and THH. Go to M4.6.4. Try another.

    3. Not this one. You divided the number of heads by the number of tosses. That is not a probability of X = 2. Read this page again. Try another.

    See the answer

    3/8

    Three of the 8 equally likely outcomes have exactly two heads: HHT, HTH and THH. Each has probability 1/8, so P(X = 2) = 3/8.

    • If you chose B: That is the chance of one outcome such as HHT. Two heads in three tosses can happen as HHT, HTH and THH. Go to M4.6.4.
    • If you chose C: You divided the number of heads by the number of tosses. That is not a probability of X = 2. Read this page again.
  6. Which of these is a discrete random variable?

    Tap your answer.
    1. Not this one. A time can be any value along a stretch, such as 24.37 minutes. It is not a list of separate values. Read this page again. Try another.

    2. Yes, that is right. A count takes separate values: 0, 1, 2, 3 and so on. Times and masses can take any value in a range, so they are not discrete.

    3. Not this one. A mass can be any value along a stretch. It is not a list of separate values. Read this page again. Try another.

    See the answer

    The number of eggs in a nest.

    A count takes separate values: 0, 1, 2, 3 and so on. Times and masses can take any value in a range, so they are not discrete.

    • If you chose A: A time can be any value along a stretch, such as 24.37 minutes. It is not a list of separate values. Read this page again.
    • If you chose C: A mass can be any value along a stretch. It is not a list of separate values. Read this page again.
  7. X takes the values 10, 20, 30 and 40 with probabilities 0.1, 0.4, 0.3 and 0.2. Find E(X).

    See the answer

    26

    E(X) = 10 × 0.1 + 20 × 0.4 + 30 × 0.3 + 40 × 0.2 = 1 + 8 + 9 + 8 = 26.

  8. X takes the values 0, 1, 2 and 3. The probabilities of 0, 1 and 2 are 0.15, 0.4 and 0.3. Find P(X = 3).

    See the answer

    0.15

    The four probabilities add to 1, so P(X = 3) = 1 − (0.15 + 0.4 + 0.3) = 1 − 0.85 = 0.15.

  9. A spinner gives 1, 2 or 5 points with probabilities 0.5, 0.3 and 0.2. Find the expected number of points on one spin.

    See the answer

    2.1

    E(X) = 1 × 0.5 + 2 × 0.3 + 5 × 0.2 = 0.5 + 0.6 + 1 = 2.1 points.

  10. P(X = x) = 0.1x for x = 1, 2, 3 and 4. Find P(X ≥ 3).

    See the answer

    0.7

    X ≥ 3 means X = 3 or X = 4. So P(X ≥ 3) = 0.3 + 0.4 = 0.7.

Keep it

Copy this into your exercise book.

Probabilities add to 1. E(X) = Σ x P(X = x). Multiply each value by its probability, then add. E(X) is the long run mean and the balance point. It need not be a possible value.

Draw: A bar chart of a distribution with a triangle under the balance point, named mean.

Reading with a child? A short page for the adult: what this chapter teaches and three questions to ask.

No internet tomorrow? Save the whole book as one file (1.1 MB). It opens on any phone.