Transforming a Random Variable

Adding moves the mean and leaves the spread.

Add the same amount to every value

A random variable X takes the values 1, 2 and 3 with probabilities 1/4, 1/2 and 1/4. Its mean is E(X) = 1 × 1/4 + 2 × 1/2 + 3 × 1/4 = 1/4 + 1 + 3/4 = 2.

Add 2 to every value. The new variable X + 2 takes the values 3, 4 and 5, with the same probabilities 1/4, 1/2 and 1/4. Nothing about the shape changes: the whole distribution slides 2 to the right.

123E(X) = 2

X as four equally likely tickets: one 1, two 2s and one 3. They balance at 2, and the outer two are each 1 away.

345E(X + 2) = 4

X + 2 on the same scale: every ticket has moved 2 to the right, and so has the balance point, now at 4. The outer tickets are still 1 away from it.

The mean moves; the spread does not

The mean slides with the values: E(X + 2) = 3 × 1/4 + 4 × 1/2 + 5 × 1/4 = 3/4 + 2 + 5/4 = 4, which is E(X) + 2. Adding 2 to every value adds 2 to the long-run average.

The distances from the mean do not change. For X they are −1, 0 and 1 from the mean 2. For X + 2 they are −1, 0 and 1 from the mean 4. So the variance is the same: Var(X) = 1 × 1/4 + 0 × 1/2 + 1 × 1/4 = 1/2, and Var(X + 2) = 1/2 as well.

Multiply every value by 2

Now double every value of X. The variable 2X takes the values 2, 4 and 6, with probabilities 1/4, 1/2 and 1/4. Its mean is 2 × 1/4 + 4 × 1/2 + 6 × 1/4 = 1/2 + 2 + 3/2 = 4, which is 2E(X).

Every distance from the mean doubles too: the distances are −2, 0 and 2 from 4, where before they were −1, 0 and 1 from 2. The variance averages the squared distances, and when a distance doubles, its square is multiplied by 2² = 4: the squared distances are now 4, 0 and 4, where before they were 1, 0 and 1.

So Var(2X) = 4 × 1/4 + 0 × 1/2 + 4 × 1/4 = 2, which is 4 × 1/2, or 4 × Var(X). The standard deviation is the square root, so it only doubles: from √(1/2) ≈ 0.71 to √2 ≈ 1.41.

246E(2X) = 4

2X on the same scale: the tickets are at 2, 4, 4 and 6, balancing at 4. The outer two are now 2 away from the balance point, twice as far as before.

Both at once: aX + b

Multiplying by a and then adding b does both things. The mean follows both steps: E(aX + b) = aE(X) + b. Only the multiplying changes the variance, and it is squared: Var(aX + b) = a² × Var(X). The b does not appear, because a shift does not move any value away from the mean.

For the X above, E(X) = 2 and Var(X) = 1/2. So E(3X + 1) = 3 × 2 + 1 = 7, and Var(3X + 1) = 3² × 1/2 = 9/2 = 4.5.

The standard deviation scales by the size of a, written |a|: σ of aX + b is |a| times σ of X. A negative a reflects the distribution, which does not change its spread: Var(−X) = (−1)² × Var(X) = Var(X).

Changing units is a transformation like this. A temperature in degrees Fahrenheit is F = 1.8C + 32, where C is in degrees Celsius. If C has mean 20 and standard deviation 5, then F has mean 1.8 × 20 + 32 = 68 and standard deviation 1.8 × 5 = 9. Check with the variance: 1.8² × 5² = 3.24 × 25 = 81 = 9².

The usual mistakes

Multiplying the variance by a instead of a². If Var(X) = 3, then Var(4X) = 16 × 3 = 48, not 4 × 3 = 12. It is the standard deviation that is multiplied by 4.

Adding b to the variance. Var(X + 5) = Var(X): adding 5 to every value moves them all together.

Leaving out a part of the mean. If E(X) = 3, then E(4X + 5) = 4 × 3 + 5 = 17. Dropping the 5 gives 12, and dropping the 4 gives 8.

Worked example: A Plumber's Bill Made of a Call-Out Fee and an Hourly Rate, Compared with a Second Firm

Question The time X hours that a plumber spends on a repair has E(X) = 1.5 and Var(X) = 0.25. Firm A charges a call-out fee of $40 plus $60 an hour, so its bill is C = 60X + 40 dollars. (a) Find the mean and the standard deviation of a bill from firm A. (b) Firm B charges $80 plus $45 an hour for the same repairs. Find the mean and the standard deviation of its bill, and say which firm is cheaper on average and which has the less variable bill.

  1. 1.For firm A, E(C) = 60E(X) + 40 = 60 × 1.5 + 40 = 90 + 40 = 130.

    hours X01.53firm A, $40130220E(C) = 60 × 1.5 + 40 = 130
    hours X01.53firm A, $40130220E(C) = 60 × 1.5 + 40 = 130
    Each hour of work maps to a bill. The mean time, 1.5 hours, maps to the mean bill: E(C) = 60 × 1.5 + 40 = 130.
  2. 2.The fee of $40 does not change the spread, and the rate squares in the variance: Var(C) = 602 × Var(X) = 3600 × 0.25 = 900.

    hours X011.523sd 0.5firm A, $40130220Var(C) = 60 × 60 × 0.25 = 900the $40 fee adds nothing to it
    hours X011.523sd 0.5firm A, $40130220Var(C) = 60 × 60 × 0.25 = 900the $40 fee adds nothing to it
    One standard deviation of X runs from 1 to 2 hours. The fee moves the bills along together, so Var(C) = 602 × 0.25 = 900.
  3. 3.(a) A bill from firm A has mean $130 and standard deviation √900 = $30. Check: the standard deviation of X is √0.25 = 0.5 hours, and 60 × 0.5 = 30.

    hours X011.523sd 0.5firm A, $40100130160220sd 30A: mean $130, sd $30sd of X is 0.5, and 60 × 0.5 = 30
    hours X011.523sd 0.5firm A, $40100130160220sd 30A: mean $130, sd $30sd of X is 0.5, and 60 × 0.5 = 30
    (a) The bills for 1 and 2 hours are $100 and $160, one standard deviation of $30 either side of $130.
  4. 4.Firm B's bill is 45X + 80. Its mean is 45 × 1.5 + 80 = 67.5 + 80 = $147.50, and its standard deviation is 45 × 0.5 = $22.50.

    hours X011.523sd 0.5firm A, $40100130160220sd 30firm B, $80125147.50170215sd 22.50B: 45 × 1.5 + 80 = $147.50sd: 45 × 0.5 = $22.50
    hours X011.523sd 0.5firm A, $40100130160220sd 30firm B, $80125147.50170215sd 22.50B: 45 × 1.5 + 80 = $147.50sd: 45 × 0.5 = $22.50
    Firm B maps the same hours to 45X + 80: a mean of $147.50 and a standard deviation of $22.50.
  5. 5.(b) Firm A is cheaper on average, $130 against $147.50. Firm B's bill is less variable, with a standard deviation of $22.50 against $30, because its hourly rate is lower; its larger call-out fee adds nothing to the spread.

    hours X011.523sd 0.5firm A, $40100130160220sd 30firm B, $80125147.50170215sd 22.50A is cheaper on average: $130B varies less: sd $22.50
    hours X011.523sd 0.5firm A, $40100130160220sd 30firm B, $80125147.50170215sd 22.50A is cheaper on average: $130B varies less: sd $22.50
    (b) Firm A is cheaper on average, and firm B has the less variable bill, because its hourly rate is lower.

Answer: (a) mean $130, standard deviation $30; (b) firm B: mean $147.50, standard deviation $22.50; firm A is cheaper on average and firm B is less variable

Common mistakes

  • Adding the fee to the variance, Var(C) = 900 + 40. Adding $40 to every bill moves them all together, so the spread is unchanged.
  • Multiplying the variance by 60 rather than 602, which gives 15 and a standard deviation of about $3.87. It is the standard deviation that is multiplied by 60, so the variance is multiplied by 3600.

More probability distributions problems, worked step by step →

Practice Transforming a Random Variable in the app