Mean and variance of a CRV

Mean and variance of a CRV

Spec SD4–SD5 · AQA A-Level Further Maths: Revision notes

Studying this course? Keep your progress in one place.

Key facts

  • E(X)=∫x f(x) dxE(X)=\int x\,f(x)\,dx over the range where ff is non-zero.
  • Var(X)=E(X2)−[E(X)]2\mathrm{Var}(X)=E(X^2)-[E(X)]^2, with E(X2)=∫x2f(x) dxE(X^2)=\int x^2f(x)\,dx.
  • E(aX+b)=aE(X)+bE(aX+b)=aE(X)+b and Var(aX+b)=a2Var(X)\mathrm{Var}(aX+b)=a^2\mathrm{Var}(X).
  • E(g(X))=∫g(x)f(x) dxE(g(X))=\int g(x)f(x)\,dx, and in general E(g(X))≠g(E(X))E(g(X))\ne g(E(X)).

Mean of a continuous random variable

Integrate x f(x)x\,f(x) over the range where ff is non-zero.

For a discrete variable E(X)=∑xP(X=x)E(X)=\sum xP(X=x). For a continuous variable the sum becomes an integral:

E(X)=∫−∞∞x f(x) dxE(X)=\int_{-\infty}^{\infty}x\,f(x)\,dx

Only integrate over the interval where ff is non-zero. If ff is symmetric, the mean is the line of symmetry, which saves integration.

For f(x)=3x28f(x)=\frac{3x^2}{8} on [0,2][0,2]: E(X)=38∫02x3 dx=38×4=32E(X)=\frac38\int_0^2x^3\,dx=\frac38\times4=\frac32.

0.20.40.60.811.21.41.61.820.20.40.60.811.21.41.6xyE(X) = 1.5f(x) = 3x²/8
f(x) = 3x²/8 on [0, 2]; the mean 1.5 lies right of the middle

f(x)=x2f(x)=\frac{x}{2} on [0,2][0,2]. Find E(X)E(X).

Variance and standard deviation

Find E(X2)=∫x2f(x) dxE(X^2)=\int x^2f(x)\,dx, then subtract the square of the mean.

First find E(X2)=∫x2f(x) dxE(X^2)=\int x^2f(x)\,dx. Then:

Var(X)=E(X2)−[E(X)]2,SD(X)=Var(X)\mathrm{Var}(X)=E(X^2)-[E(X)]^2,\qquad \mathrm{SD}(X)=\sqrt{\mathrm{Var}(X)}

Variance is never negative; a negative value means a mistake in E(X2)E(X^2) or E(X)E(X).

Continuing the example: E(X2)=38∫02x4 dx=125E(X^2)=\frac38\int_0^2x^4\,dx=\frac{12}{5}, so Var(X)=125−94=320\mathrm{Var}(X)=\frac{12}{5}-\frac94=\frac{3}{20} and the standard deviation is 0.15≈0.387\sqrt{0.15}\approx0.387.

0.20.40.60.811.21.41.61.822.22.40.20.40.60.811.21.41.61.82xyx = E(X) = 1.5(2, 1.5)f(x) = 3x²/8
f(x) = 3x²/8 on 0 ≤ x ≤ 2: E(X) = 3/2, E(X²) = 12/5, Var(X) = 12/5 − 9/4 = 3/20.
  • VarianceE(X2)−[E(X)]2E(X^2)-[E(X)]^2
  • Standard deviationVar(X)\sqrt{\mathrm{Var}(X)}

Worked example

f(x)=x2f(x)=\frac{x}{2} on [0,2][0,2], where E(X)=43E(X)=\frac43. Find Var(X)\mathrm{Var}(X).

E(X)=2E(X)=2 and E(X2)=7E(X^2)=7. Find Var(X)\mathrm{Var}(X).

Linear functions of a random variable

The mean is scaled and shifted; the variance is multiplied by a2a^2 and the shift has no effect.

For constants aa and bb:

E(aX+b)=aE(X)+b,Var(aX+b)=a2 Var(X)E(aX+b)=aE(X)+b,\qquad \mathrm{Var}(aX+b)=a^2\,\mathrm{Var}(X)

Adding bb shifts every value, so it changes the mean but not the spread. Multiplying by aa scales the spread by ∣a∣|a|, so the variance is multiplied by a2a^2. A negative aa never gives a negative variance.

00.511.522.533.544.55E(X) = 1.5E(2X + 1) = 4
With E(X) = 3/2, E(2X + 1) = 2 × 3/2 + 1 = 4: the mean is scaled and shifted.
  • E(aX+b)E(aX+b)aE(X)+baE(X)+b
  • Var(aX+b)\mathrm{Var}(aX+b)a2 Var(X)a^2\,\mathrm{Var}(X)

Worked example

E(X)=5E(X)=5 and Var(X)=4\mathrm{Var}(X)=4. Find E(Y)E(Y) and Var(Y)\mathrm{Var}(Y) for Y=2−3XY=2-3X.

How does Var(4−X)\mathrm{Var}(4-X) compare with Var(X)\mathrm{Var}(X)?

Expectation of a function of X

Integrate g(x)f(x)g(x)f(x); you cannot just put E(X)E(X) into gg.

For any function gg: E(g(X))=∫g(x) f(x) dxE(g(X))=\int g(x)\,f(x)\,dx.

For example E(5X3)=5∫x3f(x) dxE(5X^3)=5\int x^3f(x)\,dx and E(18X−3)=∫18x−3f(x) dxE(18X^{-3})=\int 18x^{-3}f(x)\,dx.

You cannot substitute E(X)E(X) into gg: in general E(g(X))≠g(E(X))E(g(X))\ne g(E(X)). For the variance of a function of a random variable, use Var(g(X))=E([g(X)]2)−[E(g(X))]2\mathrm{Var}(g(X))=E([g(X)]^2)-[E(g(X))]^2.

11.11.21.31.41.51.61.71.81.920.511.52xyf(x) = 2/x²
f(x) = 2/x² on [1, 2]; the total area under it is 1

Worked example

f(x)=2x2f(x)=\frac{2}{x^2} on [1,2][1,2]. Find Var(6X−1)\mathrm{Var}(6X^{-1}).

Worked example

f(x)=3x28f(x)=\frac{3x^2}{8} on [0,2][0,2]. Find E(5X3)E(5X^3).

For f(x)=3x28f(x)=\frac{3x^2}{8} we found E(X)=32E(X)=\frac32 and E(X2)=125E(X^2)=\frac{12}{5}. Is E(X2)=[E(X)]2E(X^2)=[E(X)]^2?

Try an exam question

A continuous random variable XX has probability density function f(x)=3x28f(x)=\dfrac{3x^2}{8} for 0≤x≤20\le x\le2, and 00 otherwise. Find E(X)E(X) and Var(X)\mathrm{Var}(X).

[5 marks]

That's the notes covered.

Carry on to the next subtopic.

Try a question

Find E(X)E(X).

1 mark, marked against the mark scheme

Revision notes