Tutorials › Statistical Theory I - Probability and Distribution Theory › Sums of Unequal Uniform Variables

Joint Laws of Independent Variables · Tutorial 283 of 994

Sums of Unequal Uniform Variables

Learn to derive and use the piecewise density of a sum of independent uniform variables whose support intervals have unequal widths or different locations.

Intermediate 9 min read

What You'll Learn

  • Express the convolution density as the length of an overlap between intervals.
  • Find the support and the points where the density changes form.
  • Derive the rising, constant, and falling portions of the density.
  • Apply the formula to uniforms with different locations and widths.
  • Check a proposed density by examining its endpoints, continuity, and total area.

Why the Overlap Determines the Density

For two independent uniform random variables, the density of their sum depends on how many pairs of values can produce each possible total. Near the smallest possible sum, there are few such pairs; as the sum increases, the available combinations grow. If one uniform interval is wider than the other, that growth eventually gives way to a range where the overlap stays constant, before it shrinks near the largest possible sum.

The continuous convolution formula turns this picture into a calculation. The most useful geometric quantity is the length of the overlap between one variable’s support and a shifted version of the other’s support. Tracking that length gives the density, including its support, change points, and peak.

Definition and General Overlap Formula

Definition: If \(X\) and \(Y\) are independent with \(X\sim\operatorname{Unif}(a,b)\) and \(Y\sim\operatorname{Unif}(c,d)\), where \(a<b\) and \(c<d\), then \(S=X+Y\) has density \[ f_S(s)=\frac{\max\!\left(0,\ \min(b,s-c)-\max(a,s-d)\right)}{(b-a)(d-c)}. \] The numerator is the length of the intersection \([a,b]\cap[s-d,s-c]\). The density is zero outside \([a+c,b+d]\).

To see the intervals in this expression, fix a possible sum \(s\). If \(X=x\), then \(Y\) must equal \(s-x\). The restriction \(c\le s-x\le d\) is equivalent to \(s-d\le x\le s-c\). Thus the allowed values of \(x\) lie in both \([a,b]\) and \([s-d,s-c]\). Their overlap length is exactly the numerator above.

A uniform density is constant on its support and zero elsewhere. In the convolution integral, the product of the two constant densities is \(1/((b-a)(d-c))\) wherever both support restrictions hold. Integrating that constant over the allowed \(x\)-interval gives the overlap formula.

The Piecewise Shape

It is convenient to shift the variables to start their supports at zero. Let \(p=b-a\), \(q=d-c\), \(U=X-a\), \(V=Y-c\), and \(T=U+V\). Then \(U\sim\operatorname{Unif}(0,p)\), \(V\sim\operatorname{Unif}(0,q)\), and \(S=a+c+T\). The widths \(p\) and \(q\) determine the shape; the locations \(a\) and \(c\) simply shift it.

Suppose first that \(p\le q\). The overlap formula, or equivalently the convolution integral, gives the following result.

Theorem: If \(U\) and \(V\) are independent, \(U\sim\operatorname{Unif}(0,p)\), \(V\sim\operatorname{Unif}(0,q)\), and \(0<p\le q\), then \(T=U+V\) has density \[ f_T(t)= \begin{cases} 0, & t<0,\\ \dfrac{t}{pq}, & 0\le t\le p,\\ \dfrac{1}{q}, & p\le t\le q,\\ \dfrac{p+q-t}{pq}, & q\le t\le p+q,\\ 0, & t>p+q. \end{cases} \] If \(p=q\), the constant portion has zero length: the density rises to its peak and then falls.

The formulas agree at the boundaries. At \(t=p\), both the rising and constant formulas equal \(1/q\); at \(t=q\), the constant and falling formulas also equal \(1/q\). Values assigned at individual boundary points do not affect probabilities, but these matches make the piecewise description continuous.

Deriving the Formula

For \(0\le t\le p+q\), the convolution integral for the sum of the two independent variables is \(f_T(t)=\int_{-\infty}^{\infty} f_U(u)f_V(t-u)\,du\). The integrand is \(1/(pq)\) when \(u\in[0,p]\) and \(t-u\in[0,q]\), and is zero otherwise. The second condition is equivalent to \(u\in[t-q,t]\). Therefore,

$$ f_T(t)=\frac{1}{pq}\,\operatorname{length}\bigl([0,p]\cap[t-q,t]\bigr). $$

This integral is the overlap length divided by \(pq\). Since \(p\le q\), the overlap has three forms:

1
Rising edge: \(0\le t\le p\).
Here \(t-q\le 0\) and \(t\le p\), so the intersection runs from \(0\) to \(t\). Its length is \(t\), giving \(f_T(t)=t/(pq)\).
2
Constant section: \(p\le t\le q\).
Here \(t-q\le 0\) and \(t\ge p\), so \([0,p]\) lies within \([t-q,t]\). The overlap length is \(p\), giving \(f_T(t)=p/(pq)=1/q\).
3
Falling edge: \(q\le t\le p+q\).
Here \(t-q\ge 0\) and \(t\ge p\), so the intersection runs from \(t-q\) to \(p\). Its length is \(p-(t-q)=p+q-t\), giving \(f_T(t)=(p+q-t)/(pq)\).

For \(t<0\), the intervals cannot overlap because \([t-q,t]\) lies entirely to the left of zero. For \(t>p+q\), it lies entirely to the right of \([0,p]\). Thus the density vanishes outside \([0,p+q]\), completing the derivation.

If \(q<p\), the same reasoning applies after exchanging the roles of \(U\) and \(V\). Equivalently, let \(m=\min(p,q)\) and \(M=\max(p,q)\). The rising section has width \(m\), the constant section has width \(M-m\), and the falling section has width \(m\). The peak height is \(1/M\).

Worked Examples

Worked Example: A Shifted Trapezoidal Density

Let \(X\sim\operatorname{Unif}(1,4)\) and \(Y\sim\operatorname{Unif}(2,7)\) be independent. Find the density of \(S=X+Y\).

The interval widths are \(p=4-1=3\) and \(q=7-2=5\), and the sum is shifted by \(1+2=3\). The support is \([1+2,4+7]=[3,11]\). For \(T=(X-1)+(Y-2)\), the formula with \(p=3\) and \(q=5\) gives a rising section on \([0,3]\), a constant section on \([3,5]\), and a falling section on \([5,8]\). Shifting by 3 yields

$$ f_S(s)= \begin{cases} \dfrac{s-3}{15}, & 3\le s\le 6,\\ \dfrac{1}{5}, & 6\le s\le 8,\\ \dfrac{11-s}{15}, & 8\le s\le 11,\\ 0, & \text{otherwise}. \end{cases} $$

At \(s=6\), the rising expression is \(3/15=1/5\), matching the plateau. At \(s=8\), the falling expression is \(3/15=1/5\), also matching the plateau. The density starts and ends at zero, as required at the support endpoints.

Worked Example: A Shorter First Uniform Interval

Let \(X\sim\operatorname{Unif}(-2,3)\) and \(Y\sim\operatorname{Unif}(1,3)\) be independent. Find the density of \(S=X+Y\), then calculate \(P(S\le 2)\).

The widths are 5 and 2, so the smaller width is \(p=2\) and the larger is \(q=5\). The minimum and maximum possible sums are \(-2+1=-1\) and \(3+3=6\). The change points are \(-1+2=1\) and \(-1+5=4\). The shifted density is therefore

$$ f_S(s)= \begin{cases} \dfrac{s+1}{10}, & -1\le s\le 1,\\ \dfrac{1}{5}, & 1\le s\le 4,\\ \dfrac{6-s}{10}, & 4\le s\le 6,\\ 0, & \text{otherwise}. \end{cases} $$

To find \(P(S\le2)\), integrate the rising section from \(-1\) to 1 and the constant section from 1 to 2:

$$ \begin{aligned} P(S\le2) &=\int_{-1}^{1}\frac{s+1}{10}\,ds+\int_{1}^{2}\frac{1}{5}\,ds\\ &=\left[\frac{(s+1)^2}{20}\right]_{-1}^{1}+\frac{1}{5}(2-1)\\ &=\frac{4}{20}-0+\frac{1}{5} =\frac{2}{5}. \end{aligned} $$

The first area is \(1/5\), the area of a triangle of base 2 and height \(1/5\); the second is another \(1/5\). Their sum is \(2/5\).

Worked Example: Using the Plateau to Find an Interval Probability

Let \(X\sim\operatorname{Unif}(0,4)\) and \(Y\sim\operatorname{Unif}(10,12)\) be independent. Find \(P(12.5\le X+Y\le14.5)\).

The widths are 4 and 2, and the support of \(S=X+Y\) is \([10,16]\). After shifting by 10, the widths are \(p=2\) and \(q=4\). Hence the density rises from 10 to 12, is constant from 12 to 14, and falls from 14 to 16:

$$ f_S(s)= \begin{cases} \dfrac{s-10}{8}, & 10\le s\le 12,\\ \dfrac{1}{4}, & 12\le s\le 14,\\ \dfrac{16-s}{8}, & 14\le s\le 16,\\ 0, & \text{otherwise}. \end{cases} $$

The requested probability is the area from 12.5 to 14 plus the area from 14 to 14.5. The first part is a rectangle. The second is a trapezoid whose endpoint heights are \(f_S(14)=1/4\) and \(f_S(14.5)=1.5/8=3/16\):

$$ \begin{aligned} P(12.5\le S\le14.5) &=(14-12.5)\frac{1}{4} +(14.5-14)\frac{\frac14+\frac{3}{16}}{2}\\ &=\frac{3}{8}+\frac{1}{2}\cdot\frac{7}{32}\\ &=\frac{3}{8}+\frac{7}{64} =\frac{31}{64}. \end{aligned} $$

The density is continuous at 14, and the two areas are \(24/64\) and \(7/64\), respectively, so the stated probability is \(31/64\).

Normalization and Checks

A piecewise expression is not a valid density merely because its formula looks plausible. It must be nonnegative and have total integral one. For \(p\le q\), the rising and falling portions each have triangular area \(\tfrac12 p\cdot(1/q)=p/(2q)\), while the plateau has area \((q-p)/q\). Therefore,

$$ \int_{-\infty}^{\infty} f_T(t)\,dt =\frac{p}{2q}+\frac{q-p}{q}+\frac{p}{2q} =1. $$

This also covers \(p=q\), when the plateau has width zero. The density is nonnegative throughout its support, equals zero at the two support endpoints, and has peak height \(1/q=1/\max(p,q)\). These provide quick checks on a calculation.

A common mistake is to assume every sum of two uniforms has a triangular density. That is true when the interval widths are equal, but not when they differ: the longer interval produces a constant-density section whose length is the difference between the widths. Another error is to use the sum of the widths as the peak denominator. The peak is \(1/\max(p,q)\), not \(1/(p+q)\), because the maximum overlap length is the shorter width and the product of the original density heights is \(1/(pq)\).

Key takeaway: The density of a sum of two independent uniform variables is the overlap length of their support intervals divided by the product of their widths. The widths determine the rising, constant, and falling sections; the interval locations determine where those sections occur.

Check Your Understanding

Use the overlap interpretation and the piecewise formula to answer these questions.

  1. If the interval widths are 2 and 6, what is the height and width of the constant section?
  2. For independent uniforms on \([3,5]\) and \([-1,4]\), what is the support of their sum and where are the density’s change points?
  3. Why is the overlap length zero for sums below the sum of the two lower endpoints?
  4. When the two uniform intervals have the same width, what happens to the constant section?
  5. State two checks that can help detect an incorrect piecewise density for a sum of independent uniform variables.