Linear transformations of random variables (HL)

Suppose your teacher gave you mark XX on an internal assessment, then using linear regression, IB moderates your mark to aX+baX + b. This is a linear transformation of a random variable.

Last updated 2025-08-09.

Formulas

E(aX+b)=aE(X)+b\text{E}(aX + b) = a\text{E}(X) + b
Var(aX+b)=a2Var(X)\text{Var}(aX + b) = a^2\text{Var}(X)

The scaling and shifting effects on a random variable do appear on the expected value. Whereas standard deviations are scaled but variance is scaled twice. Shifts do not affect either variance or standard deviation, as they quantify how the values are dispersed around the expected value.

What linear transformation is not

Suppose you earn a grade Y5Y_5 in group 5 mathematics. Your total subject grades across six subjects is not 6Y56Y_5, rather each subject grade may be different. Your total subject grades would instead be Y1+Y2+Y3+Y4+Y5+Y6Y_1 + Y_2 + Y_3 + Y_4 + Y_5 + Y_6. This is linear combination, which has its own formulas for expected value and variance beyond the scope of this course.

Bonus: distribution of random variables under linear transformations

Example: Let XN(0,1)X \sim \text{N}(0, 1).

a) Find E(3X+5)\text{E}(3X+5).

b) Find Var(3X+5)\text{Var}(3X+5).

c) Characterize the distribution of 3X+53X+5.


a) E(3X+5)=3E(X)+5=5\text{E}(3X+5) = 3\text{E}(X) + 5 = 5\qed

b) Var(3X+5)=32Var(X)=9\text{Var}(3X+5) = 3^2\text{Var}(X) = 9\qed

c) 3X+5N(5,9)3X + 5 \sim \text{N}(5, 9)

In other words, every normal distribution is a linear transformation of the standard normal. Similarly, every linear transformation of any normal distribution is also a normal distribution.

In general, for some continuous random variable XX with probability density function fX(x)f_X(x), the probability density function of Y=aX+bY = aX + b is

fY(x)=1afX(xba)f_{Y}(x) = \frac{1}{\lvert a\rvert}f_X\left(\frac{x - b}{a}\right)

This is essentially linear transformations of a function. The vertical transformation keeps the area equal to 1. The transformations apply to linear transformations of any continuous random variable, though normal distribution is a special case in that the transformations are also normal.

You can visualize different aX+baX + b, where XN(0,1)X \sim \text{N}(0, 1), use this Desmos playground.  The mean and variance of YY are also provided.

Linear transformation of a discrete random variable behaves similarly, but there is no need to transform the yy as they are already probability.

Suppose we have a discrete random variable XX defined over {0,1,2,3}\{0, 1, 2, 3 \dots\}, and probability mass function fX(x)f_X(x), then Y=aX+bY = aX + b has pmf

fY(x)=fX(xba),x{b,a+b,2a+b,3a+b}f_Y(x) = f_X\left(\frac{x - b}{a}\right),\,\,\,\, x \in \{b, a + b, 2a + b, 3a+b \dots\}

For instance, if you have BB following B(n,p)\text{B}(n, p), then 2B2B has non-zero probabilities over the even numbers from B=0B = 0 to B=2nB = 2n.