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
| Discrete | Continuous | |
|---|---|---|
| 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.
$f(x) = 3x^2$ for $0 \le x \le 1$, and $0$ elsewhere. Find the mean, variance and standard deviation.
$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.
The uniform distribution
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}$.
$X$ is uniform on $2 \le x \le 10$. Find its mean and standard deviation.
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)$.
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$.
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$.
For a continuous random variable with PDF $f$, $E(X) =$
Each value $x$ weighted by its probability density, integrated over the domain.
$f(x) = 4x^3$ for $0 \le x \le 1$. Find $E(X)$.
$\displaystyle\int_0^1 x \cdot 4x^3\,dx = \Big[\tfrac45x^5\Big]_0^1 = 0.8$.
For the same $f$, find $E(X^2)$ correct to four decimal places.
$\displaystyle\int_0^1 4x^5\,dx = \tfrac46 = \tfrac23 \approx 0.6667$.
For the same $f$, find $\text{Var}(X)$ correct to four decimal places.
$\tfrac23 - 0.8^2 = 0.6667 - 0.64 \approx 0.0267$ (exactly $\tfrac{2}{75}$).
$X$ is uniform on $0 \le x \le 12$. Find $E(X)$.
The midpoint: $\dfrac{0 + 12}{2} = 6$.
$X$ is uniform on $0 \le x \le 12$. Find $\text{Var}(X)$.
$\dfrac{(12 - 0)^2}{12} = \dfrac{144}{12} = 12$.
$f(x) = 0.75x(2 - x)$ for $0 \le x \le 2$. Find $E(X)$ without integrating.
The parabola is symmetric about $x = 1$, the middle of the domain, so the mean is $1$.
$\text{Var}(X) = 5$. Then $\text{Var}(2X + 3) =$
$2^2 \times 5 = 20$. Adding $3$ shifts the distribution but doesn't spread it.
Exam style: $f(x) = 12x^2(1 - x)$ for $0 \le x \le 1$. Find the standard deviation of $X$.
$\mu = 12\displaystyle\int_0^1 (x^3 - x^4)\,dx = 12\left(\tfrac14 - \tfrac15\right) = 0.6$. $E(X^2) = 12\displaystyle\int_0^1 (x^4 - x^5)\,dx = 12\left(\tfrac15 - \tfrac16\right) = 0.4$. $\text{Var}(X) = 0.4 - 0.36 = 0.04$, so $\sigma = 0.2$.
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.
$\displaystyle\int_1^2 \frac{k}{x^2}\,dx = k\Big[-\tfrac1x\Big]_1^2 = \tfrac{k}{2} = 1$, so $k = 2$. Then $E(X) = \displaystyle\int_1^2 \frac{2}{x}\,dx = 2\ln 2 \approx 1.39$.
Coaching Centre