Hi I have this question in my book (preparing for the exam) and I can't seem to find the answer..
X1 and X2 are independent and identically distributed. They are continuous and uniform over [-1,1].
Now I need to find the density function and cumulative distribution for Y = X1 – X2
So what I have is (not much):
fx_i(x_i) = Piecewise(1/2 for [-1,1], 0 everywhere else)
Fx_i(x_i) = Piecewise(1 for [-1,+inf[, (x+1)/2 for [-1,1], 0 everywhere else)
So to start with Fy..
Fy = Prob[Y <= y] = Prob[X1-X2 <= x1-x2] and.. I'm stuck ^^
EDIT – I got a bit further along on myself.. but still not there yet ^^
Fy = Prob[X1-X2 <= y]
= int(Prob[X1 <= y+x2 and x2 <= X2 <= x2 + dx2]
= int(Prob[X1 <= y+x2 ] . fX2(x2) dx2)
= int(Fx1(y+x2) . fx2(x2) dx2)
= int(fx2(x2) dx2, x2=a..b).int(fx1(x1),x1=c..d)
Now I thoght the boundries should be a = -inf, b = +inf, c = -inf, d=y+x2
I'm sure d is correct, but I'm quite uncertain about a,b and c..
Best Answer
Here's one way to do it. Clearly $Y$ takes values in $[-2,2]$ and for $h$ a bounded mesurable function $$ \mathbb E (h (Y)) = \int_{-2}^2 h(y) f_Y(y) dy = \int_{-1}^1 \int_{-1}^1 h(x_1 - x_2) f(x_1) f(x_2) dx_1 dx_2. $$ Here $f$ is the density of $X_1$ and $f_Y$ is the density you are looking for. Now do the change of variable $y = x_1 - x_2$ starting from the right hand side and integrate with respect to $x_2$: $$ \int_{-1}^1 \int_{-1}^1 h(x_1 - x_2) f(x_1) f(x_2) dx_1 dx_2 = \int_{-2}^2 \int_{-1}^1 h(y) f(y + x_2) f(x_2) dx_2 dy = \int_{-2}^2 h(y) \left[ \int_{-1}^1 f(y + x_2) f(x_2) dx_2 \right] dy. $$ Now you deduce by identification $$ f_Y(y) = \int_{-1}^1 f(y + x) f(x) dx. $$