[Math] Convolution of discrete uniform distributions

convolutionprobabilitysummation

For two independent, discrete, uniformly distributed random variables $X$ and $Y$, I wish to obtain the distribution of the sum $Z=X+Y$. I have the densities:
$$f_X(x)=\left\{\begin{matrix} \dfrac{1}{m+1},\;x\in [0,m]\\0,\;\text{otherwise}\end{matrix}\right.$$
$$f_Y(y)=\left\{\begin{matrix}\dfrac{1}{n+1},y\in [0,n]\\0,\;\text{otherwise}\end{matrix}\right.$$
$$f_Z(z)=\sum_{x=-\infty}^\infty f_X(x)f_Y(z-x)$$

I know that $f_Z(z)$ should look like a trapezoidal distribution. However, without knowing this, is it possible to calculate that distribution in a convenient way symbolically?

I'm finding it tedious to keep track of summation limits and such. For instance, separate cases for $m>n$ and $m<n$. I was wondering if there is a natural or intelligent notation for this, since this problem seems to be just so symmetric w.r.t $\,X$ and $Y$.

To make the question concrete: what is the most natural, symbolic/non-graphical way to solve for $f_Z(z)$? (I don't mind using another convolution formula if there is one, by the way)

Any help would be appreciated. Thanks.

Best Answer

If $X$ and $Y$ are independent integer-valued random variables uniformly distributed on $[0,m]$ and $[0,n]$ respectively, then the probability mass function (pmf) of $Z = X+Y$ has a trapezoidal shape as you have already noted, and Khashaa has written down for you. The answer can be summarized as follows, but whether this is more compact or appealing is perhaps a matter of taste.

$$P\{Z=k\} = \begin{cases}\displaystyle \frac{k+1}{(m+1)(n+1)},& k \in [0, \min(m,n)-1],\\ \\ \displaystyle\frac{1}{\max(m,n)+1},& k \in [\min(m,n), \max(m,n)],\\ \\ \displaystyle\frac{(m+n)-(k-1)}{(m+1)(n+1)}, & k \in [\max(m,n)+1, m+n].\end{cases}$$

To my mind, the easiest way of solving this problem, and indeed a way that works for dependent and non-uniformly distributed random variables as well, is to write down the joint pmf of $(X,Y)$ as a rectangular array or matrix of $m$ columns (numbered $0, 1, \ldots , m$ from left to right) and $n$ rows (numbered $n, n-1, \ldots, 0$ from top to bottom. Then, $P\{X+Y=k\}$ is the sum of the entries on the $k$-th diagonal of this array. For the case of constant entries, we get the nice trapezoidal shape that the OP has noticed.

Related Question