PDF of a Sum of Uniform Random Variables
Let $X$ and $Y$ be independent, each uniformly distributed on $[0, 1]$. Find the probability density function of $S = X + Y$.
Follow-ups:
- What does the PDF of $\bar{Z} = (X + Y + W)/3$ look like, where $X, Y, W$ are i.i.d. $\text{Unif}[0,1]$?
- What happens to the distribution of $\bar{Z}_N = (X_1 + X_2 + \cdots + X_N)/N$ as $N \to \infty$?
Hints
- The PDF of a sum of independent random variables is the convolution of their individual PDFs.
- Set up $f_S(s) = \int_0^1 \mathbf{1}(0 \le s - t \le 1)\,dt$ and find the integration limits by splitting into cases $0 \le s \le 1$ and < s \le 2$.
- For the follow-ups, look up the Irwin-Hall distribution (sum of $n$ uniforms) and apply the Central Limit Theorem for the $N \to \infty$ case.
Worked Solution
How to Think About It: When you add two independent random variables, the PDF of the sum is the convolution of their individual PDFs. For uniforms on $[0,1]$, this is a particularly clean integral because each PDF is just
$ on $[0,1]$ and $0$ elsewhere. The constraints on the integration limits are what create the piecewise shape. Before computing, think about what the answer should look like: $S$ ranges from 0 to 2, it should peak at $S = 1$ (the most likely sum), and the PDF should be symmetric about 1. That points to a triangle.Quick Estimate: The mean of $S$ is $E[X] + E[Y] = 1$. The variance is
/12 + 1/12 = 1/6$, so $\text{SD}(S) \approx 0.41$. The PDF should peak at 1 with height around/0.41 \approx 2.4$ -- but since it is triangular, the peak is exactly 1 (the triangle with base 2 and height 1 has area 1). This is a useful sanity check.Approach: Compute the convolution integral $f_S(s) = \int_{-\infty}^{\infty} f_X(t) \, f_Y(s - t) \, dt$ with the appropriate indicator constraints.
Formal Solution:
$f_S(s) = \int_{-\infty}^{\infty} f_X(t) \, f_Y(s - t) \, dt = \int_0^1 \mathbf{1}(0 \le s - t \le 1) \, dt$
The integrand is 1 when both $0 \le t \le 1$ and $0 \le s - t \le 1$, i.e., $\max(0, s-1) \le t \le \min(1, s)$.
Case 1: $0 \le s \le 1$. The limits are $0 \le t \le s$, so: $f_S(s) = \int_0^s dt = s$
Case 2:
< s \le 2$. The limits are $s - 1 \le t \le 1$, so: $f_S(s) = \int_{s-1}^1 dt = 2 - s$Therefore: $f_S(s) = \begin{cases} s & 0 \le s \le 1 \\ 2 - s & 1 < s \le 2 \\ 0 & \text{otherwise} \end{cases}$
Verification: $\int_0^2 f_S(s)\,ds = \int_0^1 s\,ds + \int_1^2 (2-s)\,ds = \frac{1}{2} + \frac{1}{2} = 1$. Check.
Mean: $E[S] = \int_0^1 s \cdot s\,ds + \int_1^2 s(2-s)\,ds = \frac{1}{3} + \frac{2}{3} = 1$. Check.
Follow-up 1: The sum of three i.i.d. uniforms has a piecewise quadratic PDF (the Irwin-Hall distribution with $n = 3$), supported on $[0, 3]$ and symmetric about $3/2$. The mean of three is then supported on $[0, 1]$ with the same shape rescaled. The density becomes smoother -- it looks like a rounded bump, already starting to resemble a bell curve.
Follow-up 2: By the Central Limit Theorem, $\bar{Z}_N \to N(\mu, \sigma^2/N)$ in distribution, where $\mu = 1/2$ and $\sigma^2 = 1/12$. So $\bar{Z}_N \approx N(1/2, 1/(12N))$. The PDF concentrates around
/2$ and becomes a Gaussian spike. By $N = 12$, the normal approximation is already excellent.Answer: The PDF of $X + Y$ is the triangular distribution on $[0, 2]$: $f_S(s) = s$ for $0 \le s \le 1$ and $f_S(s) = 2 - s$ for
< s \le 2$. Adding more uniforms produces the Irwin-Hall distributions (piecewise polynomial), and by the CLT, the normalized sum converges to a Gaussian.Intuition
Convolution is the fundamental operation for sums of independent random variables, and this problem is the cleanest possible illustration. The triangular shape emerges because there are more ways to get a sum near 1 (many $(x, y)$ pairs with $x + y \approx 1$) than near 0 or 2 (only pairs near $(0,0)$ or $(1,1)$ respectively). Each additional uniform you convolve in makes the PDF smoother and more bell-shaped -- this is the Central Limit Theorem in slow motion.
In practice, this shows up constantly. The Irwin-Hall distribution (sum of $n$ uniforms) is a pedagogical stepping stone, but the deeper lesson is that convolution turns hard distributional questions into manageable integrals. The same technique applies to computing the distribution of P&L across independent bets, aggregating independent risk factors, or understanding why portfolio returns look more Gaussian than individual stock returns.