From a list of probabilities to a curve
A discrete variable has a list: each value carries its own probability, and the list adds to 1. A continuous variable cannot work that way, because between any two values there is another — the list would be infinite and every entry would have to be zero.
Instead, probability is carried by a probability density function, written f(x). The density itself is not a probability. What is a probability is the area under the curve between two values, which is why every rule from the discrete case reappears with the sum replaced by an integral.
- f(x)
- the probability densitya height, not a probability — it may exceed 1
- ∫f dx = 1
- the total areathe continuous version of ΣP = 1
- P(X = a)
- always zeroso < and ⩽ give the same answer
Density is not probability
f(x) can be greater than 1 without anything being wrong. A distribution spread over the interval from 0 to 0.5 must have an average height of 2 for its area to come to 1. What can never exceed 1 is the area. Confusing the height with the probability is the conceptual error that makes the rest of the topic feel arbitrary.
Every formula, translated
Once the sum has become an integral, nothing else changes. Each discrete formula has a continuous twin that looks almost identical, and knowing the pairing means there is very little new to learn.
| Discrete | Continuous | What it gives |
|---|---|---|
| Σ P(X = x) = 1 | ∫ f(x) dx = 1 | total probability |
| Σ x·P(X = x) | ∫ x·f(x) dx | the mean, E(X) |
| Σ x²·P(X = x) | ∫ x²·f(x) dx | E(X²) |
| E(X²) − μ² | E(X²) − μ² | the variance — unchanged |
| running total | F(x) = ∫₋∞ˣ f(t) dt | the cumulative distribution |
- F(x)
- the cumulative functionF(x) = P(X ⩽ x), rising from 0 to 1
- dF/dx
- recovering the densitydifferentiate the cumulative function
- median m
- solves F(m) = 0.5the value with half the area on each side
The random variable X has f(x) = kx² for 0 ⩽ x ⩽ 3, and f(x) = 0 otherwise. Find k, E(X), and the median.
- Total area is 1: ∫₀³ kx² dx = k[x³/3]₀³ = 9k = 1, so k = 1/9.Always the first step — the density must integrate to 1 over its range.
- E(X) = ∫₀³ x·(x²/9) dx = (1/9)∫₀³ x³ dx = (1/9)[x⁴/4]₀³.Multiply the density by x, then integrate over the same range.
- = (1/9)(81/4) = 2.25.The mean sits well right of centre, as expected for a density that grows with x.
- For the median m: ∫₀ᵐ (x²/9) dx = 0.5, so m³/27 = 0.5.The median splits the area in half, so the integral up to m equals 0.5.
- m³ = 13.5, so m = 2.38.Below the mean, which is the expected order for a right-skewed distribution.
k = 1/9, E(X) = 2.25, median = 2.38
The cumulative distribution function
F(x) answers "what is the probability of being at most x". It starts at 0 below the range, climbs to 1 above it, and never decreases — because accumulating more area can only add.
It is often quicker than integrating from scratch. Once F is known, P(a < X < b) = F(b) − F(a), exactly as with the normal tables. And since integrating gives F, differentiating gives f back — a fact questions exploit in both directions.
Use the limits the density actually occupies
If f is defined only on [0, 3], then integrating from 0 to 5 is wrong — beyond 3 the density is zero and contributes nothing, but writing the wrong limits usually produces a wrong answer rather than a harmless one. For P(X > 2) with that density, integrate from 2 to 3, not from 2 to infinity.
What to do when
- Find an unknown constant → set the total integral to 1.
- Find a probability over an interval → integrate f between the limits, or use
F(b) − F(a). - Find the mean → integrate
x·f(x). - Find the variance → integrate
x²·f(x), then subtractμ². - Find the median → solve
F(m) = 0.5. - Given F and asked for f → differentiate. Given f and asked for F → integrate.
- Piecewise densities must be integrated piece by piece, over the correct limits for each.
The uniform distribution
One continuous distribution appears often enough to be worth knowing outright: the rectangular or uniform distribution, where every value in an interval is equally likely and the density is a horizontal line.
Its height follows from the total area being 1. Over an interval from a to b the width is b − a, so the height must be 1/(b − a) for the rectangle to have area 1. Everything else can be read off geometry rather than calculus — the mean is the midpoint by symmetry, and a probability is just the fraction of the interval covered.
- 1/(b − a)
- the densitywhatever height makes the area 1
- (a + b)/2
- the meanthe midpoint, since the shape is symmetric
- (b − a)²/12
- the variancea standard result worth memorising
A useful check on any density
Before doing anything else, confirm the total area is 1. For a rectangle that is height × width; for a triangle it is ½ × base × height. If the area is not 1 the density is wrong, and every probability, mean and variance computed from it will be wrong too — so it is worth thirty seconds at the start rather than discovering it at the end.
Piecewise densities
A density is often defined in pieces — one expression on one interval and a different one on the next. Nothing changes conceptually, but every calculation has to be split at the boundary and the parts added.
The total-area condition becomes a sum of integrals, one per piece, set equal to 1. A probability spanning the boundary likewise splits into the part in each piece. The commonest error is integrating a single expression across the whole range as though the other piece did not exist.
- boundary
- where the definition changesalways a limit of integration
- each piece
- its own expressionnever integrate one across the other
Sketch it before integrating
A quick sketch of a piecewise density shows the shape, makes the boundary obvious, and often reveals that part of the area is a triangle or rectangle whose area can simply be written down. Several exam densities are made entirely of straight lines, and geometry is both faster and less error-prone than integration there.