Distribution of sums

I'm really having a hard time with this topic in probability theory and I was wondering if someone has any tricks, tips or anything useful to help me understand it. In my notes I am told that $X\sim$Uniform$[0,1]$ and $Y\sim$Uniform$[0,1]$. My professor wrote:

$f_{X+Y}(Z) = \int_0^Z f_X(x) f_Y(Z-x)\;dx \neq Z$

Then somehow he came up with these cases where $Z$ is defined, and used that in making the pdf. I'm just not sure of how he did this or how he also came to find $P(X_1+X_2\le 2)$. Can someone help me fill in the blanks? I went to him directly but he just said the same thing as in lecture and wasn't helpful.

-
I made a minor correction to your formula--you had $f_Y(Z-X)$, but it should be a little $x$, not a big $X$. This is called a convolution, and gives you the distribution of $X+Y$. To find the distribution of $X_1 + X_2$ you could do a similar convolution, then integrate to find $P(X_1 + X_2 \leq 2)$. I'm not sure if that's what your professor did, but it's one way to do it. Does that sound familiar? –  Jonathan Christensen Dec 4 '12 at 3:21
@JonathanChristensen Yes I believe that's what he did. It all just seems jibberish to me. He didn't exactly write everything down he did and I have quite a few gaps I'm not sure how to finish. –  TheHopefulActuary Dec 4 '12 at 3:24
Can you point to particular things you're having trouble with? It's hard to know what exactly you need help with. –  Jonathan Christensen Dec 4 '12 at 3:27
I actually made a mistake, $Y$ is uniform on $(0,1)$ not $(0,2)$. Well he started out saying that we have 2 cases where $Z$ is valid saying first: If $0\le z \le 1$ then $f_X(x)=1$ and $f_Y(Z-x)=1$, $f_{X+Y}(Z)=z$. I'm not sure how he deducted this. –  TheHopefulActuary Dec 4 '12 at 3:32
@JonathanChristensen And actually on the first part where he found $P(X_1+X_2\le 2)$ he did that without convolution somehow. –  TheHopefulActuary Dec 4 '12 at 3:38

In terms of upper and lower cases, I suspect you saw $$f_{X+Y}(z)=\int_0^z f_X(x)f_Y(z-x)dx$$ as the convolution of two non-negative random variables.

With Y Uniform on $[0,2]$:

Taking account of where $f_X$ and $f_Y$ are non-zero, I would write $$f_{X+Y}(z)=\int_{\max(0,z-2)}^{\min(1,z)} f_X(x)f_Y(z-x)dx = \int_{\max(0,z-2)}^{\min(1,z)} \frac{1}{2} dx$$ which leads to

$$f_{X+Y}(z) = \begin{cases} z/2 &\mbox{if } 0 \le z \le 1 \\ 1/2 &\mbox{if } 1 \le z \le 2 \\ (3-z)/2 &\mbox{if } 2 \le z \le 3. \end{cases}$$

You then get $$P(X_1+X_2\le 2) = \int_0^2 f_{X+Y}(z)dz = \int_0^1 f_{X+Y}(z)dz + \int_1^2 f_{X+Y}(z)dz = \frac14+\frac12 =\frac34.$$

With the change in the question of Y to be Uniform on $[0,1]$, the above becomes:

Taking account of where $f_X$ and $f_Y$ are non-zero, I would write $$f_{X+Y}(z)=\int_{\max(0,z-1)}^{\min(1,z)} f_X(x)f_Y(z-x)dx = \int_{\max(0,z-1)}^{\min(1,z)} 1 \, dx$$ which leads to

$$f_{X+Y}(z) = \begin{cases} z &\mbox{if } 0 \le z \le 1 \\ 2-z &\mbox{if } 1 \le z \le 2. \end{cases}$$

You then get $$P(X_1+X_2\le 2) = \int_0^2 f_{X+Y}(z)dz = \int_0^1 f_{X+Y}(z)dz + \int_1^2 f_{X+Y}(z)dz = \frac12+\frac12 =1$$ which is in fact obvious.

-
Thanks that is indeed close to what I saw. The only part I'm confused about is the min and max as the upper and lower bounds of the integral here: $$f_{X+Y}(z)=\int_{\max(0,z-1)}^{\min(1,z)} f_X(x)f_Y(z-x)dx$$ –  TheHopefulActuary Dec 4 '12 at 3:49
The $\min(1,z)$ comes because $f_X(x)=0$ if $x \gt 1$. In the second version the $\max(0,z-1)$ comes because $f_Y(z-x)=0$ if $z-x \gt 1$ i.e. if $x \lt z-1$. –  Henry Dec 4 '12 at 3:53
Okay that's making more sense now. One last thing, my professor ended up finding $P(X_1+X_2\le 2)$ before he did these calculations. Is there a way you can do that without integrating? –  TheHopefulActuary Dec 4 '12 at 3:57
Let $Z = X+Y$. Then, if $X$ and $Y$ have values in $[0,1]$, it follows that $0 \leq Z \leq 2$. Thus, it is obvious that the cumulative probability distribution function $F_Z(z) = P\{Z \leq z\}$ enjoys the property that $F_z(z) = 0$ for $z < 0$ and $F_Z(z) = 1$ for $z \geq 1$. More generally, for any fixed value of $z$, $$F_Z(z) = P\{Z \leq z\} = P\{X+Y \leq z\} = \int_{-\infty}^{\infty}\left[ \int_{-\infty}^{z-x} f_{X,Y}(x,y)\,\mathrm dy\right]\,\mathrm dx$$ and so, using the rule for differentiating under the integral sign (see the comments following this answer if you have forgotten this) \begin{align*} f_Z(z) &= \frac{\partial}{\partial z}F_Z(z)\\ &= \frac{\partial}{\partial z}\int_{-\infty}^{\infty}\left[ \int_{-\infty}^{z-x} f_{X,Y}(x,y)\,\mathrm dy\right] \,\mathrm dx\\ &= \int_{-\infty}^{\infty}\frac{\partial}{\partial z}\left[ \int_{-\infty}^{z-x} f_{X,Y}(x,y)\,\mathrm dy\right]\,\mathrm dx\\ &= \int_{-\infty}^{\infty} f_{X,Y}(x,z-x)\,\mathrm dx \end{align*} When $X$ and $Y$ are independent random variables, the joint density is the product of the marginal densities and we get the convolution formula $$f_{X+Y}(z) = \int_{-\infty}^{\infty} f_{X}(x)f_Y(z-x)\,\mathrm dx ~~ \text{for independent random variables} ~X~\text{and}~Y.$$ When $X$ and $Y$ take on values in $[0,1]$, we have that $f_X(x) = 0$ for $x<0$ and $x>1$, and so $$f_{X+Y}(z) = \int_{0}^{1} f_{X}(x)f_Y(z-x)\,\mathrm dx.$$ Furthermore, for fixed $z, 0 < z < 1$, as $x$ sweeps from $0$ to $1$, $f_Y(z-x)$ goes to $0$ as soon as $x$ exceeds $z$, and so $$f_{X+Y}(z) = \int_{0}^{1} f_{X}(x)f_Y(z-x)\,\mathrm dx, ~~ 0 \leq z \leq 1.$$ Similarly, if $z \in [1,2]$, $f_Y(z-x) = 0$ as long as $x < z-1$ and so $$f_{X+Y}(z) = \int_{z-1}^{1} f_{X}(x)f_Y(z-x)\,\mathrm dx, ~~ 1 \leq z \leq 2.$$ Finally, if $X$ and $Y$ are uniformly distributed on $[0,1]$, the integrands above have value $1$ and we get $$f_{X+Y}(z) = \begin{cases} z, & 0\leq z \leq 1,\\ 2-z, & 1 \leq z \leq 2,\\ 0, &\text{otherwise.}\end{cases}$$