Tutorials › Statistical Theory I - Probability and Distribution Theory › Triangular Densities from Uniform Sums

Joint Laws of Independent Variables · Tutorial 282 of 994

Triangular Densities from Uniform Sums

See how the overlap of two interval supports in the convolution integral determines the triangular density of a sum of two identically distributed uniform variables.

Intermediate 9 min read

What You'll Learn

  • Set up the convolution integral for two independent uniforms on the same interval.
  • Find the overlap interval that determines the density at each possible sum.
  • Derive the triangular density, including its support, peak, and symmetry.
  • Obtain and use the corresponding piecewise cumulative distribution function.
  • Check normalization and avoid confusing the sum's density with a uniform density.

Why a Uniform Sum Is Not Uniform

Let \(X\) and \(Y\) be independent and each uniform on the same interval. Their individual densities are constant, but their sum is not: values near the middle of the possible range can be produced by more pairs \((X,Y)\) than values near either endpoint. The convolution integral measures exactly how many such pairs contribute at each sum.

Write the common interval as \([a,b]\), where \(a<b\), and its length as \(d=b-a\). We will find the density of \(S=X+Y\) by calculating the overlap length inside the convolution integral. The result is a triangular density, rising linearly to its midpoint and then falling linearly.

Setup: Suppose \(X\) and \(Y\) are independent, with \(X\sim \operatorname{Uniform}(a,b)\) and \(Y\sim \operatorname{Uniform}(a,b)\). Their common density is \(f(x)=1/d\) for \(a<x<b\) and \(0\) otherwise, where \(d=b-a>0\). Values assigned to a density at the endpoints do not affect its distribution.

Turning the Convolution Integral into an Overlap Length

For independent continuous random variables with densities \(f_X\) and \(f_Y\), the continuous convolution formula gives the density of \(S=X+Y\) as \(f_S(s)=\int_{-\infty}^{\infty} f_X(x)f_Y(s-x)\,dx\). Here, each density is \(1/d\) only when its argument lies in \((a,b)\). Thus the integrand is \(1/d^2\) exactly when both \(x\) and \(s-x\) lie in that interval, and is zero otherwise.

The two conditions on \(x\) can be written together:

$$ a<x<b,\qquad a<s-x<b \quad\Longleftrightarrow\quad x\in(a,b)\cap(s-b,s-a). $$

Consequently, the integral is the constant \(1/d^2\) multiplied by the length of this intersection. If the intersection is empty, the density is zero. The sum can only lie between \(2a\) and \(2b\). Within that range, the overlap grows until \(s=a+b\), then shrinks.

Theorem: Under the setup above, a density of \(S=X+Y\) is $$ f_S(s)= \begin{cases} \dfrac{s-2a}{d^2}, & 2a\le s\le a+b,\\[6pt] \dfrac{2b-s}{d^2}, & a+b<s\le 2b,\\[6pt] 0, & \text{otherwise}. \end{cases} $$ Equivalently, \(f_S(s)=d^{-2}\max\{0,\,d-|s-(a+b)|\}\). The formulas agree at \(s=a+b\); endpoint values may be changed without changing the distribution.

To justify the result directly, the joint density of \((X,Y)\) is \(d^{-2}\) on the square \((a,b)^2\) and zero outside. In the change of variables \(s=x+y\), \(x=x\), the absolute Jacobian determinant is \(1\). For any Borel set \(A\subseteq\mathbb{R}\), integration and this change of variables give

$$ \begin{aligned} P(S\in A) &=\int_{\mathbb{R}}\int_{\mathbb{R}} \mathbf{1}_{A}(x+y) f_X(x)f_Y(y)\,dy\,dx\\ &=\int_A\left(\int_{\mathbb{R}}f_X(x)f_Y(s-x)\,dx\right)ds. \end{aligned} $$

The integrands are nonnegative, so changing the order of integration is justified by Tonelli's theorem. This establishes the convolution expression as a density. In the present case, its inner integral is \(d^{-2}\) times the length of \((a,b)\cap(s-b,s-a)\). For \(2a\le s\le a+b\), that intersection has endpoints \(a\) and \(s-a\), so its length is \(s-2a\). For \(a+b\le s\le2b\), its endpoints are \(s-b\) and \(b\), so its length is \(2b-s\). Outside \([2a,2b]\) it is empty. Substitution yields the stated density. \(\square\)

Shape, Support, and Cumulative Distribution Function

The support is \([2a,2b]\), because neither variable can be below \(a\) or above \(b\). The apex is at \(s=a+b\), where the overlap has its maximum length \(d\). Therefore the maximum density is \(d/d^2=1/d\). The two sides have equal slopes in magnitude, so the density is symmetric about \(a+b\).

Integrating the density gives the CDF \(F_S(t)=P(S\le t)\). On the lower half, the area up to \(t\) is a triangle with base and height both \(t-2a\). On the upper half, it is easier to subtract the small triangular area above \(t\) from one. Thus

$$ F_S(t)= \begin{cases} 0, & t<2a,\\[4pt] \dfrac{(t-2a)^2}{2d^2}, & 2a\le t\le a+b,\\[8pt] 1-\dfrac{(2b-t)^2}{2d^2}, & a+b<t\le 2b,\\[8pt] 1, & t>2b. \end{cases} $$

For example, the lower-half expression follows by integrating \((s-2a)/d^2\) from \(2a\) to \(t\): \(\int_{2a}^{t}(s-2a)d^{-2}\,ds=(t-2a)^2/(2d^2)\). For \(a+b<t\le2b\), the remaining upper-tail area is \(\int_t^{2b}(2b-s)d^{-2}\,ds=(2b-t)^2/(2d^2)\), giving the upper-half expression by subtraction from one.

Worked Example: The Sum of Two Uniform Variables on \([0,1]\)

Let \(X\) and \(Y\) be independent \(\operatorname{Uniform}(0,1)\) random variables, and set \(S=X+Y\). Here \(a=0\), \(b=1\), and \(d=1\). The possible sums range from \(0\) to \(2\), and the midpoint is \(1\).

For \(0\le s\le1\), the allowed values of \(x\) satisfy \(0<x<s\), so the overlap length is \(s\). For \(1<s\le2\), they satisfy \(s-1<x<1\), so the overlap length is \(2-s\). Since \(d^2=1\), the density is

$$ f_S(s)= \begin{cases} s, & 0\le s\le1,\\ 2-s, & 1<s\le2,\\ 0, & \text{otherwise}. \end{cases} $$

As a check, the total area is \(\int_0^1s\,ds+\int_1^2(2-s)\,ds=\tfrac12+\tfrac12=1\). The probability that the sum is at most \(1/2\) is \(F_S(1/2)=(1/2)^2/2=1/8\).

Worked Example: The Sum of Two Uniform Variables on \([2,5]\)

Suppose \(X\) and \(Y\) are independent \(\operatorname{Uniform}(2,5)\) variables. The interval length is \(d=3\), the sum ranges from \(4\) to \(10\), and the midpoint is \(7\). Substituting these values into the density formula gives

$$ f_S(s)= \begin{cases} \dfrac{s-4}{9}, & 4\le s\le7,\\[5pt] \dfrac{10-s}{9}, & 7<s\le10,\\[5pt] 0, & \text{otherwise}. \end{cases} $$

At the midpoint, the density is \((7-4)/9=1/3\), which also equals \(1/d\). To find \(P(S\le6)\), use the lower-half CDF because \(6\le7\): \(P(S\le6)=(6-4)^2/(2\cdot9)=4/18=2/9\).

The area check gives \(\int_4^7(s-4)/9\,ds=9/18=1/2\) and \(\int_7^{10}(10-s)/9\,ds=9/18=1/2\). The two pieces therefore integrate to \(1\), as a density must.

Worked Example: A Probability on the Descending Side

Let \(X\) and \(Y\) be independent \(\operatorname{Uniform}(-1,1)\) variables. Then \(d=2\), and \(S=X+Y\) has support \([-2,2]\) with midpoint \(0\). On the upper half, its density is \(f_S(s)=(2-s)/4\) for \(0<s\le2\). Find \(P(1/2<S<3/2)\).

Both bounds are on the descending side, so integrate that density:

$$ \begin{aligned} P(1/2<S<3/2) &=\int_{1/2}^{3/2}\frac{2-s}{4}\,ds\\ &=\frac14\left[2s-\frac{s^2}{2}\right]_{1/2}^{3/2}\\ &=\frac14\left[\left(3-\frac98\right)-\left(1-\frac18\right)\right]\\ &=\frac14\left(\frac{15}{8}-\frac{7}{8}\right) =\frac14. \end{aligned} $$

The same result follows from the CDF: \(F_S(3/2)=1-(2-3/2)^2/8=31/32\), while \(F_S(1/2)=1-(2-1/2)^2/8=23/32\). Their difference is \(8/32=1/4\). Since \(S\) has a density, including or excluding either endpoint does not change this probability.

Why the Overlap Argument Matters

The convolution is not constant across the support because the length of the overlap changes with \(s\). Near \(2a\), only a short interval of values of \(x\) can pair with \(s-x\) inside \([a,b]\). At \(a+b\), every \(x\) in the common interval has a valid partner. Near \(2b\), the overlap shortens again. The product of the two densities stays at \(1/d^2\) where both are nonzero; it is the length of the region being integrated that creates the triangle.

This gives a useful check on any proposed answer. The support must be \([2a,2b]\), the peak must occur at \(a+b\), and the peak height must be \(1/d\). The two triangular halves each have area \(1/2\), so the total probability is one.

  • Common mistake: treating the sum as uniform. The fact that \(X\) and \(Y\) each have constant density does not imply their sum has constant density. The overlap length varies with the proposed sum.
  • Common mistake: multiplying densities but forgetting the integration interval. The integrand is \(1/d^2\), but the density of \(S\) is that value times the overlap length, not simply \(1/d^2\).
  • Common mistake: using the wrong support. If each variable lies in \([a,b]\), their sum lies in \([2a,2b]\), not \([a,b]\).
Key takeaway: For two independent uniforms on the same interval, the convolution density equals the overlap length of the two allowed intervals divided by \(d^2\). That overlap increases linearly to its maximum \(d\), then decreases linearly, giving a symmetric triangular density.

Check Your Understanding

Use the overlap interval and the piecewise density to answer these questions.

  1. If \(X\) and \(Y\) are independent \(\operatorname{Uniform}(3,7)\), what are the support, midpoint, and maximum density of \(X+Y\)?
  2. For two independent \(\operatorname{Uniform}(a,b)\) variables, describe the interval of \(x\)-values contributing to the convolution at a fixed sum \(s\).
  3. Why does the density increase linearly for \(2a\le s\le a+b\)?
  4. For independent \(\operatorname{Uniform}(0,1)\) variables, use the CDF to calculate \(P(X+Y\le 3/2)\).
  5. Explain why the value of a density at a single endpoint does not change the distribution.