Probability Density Functions
Textbook Reference
| Primary source | OpenStax Calculus Volume 2, Section 3.7: “Probability” (see also improper integrals) |
| Direct link | https://openstax.org/books/calculus-volume-2/pages/3-7-probability |
| Textbook used in class | Stewart, Calculus, Section 8.5: “Probability” |
Opening Scenario
The time until a radioactive atom decays, the height of a randomly selected adult, the wait time for a bus -- all of these are continuous random quantities. For a continuous random variable $X$, it makes no sense to ask “what is the probability that $X = 3.7$?” because the probability of hitting any exact value is zero. Instead, the right question is “what is the probability that $X$ falls in the interval $[a, b]$?”
The answer is the area under a curve called the probability density function: $P(a \leq X \leq b) = \int_a^b f(x)\,dx$. The density function encodes how likely the variable is to fall in any region.
Quick Reference
A function $f$ is a probability density function (pdf) if:
- $f(x) \geq 0$ for all $x$, and
- $\displaystyle\int_{-\infty}^{\infty} f(x)\,dx = 1$.
For a continuous random variable $X$ with pdf $f$: $$P(a \leq X \leq b) = \int_a^b f(x)\,dx.$$
The pdf integrates to 1 over the entire real line (or the support of $f$): total probability is 1.
Key Concepts
1. Density vs. Probability
A pdf $f(x)$ is not itself a probability. The value $f(x_0)$ is a density -- like mass per unit length or charge per unit area. The probability of $X$ landing in an interval is the area under the density curve over that interval.
Consequence: $f(x)$ can be greater than 1 at some points (as long as the total area is still 1). What $f(x)$ cannot be is negative.
2. The Normalization Condition
The condition $\int_{-\infty}^{\infty} f(x)\,dx = 1$ reflects the certainty that the random variable takes some value. The total probability over all outcomes is 100%.
If a proposed pdf has a free constant $c$ (e.g., $f(x) = cx^2(1-x)$ for $0 \leq x \leq 1$), you find $c$ by solving $\int_0^1 f(x)\,dx = 1$.
3. Computing Probabilities
To find $P(a \leq X \leq b)$: integrate $f$ from $a$ to $b$. Note:
- $P(X = a) = \int_a^a f(x)\,dx = 0$ for any single point.
- Therefore $P(a < X < b) = P(a \leq X \leq b)$ (the endpoints do not matter for continuous variables).
4. Support and Improper Integrals
Many pdfs are zero outside a finite interval (the support). For example, $f(x) = 2x$ for $0 \leq x \leq 1$, $f(x) = 0$ elsewhere. Integration “over all reals” reduces to integration over the support.
Other pdfs (like the exponential and normal) are nonzero for all $x > 0$ or all $x \in \mathbb{R}$; normalization then requires an improper integral.
Worked Example
The function $f(x) = cx(1-x)$ for $0 \leq x \leq 1$ (and $f(x) = 0$ elsewhere) is a pdf. Find $c$, and then find $P(0.25 \leq X \leq 0.75)$.
Step 1 -- Find $c$. $$\int_0^1 cx(1-x)\,dx = 1 \Rightarrow c\int_0^1 (x-x^2)\,dx = 1 \Rightarrow c\left[\frac{x^2}{2}-\frac{x^3}{3}\right]_0^1 = c\cdot\frac{1}{6} = 1 \Rightarrow c = 6.$$
So $f(x) = 6x(1-x)$.
Step 2 -- Find the probability. $$P(0.25 \leq X \leq 0.75) = \int_{0.25}^{0.75}6x(1-x)\,dx = 6\left[\frac{x^2}{2}-\frac{x^3}{3}\right]_{0.25}^{0.75}.$$
At $x = 0.75$: $\dfrac{0.5625}{2} - \dfrac{0.421875}{3} = 0.28125 - 0.140625 = 0.140625$.
At $x = 0.25$: $\dfrac{0.0625}{2} - \dfrac{0.015625}{3} = 0.03125 - 0.005208 = 0.026042$.
$$P = 6(0.140625 - 0.026042) = 6(0.114583) \approx 0.6875.$$
Boxed answer: $c = 6$; $P(0.25 \leq X \leq 0.75) = \dfrac{11}{16} = 0.6875$.
Common Errors Summary
| Error | Example | Correction |
|---|---|---|
| Interpreting $f(x_0)$ as a probability | “The probability at $x = 0.5$ is $f(0.5) = 1.5$” | $f(x_0)$ is a density, not a probability; $P(X = 0.5) = 0$; probability requires an interval |
| Forgetting that $f$ must be non-negative | Using $f(x) = x - x^2$ for $x \in [0,2]$ without checking sign | Check that $f(x) \geq 0$ on the entire support before declaring it a pdf |
| Normalizing over the wrong interval | $\int_{-\infty}^{\infty} f(x)\,dx$ when $f$ is only supported on $[0,1]$ | If $f(x) = 0$ outside $[a,b]$, normalization reduces to $\int_a^b f(x)\,dx = 1$ |
Common Misconceptions
the value $f(x_0)$ of a probability density function at a point is the probability that the random variable equals $x_0$.
This is the concept-image-conflicts-definition error. A probability density function is not a probability; it is a density. For a continuous random variable, $P(X = x_0) = 0$ for any single point because any single value has measure zero. The value $f(x_0)$ describes how concentrated probability is near $x_0$, but probability requires integration over an interval: $P(a \leq X \leq b) = \int_a^b f(x)\,dx$. For $f(x) = 6x(1-x)$ on $[0,1]$, $f(0.5) = 1.5$, which exceeds $1$ and therefore cannot be a probability, confirming that $f$ values are densities, not probabilities.
a probability density function must satisfy $f(x) \leq 1$ everywhere, since probabilities cannot exceed $1$.
This is the height-vs-slope error. The constraint on a pdf is that the total area under it equals $1$, not that any individual value is at most $1$. A pdf can take values greater than $1$ at some points provided it is concentrated over a narrow interval so that the total area remains $1$. For example, $f(x) = 4x$ on $[0, 1/\sqrt{2}]$ (zero elsewhere) integrates to $1$ and attains the value $f(1/\sqrt{2}) = 4/\sqrt{2} \approx 2.83 > 1$. What must always hold is $f(x) \geq 0$ (no negative probabilities) and $\int_{-\infty}^{\infty} f(x)\,dx = 1$.
Leveled Practice
Level 1 -- Verify a pdf
Problem 1. Show that $f(x) = 3x^2$ for $0 \leq x \leq 1$ (zero elsewhere) is a valid pdf.
Show answer
Check $f(x) = 3x^2 \geq 0$ for $x \in [0,1]$. Yes.
Check $\displaystyle\int_0^1 3x^2\,dx = [x^3]_0^1 = 1$. Yes.
Both conditions are satisfied; $f$ is a pdf.
Level 2 -- Find $c$ and a Probability
Problem 2. Let $f(x) = ce^{-2x}$ for $x \geq 0$ (zero for $x < 0$). Find $c$ and compute $P(X > 1)$.
Show answer
Normalization: $\displaystyle\int_0^{\infty} ce^{-2x}\,dx = c\cdot\frac{1}{2} = 1 \Rightarrow c = 2$.
So $f(x) = 2e^{-2x}$.
$P(X > 1) = \displaystyle\int_1^{\infty}2e^{-2x}\,dx = \left[-e^{-2x}\right]_1^{\infty} = 0-(-e^{-2}) = e^{-2} \approx 0.135$.
Boxed answers: $c = 2$; $P(X > 1) = e^{-2} \approx 0.135$.
(This is an exponential distribution with rate $\lambda = 2$.)
Mastery Checklist
Mental Model
A probability density function is a recipe for distributing total probability (which equals 1) across the real line. Think of it as a probability per unit length: dense in regions where the variable is likely to fall, sparse where it is unlikely. To find the probability that the variable lands in $[a,b]$, compute the area under the density curve over $[a,b]$. The total area under the entire curve must be 1 (total probability = 100%).
Connections
Looking back
- Improper integrals (Section 7.8): Many normalization integrals are improper; check convergence.
- Definite integral as area (Section 4.2): Probability is area under the density curve.
Looking ahead
- Expected value (Section 8.5): The mean of a continuous random variable is $\mu = \int x f(x)\,dx$.
- Normal distribution (Section 8.5): The most important pdf in probability, involving $e^{-x^2}$.