# Convolution of two Uniform random variables

We have $X \sim \mathrm{Unif}[0,2]$ and $Y \sim \mathrm{Unif}[3,4]$. The random variables $X,Y$ are independent. We define a random variable $Z = X + Y$ and want to find the PDF of $Z$ using convolution. Here is my work so far:

The definition of convolution is:

• $f_Z(z) = \int_{-\infty}^{\infty}f_X(x)f_Y(z-x)\mathrm{d} x$

We know the PDF's of $X$ and $Y$ because they are just uniform distributions. The hard part for me is finding the limits of integration. We have to solve for the constraints.

The integrand is nonzero when $3 \leq z-x \leq 4$ and when $0 \leq x \leq 2$. Together these constraints imply that $\max \{0, z-4\} \leq x \leq \min \{2, z-3 \}$.

These constraints imply that there are three cases:

• Case 1 - $z \leq 4 \implies f_Z(z) = \int_0^{z-3}$
• Case 2 - $4 \leq z \leq 5 \implies f_Z(z) = \int_{z-4}^{z-3}$
• Case 3 - $z \geq 5 \implies f_Z(z) = \int_{z-4}^{2}$

My question is how to find the bounds of $Z$ i.e. what are the possible values of $Z$? Does $Z$ run from $0 \to 6$ since it is the sum of $X+Y$ and this sum will have some value for every value $\in [0,6]$?

• "The hard part for me is finding the limits of integration" Then write down the densities correctly, that is, including the indicator functions. Here, $$f_X(x)=\tfrac12\mathbf 1_{0<x<2}\qquad f_Y(y)=\mathbf 1_{3<y<4}$$ hence $$f_Z(z)=\int f_X(x)f_Y(z-x)dx=\int\tfrac12\mathbf 1_{0<x<2}\mathbf 1_{3<z-x<4}dx=\tfrac12\int\mathbf 1_{0<x<2}\mathbf 1_{z-4<x<z-3}dx,$$ that is, for every $z$, $$f_Z(z)=\tfrac12\int_\mathbb R\mathbf 1_{\max(0,z-4)<x<\min(2,z-3)}dx=\tfrac12(\min(2,z-3)-\max(0,z-4))^+,$$ and, only now, turn to cases to identify the RHS. This way, you cannot fail. – Did Oct 19 '15 at 11:10
• @AlexanderCska "how do you evaluate min(2,z−3) and max(0,z−4)" ?? Well, by considering three cases, depending on the signs of z-5 and z-4 (what else?). – Did Jun 30 '17 at 13:11
• @Did yes but $z$ is limited by bound, that depend on $x$. $3+x\le z \le 4+x$. Are these cases obtained by setting the limits for $x$, $0 \le x \le 1$. Say $3 \le z \le 4$ and $4 \le z \le 5$ – Alexander Cska Jun 30 '17 at 13:26
• @AlexanderCska Sorry but I do not get your point. (Additionally, I am not quite sure you really read my previous comment.) Maybe ask a new question, centered around the specific problem you are facing? – Did Jun 30 '17 at 13:28
• @Did I am just confused how exactly do you get the limits of $z$, when looking for $min(2,z-3)$. You need to know the possible values of $z$ to get the minimum. – Alexander Cska Jun 30 '17 at 13:32

Instead of trying to find appropriate $z$ values at the very beginning, note that $f_X(x)$ is zero unless $0\le x\le2$. Therefore $$\int_{-\infty}^{\infty}f_X(x)f_Y(z-x)\mathrm{d} x =\int_0^2f_X(x)f_Y(z-x)\mathrm{d} x =\frac12\int_0^2 f_Y(z-x)\mathrm{d} x\ .$$ You can now substitute $t=z-x$ to get $$\int_{z-2}^z f_Y(t)\mathrm{d} t$$ - see if you can take it from here.
• Yes, $f_X(x)$ is nonzero only when $0 \leq x \leq 2$. To find the bounds of $z$, we see that $3 \leq z-x \leq 4$. But, the minimum $x$ can be is $0$ and when $x=0, z = 3$. The maximum $x$ can be is $2$ and when $x = 2$, the maximum $z$ can be is $6$. Does this all imply $3 \leq z \leq 6$? – David South Oct 18 '15 at 22:56
• Yes, to get a non-zero result from the last integral we must have $z-2\le4$ and $z\ge3$. (Sorry for the delay, I was away from my desk for an hour.) – David Oct 19 '15 at 0:04