# Let $X\sim hom(0,1)$ en $Y\sim hom(-1,0)$ independent random variables. Calculate the density of $Z:=X+Y$ and $EZ$.

Let $X\sim hom(0,1)$ en $Y\sim hom(-1,0)$ independent random variables. Calculate the density of $Z:=X+Y$ and $EZ$.

This is what I got so far:

$$EZ=E(X+Y)=EX+EY=1/2-1/2=0$$

$$f_Z(z)=\int_{-\infty}^{\infty}f_X(x)f_Y(z-x)dx=\int_{-\infty}^{\infty}1_{(0,1)}(x)1_{(-1,0)}(z-x)dx=\int_{0}^{1}1_{(-1,0)}(z-x)dx=\int_{0}^{1}1_{z<x<z+1}(x)dx=...?$$

How can I simplify this ?

-
Hint: First, figure out the possible values of $Z$. Then, choose one particular value that $Z$ can take on, call it $z$ and find the value of your integral for that particular value of $z$. Your answer might depend on whether $z$ is positive or negative, and so be careful to note whether you had chosen $z$ as a positive number or negative number. –  Dilip Sarwate Jan 21 '13 at 13:08
@DilipSarwate If $z\in [-1,0]$, then I get $1+z$. If $z\in [0,1]$, I get $1-z$. How can I prove this ? –  Kasper Jan 21 '13 at 13:31
Further hint: If you got the results you state, what is there to "prove"? It is not necessary that the probability density function of a random variable is always a single expression such as $\frac{1}{\sqrt{2\pi}}\exp(-x^2/2)$ that holds for all real numbers $x$. Is $$g(z)=\begin{cases}1-z, & 0 \leq z \leq 1,\\1+z, & -1 \leq z < 0,\\0, & \text{otherwise,}\end{cases}$$ a valid probability density function? Why, or why not? –  Dilip Sarwate Jan 21 '13 at 15:17
@DilipSarwate I don't know how I can prove this equality: $$\int_{0}^{1}1_{z<x<z+1}(x)dx=\begin{cases}1-z, & 0 \leq z \leq 1,\\1+z, & -1 \leq z < 0,\\0, & \text{otherwise}\end{cases}$$ I just tried out some values for $z$, and they all satisfy this result, but I can't show rigorously that this result hold for all $z$. –  Kasper Jan 21 '13 at 15:47
For any fixed number $z$ between $0$ and $1$, $\mathbf 1_{z < x < z+1}(x)$ has value $1$ for all $x$ between the fixed number $z$ and fixed number $z+1$. Note that $z+1 > 1$ (why?) and so the integrand of your integral has value $1$ for all $x > z$ within the range of integration so that $$\int_0^1 \mathbf 1_{z<x<z+1}(x)dx=\int_z^1 1dx = 1-z$$ for $0 \leq z \leq 1$. Can you work a similar calculation for the case $z < 0$? –  Dilip Sarwate Jan 21 '13 at 16:20