---
title: "A number for every outcome. | FiveStudy"
description: "A coffee kiosk owner records one number for each customer: how many items that person buys. She cannot predict any single customer. Over a week the pattern is stable."
url: https://fivestudy.com/guides/apstats-2-8-random-variables
---

[AP Statistics](https://fivestudy.com/ap-statistics) · Study guide

# A number for every outcome.

[Figure: FiveStudy]

FiveStudy

AP® Statistics · Unit 2 · Probability, Random Variables, and Probability Distributions

AP® Statistics · Unit 2 · Probability, Random Variables, and Probability Distributions

# Random Variables and *Probability Distributions*

What a random variable is, how to build the probability distribution of a discrete random variable with the rules of probability or a simulation, how to show it as a table or graph, and how cumulative probabilities work.

1. Random variables 2. Probability distributions 3. Tables and graphs 4. Simulation 5. Cumulative probability

The idea in one paragraph

A **random variable** attaches a number to each outcome of a random process, such as the number of heads in three tosses. Its **probability distribution** lists every value it can take and the probability of each, and those probabilities add to 1. With the distribution in hand, “at least,” “at most,” and “between” questions become sums.

## 1 Random variables

A **random variable** is a variable whose values are numerical outcomes of a random process. Random variables are written with capital letters, like \(X\), and their particular values with lowercase letters, like \(x\). The probability that \(X\) takes the value \(x\) is written \(P(X = x)\).

| Random process | Random variable | Possible values |
| --- | --- | --- |
| Toss a coin three times | X = number of heads | 0, 1, 2, 3 |
| Pick a junior at random | X = number of AP classes taken | 0, 1, 2, 3, 4 |
| A 70% shooter takes 3 free throws | X = number made | 0, 1, 2, 3 |
| Roll two dice | X = sum of the dice | 2, 3, …, 12 |

All of these are **discrete** random variables: their possible values can be listed and counted.

## 2 Probability distributions

The **probability distribution** of a discrete random variable shows the probability of every possible value. Two rules always hold: each probability is between 0 and 1, and the probabilities over all possible values add to 1. A distribution can be found with the rules of probability or estimated with a simulation.

**Figure 1.** The random variable X turns each outcome into a number. Grouping the 8 equally likely outcomes by that number gives the probability of each value: the probability distribution of X.

Worked Example 1 Build a distribution with the rules

### Three coins

Toss a fair coin three times. Let X be the number of heads. Find the probability distribution of X.

1. 1List the sample space: HHH, HHT, HTH, THH, HTT, THT, TTH, TTT. The 8 outcomes are equally likely.
2. 2Count the outcomes for each value of X: 0 heads (1 outcome), 1 head (3), 2 heads (3), 3 heads (1).
3. 3Divide each count by 8, and check that the probabilities add to 1: \(\tfrac{1}{8} + \tfrac{3}{8} + \tfrac{3}{8} + \tfrac{1}{8} = 1\).

**Answer:** P(X = 0) = 1/8, P(X = 1) = 3/8, P(X = 2) = 3/8, P(X = 3) = 1/8.

Worked Example 2 Complete a distribution

### AP classes

Let X be the number of AP classes taken by a randomly chosen junior at a school.

| x | 0 | 1 | 2 | 3 | 4 |
| --- | --- | --- | --- | --- | --- |
| P(X = x) | 0.30 | 0.25 | 0.20 | ? | 0.10 |

Find P(X = 3).

1. 1The probabilities over all possible values of a discrete random variable add to 1.
2. 2\(P(X = 3) = 1 - (0.30 + 0.25 + 0.20 + 0.10) = 1 - 0.85 = 0.15\).
3. 3Check: 0.15 is between 0 and 1, so the distribution is valid.

**Answer:** P(X = 3) = 0.15.

Common Mistake 1 · A distribution that does not add to 1

If the probabilities add to 0.95 or 1.10, a value is missing, a probability is wrong, or two values overlap. Always add them up before using the table. (Rounding can leave the sum at 0.999 or 1.001; that is fine.)

## 3 Tables, graphs, and functions

A discrete probability distribution can be shown as a table, a graph, or a function that gives the probability for each value of the random variable.

| x | 0 | 1 | 2 | 3 | 4 |
| --- | --- | --- | --- | --- | --- |
| P(X = x) | 0.30 | 0.25 | 0.20 | 0.15 | 0.10 |

**Figure 2.** Each bar sits over one value of X, and its height is the probability of that value. The heights add to 1. The bars are next to each other because the values of X are numbers in order.

A function works when the probabilities follow a rule. For example, a spinner where \(P(X = x) = x/10\) for \(x = 1, 2, 3, 4\) gives probabilities 0.1, 0.2, 0.3 and 0.4, which add to 1.

Worked Example 3 Answer probability questions

### At least, fewer than, between

Use the completed AP-class distribution. Find P(X ≥ 2), P(X < 2), and P(1 ≤ X ≤ 3).

1. 1“At least 2” includes 2: \(P(X \ge 2) = 0.20 + 0.15 + 0.10 = 0.45\).
2. 2“Fewer than 2” means 0 or 1: \(P(X \lt 2) = 0.30 + 0.25 = 0.55\). It is the complement of \(X \ge 2\): \(1 - 0.45 = 0.55\).
3. 3“Between 1 and 3, inclusive”: \(P(1 \le X \le 3) = 0.25 + 0.20 + 0.15 = 0.60\).

**Answer:** P(X ≥ 2) = 0.45, P(X < 2) = 0.55, P(1 ≤ X ≤ 3) = 0.60.

Common Mistake 2 · Mixing up “at least” and “more than”

For a discrete random variable the boundary value matters. \(P(X \ge 2)\) includes 2 (0.45); \(P(X \gt 2)\) does not (0.25). Translate the words first: “at least” and “no fewer than” mean \(\ge\); “more than” means \(\gt\); “at most” means \(\le\); “fewer than” means \(\lt\).

## 4 Estimating a distribution by simulation

When the rules of probability are hard to apply, a simulation can estimate the whole distribution: run many trials, record the value of the random variable each time, and use the relative frequency of each value.

**Figure 3.** A probability distribution can be estimated by simulation or worked out with the rules of probability. With 1,000 trials, the simulated relative frequencies land close to the exact probabilities.

Worked Example 4 Estimate a distribution by simulation

### Free throws

A 70% free-throw shooter takes 3 shots. Describe how to estimate the distribution of X = number made by simulation, and compare with Figure 3.

1. 1For each shot, use a random digit: 0 to 6 means made, 7 to 9 means missed. Three digits make one trial; record X, the number made.
2. 2Repeat for many trials, say 1,000, and find the relative frequency of X = 0, 1, 2, and 3.
3. 3In Figure 3, 1,000 simulated trials gave 0.022, 0.180, 0.441, 0.357, close to the exact values 0.027, 0.189, 0.441, 0.343.

**Answer:** The simulation estimates the distribution: making 2 of 3 is most likely, at about 0.44.

## 5 Cumulative probability

A **cumulative probability distribution** shows, for each value \(x\), the probability that the random variable is less than or equal to \(x\): \(P(X \le x)\). It is a running total of the ordinary probabilities, and it always ends at 1.

| x | 0 | 1 | 2 | 3 | 4 |
| --- | --- | --- | --- | --- | --- |
| P(X = x) | 0.30 | 0.25 | 0.20 | 0.15 | 0.10 |
| P(X ≤ x) | 0.30 | 0.55 | 0.75 | 0.90 | 1.00 |

Worked Example 5 Use a cumulative distribution

### Running totals

Build the cumulative distribution of the AP-class variable, and use it to find P(X > 2).

1. 1Each cumulative probability adds all the probabilities up to and including that value: \(P(X \le 0) = 0.30\), \(P(X \le 1) = 0.55\), \(P(X \le 2) = 0.75\), \(P(X \le 3) = 0.90\), \(P(X \le 4) = 1.00\).
2. 2“More than 2” is the complement of “at most 2”: \(P(X \gt 2) = 1 - P(X \le 2) = 1 - 0.75 = 0.25\).

**Answer:** P(X > 2) = 0.25. The last cumulative probability is always 1.

Common Mistake 3 · Reading P(X ≤ 2) as excluding 2

Cumulative probabilities include the value itself: \(P(X \le 2) = 0.30 + 0.25 + 0.20 = 0.75\). To get \(P(X \lt 2)\), use the entry before it, \(P(X \le 1) = 0.55\).

### Quick reference

| Idea | What to remember |
| --- | --- |
| Random variable | A number attached to each outcome of a random process |
| Probability distribution | Every value with its probability; probabilities between 0 and 1, adding to 1 |
| Ways to show it | Table, probability histogram, or function |
| Ways to find it | Rules of probability, or estimate by simulation |
| Cumulative distribution | \(P(X \le x)\): running total, ends at 1 |

FiveStudy AP® Statistics · Random variables and probability distributions
