Random Variables — AP Statistics Study Guide
For: AP Statistics candidates sitting AP Statistics.
Covers: Definition of discrete and continuous random variables, their probability distributions, expected value, variance, linear transformation rules, and combination rules for independent random variables, aligned to the AP Statistics CED.
You should already know: Basic probability rules for independent events. Algebraic manipulation of sums and products. Interpretation of mean and spread of data.
A note on the practice questions: All worked questions in the "Practice Questions" section below are original problems written by us in the AP Statistics style for educational use. They are not reproductions of past College Board / Cambridge / IB papers and may differ in wording, numerical values, or context. Use them to practise the technique; cross-check with official mark schemes for grading conventions.
1. What Is Random Variables?
A random variable (RV) is a function that maps every possible outcome of a random process to a unique numerical value. By converting qualitative or categorical outcomes to numbers, we can use mathematical tools to analyze random processes, which is the core of all statistical inference. Standard AP Stats notation uses an uppercase letter (e.g., (X), (Y)) to name the random variable, and a lowercase letter (e.g., (x), (y)) to refer to a specific observed value of the variable; following this convention is critical to avoiding confusion on FRQs.
Per the AP Statistics CED, this unit (Unit 4: Probability, Random Variables, and Probability Distributions) accounts for 10-15% of the total exam score, and random variable concepts appear in both multiple-choice (MCQ) and free-response (FRQ) sections. They are often combined with other topics like the binomial and normal distributions, sampling distributions, and inference, so mastery here is non-negotiable. The two primary categories of random variables are discrete (which take a countable set of distinct values) and continuous (which take any value in an interval, with uncountably many possible outcomes).
2. Discrete vs. Continuous Random Variables and Probability Distributions
A discrete random variable takes a countable set of distinct possible values (e.g., number of heads in 5 coin flips, number of defective parts in a batch). Its probability distribution lists or describes every possible value (x) and its corresponding probability (P(X=x)). A discrete probability distribution is valid if and only if two conditions are met: (1) (0 \leq P(X=x) \leq 1) for all (x), and (2) the sum of all probabilities equals 1.
A continuous random variable takes any value in one or more intervals, so it has uncountably many possible outcomes. For continuous random variables, we use a probability density function (pdf) to describe probability, and the probability of an event is the area under the pdf curve over the corresponding interval. A key property of continuous random variables is that (P(X = x) = 0) for any single value (x), so (P(a < X < b) = P(a \leq X \leq b)) for any constants (a < b). The total area under a valid pdf is always 1.
Worked Example
Problem: A café records (X), the number of lunch customers who order a vegan option on a randomly selected weekday. The proposed probability distribution for (X) is given below. Is this a valid discrete probability distribution? If valid, find (P(X > 2)).
| (x) | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| (P(X=x)) | 0.18 | 0.32 | 0.26 | 0.15 | 0.09 |
- Check the first validity condition: all probabilities are between 0 and 1. All values (0.18, 0.32, 0.26, 0.15, 0.09) fall in the interval [0, 1], so this condition is satisfied.
- Check the second validity condition: sum all probabilities: (0.18 + 0.32 + 0.26 + 0.15 + 0.09 = 1.00). Both conditions are met, so this is a valid discrete distribution.
- To find (P(X > 2)), sum the probabilities for all (x) greater than 2: (P(X=3) + P(X=4) = 0.15 + 0.09 = 0.24).
Exam tip: On AP FRQs, always explicitly state and verify both validity conditions for a discrete distribution; skipping one condition will almost always cost you a point.
3. Expected Value and Variance of Random Variables
The expected value (or mean) of a random variable (X), denoted (E(X)) or (\mu_X), is the long-run average value of (X) if the random process is repeated infinitely many times. For a discrete random variable, expected value is calculated as: where the sum runs over all possible values of (X).
Variance, denoted (Var(X)) or (\sigma_X^2), measures the spread of the distribution around the expected value. It is the expected value of the squared deviation from the mean. The most convenient computational formula for variance of a discrete random variable is: where (E(X^2) = \sum x^2 \cdot P(X=x)). The standard deviation (\sigma_X = \sqrt{Var(X)}), which has the same units as the original random variable (unlike variance, which has squared units). For continuous random variables, AP Stats never requires manual calculation of (E(X)) or (Var(X)), but you are expected to know the same interpretations as for discrete random variables.
Worked Example
Problem: Use the valid distribution of (X) = number of vegan customers from the previous example to calculate the expected value and standard deviation of (X).
- Calculate (E(X)) by summing (xP(X=x)): (E(X) = (0)(0.18) + (1)(0.32) + (2)(0.26) + (3)(0.15) + (4)(0.09) = 0 + 0.32 + 0.52 + 0.45 + 0.36 = 1.65).
- Calculate (E(X^2)) for the variance formula: (E(X^2) = (0^2)(0.18) + (1^2)(0.32) + (2^2)(0.26) + (3^2)(0.15) + (4^2)(0.09) = 0 + 0.32 + 1.04 + 1.35 + 1.44 = 4.15).
- Apply the variance formula: (Var(X) = E(X^2) - [E(X)]^2 = 4.15 - (1.65)^2 = 4.15 - 2.7225 = 1.4275).
- Calculate standard deviation: (\sigma_X = \sqrt{1.4275} \approx 1.195).
Exam tip: Always interpret expected value in context on FRQs, even if the question does not explicitly ask for an interpretation; this is a common point that students leave on the table.
4. Linear Transformations of Random Variables
A linear transformation converts a random variable (X) into a new random variable (Y = aX + b), where (a) and (b) are fixed constants. Common examples include unit conversion (e.g., converting temperatures from Fahrenheit to Celsius) or adding a fixed fee to a random payout. There are simple rules for how the mean and variance of (Y) relate to the mean and variance of (X):
Intuition for these rules: Adding a constant (b) shifts every value of (X) by the same amount, so it shifts the mean by (b) but does not change the spread (variance or standard deviation) at all. Multiplying by (a) scales every value of (X) by (a), so the mean scales by (a), and variance scales by (a^2) because variance is measured in squared units. These rules hold for both discrete and continuous random variables.
Worked Example
Problem: The café from the previous example charges 2 per weekday, regardless of how many vegan meals are sold. Let (P) = the daily profit from vegan meals, so (P = 4.50X - 2), where (X) is the number of vegan customers from the previous example. Use (E(X) = 1.65) and (\sigma_X \approx 1.195) to find the expected value and standard deviation of daily profit from vegan meals.
- Apply the linear transformation rule for expected value: (E(P) = 4.50 E(X) - 2 = 4.50(1.65) - 2 = 7.425 - 2 = 5.425).
- Apply the rule for variance: (Var(P) = (4.50)^2 Var(X)). We know (Var(X) = 1.4275), so (Var(P) = 20.25(1.4275) \approx 28.907).
- Calculate standard deviation: (\sigma_P = \sqrt{28.907} \approx 5.377). The fixed cost of $2 does not affect the standard deviation, as expected.
Exam tip: Never include the constant (b) in the variance calculation; a common mistake is writing (Var(aX + b) = a^2 Var(X) + b^2), which is incorrect and will cost you points.
5. Combining Independent Random Variables
We often need to find the mean and variance of a sum or difference of two random variables, for example, total profit from two different café locations, or the difference in wait time between two service counters. Linearity of expectation holds for all random variables, regardless of independence: For variance, the addition rule only applies if (X) and (Y) are independent (the outcome of one does not affect the probability distribution of the other): A critical point to remember: even for the difference of two independent random variables, variances still add. This is because variance measures spread: combining two independent variables always increases the total variability, whether you add or subtract them. The standard deviation of the sum or difference is the square root of the total variance.
Worked Example
Problem: The café from the previous example opens a second location. Let (X_1) be the number of vegan customers at the first location, and (X_2) be the number at the second location on the same day. (X_1) and (X_2) are independent, and both have the same distribution we used earlier, with (E(X_i) = 1.65) and (Var(X_i) = 1.4275). Let (D = X_1 - X_2) be the difference in the number of vegan customers between the two locations. Find the expected value and standard deviation of (D).
- Calculate expected value using linearity: (E(D) = E(X_1) - E(X_2) = 1.65 - 1.65 = 0). This makes sense: we expect no difference between the two locations on average.
- Since (X_1) and (X_2) are independent, add the variances even though we subtract the variables: (Var(D) = Var(X_1) + Var(X_2) = 1.4275 + 1.4275 = 2.855).
- Calculate standard deviation: (\sigma_D = \sqrt{2.855} \approx 1.69).
Exam tip: When you see a difference of two independent random variables, automatically write the sum of variances before doing any other calculation; this avoids the most common mistake on this topic.
6. Common Pitfalls (and how to avoid them)
- Wrong move: Calculating (Var(X - Y) = Var(X) - Var(Y)) for independent (X) and (Y). Why: Students assume the minus sign from expectation carries over to variance, but variance measures spread, which always increases when combining independent variables. Correct move: Always add variances for both sums and differences of independent random variables, regardless of the connecting sign.
- Wrong move: Claiming (P(X = 5) = 0.2) for a continuous random variable (X). Why: Students confuse discrete and continuous distribution rules, forgetting that continuous variables have non-zero probability only for intervals. Correct move: For any continuous random variable, the probability of any single exact outcome is 0; always report probability for intervals.
- Wrong move: Forgetting to square the coefficient (a) when calculating (Var(aX + b)), writing (Var(aX + b) = a Var(X)). Why: Students mix up the linear expected value rule with the variance rule. Correct move: Always explicitly write (Var(aX + b) = a^2 Var(X)) before substituting values to force yourself to square the coefficient.
- Wrong move: Verifying discrete distribution validity by only checking that all probabilities are between 0 and 1, skipping the sum equals 1 check. Why: Students rush through routine problems and forget the second required condition. Correct move: Always list and check both conditions explicitly when asked to verify validity.
- Wrong move: Applying the variance addition rule for combining dependent random variables. Why: Problems don’t always explicitly remind you that independence is required, so students assume the rule works for all RVs. Correct move: Always confirm the problem states the random variables are independent before using the variance addition rule.
7. Practice Questions (AP Statistics Style)
Question 1 (Multiple Choice)
Let (X) be a random variable with mean (\mu_X = 10) and standard deviation (\sigma_X = 4). If we define a new random variable (Y = 3X - 6), what is the standard deviation of (Y)? A) 4 B) 12 C) 36 D) 72
Worked Solution: We use the linear transformation rule for standard deviation: for (Y = aX + b), (\sigma_Y = |a| \sigma_X). The constant term (b = -6) does not affect the standard deviation, so we only multiply the original standard deviation by the absolute value of the coefficient of (X). Substituting values, we get (\sigma_Y = 3 * 4 = 12). Distractor A incorrectly assumes the constant changes the standard deviation, distractor C incorrectly gives the variance instead of the standard deviation, and distractor D incorrectly includes the constant in the calculation. The correct answer is B.
Question 2 (Free Response)
A community college bookstore sells used textbook bundles. Let (B) = number of defective textbooks in a randomly selected 3-bundle. The probability distribution of (B) is:
| (b) | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| (P(B=b)) | 0.72 | 0.20 | 0.06 | 0.02 |
(a) Verify that this is a valid discrete probability distribution. (b) Calculate the expected value of (B) and interpret it in context. (c) A student buys 2 independent bundles for their classes. Find the expected value and standard deviation of the total number of defective textbooks in the two bundles.
Worked Solution: (a) To be valid, two conditions must hold: 1) All probabilities are between 0 and 1: 0.72, 0.20, 0.06, 0.02 are all in [0, 1]. 2) Sum of probabilities: (0.72 + 0.20 + 0.06 + 0.02 = 1.00). Both conditions are satisfied, so this is a valid distribution. (b) (E(B) = (0)(0.72) + (1)(0.20) + (2)(0.06) + (3)(0.02) = 0 + 0.20 + 0.12 + 0.06 = 0.38). Interpretation: Over many randomly selected 3-textbook bundles from this bookstore, the average number of defective textbooks per bundle is 0.38. (c) Let (T = B_1 + B_2), where (B_1, B_2) are independent. Expected value: (E(T) = E(B_1) + E(B_2) = 0.38 + 0.38 = 0.76). To find variance of (B): (E(B^2) = 0^2(0.72) + 1^2(0.20) + 2^2(0.06) + 3^2(0.02) = 0.20 + 0.24 + 0.18 = 0.62). (Var(B) = 0.62 - (0.38)^2 = 0.62 - 0.1444 = 0.4756). For independent (B_1, B_2), (Var(T) = 0.4756 + 0.4756 = 0.9512). Standard deviation: (\sigma_T = \sqrt{0.9512} \approx 0.975). So the expected total number of defective textbooks is 0.76, with a standard deviation of ~0.98.
Question 3 (Application / Real-World Style)
A hiker records the daily hiking distance (D) (in miles) for multi-day trips. The distribution of (D) has expected value 12 miles and standard deviation 2.5 miles. The hiker wants to find the difference in distance between two randomly selected days on an upcoming trip, and wants the result in kilometers (1 mile = 1.609 km). Let (D_{diff} = D_1 - D_2), where (D_1) and (D_2) are independent daily distances. Find the expected value and standard deviation of (D_{diff}) in kilometers, and interpret the result.
Worked Solution: First, convert daily distance to kilometers: (K = 1.609 D), so (E(K) = 1.609 E(D) = 1.609(12) = 19.308) km, (\sigma_K = 1.609 \sigma_D = 1.609(2.5) = 4.0225) km. For the difference (D_{diff(km)} = K_1 - K_2), expected value is (E(K_1 - K_2) = E(K_1) - E(K_2) = 19.308 - 19.308 = 0) km. Variance: (Var(K_1 - K_2) = Var(K_1) + Var(K_2) = (4.0225)^2 + (4.0225)^2 \approx 16.18 + 16.18 = 32.36). Standard deviation: (\sigma = \sqrt{32.36} \approx 5.69) km. Interpretation: We expect a difference of 0 km between two randomly selected days (since both have the same mean distance), and the typical difference between daily distances is about 5.7 km, or roughly 3.5 miles.
8. Quick Reference Cheatsheet
| Category | Formula | Notes |
|---|---|---|
| Discrete RV Expected Value | (E(X) = \mu_X = \sum x P(X=x)) | Sum over all possible values of (x); for discrete RVs only |
| Discrete RV Variance | (Var(X) = \sigma_X^2 = E(X^2) - [E(X)]^2) | Computational form is easier than the deviation sum formula |
| Linear Transformation Mean | (E(aX + b) = aE(X) + b) | Applies to all random variables, discrete or continuous |
| Linear Transformation Variance | (Var(aX + b) = a^2 Var(X)) | Constant (b) does not change variance; always square (a) |
| Linear Transformation SD | (\sigma_{aX + b} = | a |
| Mean of Sum/Difference | (E(X \pm Y) = E(X) \pm E(Y)) | Holds for any (X,Y), regardless of independence |
| Variance (Independent RVs) | (Var(X \pm Y) = Var(X) + Var(Y)) | Only for independent RVs; add variances even for differences |
| Discrete Distribution Validity | 1. (0 \leq P(X=x) \leq 1) 2. (\sum P(X=x) = 1) |
Both conditions required for validity |
| Continuous RV Property | (P(X = x) = 0) for any single (x) | Probability is only non-zero for intervals |
9. What's Next
Random variables are the foundational building block for all the probability distributions you will study next in Unit 4, so mastering the rules for expected value, variance, linear transformations, and combining independent random variables is critical before moving on. Next, you will apply these general rules to specific common probability distributions: first the binomial and geometric distributions, then the normal distribution. Without understanding how to calculate expected value and variance for general random variables, you will not be able to apply these specific distributions to sampling and inference problems later in the course. This topic also feeds directly into sampling distributions, which are the basis for all confidence intervals and significance tests in Units 5 through 8 of the AP Stats CED.
Binomial Distributions Geometric Distributions Normal Distributions Sampling Distributions