A discrete random variable has a probability at each value. A continuous one does not: P ( X = 2 ) P(X = 2) P ( X = 2 ) is zero, because a single point has no width. Probability lives in areas instead, and every formula in this topic is an integral where the discrete version was a sum.
Probability density functions
A function f ( x ) f(x) f ( x ) is a probability density function for X X X if
f ( x ) ≥ 0 for all x and ∫ − ∞ ∞ f ( x ) d x = 1 f(x) \ge 0 \quad\text{for all } x \qquad\text{and}\qquad \int_{-\infty}^{\infty} f(x)\,dx = 1 f ( x ) ≥ 0 for all x and ∫ − ∞ ∞ f ( x ) d x = 1
Probability is then area under the curve:
P ( a < X < b ) = ∫ a b f ( x ) d x P(a < X < b) = \int_a^b f(x)\,dx P ( a < X < b ) = ∫ a b f ( x ) d x
Common mistake f ( x ) f(x) f ( x ) is not a probability and may exceed 1. Only the area is a probability. A density of 4 on an interval of width 1 10 \tfrac{1}{10} 10 1 gives an area of 0.4 0.4 0.4 — perfectly legitimate.
Key result Because a point has no width, P ( X = a ) = 0 P(X = a) = 0 P ( X = a ) = 0 . That makes < < < and ≤ \le ≤ interchangeable throughout: P ( X < 2 ) = P ( X ≤ 2 ) P(X < 2) = P(X \le 2) P ( X < 2 ) = P ( X ≤ 2 ) . Endpoints never need the care they demand with discrete variables.
Finding an unknown constant
Almost every question begins here: the total area must be 1.
Given f ( x ) = k x ( 4 − x ) f(x) = kx(4-x) f ( x ) = k x ( 4 − x ) for 0 ≤ x ≤ 4 0 \le x \le 4 0 ≤ x ≤ 4 and zero elsewhere, find k k k .
∫ 0 4 ( 4 x − x 2 ) d x = [ 2 x 2 − x 3 3 ] 0 4 = 32 − 64 3 = 32 3 \int_0^4 (4x - x^2)\,dx = \left[2x^2 - \frac{x^3}{3}\right]_0^4 = 32 - \frac{64}{3} = \frac{32}{3} ∫ 0 4 ( 4 x − x 2 ) d x = [ 2 x 2 − 3 x 3 ] 0 4 = 32 − 3 64 = 3 32
k × 32 3 = 1 ⟹ k = 3 32 k \times \frac{32}{3} = 1 \quad\Longrightarrow\quad k = \frac{3}{32} k × 3 32 = 1 ⟹ k = 32 3
Then, for instance,
P ( 1 < X < 3 ) = 3 32 ∫ 1 3 ( 4 x − x 2 ) d x = 11 16 = 0.6875 P(1 < X < 3) = \frac{3}{32}\int_1^3 (4x - x^2)\,dx = \frac{11}{16} = 0.6875 P ( 1 < X < 3 ) = 32 3 ∫ 1 3 ( 4 x − x 2 ) d x = 16 11 = 0.6875
Exam tip Integrate over the interval where f f f is non-zero, not from − ∞ -\infty − ∞ to ∞ \infty ∞ . Outside that interval f = 0 f = 0 f = 0 contributes nothing, so those parts can be ignored entirely.
Expectation and variance
E ( X ) = ∫ x f ( x ) d x E ( X 2 ) = ∫ x 2 f ( x ) d x E(X) = \int x\,f(x)\,dx \qquad E(X^2) = \int x^2 f(x)\,dx E ( X ) = ∫ x f ( x ) d x E ( X 2 ) = ∫ x 2 f ( x ) d x
Var ( X ) = E ( X 2 ) − [ E ( X ) ] 2 \operatorname{Var}(X) = E(X^2) - \big[E(X)\big]^2 Var ( X ) = E ( X 2 ) − [ E ( X ) ] 2
Continuing with f ( x ) = 3 32 x ( 4 − x ) f(x) = \tfrac{3}{32}x(4-x) f ( x ) = 32 3 x ( 4 − x ) :
E ( X ) = 3 32 ∫ 0 4 ( 4 x 2 − x 3 ) d x = 3 32 ( 256 3 − 64 ) = 2 E(X) = \frac{3}{32}\int_0^4 (4x^2 - x^3)\,dx = \frac{3}{32}\left(\frac{256}{3} - 64\right) = 2 E ( X ) = 32 3 ∫ 0 4 ( 4 x 2 − x 3 ) d x = 32 3 ( 3 256 − 64 ) = 2
E ( X 2 ) = 3 32 ∫ 0 4 ( 4 x 3 − x 4 ) d x = 3 32 ( 256 − 1024 5 ) = 24 5 = 4.8 E(X^2) = \frac{3}{32}\int_0^4 (4x^3 - x^4)\,dx = \frac{3}{32}\left(256 - \frac{1024}{5}\right) = \frac{24}{5} = 4.8 E ( X 2 ) = 32 3 ∫ 0 4 ( 4 x 3 − x 4 ) d x = 32 3 ( 256 − 5 1024 ) = 5 24 = 4.8
Var ( X ) = 4.8 − 2 2 = 0.8 \operatorname{Var}(X) = 4.8 - 2^2 = 0.8 Var ( X ) = 4.8 − 2 2 = 0.8
Key result E ( X ) = 2 E(X) = 2 E ( X ) = 2 could have been written down without integrating: the density is symmetric about x = 2 x = 2 x = 2 . Look for symmetry before doing the work — but note that the variance still needs the integral.
Common mistake Square the mean, not the variable, in [ E ( X ) ] 2 [E(X)]^2 [ E ( X ) ] 2 . Writing E ( X 2 ) − E ( X 2 ) E(X^2) - E(X^2) E ( X 2 ) − E ( X 2 ) gives zero and is the most common slip in the topic.
The cumulative distribution function
F ( x ) = P ( X ≤ x ) = ∫ − ∞ x f ( t ) d t F(x) = P(X \le x) = \int_{-\infty}^{x} f(t)\,dt F ( x ) = P ( X ≤ x ) = ∫ − ∞ x f ( t ) d t
For the same density,
F ( x ) = 3 32 ( 2 x 2 − x 3 3 ) = 3 x 2 16 − x 3 32 , 0 ≤ x ≤ 4 F(x) = \frac{3}{32}\left(2x^2 - \frac{x^3}{3}\right) = \frac{3x^2}{16} - \frac{x^3}{32}, \qquad 0 \le x \le 4 F ( x ) = 32 3 ( 2 x 2 − 3 x 3 ) = 16 3 x 2 − 32 x 3 , 0 ≤ x ≤ 4
with F ( x ) = 0 F(x) = 0 F ( x ) = 0 below 0 and F ( x ) = 1 F(x) = 1 F ( x ) = 1 above 4. Check: F ( 4 ) = 3 − 2 = 1 F(4) = 3 - 2 = 1 F ( 4 ) = 3 − 2 = 1 ✓
Differentiating recovers the density, so f ( x ) = F ′ ( x ) f(x) = F'(x) f ( x ) = F ′ ( x ) — the two are always one integration apart.
Key result Once you have F F F , probabilities need no further integration: P ( a < X < b ) = F ( b ) − F ( a ) P(a < X < b) = F(b) - F(a) P ( a < X < b ) = F ( b ) − F ( a ) . If a question asks several probabilities from one density, find F F F first and the rest is substitution.
Common mistake A complete answer for F F F gives all three pieces: 0 before the interval, the expression on it, and 1 after it. Marks are routinely lost for quoting only the middle line.
The median m m m splits the area in half:
F ( m ) = 0.5 F(m) = 0.5 F ( m ) = 0.5
and the quartiles solve F ( Q 1 ) = 0.25 F(Q_1) = 0.25 F ( Q 1 ) = 0.25 and F ( Q 3 ) = 0.75 F(Q_3) = 0.75 F ( Q 3 ) = 0.75 .
Here symmetry gives m = 2 m = 2 m = 2 immediately, and the algebra agrees: F ( 2 ) = 12 16 − 8 32 = 0.5 F(2) = \tfrac{12}{16} - \tfrac{8}{32} = 0.5 F ( 2 ) = 16 12 − 32 8 = 0.5 ✓
For a density without symmetry the equation must be solved. With f ( x ) = 1 9 x 2 f(x) = \tfrac19 x^2 f ( x ) = 9 1 x 2 on 0 ≤ x ≤ 3 0 \le x \le 3 0 ≤ x ≤ 3 :
F ( x ) = x 3 27 = 0.5 ⟹ m = 13.5 3 = 2.38 F(x) = \frac{x^3}{27} = 0.5 \quad\Longrightarrow\quad m = \sqrt[3]{13.5} = 2.38 F ( x ) = 27 x 3 = 0.5 ⟹ m = 3 13.5 = 2.38
Exam tip Check that a median lands inside the interval. A value outside it means either F F F or the algebra has gone wrong, and the check costs a few seconds.
If X X X is equally likely to take any value between a a a and b b b , written X ∼ U ( a , b ) X \sim U(a,b) X ∼ U ( a , b ) :
f ( x ) = 1 b − a ( a ≤ x ≤ b ) , E ( X ) = a + b 2 , Var ( X ) = ( b − a ) 2 12 f(x) = \frac{1}{b-a} \quad (a \le x \le b), \qquad E(X) = \frac{a+b}{2}, \qquad \operatorname{Var}(X) = \frac{(b-a)^2}{12} f ( x ) = b − a 1 ( a ≤ x ≤ b ) , E ( X ) = 2 a + b , Var ( X ) = 12 ( b − a ) 2
A bus arrives at a time uniformly distributed between 2 and 10 minutes past the hour.
f ( x ) = 1 8 E ( X ) = 6 Var ( X ) = 64 12 = 5.33 f(x) = \tfrac18 \qquad E(X) = 6 \qquad \operatorname{Var}(X) = \frac{64}{12} = 5.33 f ( x ) = 8 1 E ( X ) = 6 Var ( X ) = 12 64 = 5.33
P ( X > 7 ) = 10 − 7 8 = 3 8 P(X > 7) = \frac{10 - 7}{8} = \frac38 P ( X > 7 ) = 8 10 − 7 = 8 3
Key result For a uniform distribution every probability is a ratio of lengths — no integration at all. The wanted width over the total width, and the answer is done.
The exponential distribution
Waiting times between random events follow
f ( x ) = λ e − λ x ( x ≥ 0 ) , F ( x ) = 1 − e − λ x , E ( X ) = 1 λ , Var ( X ) = 1 λ 2 f(x) = \lambda e^{-\lambda x} \quad (x \ge 0), \qquad F(x) = 1 - e^{-\lambda x}, \qquad E(X) = \frac1\lambda, \qquad \operatorname{Var}(X) = \frac{1}{\lambda^2} f ( x ) = λ e − λ x ( x ≥ 0 ) , F ( x ) = 1 − e − λ x , E ( X ) = λ 1 , Var ( X ) = λ 2 1
A component has a mean lifetime of 5 hours, so λ = 0.2 \lambda = 0.2 λ = 0.2 .
P ( X > 8 ) = e − 0.2 × 8 = e − 1.6 = 0.2019 P(X > 8) = e^{-0.2 \times 8} = e^{-1.6} = 0.2019 P ( X > 8 ) = e − 0.2 × 8 = e − 1.6 = 0.2019
P ( X < 3 ) = 1 − e − 0.6 = 0.4512 P(X < 3) = 1 - e^{-0.6} = 0.4512 P ( X < 3 ) = 1 − e − 0.6 = 0.4512
The median solves 1 − e − λ m = 0.5 1 - e^{-\lambda m} = 0.5 1 − e − λm = 0.5 , giving
m = ln 2 λ = 0.6931 0.2 = 3.47 hours m = \frac{\ln 2}{\lambda} = \frac{0.6931}{0.2} = 3.47 \text{ hours} m = λ ln 2 = 0.2 0.6931 = 3.47 hours
Common mistake The median is smaller than the mean of 5 — the distribution is heavily skewed to the right. For an exponential the two are never equal, and quoting one for the other is a real error rather than a rounding difference.
Key result Poisson and exponential describe the same process from two sides: the Poisson counts events in a fixed time, the exponential measures the time between them. If events occur at 3 per hour, waits are exponential with λ = 3 \lambda = 3 λ = 3 and a mean of 20 minutes.