Let $X$ and $Y$ both be distributed between $[1,2]$, what is the distribution of $Z=X-Y$?

  • $\begingroup$ Clearly, $Z$ has a range $[-1,1]$ so what are the problems of computing its density? $\endgroup$ – Ilya Mar 28 '13 at 15:47
  • $\begingroup$ If you are interested in the answer only, try PDF[TransformedDistribution[ x - y, {Distributed[x, UniformDistribution[{1, 2}]], Distributed[y, UniformDistribution[{1, 2}]]}], z] in Mathematica. Otherwise state the origin of the problem, and share what you had attempted so far. $\endgroup$ – Sasha Mar 28 '13 at 15:59
  • $\begingroup$ $f_Z(z)=\int_{-\infty}^\infty f_X(z+y)f_Y(y)dy=\int_{-1}^1f_X(z+y)dy$ Is this right? $\endgroup$ – Tarek Abed Mar 28 '13 at 16:00
  • $\begingroup$ @TarekAbed: $y\in [1,2]$ rather than in $[-1,1]$ $\endgroup$ – Ilya Mar 28 '13 at 16:06
  • 1
    $\begingroup$ @Ilya: $f_Z(z)=\int_{-\infty}^\infty f_X(z+y)f_Y(y)dy=\int_{1}^2f_X(z+y)dy$ What comes next? $\endgroup$ – Tarek Abed Mar 28 '13 at 16:17

If $x,y$ are independent and uniformly distributed on $[1,2]$, then the PDF of $x$ is $1_{[1,2]}$ and the PDF of $-y$ (note the minus sign) is $1_{[-2,-1]}$. Then the PDF of $z=x-y$ is given by the convolution $f_z=1_{[1,2]} * 1_{[-2,-1]}$.

Computing this is straightforward. \begin{eqnarray} f_z(x) &=& \int 1_{[1,2]}(y) 1_{[-2,-1]}(x-y) dy \\ &=& \int_1^2 1_{[-2,-1]}(x-y) dy \\ &=& \int_{x-2}^{x-1}1_{[-2,-1]}(t) dt \\ &=& \int 1_{[x-2,x-1] \cap [-2,-1]}(t)dt \\ &=& m([x-2,x-1] \cap [-2,-1]) \\ &=& m([x,x+1] \cap [0,1]) \\ &=& (1-|x|)1_{[-1,1]}(x) \end{eqnarray}

  • $\begingroup$ What is m()? Also I dont get the second = where you go to using $t$. $\endgroup$ – jacob Oct 7 '15 at 23:08
  • $\begingroup$ @jacob: The $m$ is the Lebesgue measure, it is the length of the interval in this case. For the second, I use the change of variables $t=x-y$ (remember that $x$ is fixed for the integration). $\endgroup$ – copper.hat Oct 7 '15 at 23:47
  • $\begingroup$ Ok I get the second = now. I have not used the Lebesgue measure but maybe I can think of it as a usual integral? If so, then I think the 4th = sign is that "integrating from $x-2$ to $x-1$ for the integrand $t$ is the same as integrating over from $- \infty$ to $\infty$ for the integrand $1_{x-2, x-1} (t)$ correct? (Where $- \infty$ to $\infty$ rather is "for all values of $t$". And if that is true, then I do not get the fifth = sign because the primitive function of $t$ is $t^2$ but you apply some sort of logic here. $\endgroup$ – jacob Oct 10 '15 at 11:10
  • $\begingroup$ @jacob: Here I am using $m$ to denote the length of an interval. Yes regarding the 4th =. For the 5th, remember that you are integrating a function that only takes values $0,1$, not $t$. $\endgroup$ – copper.hat Oct 10 '15 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.