10B

Probability density functions

Continuous random variables, probability density functions and their two conditions, probabilities as integrals, the cumulative distribution function and its relationship with the PDF, uniform distributions, piecewise PDFs, the median, and PDFs over unbounded domains.

Heights, times and masses can take any value in a range. The chance of a height being exactly $172.000\ldots$ cm is zero, so we can't list probabilities value by value the way we did in chapter 9. Instead, as 10A suggested, probability becomes the area under a curve, and integration is how we find it.

Probability density functions

The two conditions match the two in chapter 9: no negative probability, and a total of $1$. Because a single point has no width, it has no area, so $P(X = a) = 0$. That means $P(X \lt b)$ and $P(X \le b)$ are the same for a continuous variable.

Probability is area

The PDF f(x) = 0.75x(2 − x) on 0 ≤ x ≤ 2. The shaded area is P(X ≤ b).

Try this

Set $b = 1$. Explain why the area must be exactly $0.5$ without integrating. Then find the value of b that makes the area $0.25$: that is the lower quartile.

Example 1: finding k●●

$f(x) = k(4 - x^2)$ for $0 \le x \le 2$, and $0$ elsewhere. Find $k$, then $P(X \le 1)$.

$\displaystyle\int_0^2 k(4 - x^2)\,dx = k\Big[4x - \tfrac{x^3}{3}\Big]_0^2 = k\left(8 - \tfrac83\right) = \tfrac{16k}{3}$
The total area must be 1.
$\tfrac{16k}{3} = 1$, so $k = \tfrac{3}{16}$.
Set the total equal to 1. Also check f(x) ≥ 0: 4 − x² ≥ 0 on this interval, so it is.
$P(X \le 1) = \tfrac{3}{16}\Big[4x - \tfrac{x^3}{3}\Big]_0^1 = \tfrac{3}{16} \times \tfrac{11}{3} = \tfrac{11}{16} \approx 0.69$
Integrate from 0 to 1.

The cumulative distribution function

CDF and PDF
$$F(x) = P(X \le x) = \int_{-\infty}^{x} f(t)\,dt \qquad\qquad F'(x) = f(x)$$

The CDF is the area to the left of $x$. By the fundamental theorem of calculus, differentiating it gives back the PDF. Once you have $F$, every probability is a subtraction: $P(a \le X \le b) = F(b) - F(a)$.

Example 2●●

$f(x) = \dfrac{x}{8}$ for $0 \le x \le 4$, and $0$ elsewhere. Find the CDF, the median, the quartiles and the mode.

For $0 \le x \le 4$: $F(x) = \displaystyle\int_0^x \frac{t}{8}\,dt = \frac{x^2}{16}$. Also $F(x) = 0$ for $x \lt 0$ and $F(x) = 1$ for $x \gt 4$.
Integrate from the left end of the domain, 0, up to x.
$\dfrac{m^2}{16} = 0.5$, so $m^2 = 8$ and $m = 2\sqrt2 \approx 2.83$.
Solve F(m) = 0.5, taking the positive root.
$x^2 = 4$ gives $Q_1 = 2$. $x^2 = 12$ gives $Q_3 = 2\sqrt3 \approx 3.46$.
Same idea with 0.25 and 0.75.
Mode $= 4$
f(x) = x/8 increases across the domain, so it is highest at the right end.
Example 3: from F back to f●

$F(x) = \dfrac{x^3}{27}$ for $0 \le x \le 3$. Find the PDF.

$f(x) = F'(x) = \dfrac{x^2}{9}$ for $0 \le x \le 3$, and $0$ elsewhere.
Differentiate the CDF.

Uniform distributions

A uniform distribution on $a \le x \le b$ has a constant PDF. The graph is a rectangle with base $b - a$, and its area must be $1$, so its height is $\dfrac{1}{b - a}$. Probabilities are rectangle areas.

Example 4●

A computer picks a random real number $X$ uniformly between $2$ and $10$. Find $P(X \gt 7)$.

$f(x) = \dfrac{1}{10 - 2} = \dfrac18$ for $2 \le x \le 10$
Height of the rectangle.
$P(X \gt 7) = 3 \times \dfrac18 = \dfrac38$
Width 10 − 7 = 3, height 1/8.

Piecewise and unbounded PDFs

A PDF can be defined in pieces. Integrate each piece over its own interval, and add. Often a sketch shows the area is a triangle, which is quicker.

Example 5: a triangle●●

$f(x) = x$ for $0 \le x \le 1$, $f(x) = 2 - x$ for $1 \le x \le 2$, and $0$ elsewhere. Find $P(X \le 1.5)$.

Use the complement: the area to the right of $1.5$ is a small triangle.
The graph is a triangle with base 2 and height 1, so its area is 1: a valid PDF.
$P(X \gt 1.5) = \tfrac12 \times 0.5 \times 0.5 = 0.125$, so $P(X \le 1.5) = 0.875$.
That small triangle has base 0.5 and height f(1.5) = 0.5.

A PDF can also live on an unbounded domain such as $x \ge 0$. Then the total area is an improper integral: integrate up to $N$ and let $N \to \infty$.

Example 6: an unbounded domain●●●

Show that $f(x) = 2e^{-2x}$ for $x \ge 0$ (and $0$ for $x \lt 0$) is a PDF, and find $P(X \gt 1)$.

$f(x) \gt 0$ for $x \ge 0$.
Exponentials are always positive.
$\displaystyle\int_0^N 2e^{-2x}\,dx = \Big[-e^{-2x}\Big]_0^N = 1 - e^{-2N} \to 1$ as $N \to \infty$.
Integrate to N, then take the limit.
$P(X \gt 1) = \displaystyle\lim_{N \to \infty}\left(e^{-2} - e^{-2N}\right) = e^{-2} \approx 0.135$
The area from 1 to N, as N → ∞.

Your turn

$f(x) = 3x^2$ for $0 \le x \le 1$. Find the median, correct to two decimal places.

Show the working

$F(x) = x^3$ on $0 \le x \le 1$. Solve $m^3 = 0.5$: $m = \sqrt[3]{0.5} \approx 0.79$.

Flashcards
Two conditions for a PDF
$f(x) \ge 0$, and the total area $\displaystyle\int f(x)\,dx = 1$
Link between CDF and PDF
$F'(x) = f(x)$
Median of a continuous distribution
Solve $F(m) = 0.5$.
Uniform PDF on $a le x le b$
$f(x) = \dfrac{1}{b - a}$
Practice
  1. Which could be a PDF on $0 \le x \le 1$ (and $0$ elsewhere)?

  2. $f(x) = kx$ for $0 \le x \le 4$, and $0$ elsewhere. Find $k$.

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

  4. $X$ is uniform on $0 \le x \le 20$. Find $P(5 \le X \le 9)$.

  5. $X$ is a continuous random variable. Find $P(X = 2)$.

  6. $X$ has CDF $F(x) = \dfrac{x^2}{16}$ for $0 \le x \le 4$. Find $P(1 \le X \le 3)$.

  7. $F(x) = \dfrac{x^3}{8}$ for $0 \le x \le 2$. The PDF is:

  8. $f(x) = \dfrac{x}{8}$ for $0 \le x \le 4$. Find the median, correct to two decimal places.

  9. Exam style: $f(x) = ke^{-0.5x}$ for $x \ge 0$, and $0$ elsewhere, is a PDF. Find $k$, then find $P(X \gt 2)$ correct to two decimal places.

  10. Exam style: $f(x) = kx$ for $0 \le x \le 2$, $f(x) = k(4 - x)$ for $2 \le x \le 4$, and $0$ elsewhere. Find $k$, then $P(1 \le X \le 3)$.

Formula sheet