Lesson 4 of 8 · 15 min

Expected value of a continuous random variable

Calculate the mean E⁡(X)\E(X) of a continuous random variable by integrating x p(x)x\,p(x), use symmetry as a shortcut, and interpret the mean as the balance point of the density.

What you will be able to do

  • Explain E⁡(X)=∫−∞∞x p(x) dx\E(X) = \int_{-\infty}^{\infty} x\,p(x)\,dx as the continuous version of ∑xipi\sum x_i p_i.
  • Calculate E⁡(X)\E(X) for a pdf given by a rule on an interval.
  • Use symmetry to write down the mean, and the uniform mean a+b2\frac{a + b}{2}.
  • Compare the mean and median of a skewed distribution.

For a discrete random variable you found the mean as a weighted average, E⁡(X)=∑xipi\E(X) = \sum x_i p_i: each value times its probability, added up. For a continuous variable, slice the xx-axis into thin strips of width dxdx. The strip at xx has probability about p(x) dxp(x)\,dx, so it contributes about x⋅p(x) dxx \cdot p(x)\,dx. Adding infinitely many thin strips is exactly what an integral does.

Discrete

E⁡(X)=μ=∑xi pi\E(X) = \mu = \sum x_i\,p_i

Each value is weighted by its probability.

Continuous

E⁡(X)=μ=∫−∞∞x p(x) dx\E(X) = \mu = \int_{-\infty}^{\infty} x\,p(x)\,dx

Each value is weighted by its density, over the support.

Definition

Expected value (mean)

If XX has pdf p(x)p(x), the expected value of XX is

E⁡(X)=μ=∫−∞∞x p(x) dx.\E(X) = \mu = \int_{-\infty}^{\infty} x\,p(x)\,dx.

In practice, integrate over the support only. E⁡(X)\E(X) is the long-run average of many observations of XX, and it is the balance point of the region under the pdf: if you cut the shape out of cardboard, it would balance on a pivot at x=μx = \mu.

Interactive

Find the balance point

This family blends the uniform density 14\frac{1}{4} with the triangular density x8\frac{x}{8} on [0,4][0, 4]. As aa grows, more area moves to the right. Watch the mean follow it: here E⁡(X)=2+2a3\E(X) = 2 + \frac{2a}{3}.

Worked example

Mean and median of p(x)=38x2p(x) = \frac{3}{8}x^2

  • Simple familiar
  • Technology free

XX has pdf p(x)=38x2p(x) = \frac{3}{8}x^2 for 0≤x≤20 \le x \le 2, and p(x)=0p(x) = 0 elsewhere.

(a) Find E⁡(X)\E(X).

(b) The median of XX is 43≈1.59\sqrt[3]{4} \approx 1.59. Explain why the mean is less than the median.

4 steps

Try it yourself first, then check the working one step at a time.

Method

  1. E⁡(X)=∫x p(x) dx\E(X) = \int x\,p(x)\,dx over the support.

  2. Check the mean lies inside the support, towards the heavier side.

Watch out for

  • Integrating p(x)p(x) instead of x p(x)x\,p(x), which always gives 1.

Find E⁡(X)\E(X) when p(x)=x8p(x) = \frac{x}{8} for 0≤x≤40 \le x \le 4, and 0 elsewhere.

Reads asYour answer shows here as maths.

Tip

Symmetry shortcut

If the pdf is symmetric about x=cx = c (its graph is a mirror image either side of cc), then E⁡(X)=c\E(X) = c. So for the uniform distribution on [a,b][a, b],

E⁡(X)=a+b2,\E(X) = \frac{a + b}{2},

and for p(x)=332x(4−x)p(x) = \frac{3}{32}x(4 - x) on [0,4][0, 4], E⁡(X)=2\E(X) = 2, with no integral needed. State the symmetry as your reason.

Why the uniform mean is (a + b)/2

With p(x)=1b−ap(x) = \frac{1}{b - a} on [a,b][a, b]:

E⁡(X)=∫abxb−a dx=1b−a[x22]ab=b2−a22(b−a)=(b−a)(b+a)2(b−a)=a+b2.\E(X) = \int_a^b \frac{x}{b - a}\,dx = \frac{1}{b - a}\left[\frac{x^2}{2}\right]_a^b = \frac{b^2 - a^2}{2(b - a)} = \frac{(b - a)(b + a)}{2(b - a)} = \frac{a + b}{2}.

The pdf p(x)=6x(1−x)p(x) = 6x(1 - x) on 0≤x≤10 \le x \le 1 is an upside-down parabola. What is E⁡(X)\E(X)?

Choose one answer

The mean and the median measure the centre in different ways. The median splits the area in half; the mean is the balance point, which a long tail pulls towards it. For p(x)=38x2p(x) = \frac{3}{8}x^2 on [0,2][0, 2] the mean is 1.5 but the median is 43≈1.59\sqrt[3]{4} \approx 1.59: the long tail to the left drags the mean below the median. For a symmetric density they are equal.

The time customers spend in a bank queue has a density that is high near 0 minutes and has a long tail to the right. Which is most likely true?

Choose one answer

Common mistake

Forgetting the x

∫p(x) dx=1\int p(x)\,dx = 1 for every pdf, so if your "mean" is 1 you probably forgot to multiply by xx. Check every mean you find: it must lie inside the support, and on the side where most of the area is.

Summary

  • E⁡(X)=μ=∫−∞∞x p(x) dx\E(X) = \mu = \int_{-\infty}^{\infty} x\,p(x)\,dx; integrate over the support only.

  • The mean is the long-run average and the balance point of the density.

  • If the density is symmetric about cc, then E⁡(X)=c\E(X) = c; the uniform mean is a+b2\frac{a + b}{2}.

  • Skewness separates the mean from the median: a long tail pulls the mean towards it.

  • Check: the mean lies inside the support, towards the heavier side.

Finished the lesson?

Try the 3 quick checks above and the lesson completes itself, or mark it complete now.

Lesson 4 of 80% read

Save your progress with a free account