impera Open Impera

A levels Further Mathematics · Further statistics

Continuous random variables

1Probability density functions

A continuous random variable $X$ is described by a probability density function (pdf) $f(x)$:

  • $f(x) \geq 0$ for all $x$;
  • the total area under $f$ is 1: $\displaystyle\int f(x)\,dx = 1$;
  • probabilities are areas: $P(a < X < b) = \displaystyle\int_a^b f(x)\,dx$.

For a continuous variable, $P(X = a) = 0$, so $P(X < a) = P(X \leq a)$.

Worked example

Finding k

  1. $f(x) = kx^2$ for $0 \leq x \leq 3$, and 0 otherwise.
  2. $\displaystyle\int_0^3 kx^2\,dx = 9k = 1$, so $k = \frac{1}{9}$.
  3. $P(X < 2) = \displaystyle\int_0^2 \frac{x^2}{9}\,dx = \frac{8}{27} \approx 0.296$.

The shaded area is P(X < 2) = 8/27. The whole area from 0 to 3 is 1.

Check yourself

What must the total area under a pdf be?

  • Infinite

  • f(0)

  • 0

  • 1

Show the answer

1

Total probability.

2Mean and variance

For a continuous random variable:

$$E(X) = \int x f(x)\,dx \qquad E(X^2) = \int x^2 f(x)\,dx \qquad \text{Var}(X) = E(X^2) - [E(X)]^2$$

Worked example

Using the pdf above

  1. $E(X) = \displaystyle\int_0^3 \frac{x^3}{9}\,dx = \frac{81}{36} = 2.25$.
  2. $E(X^2) = \displaystyle\int_0^3 \frac{x^4}{9}\,dx = \frac{243}{45} = 5.4$.
  3. $\text{Var}(X) = 5.4 - 2.25^2 = 0.3375$.

The rules $E(aX + b) = aE(X) + b$ and $\text{Var}(aX + b) = a^2\text{Var}(X)$ still hold.

Check yourself

How do you find E(X) for a continuous random variable?

  • Integrate x f(x)

  • Differentiate f(x)

  • Find the maximum of f(x)

  • Integrate f(x)

Show the answer

Integrate x f(x)

The continuous version of Σx P(X = x).

3The cumulative distribution function

The cumulative distribution function (cdf) is

$$F(x) = P(X \leq x) = \int_{-\infty}^{x} f(t)\,dt$$

  • $F$ increases from 0 to 1.
  • Differentiating gives the pdf: $f(x) = F'(x)$.
Worked example

A cdf

  1. For $f(x) = \frac{x^2}{9}$ on $[0, 3]$: $F(x) = \dfrac{x^3}{27}$ for $0 \leq x \leq 3$.
  2. $F(x) = 0$ for $x < 0$ and $F(x) = 1$ for $x > 3$.
  3. $P(1 < X < 2) = F(2) - F(1) = \frac{8 - 1}{27} = \frac{7}{27}$.

Always define $F(x)$ for all real $x$, in pieces.

Check yourself

How do you get the pdf from the cdf?

  • Take 1 − F(x)

  • Integrate F(x)

  • Differentiate F(x)

  • Square F(x)

Show the answer

Differentiate F(x)

f(x) = F'(x).

4Median, quartiles and mode

  • The median $m$ satisfies $F(m) = 0.5$.
  • The lower quartile satisfies $F(q_1) = 0.25$; the upper quartile, $F(q_3) = 0.75$.
  • The mode is the value of $x$ where $f(x)$ is greatest (check endpoints, or use calculus).
Worked example

Median and mode

  1. $F(x) = \frac{x^3}{27}$: $\frac{m^3}{27} = 0.5$, so $m = \sqrt[3]{13.5} = 2.38$.
  2. $f(x) = \frac{x^2}{9}$ is increasing on $[0, 3]$, so the mode is 3.

Skew: here mean (2.25) < median (2.38) < mode (3), so the distribution is negatively skewed.

Check yourself

Which equation gives the median of a continuous random variable?

  • F(m) = 0.5

  • f(m) = 1

  • f(m) = 0.5

  • F(m) = 0

Show the answer

F(m) = 0.5

Half the probability lies below m.

5The continuous uniform distribution

The continuous uniform (rectangular) distribution on $[a, b]$ has

$$f(x) = \frac{1}{b - a} \text{ for } a \leq x \leq b$$

$$E(X) = \frac{a + b}{2} \qquad \text{Var}(X) = \frac{(b - a)^2}{12}$$

Worked example

Rounding error

  1. A length is rounded to the nearest centimetre. The error $X$ is uniform on $[-0.5, 0.5]$.
  2. $E(X) = 0$, $\text{Var}(X) = \frac{1}{12}$.
  3. $P(|X| < 0.2) = \frac{0.4}{1} = 0.4$.
Check yourself

What is the variance of a uniform distribution on [0, 6]?

  • 36

  • 6

  • 1/6

  • 3

Show the answer

3

36/12.

6Piecewise pdfs

Some pdfs are defined in pieces. Integrate each piece over its own range.

Worked example

A triangular pdf

  1. $f(x) = \frac{x}{4}$ for $0 \leq x \leq 2$ and $f(x) = \frac{4 - x}{4}$ for $2 < x \leq 4$.
  2. Check: each triangle has area $\frac{1}{2}$, total 1. ✓
  3. By symmetry, $E(X) = 2$ and the median is 2.
  4. $P(X < 1) = \displaystyle\int_0^1 \frac{x}{4}\,dx = \frac{1}{8}$.

For the cdf of a piecewise pdf, the second piece must start where the first ends: $F(2) = \frac{1}{2}$.

Check yourself

In a piecewise cdf, what must be true where the pieces join?

  • The pdf is zero

  • The two pieces give the same value

  • The cdf jumps to 1

  • The second piece starts at 0

Show the answer

The two pieces give the same value

A cdf is continuous.

Now test yourself

This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.

Practise in Impera