f(x) = 1/(b − a) if a ≤ x ≤ b, and 0 otherwise
Holds for a quantity equally likely to fall anywhere between a and b, with b > a. The first row needs
two conditions at once, x ≥ a and x ≤ b, which a book writes as the one chain a ≤ x ≤ b.
Why the height is 1/(b − a)
The total probability is 1, and under a constant density it is the area of a rectangle of width b − a.
Height times width is 1, so the height is 1/(b − a). A wider interval gives a lower density.
Worked examples
a = 0, b = 10, x = 4. 0 ≤ 4 ≤ 10, so the first row: f(4) = 1/(10 − 0) = 0.1.
a = 2, b = 6, x = 3. f(3) = 1/(6 − 2) = 0.25.
a = 0, b = 5, x = 7. 7 > 5, so the first row does not apply and the last row gives 0.
a = −5, b = 5, x = 0. f(0) = 1/(5 − (−5)) = 0.1. The width is 10, not 5.
From density to probability
The probability that X lands in an interval [c, d] inside [a, b] is the area of the rectangle over it,
(d − c) · 1/(b − a). That is the
probability for the uniform distribution.
Common mistakes
- Dividing by b instead of b − a. That holds only when a = 0.
- Reading f(x) as a probability. With b − a < 1 the density is above 1, which no probability can be.
- Leaving out the second row. A constant 1/(b − a) for every x has no finite area at all.