Why Sums of Uniform Variables Have Piecewise Densities
A uniform random variable has constant density across its interval, but the sum of two such variables does not. Near the lower end of the possible sum, only a small part of the two-variable range can produce that value. Near the middle, many more pairs can produce it. The resulting density rises and then falls, forming a triangle when the variables are uniform on the same interval.
This tutorial derives that triangular shape and extends the same geometric reasoning to the sum of \(n\) independent uniform variables on a common interval. The extension is called the Irwin–Hall distribution for the sum of \(n\) independent \(U(0,1)\) variables. The central tasks are to identify the support, determine which pieces of the density apply, and use the correct scaling when the common interval is not \(0\) to \(1\).
Two Uniform Variables: The Triangular Density
Begin with independent \(X,Y\sim U(0,1)\), and let \(S=X+Y\). Each variable has density \(1\) on \((0,1)\), so the joint density of \((X,Y)\) is \(1\) on the unit square and \(0\) outside it. The sum can range from \(0\) to \(2\). For a fixed sum \(s\), the possible pairs lie along the line \(x+y=s\). The amount of this line that remains inside the square grows up to \(s=1\), then shrinks.
More formally, the density of a sum of independent continuous variables is obtained by convolution. For \(0<s<2\),
The integrand is \(1\) only when both \(0<x<1\) and \(0<s-x<1\). Thus the integration range is the overlap of \(0<x<1\) and \(s-1<x<s\). For \(0<s<1\), this overlap is \(0<x<s\), with length \(s\). For \(1<s<2\), it is \(s-1<x<1\), with length \(2-s\). Outside \((0,2)\), there is no overlap.
The value at the single joining point \(s=1\), or at either endpoint, does not affect probabilities for a continuous random variable. The density increases from \(0\) to \(1\) on the first interval and decreases from \(1\) to \(0\) on the second. As a check, the area under the density is
Worked Example: A Lower-Tail Probability for Two Standard Uniforms
Let \(X\) and \(Y\) be independent \(U(0,1)\) variables. Find \(P(X+Y\le 0.5)\). State the method and avoid treating the sum as uniform.
Method. Set \(S=X+Y\). Since \(0.5\) lies in the rising part of the triangular density, \(f_S(s)=s\) for \(0<s<1\). Therefore,
The same result follows from geometry: the event is a right triangle in the unit square with legs of length \(0.5\), so its area is \(\frac12(0.5)(0.5)=0.125\). The density integrates to one over its full support, and the event occupies only a small lower corner of the square. Common mistake avoided: the sum is not uniform on \((0,2)\); assuming a constant density would give \(0.25\), which is twice the correct probability.
Scaling to Any Common Interval
If \(X,Y\) are independent \(U(a,b)\) variables, where \(a<b\), write \(L=b-a\). Each variable can be expressed as \(a+L U\), where \(U\sim U(0,1)\). Consequently, \(X+Y=2a+L(U_1+U_2)\), with \(U_1,U_2\) independent \(U(0,1)\). Transforming the standard triangular density gives support from \(2a\) to \(2b\), with its peak at \(a+b\):
The denominator is \((b-a)^2\), not \(b-a\): the sum's density has units inverse to the sum's measurement scale. One way to verify the formula is to integrate each triangular half. Each half has base \(b-a\) and height \(1/(b-a)\), so each has area \(1/2\); together they have area \(1\).
Worked Example: A Probability on a Shifted and Scaled Interval
A hypothetical model assigns independent uniform values \(X,Y\sim U(2,6)\), measured in thousands of dollars. Find \(P(6<X+Y<9)\). Use the scaled triangular density and check the probability against the support and total area.
Method. Here \(a=2\), \(b=6\), and \(b-a=4\). The sum has support \((4,12)\) and peak at \(a+b=8\). The interval from \(6\) to \(9\) crosses the peak, so split the probability at \(8\):
On the rising section,
On the falling section,
The two pieces give \(\frac38+\frac7{32}=\frac{12}{32}+\frac7{32}=\frac{19}{32}=0.59375\), or \(0.5938\) to four decimal places. This is between \(0\) and \(1\), and the interval is inside the support \((4,12)\). Common mistake avoided: applying the standard \(U(0,1)\) density without shifting and scaling would put the support in the wrong place and use the wrong density height.
Several Standard Uniforms: The Irwin–Hall Density
For \(n\) independent \(U(0,1)\) variables, define \(T_n=X_1+\cdots+X_n\). Its support is \((0,n)\). The density is polynomial on each interval between successive integers, because as the possible sum increases past an integer, additional parts of the unit cube become available.
A useful derivation starts with the cumulative distribution function. In the nonnegative orthant, the region \(x_1+\cdots+x_n\le t\) has volume \(t^n/n!\) for \(t>0\). To restrict this region to the unit cube, exclude points for which one or more coordinates exceed \(1\). If a specified set of \(k\) coordinates exceeds \(1\), subtract \(1\) from each of those coordinates. The remaining region has volume \((t-k)^n/n!\) when \(t>k\), and has zero volume when \(t\le k\). Inclusion-exclusion over the choices of coordinates therefore gives the CDF below. Here \((z)_+=\max(z,0)\).
This volume argument uses independence and the fact that the joint density is \(1\) throughout the unit cube. Differentiating on each open interval between integers gives the density. Terms with \(k>t\) are zero, so for \(0<t<n\),
At an integer boundary, a newly included term is zero at the instant it enters, so the expression gives the same continuous density there for \(n\ge2\). Outside the support the density is zero. This is a piecewise-polynomial formula, not a single polynomial across the whole support. For example, when \(n=3\), it becomes
The middle expression comes directly from \(\frac12[t^2-3(t-1)^2]\); the last comes from \(\frac12[t^2-3(t-1)^2+3(t-2)^2]\). The density is symmetric about \(1.5\), as expected because replacing each \(X_i\) by \(1-X_i\) changes the sum to \(3-T_3\).
For \(n\) independent \(U(a,b)\) variables, let \(L=b-a\). Their sum is \(na+LT_n\), so the corresponding density is \(f_{T_n}((s-na)/L)/L\), on \(na<s<nb\). The factor \(1/L\) is the density adjustment for the change of scale.
Worked Example: A Probability for Three Standard Uniforms
Let \(X_1,X_2,X_3\) be independent \(U(0,1)\) variables and \(T=X_1+X_2+X_3\). Find \(P(1.5<T<2.5)\). Use the CDF formula, show each piece, and avoid applying a single polynomial beyond its interval.
Method. For \(1<t<2\), the CDF has the terms \(k=0,1\):
Thus,
For \(2<t<3\), the \(k=2\) term must also be included:
Therefore,
Subtracting the two CDF values gives
The probability is \(0.4792\) to four decimal places. The interval lies inside the support \((0,3)\), and the result is consistent with symmetry about \(1.5\): the probability from \(1.5\) to \(2.5\) equals the probability from \(0.5\) to \(1.5\). Common mistake avoided: using the \(1<t<2\) CDF expression at \(t=2.5\) omits the inclusion-exclusion term for two coordinates exceeding \(1\).
Common Exam Traps and a Reliable Procedure
The main challenge is not integration itself; it is choosing the correct region or formula before integrating. A sum of uniforms is not uniform merely because each summand is uniform. Also, the density changes at the midpoint for two variables, and at integer thresholds for the standard sum of several variables. A formula from one piece must not be extended beyond that piece.
Confirm that the variables are independent and share the stated uniform interval. For \(n\) variables on \((a,b)\), the sum lies between \(na\) and \(nb\).
For a common interval \((a,b)\), subtract \(a\) from each variable and divide by \(b-a\). Track the resulting sum and density scale.
For two variables, split at the midpoint. For \(n\) standard uniforms, split at integer values and include every term whose threshold has been passed.
Integrate the relevant density or subtract CDF values. Verify that the event lies in the support and that the final probability is between zero and one.
When using the geometric argument for two variables, the density at a sum \(s\) is the length of the allowed overlap in the convolution integral, multiplied by the product of the individual densities. The overlap length is not the same for every \(s\). For more variables, the inclusion-exclusion formula accounts for the cube boundaries that create the successive polynomial pieces.
Check Your Understanding
For each problem, identify the applicable support and density piece before calculating.
- Let \(X,Y\) be independent \(U(0,1)\) variables. Find \(P(X+Y>1.4)\). (Answer: \(0.1800\))
- Let \(X,Y\) be independent \(U(10,14)\) variables. Find the density of \(X+Y\) at \(25\). (Answer: \(3/16=0.1875\))
- Let \(X_1,X_2,X_3\) be independent \(U(0,1)\) variables. Find \(P(0.5<X_1+X_2+X_3<1.5)\). (Answer: \(23/48=0.4792\), to four decimal places)
- Let \(X_1,\ldots,X_4\) be independent \(U(0,1)\) variables. Find the density of their sum at \(1.5\). (Answer: \(23/48=0.4792\), to four decimal places)
- Let \(X_1,X_2,X_3\) be independent \(U(-1,1)\) variables. Find \(P(-1<X_1+X_2+X_3<1)\). (Answer: \(2/3=0.6667\), to four decimal places)