Skip to content
Family Table Math

Discrete Random Variables

When you roll two dice, you usually care about one number: the sum. A random variable turns each outcome of an experiment into a number like that, so you can organize all the probabilities in one table or graph. This idea is the starting point for everything else in this unit: expected value, the binomial distribution, and the hypergeometric distribution.

A random variable is a variable whose value is a number decided by the outcome of an experiment. We name it with a capital letter, like XX, and write its possible values in lower case, like xx.

  • Roll two dice and let XX be the sum. The possible values are x=2,3,…,12x = 2, 3, \dots, 12.
  • Flip a coin 44 times and let XX be the number of heads. The possible values are x=0,1,2,3,4x = 0, 1, 2, 3, 4.

A random variable is discrete if you can list its values (usually whole numbers you get by counting). Measured quantities like time or mass are continuous; they come later, in continuous random variables.

P(X=x)P(X = x) means “the probability that XX takes the value xx”. For two dice, P(X=7)=636P(X = 7) = \tfrac{6}{36}.

A probability distribution of XX matches each value xx with its probability P(X=x)P(X = x). You can think of it as a mapping x→P(X=x)x \to P(X = x), and it’s usually shown in a table:

xx2233445566778899101011111212
P(X=x)P(X = x)136\tfrac{1}{36}236\tfrac{2}{36}336\tfrac{3}{36}436\tfrac{4}{36}536\tfrac{5}{36}636\tfrac{6}{36}536\tfrac{5}{36}436\tfrac{4}{36}336\tfrac{3}{36}236\tfrac{2}{36}136\tfrac{1}{36}

Every probability distribution has two properties:

  • each probability is between 00 and 11: 0≤P(X=x)≤10 \le P(X = x) \le 1;
  • the probabilities add to 11: ∑P(X=x)=1\sum P(X = x) = 1.

(The symbol ∑\sum, the Greek capital sigma, means “add up all of these”.)

Without technology: list the sample space (with a table or tree diagram), find the value of XX for each outcome, then count. The sums table on probability and sample spaces gives the two-dice distribution above.

With technology: a spreadsheet makes the counting quick. List all 3636 pairs of dice in two columns, add them in a third column, then use COUNTIF to count how many times each sum appears and divide by 3636. You can also simulate: =RANDBETWEEN(1,6)+RANDBETWEEN(1,6) copied down 10001000 rows gives an experimental distribution that should come out close to the theoretical one.

A probability histogram is a bar graph of a distribution:

  • each value xx gets a bar of width 11, centred on xx (so the bar for 77 runs from 6.56.5 to 7.57.5);
  • the bar’s height is P(X=x)P(X = x);
  • the bars touch, because the values are consecutive whole numbers.

Since each bar has width 11, its area equals its probability, and the total area of all the bars is 11.

Probability histogram for the sum of two dice. Bars of width 1 are centred on 2 to 12. Heights rise from 1/36 at 2 to 6/36 at 7, then fall back to 1/36 at 12. 0.00 0.03 0.06 0.09 0.12 0.15 0.18 2 3 4 5 6 7 8 9 10 11 12 sum of two dice, x P(X = x) 1/36 2/36 3/36 4/36 5/36 6/36 5/36 4/36 3/36 2/36 1/36
The probability histogram for XX, the sum of two dice. It’s symmetric about x=7x = 7.

A frequency histogram looks similar but shows what actually happened in an experiment: bar heights are counts (or relative frequencies). It changes every time you repeat the experiment. A probability histogram shows what should happen in theory. With more and more trials, a relative frequency histogram gets closer and closer to the probability histogram.

A random variable has a uniform distribution if all its nn values are equally likely:

P(X=x)=1nfor each of the n valuesP(X = x) = \frac{1}{n} \quad \text{for each of the } n \text{ values}

Rolling one fair die is uniform with n=6n = 6: each value has probability 16\tfrac{1}{6}. Its probability histogram is six bars of the same height, a flat “rectangle” shape.

To count the values from aa to bb (whole numbers), use n=b−a+1n = b - a + 1. The numbers 11 to 2525 have n=25n = 25 values; the numbers 1010 to 9999 have n=90n = 90.

Example 1: Using the two-dice distribution

Section titled “Example 1: Using the two-dice distribution”

Let XX be the sum of two fair dice. Use the table above to find P(X≥9)P(X \ge 9) and P(4≤X≤6)P(4 \le X \le 6).

Solution. Add the probabilities of the values that fit.

P(X≥9)=4+3+2+136=1036=518P(X \ge 9) = \frac{4 + 3 + 2 + 1}{36} = \frac{10}{36} = \frac{5}{18} P(4≤X≤6)=3+4+536=1236=13P(4 \le X \le 6) = \frac{3 + 4 + 5}{36} = \frac{12}{36} = \frac{1}{3}

On the histogram, these are the total areas of the bars for 99 to 1212, and for 44 to 66.

Example 2: Building a distribution by hand

Section titled “Example 2: Building a distribution by hand”

A bag holds 33 red and 22 blue marbles. Two are drawn without replacement, and XX is the number of red marbles drawn. Make the probability distribution of XX.

Solution. Use the tree diagram from independent and dependent events. The four paths are RR, RB, BR, BB.

  • X=0X = 0: only BB, so P(X=0)=25×14=220P(X = 0) = \tfrac{2}{5} \times \tfrac{1}{4} = \tfrac{2}{20}.
  • X=1X = 1: RB or BR, so P(X=1)=35×24+25×34=1220P(X = 1) = \tfrac{3}{5} \times \tfrac{2}{4} + \tfrac{2}{5} \times \tfrac{3}{4} = \tfrac{12}{20}.
  • X=2X = 2: only RR, so P(X=2)=35×24=620P(X = 2) = \tfrac{3}{5} \times \tfrac{2}{4} = \tfrac{6}{20}.
xx001122
P(X=x)P(X = x)110\tfrac{1}{10}35\tfrac{3}{5}310\tfrac{3}{10}

Check: 220+1220+620=1\tfrac{2}{20} + \tfrac{12}{20} + \tfrac{6}{20} = 1. ✓

At a school assembly, one ticket is drawn at random from tickets numbered 11 to 2525. Let XX be the number drawn. Find P(X=13)P(X = 13), P(X is a multiple of 4)P(X \text{ is a multiple of } 4), and P(X>18)P(X \gt 18).

Solution. All 2525 numbers are equally likely, so XX is uniform with P(X=x)=125P(X = x) = \tfrac{1}{25}.

P(X=13)=125P(X = 13) = \frac{1}{25}

The multiples of 44 are 4,8,12,16,20,244, 8, 12, 16, 20, 24: six values.

P(X is a multiple of 4)=625P(X \text{ is a multiple of } 4) = \frac{6}{25}

The values greater than 1818 are 1919 to 2525, which is 25−19+1=725 - 19 + 1 = 7 values.

P(X>18)=725P(X \gt 18) = \frac{7}{25}

Two coins are flipped 4040 times, and XX is the number of heads each time. The results were: 00 heads 1212 times, 11 head 1717 times, 22 heads 1111 times. Compare the relative frequencies with the theoretical probabilities.

Solution. The sample space is HH, HT, TH, TT, so the theoretical distribution is P(X=0)=14P(X = 0) = \tfrac{1}{4}, P(X=1)=12P(X = 1) = \tfrac{1}{2}, P(X=2)=14P(X = 2) = \tfrac{1}{4}.

xx001122
Frequency121217171111
Relative frequency0.30.30.4250.4250.2750.275
Probability0.250.250.50.50.250.25

The frequency histogram has the same general shape (tallest in the middle), but the heights don’t match exactly. That’s normal for only 4040 trials. With thousands of trials, the relative frequencies would get very close to 0.250.25, 0.50.5, 0.250.25.

Assuming every value of X is equally likely. The sums of two dice go from 22 to 1212, but they are not uniform. Only use P(X=x)=1nP(X = x) = \tfrac{1}{n} when each value really is equally likely, like one fair die.

Forgetting to check that the probabilities add to 1. If your table adds to 0.950.95 or 1.11.1, a value is missing or a probability is wrong. Check every distribution you build.

Miscounting the values from a to b. From 1010 to 9999 there are 9090 whole numbers, not 8989. Use b−a+1b - a + 1.

Drawing histogram bars in the wrong place. In a probability histogram, the bar for x=3x = 3 goes from 2.52.5 to 3.53.5, centred on 33, with height P(X=3)P(X = 3). The bars touch.

Treating experimental results as the theoretical distribution. A frequency histogram from a small experiment is only an estimate. The probability histogram comes from the sample space, not from data.

1. (Warm-up) Is each random variable discrete or continuous?

  • (a) the number of texts you get in a day
  • (b) the time it takes to get to school
  • (c) the number of heads in 1010 coin flips
  • (d) the mass of your backpack
Solution

(a) Discrete. (b) Continuous. (c) Discrete. (d) Continuous.

2. (Warm-up) Is this a valid probability distribution? Explain.

xx00112233
P(X=x)P(X = x)0.10.10.30.30.40.40.30.3
Solution

No. Each probability is between 00 and 11, but they add to 0.1+0.3+0.4+0.3=1.10.1 + 0.3 + 0.4 + 0.3 = 1.1, not 11.

3. (Warm-up) A spinner has 88 equal sections numbered 11 to 88, and XX is the number spun. Write the distribution of XX in words, and find P(X≥6)P(X \ge 6).

Solution

XX is uniform: P(X=x)=18P(X = x) = \tfrac{1}{8} for x=1,2,…,8x = 1, 2, \dots, 8. The values 6,7,86, 7, 8 give:

P(X≥6)=38P(X \ge 6) = \frac{3}{8}

4. (Core) A random variable has this distribution. Find kk, then find P(X≥3)P(X \ge 3).

xx11223344
P(X=x)P(X = x)kk2k2k3k3k4k4k
Solution

The probabilities add to 11: k+2k+3k+4k=10k=1k + 2k + 3k + 4k = 10k = 1, so k=0.1k = 0.1.

P(X≥3)=3k+4k=0.3+0.4=0.7P(X \ge 3) = 3k + 4k = 0.3 + 0.4 = 0.7

5. (Core) A coin is flipped 44 times, and XX is the number of heads. Make the probability distribution of XX, and find P(X≥3)P(X \ge 3).

Solution

There are 24=162^4 = 16 equally likely outcomes. Counting the outcomes with each number of heads (from a tree diagram, or row 44 of Pascal’s triangle) gives 1,4,6,4,11, 4, 6, 4, 1.

xx0011223344
P(X=x)P(X = x)116\tfrac{1}{16}416\tfrac{4}{16}616\tfrac{6}{16}416\tfrac{4}{16}116\tfrac{1}{16}
P(X≥3)=4+116=516P(X \ge 3) = \frac{4 + 1}{16} = \frac{5}{16}

6. (Core) Two dice are rolled, and XX is the difference between the larger and smaller numbers (00 for doubles). Make the probability distribution of XX. Which value is most likely?

Solution

Make a 6×66 \times 6 table of differences and count each value:

xx001122334455
P(X=x)P(X = x)636\tfrac{6}{36}1036\tfrac{10}{36}836\tfrac{8}{36}636\tfrac{6}{36}436\tfrac{4}{36}236\tfrac{2}{36}

Check: 6+10+8+6+4+2=366 + 10 + 8 + 6 + 4 + 2 = 36. ✓ The most likely difference is 11.

7. (Core) A die is rolled 6060 times with these results:

Face112233445566
Frequency881212991111771313
  • (a) Find the relative frequency of each face, to 44 decimal places.
  • (b) Describe the probability histogram for a fair die, and how the frequency histogram differs from it.
  • (c) What would you expect to see if the die were rolled 60006000 times?
Solution

(a) Divide each count by 6060: 0.13330.1333, 0.20000.2000, 0.15000.1500, 0.18330.1833, 0.11670.1167, 0.21670.2167.

(b) The probability histogram is uniform: six touching bars, each of height 16≈0.1667\tfrac{1}{6} \approx 0.1667. The relative frequency histogram is bumpy: some bars are above 0.16670.1667 (faces 22, 44, 66) and some below (faces 11, 33, 55).

(c) The relative frequencies would all be much closer to 0.16670.1667, so the frequency histogram would look almost flat, like the probability histogram.

8. (Challenge) You roll a die until you get a 66, but you stop after 33 rolls no matter what. Let XX be the number of rolls you make. Find the probability distribution of XX.

Solution
  • X=1X = 1: the first roll is a 66, so P(X=1)=16P(X = 1) = \tfrac{1}{6}.
  • X=2X = 2: not a 66, then a 66, so P(X=2)=56×16=536P(X = 2) = \tfrac{5}{6} \times \tfrac{1}{6} = \tfrac{5}{36}.
  • X=3X = 3: the first two rolls aren’t 66s (the third roll happens whatever it shows), so P(X=3)=56×56=2536P(X = 3) = \tfrac{5}{6} \times \tfrac{5}{6} = \tfrac{25}{36}.
xx112233
P(X=x)P(X = x)636\tfrac{6}{36}536\tfrac{5}{36}2536\tfrac{25}{36}

Check: 6+5+25=366 + 5 + 25 = 36. ✓

9. (Challenge) A computer picks a two-digit whole number at random (from 1010 to 9999, all equally likely). Find the probability that its digits add up to 99.

Solution

This is a uniform distribution with n=99−10+1=90n = 99 - 10 + 1 = 90 values. The numbers whose digits add to 99 are 18,27,36,45,54,63,72,81,9018, 27, 36, 45, 54, 63, 72, 81, 90: nine of them.

P=990=110P = \frac{9}{90} = \frac{1}{10}