Exam PRandom variablesFree to read

Expectation, variance and moments

E[X] is the centre, Var(X) the spread, and Var(X) = E[X²] − (E[X])² is the identity that turns most exam questions into two sums.

The formulas

Expectation
E[X]=∑xx p(x)or∫−∞∞xf(x) dxE[X] = \sum_x x\,p(x) \quad\text{or}\quad \int_{-\infty}^{\infty} x f(x)\,dx
Law of the unconscious statistician
E[g(X)]=∑xg(x)p(x)or∫g(x)f(x) dxE[g(X)] = \sum_x g(x)p(x) \quad\text{or}\quad \int g(x)f(x)\,dx
Variance
Var⁡(X)=E ⁣[(X−μ)2]=E[X2]−μ2\operatorname{Var}(X) = E\!\left[(X-\mu)^2\right] = E[X^{2}] - \mu^{2}
Linear transform
E[aX+b]=aE[X]+b,Var⁡(aX+b)=a2Var⁡(X)E[aX+b] = aE[X]+b, \qquad \operatorname{Var}(aX+b) = a^{2}\operatorname{Var}(X)
Survival form
E[X]=∫0∞S(x) dxE[X] = \int_0^{\infty} S(x)\,dx

non-negative X

Where it comes from

  1. Expanding E[(X−μ)2]=E[X2−2μX+μ2]E[(X-\mu)^2] = E[X^2 - 2\mu X + \mu^2] and using linearity gives E[X2]−2μ2+μ2=E[X2]−μ2E[X^2] - 2\mu^2 + \mu^2 = E[X^2] - \mu^2.
  2. The shift bb moves the whole distribution and cannot change spread, which is why it disappears from the variance.
  3. The survival form comes from swapping the order of integration in ∫0∞∫0xf(x) dt dx\int_0^\infty \int_0^x f(x)\,dt\,dx.

Worked example

The number of claims filed by a policyholder in a year takes values 0, 1, 2, 3 with probabilities 0.25, 0.35, 0.28, 0.12. Find the variance.

  1. E[X]=0(0.25)+1(0.35)+2(0.28)+3(0.12)=1.27E[X] = 0(0.25)+1(0.35)+2(0.28)+3(0.12) = 1.27.
  2. E[X2]=0+1(0.35)+4(0.28)+9(0.12)=2.55E[X^{2}] = 0+1(0.35)+4(0.28)+9(0.12) = 2.55.
  3. Var⁡(X)=2.55−1.272=2.55−1.6129\operatorname{Var}(X) = 2.55 - 1.27^{2} = 2.55 - 1.6129.
  4. Var⁡(X)=0.9371\operatorname{Var}(X) = 0.9371.

Answer: 0.9371

This answer is recomputed from the site’s own interest-theory and probability functions every time the test suite runs, so the page and the mathematics cannot drift apart.

Memory hooks

  • Var = E[X²] − (E[X])². Compute the second moment, never the squared deviations, unless the question hands you deviations.
  • Adding a constant never changes a variance; multiplying by a scales it by a².

Traps

  • Reporting the standard deviation when the question asked for the variance (or the reverse).
  • Applying E[g(X)] = g(E[X]) - true only for linear g.

2 solved sample questions

From the free samples in the question bank, solved in full. They never rotate and they are never gated.

  1. Exam PExpectation, variance and momentsCore
    A random variable has E[X]=4E[X] = 4 and E[X2]=25E[X^{2}] = 25. Find the variance.
    1. A3.00003.0000
    2. B5.00005.0000
    3. C9.00009.0000
    4. D16.000016.0000
    5. E21.000021.0000

    Solution

    1. The computational formula is Var⁡(X)=E[X2]−(E[X])2\operatorname{Var}(X) = E[X^{2}] - (E[X])^{2}.
    2. (E[X])2=16(E[X])^{2} = 16.
    3. Var⁡(X)=25−16\operatorname{Var}(X) = 25 - 16.
    4. =9= 9, so the standard deviation is 3. Never subtract E[X]E[X] from E[X2]E[X^2] directly - the square matters.

    Trap. Reporting the standard deviation 3, or subtracting 4 from 25 to get 21.

  2. Exam PExpectation, variance and momentsStretch
    A non-negative variable has survival function S(x)=(1+x)−2S(x) = (1+x)^{-2} for x>0x>0. Find E[X]E[X].
    1. A0.50000.5000
    2. B1.00001.0000
    3. C1.50001.5000
    4. D2.00002.0000
    5. EIt does not exist

    Solution

    1. For a non-negative variable, E[X]=∫0∞S(x) dxE[X] = \int_0^{\infty}S(x)\,dx - usually much faster than integrating xf(x)xf(x).
    2. ∫0∞(1+x)−2dx=[−(1+x)−1]0∞\int_0^{\infty}(1+x)^{-2}dx = \left[-(1+x)^{-1}\right]_0^{\infty}.
    3. =0−(−1)=1= 0 - (-1) = 1.
    4. The survival-function route avoids differentiating SS to get the density at all.

    Trap. Differentiating S to get f and then integrating xf(x) - correct but twice the work.

Drill this topic: Expectation, variance and moments has 18 questions, 2 of them solved free on that page, and the full question bank has 400. The drills are part of Premium. Every free sample and today’s mixed round stay free.

Related