impera Open Impera

AP Statistics · Probability, random variables and probability distributions

Random variables

1Discrete random variables

A random variable $X$ takes numerical values determined by a chance process. A discrete random variable has a countable set of values, given by a probability distribution: each value $x_i$ with probability $p_i$, where every $p_i$ is between 0 and 1 and the $p_i$ add to 1.

Example

$X$ = number of heads in 3 coin tosses.

  • $P(X = 0) = \frac{1}{8}$, $P(X = 1) = \frac{3}{8}$, $P(X = 2) = \frac{3}{8}$, $P(X = 3) = \frac{1}{8}$.

A continuous random variable takes any value in an interval; probabilities are areas under a density curve, and $P(X = a) = 0$.

Check yourself

A distribution has P(X = 1) = 0.2, P(X = 2) = 0.5, P(X = 3) = k. Then k =

  • 0.2

  • 0.3

  • 0.5

  • 0.7

Show the answer

0.3

Probabilities add to 1.

2Mean and standard deviation

The mean (expected value) is the long-run average value:

$$\mu_X = E(X) = \sum x_i p_i$$

The standard deviation measures the typical distance from the mean:

$$\sigma_X = \sqrt{\sum (x_i - \mu_X)^2 p_i}$$

Worked example

a game pays $0 with probability 0.6, $5 with probability 0.3 and $20 with probability 0.1.

  1. $\mu = 0(0.6) + 5(0.3) + 20(0.1) = 3.5$.
  2. $\sigma^2 = (0 - 3.5)^2(0.6) + (5 - 3.5)^2(0.3) + (20 - 3.5)^2(0.1) = 7.35 + 0.675 + 27.225 = 35.25$.
  3. $\sigma \approx 5.94$.
  4. Interpretation: over many plays, the average payout is about $3.50; payouts typically vary by about $5.94 from this mean.

A probability histogram for the game: the mean is the balance point

Check yourself

E(X) for P(X = 0) = 0.5, P(X = 10) = 0.5 is:

  • 0.5

  • 5

  • 0

  • 10

Show the answer

5

0 × 0.5 + 10 × 0.5.

3Transforming random variables

For $Y = a + bX$:

  • $\mu_Y = a + b\mu_X$
  • $\sigma_Y = |b|\sigma_X$ (adding $a$ does not change spread)
Worked example

a tour company's number of customers $X$ has $\mu = 20$, $\sigma = 4$. Profit $Y = 50X - 300$.

  1. $\mu_Y = 50(20) - 300 = 700$.
  2. $\sigma_Y = 50 \times 4 = 200$.
Check yourself

If σ_X = 3, then σ for Y = 10 − 2X is:

  • 6

  • 4

  • −6

  • 3

Show the answer

6

|b| × σ.

4Combining random variables

For any random variables $X$ and $Y$:

  • $\mu_{X + Y} = \mu_X + \mu_Y$ and $\mu_{X - Y} = \mu_X - \mu_Y$.

If $X$ and $Y$ are independent:

  • $\sigma^2_{X + Y} = \sigma^2_X + \sigma^2_Y$ and also $\sigma^2_{X - Y} = \sigma^2_X + \sigma^2_Y$.

Variances add, never subtract, and standard deviations do not add directly.

Worked example

time to get ready $X$: $\mu = 30$, $\sigma = 5$ min; commute $Y$: $\mu = 20$, $\sigma = 4$ min, independent.

  1. Total $T = X + Y$: $\mu_T = 50$ min.
  2. $\sigma_T = \sqrt{25 + 16} = \sqrt{41} \approx 6.4$ min.
  3. If both are normal, $T$ is normal, so $P(T > 60) = P\left(Z > \frac{10}{6.4}\right) = P(Z > 1.56) \approx 0.059$.
Check yourself

For independent X and Y with σ_X = 6 and σ_Y = 8, σ of X − Y is:

  • 2

  • 100

  • 14

  • 10

Show the answer

10

√(36 + 64).

5Going deeper: mean and standard deviation, and the rules for transforming and combining

A random variable takes numerical values determined by the outcome of a chance process.

  • Discrete: a countable set of possible values, each with a probability. The probabilities total 1.
  • Continuous: any value in an interval; probabilities are areas under a density curve, and the probability of any single exact value is 0.

Mean (expected value) of a discrete random variable: $\mu_X = \sum x_i p_i$. It is the long-run average over many repetitions; it need not be a possible value.

Variance and standard deviation: $\sigma_X^2 = \sum (x_i - \mu_X)^2 p_i$, and σ is its square root.

Worked example

X = the number of cars a salesperson sells in a day.

  • Values 0, 1, 2, 3 with probabilities 0.1, 0.3, 0.4, 0.2.
  1. Mean = 0(0.1) + 1(0.3) + 2(0.4) + 3(0.2) = 1.7 cars.
  2. Variance = (0 − 1.7)²(0.1) + (1 − 1.7)²(0.3) + (2 − 1.7)²(0.4) + (3 − 1.7)²(0.2) = 0.289 + 0.147 + 0.036 + 0.338 = 0.81.
  3. Standard deviation = 0.9 cars.
  4. Interpretation: "Over many days, the salesperson sells an average of 1.7 cars a day, and the number sold typically varies from that by about 0.9."

Finding probabilities: P(X ≥ 2) = 0.4 + 0.2 = 0.6. For discrete variables, watch the wording: "more than 2" excludes 2; "at least 2" includes it.

Expected value of a game

Worked example

a game costs 2 dollars to play. You win 10 dollars with probability 0.1, 3 dollars with probability 0.2, and nothing otherwise.

  1. Expected winnings = 10(0.1) + 3(0.2) + 0(0.7) = 1.60 dollars.
  2. Expected net gain = 1.60 − 2.00 = −0.40 dollars.
  3. On average a player loses 40 cents a game; the game is not fair. (A fair game has expected net gain 0.)

Linear transformations: for Y = a + bX,

  • $\mu_Y = a + b\mu_X$;
  • $\sigma_Y = |b|\sigma_X$ (adding a constant does not change the spread);
  • the shape is unchanged.
Worked example

the salesperson earns 50 dollars a day plus 200 dollars per car.

  1. Mean earnings = 50 + 200(1.7) = 390 dollars.
  2. Standard deviation = 200(0.9) = 180 dollars.

Combining random variables

Means: for any two random variables,

  • $\mu_{X+Y} = \mu_X + \mu_Y$ and $\mu_{X-Y} = \mu_X - \mu_Y$.

Variances: if X and Y are independent,

  • $\sigma^2_{X+Y} = \sigma^2_X + \sigma^2_Y$, and also $\sigma^2_{X-Y} = \sigma^2_X + \sigma^2_Y$.
  • Variances add, even for a difference. Standard deviations do not add: add the variances, then take the square root.
Worked example

X has mean 10 and standard deviation 3; Y has mean 6 and standard deviation 4; they are independent.

  1. X + Y: mean 16; variance 9 + 16 = 25; standard deviation 5.
  2. X − Y: mean 4; variance 9 + 16 = 25; standard deviation 5 (not 3 − 4, and not 1).

Why a difference has more variability, not less: both X and Y contribute uncertainty to the result, whichever way they are combined.

Sum of independent copies against a multiple

  • Two independent days' sales, X₁ + X₂: variance 0.81 + 0.81 = 1.62; standard deviation 1.27.
  • Twice one day's sales, 2X: standard deviation 2(0.9) = 1.8.

These differ: in the sum, a good day can be offset by a bad one.

Combining normal variables: any sum or difference of independent normal random variables is itself normal.

Worked example

a bolt's diameter is N(10.00, 0.03) mm and a nut's hole is N(10.08, 0.04) mm, independently. What is the probability that a randomly chosen bolt fits a randomly chosen nut?

  1. Let D = hole − bolt. Mean = 0.08; standard deviation = √(0.03² + 0.04²) = 0.05.
  2. The bolt fits if D > 0: z = (0 − 0.08) ÷ 0.05 = −1.6.
  3. P(D > 0) = 1 − 0.0548 = 0.945.

Common mistakes

  • Adding standard deviations.
  • Subtracting variances for a difference.
  • Applying the variance rule to variables that are not independent.
  • Forgetting that adding a constant leaves σ unchanged.
  • Interpreting the expected value as the most likely value.
  • Treating X₁ + X₂ as 2X.
Check yourself

X and Y are independent random variables with standard deviations 6 and 8. What is the standard deviation of X − Y?

  • 10

  • 2

  • 28

  • 14

Show the answer

10

Variances add: 36 + 64 = 100, and the square root is 10.

6For top marks

  • Check that probabilities sum to 1 before using a distribution.
  • Interpret expected value as a long-run average, not a value you expect on one trial.
  • Add variances, not standard deviations, and only for independent variables.
  • For differences, variances still add.
Example

"The expected value of a $2 lottery ticket is $1.40, so in the long run players lose an average of $0.60 per ticket."

Check yourself

For independent X and Y, Var(X − Y) =

  • Var(X) − Var(Y)

  • Var(X) + Var(Y)

  • (σ_X − σ_Y)²

  • 0

Show the answer

Var(X) + Var(Y)

Variances add.

Now test yourself

This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.

Practise in Impera