10C

Mean and variance of a continuous distribution

The mean or expected value, variance and standard deviation of a continuous random variable found by integration, the uniform distribution, and linear changes aX + b.

In chapter 9 the mean was $\sum x\,P(X = x)$: each value times its probability, added up. For a continuous variable, "add up" becomes "integrate", and the probability of a thin strip near $x$ is $f(x)\,dx$. So every formula carries straight across, with $\sum$ replaced by $\int$.

The formulas

DiscreteContinuous
Mean $\mu = E(X)$$\sum x\,P(X = x)$$\displaystyle\int x\,f(x)\,dx$
$E(X^2)$$\sum x^2\,P(X = x)$$\displaystyle\int x^2 f(x)\,dx$
Variance$\text{Var}(X) = E(X^2) - \mu^2$, and $\sigma = \sqrt{\text{Var}(X)}$

The integrals run over the whole domain of the PDF. The variance can also be found from the definition $\displaystyle\int (x - \mu)^2 f(x)\,dx$, but the $E(X^2)$ form is nearly always quicker.

Example 1●●

$f(x) = 3x^2$ for $0 \le x \le 1$, and $0$ elsewhere. Find the mean, variance and standard deviation.

$\mu = \displaystyle\int_0^1 x \times 3x^2\,dx = \Big[\tfrac34x^4\Big]_0^1 = \tfrac34$
Multiply by x and integrate over the domain.
$E(X^2) = \displaystyle\int_0^1 3x^4\,dx = \Big[\tfrac35x^5\Big]_0^1 = \tfrac35$
Multiply by x² and integrate.
$\text{Var}(X) = \tfrac35 - \tfrac{9}{16} = \tfrac{3}{80} = 0.0375$
Mean of the squares minus the square of the mean.
$\sigma = \sqrt{0.0375} \approx 0.194$
Example 2: mean versus median●●

$f(x) = \dfrac{x}{8}$ for $0 \le x \le 4$. In 10B we found the median is $2\sqrt2 \approx 2.83$. Find the mean and standard deviation, and compare.

$\mu = \displaystyle\int_0^4 \frac{x^2}{8}\,dx = \Big[\tfrac{x^3}{24}\Big]_0^4 = \tfrac{64}{24} = \tfrac83 \approx 2.67$
$E(X^2) = \displaystyle\int_0^4 \frac{x^3}{8}\,dx = \Big[\tfrac{x^4}{32}\Big]_0^4 = 8$
$\text{Var}(X) = 8 - \tfrac{64}{9} = \tfrac89$, so $\sigma \approx 0.943$.
The mean ($2.67$) is less than the median ($2.83$). The distribution is negatively skewed.
The PDF has a long tail to the left (low values are less likely but stretch out), which pulls the mean down.

The uniform distribution

Uniform on a ≤ x ≤ b
$$\mu = \frac{a + b}{2} \qquad \text{Var}(X) = \frac{(b - a)^2}{12}$$

The mean is the midpoint, by symmetry. The variance formula comes from integrating, as in the reveal below.

Where the 12 comes from

Take $a = 0$ and $b = L$, so $f(x) = \tfrac1L$. Then $\mu = \tfrac{L}{2}$ and $E(X^2) = \displaystyle\int_0^L \frac{x^2}{L}\,dx = \frac{L^2}{3}$. So $\text{Var}(X) = \dfrac{L^2}{3} - \dfrac{L^2}{4} = \dfrac{L^2}{12}$. Sliding the interval along doesn't change the spread, so the general result is $\dfrac{(b - a)^2}{12}$.

Example 3●

$X$ is uniform on $2 \le x \le 10$. Find its mean and standard deviation.

$\mu = \dfrac{2 + 10}{2} = 6$
$\text{Var}(X) = \dfrac{8^2}{12} = \dfrac{16}{3}$, so $\sigma = \sqrt{16/3} \approx 2.31$.

Linear changes

The rules from 9B and 9C hold for continuous variables too: $E(aX + b) = aE(X) + b$ and $\text{Var}(aX + b) = a^2\,\text{Var}(X)$.

Example 4●

The time $X$ hours a job takes has mean $2.5$ and standard deviation $0.4$. The charge is $C = 80X + 50$ dollars. Find the mean and standard deviation of $C$.

$E(C) = 80 \times 2.5 + 50 = \$250$
$\text{SD}(C) = 80 \times 0.4 = \$32$
The +50 doesn't affect spread. The SD is multiplied by |80|.

Your turn

$f(x) = 2x$ for $0 \le x \le 1$. Find the mean and variance.

Show the working

$\mu = \displaystyle\int_0^1 2x^2\,dx = \tfrac23$. $E(X^2) = \displaystyle\int_0^1 2x^3\,dx = \tfrac12$. $\text{Var}(X) = \tfrac12 - \tfrac49 = \tfrac{1}{18} \approx 0.056$.

Flashcards
Mean of a continuous random variable
$\displaystyle\int x\,f(x)\,dx$
Variance of a continuous random variable
$\displaystyle\int x^2 f(x)\,dx - \mu^2$
Uniform on $a le x le b$
$\mu = \dfrac{a + b}{2}$, $\;\text{Var} = \dfrac{(b - a)^2}{12}$
Practice
  1. For a continuous random variable with PDF $f$, $E(X) =$

  2. $f(x) = 4x^3$ for $0 \le x \le 1$. Find $E(X)$.

  3. For the same $f$, find $E(X^2)$ correct to four decimal places.

  4. For the same $f$, find $\text{Var}(X)$ correct to four decimal places.

  5. $X$ is uniform on $0 \le x \le 12$. Find $E(X)$.

  6. $X$ is uniform on $0 \le x \le 12$. Find $\text{Var}(X)$.

  7. $f(x) = 0.75x(2 - x)$ for $0 \le x \le 2$. Find $E(X)$ without integrating.

  8. $\text{Var}(X) = 5$. Then $\text{Var}(2X + 3) =$

  9. Exam style: $f(x) = 12x^2(1 - x)$ for $0 \le x \le 1$. Find the standard deviation of $X$.

  10. Exam style: $f(x) = \dfrac{k}{x^2}$ for $1 \le x \le 2$, and $0$ elsewhere. Find $k$, then find $E(X)$ correct to two decimal places.

Formula sheet