Open Mathhh

Expectation and variance of continuous distributions

Statistics · worksheets 31 to 35 · 2 min read

I can

  • find E(X) and E(X²) from a pdf by integrating
  • find Var(X) = E(X²) − (E(X))²
  • use the uniform distribution on a to b

Key idea

For a pdf f(x): E(X) is the integral of x × f(x), and E(X²) is the integral of x² × f(x), both over the range of X. Then Var(X) = E(X²) − (E(X))².

A uniform distribution on a ≤ x ≤ b has a flat pdf f(x) = 1/(b − a). Its mean and median are both (a + b)/2, and its variance is (b − a)² ÷ 12.

Worked examples

Example 1: uniform on 2 ≤ x ≤ 8

Watch it: uniform on 2 ≤ x ≤ 8, step by step:

  1. E(X) = (2 + 8) ÷ 2 = 5, the middle.
  2. Var(X) = (8 − 2)² ÷ 12 = 36 ÷ 12 = 3.
  3. Both answers.
  4. The pdf is a flat rectangle. The mean is in the middle, at 5.
  1. E(X) = (2 + 8)/2 = 5.
  2. Var(X) = 6² ÷ 12 = 36/12 = 3.

E(X) = 5, Var(X) = 3

Example 2: f(x) = (1/2)x for 0 ≤ x ≤ 2, find E(X)

Watch it: f(x) = x/2 for 0 ≤ x ≤ 2: E(X), step by step:

  1. E(X) is the integral of x × f(x).
  2. At 2: 8/6. At 0: 0. So 8/6 = 4/3.
  3. The mean is 4/3.
  4. The mean 4/3 is nearer the right, where the line is higher.
  1. x × f(x) = x²/2. Its integral is x³/6.
  2. At 2 this is 8/6.

E(X) = 4/3

Example 3: the same pdf, find Var(X)

Watch it: the same pdf: Var(X), step by step:

  1. E(X²) is the integral of x² × f(x).
  2. At 2: 16/8 = 2. So E(X²) = 2.
  3. Var(X) = E(X²) − (E(X))² = 2 − 16/9 = 2/9.
  4. The variance is 2/9.
  1. x² × f(x) = x³/2. Its integral is x⁴/8. At 2 this is 16/8 = 2, so E(X²) = 2.
  2. Var(X) = 2 − (4/3)² = 2 − 16/9.

Var(X) = 2/9

Try it

X has a uniform distribution with pdf f(x) = 1/6 for 0 ≤ x ≤ 6. Find Var(X).
Show answer3
X has a uniform distribution with pdf f(x) = 1/6 for 1 ≤ x ≤ 7. Find the median of X.
Show answer4
The pdf of X is f(x) = (1/8)x for 0 ≤ x ≤ 4, and 0 otherwise. Find E(X²).
Show answer8
The pdf of X is f(x) = (2/9)x for 0 ≤ x ≤ 3, and 0 otherwise. Find E(X).
Show answer2
The pdf of X is f(x) = (3/8)x² for 0 ≤ x ≤ 2, and 0 otherwise. Find E(X). Give your answer as a fraction.
Show answer3/2

Common mistakes

  • Integrating f(x) instead of x × f(x) for the mean.
  • Forgetting to square E(X) when finding the variance.
  • Using (b − a) ÷ 12 for the uniform variance. The top is (b − a)².

Remember

  • Var(X) = E(X²) − (E(X))².
  • Uniform on a to b: mean (a + b)/2, variance (b − a)²/12.

Practise this

Worksheets 31 to 35 of Statistics practise this note. Sign in to Mathhh, write your answers by hand and see your marks straight away.

Open Mathhh

More Statistics notes

Keep learning

All Statistics notes · All study notes