# Find the distribution of $Z = X + Y$ where $X$ and $Y$ are uniformly distributed random variables

Problem:
Let $X$ and $Y$ be independent r.v.'s each uniformly distributed over $(0,1)$. Let $Z = X + Y$. Find the CDF of $Z$.
I want to find $P(z <= z_0)$. There are two non-trivial cases to consider. The first is when $0 <= z_0 <= 1$ and the second is when $1< z_0 < 2$.
case 1: \begin{eqnarray*} P(z \leq z_0) &=& \int_0^{z_0} \int_{0}^{z_0 - x} dy \,\, dx = \int_0^{z_0} = z_0 - x \, dx \\ P(z \leq z_0) &=& z_0 x - \frac{x^2}{2} \Big|_{0}^{z_0} = {z_0}^2 - \frac{ {z_0}^2 }{2} \\ P(z \leq z_0) &=& \frac{ {z_0}^2 }{2} \\ F(z) &=& \frac{ {z}^2 }{2} \\ f(z) &=& z \\ \end{eqnarray*}
case 2: \begin{eqnarray*} P(z \leq z_0) + P(z \geq z_0) &=& 1 \\ P(z \leq z_0) &=& 1 - P(z \geq z_0) \\ \end{eqnarray*} Now to find $P(z \geq z_0)$ we consider the triangle, whose points are $(z_0-1,1)$, $(1,1)$ and $(1,z_0-1)$. \begin{eqnarray*} P(z \geq z_0) &=& \int_{z_0-1}^{1} \int_{z_0 - x}^{1} \,\, dy \, \, dx = \int_{z_0-1}^{1} 1 - z_0 + x \, \, dx \\ P(z \geq z_0) &=& (1 - z_0)x + \frac{x^2}{2} \Big|_{z_0 - 1}^{1} \\ P(z \geq z_0) &=& 1 - z_0 + \frac{1}{2} - (1-z_0)(z_0 - 1) - \frac{(z_0 - 1)^2}{2} \\ P(z \geq z_0) &=& 1 - z_0 + \frac{1}{2} + (1-z_0)^2 - \frac{(z_0 - 1)^2}{2}\\ P(z \geq z_0) &=& 1 - z_0 + \frac{1}{2} + \frac{(z_0 - 1)^2}{2} \\ P(z \geq z_0) &=& -z_0 + \frac{3}{2} + \frac{z_0^2 - 2z_0 + 1}{2} \\ P(z \geq z_0) &=& \frac{z_0^2}{2} - 2z_0 + 2 \\ F(z) &=& 1 - ( \frac{z_0^2}{2} - 2z_0 + 2 ) = 1 - \frac{z_0^2}{2} + 2z_0 - 2 \\ F(z) &=& -\frac{z_0^2}{2} + 2z_0 - 1 \\ \end{eqnarray*} For case 2, the book gets: $F_z(z) = 1 - \frac{(2-z)^2}{2}$ but algebra will show that they are the same.
How to find the CDF of the sum of independent uniformly distributed random variables?
However, that is done using the convolution. I would like to do it without the convolution which is what I have done. I have a feeling that I just made a stupid mistake but I am not sure.
Thanks
Bob

• In part 2 the triangle is a right triangle with length of the legs $h=|2-z_0|$, so instead of doing those cumbersome and error integrals you could just conclude that its area is $h^2/2$, wouldn't that be easier? – flawr Sep 22 '17 at 14:59
• @flawr Your method is easier in this case, but it does not work in the general case. I would like to be able to do this problem using a double integral for educational purposes.. – Bob Sep 22 '17 at 17:47
• This mayyyy have been done on math SE beforeeeeee – wolfies Sep 22 '17 at 20:14

You're almost there. You are just integrating over the wrong area a bit.

You've set $x$ to be between $z_0-1$ to $y$, which is fine. Now, for $y$ you must consider the line between $(z_0-1,1)$ and $(1, z_0-1)$. You have that almost right, but if you look at it once again, you can see it is $y=-x+z_0$.

So you should be integrating the inner-integral from $z_0-x$ to $1$ instead.

Edit: Regarding your final editing, you already have it right. Open up $(2-z_0)^2/2$ and look back at your result.

Ok I think I found your mistake: What you're doing here:

$$P(z \geq z_0) = \int_{z_0-1}^{1} \int_{z_0-1}^{1} \,\, dy \, \, dx$$

is not integrating over the triangle you mentioned, but over the rectangle $(z_0-1,1),(1,1),(1,z_0-1),(z_0-1,z_0-1)$.

• I think you are right. Can you please tell me what the correct bounds on the double integral is? – Bob Sep 22 '17 at 17:54
• I recommend drawinga picture and finding functions $l(x)$ and $u(x)$ such that the triangle is bounded (in $y$-direction) by $l(x)$ and $u(x)$. Then the inner integral transforms to $\int_{l(x)}^{u(x)}dy$. – flawr Sep 22 '17 at 18:16
• Is this right? $P(z \geq z_0) = \int_{z_0-1}^{1} \int_{x - z_0 + 1}^{1} \,\, dy \, \, dx$ – Bob Sep 22 '17 at 18:56
• Yes that looks great! – flawr Sep 22 '17 at 19:09