Suppose $X$ is an exponential random variable with mean $2$, and $Y$ is an exponential random variable with mean $3$. I want to write the density function for $X-Y$. Now, I know (at least, I'm pretty sure) that this is calculated by the formula:
$f_{X-Y}(z)=\displaystyle\int_{-\infty}^\infty f_X(y)f_Y(y-z)\,dy$,
but I have a hard time with the actual calculation. The trouble is that both $f_X$ and $f_Y$ have support $[0,\infty)$, and that makes me confused about when the expression $f_Y(y-z)$ is defined.
To be clear, I have the density functions:
$f_X(y)=\frac12e^{-y/2}$, $f_Y(y)=\frac13e^{-y/3}$, both for $y\ge 0$.
I hope my question makes sense; thanks in advance.
We are convolving $X\sim f_X(x)={\frac{1}{2}e^{-x/2}}$ supported on ${[0,\infty)}$ with $-Y\sim f_{-Y}(y)={\frac{1}{3}e^{y/3}}$ supported on ${(-\infty,0]}$. Now consider the graphical representations for convolution of these two exponential functions. We fix the former and move the mirrored of the latter with respect to the $y$-axis: $$f_Z(z)=\int_{-\infty}^{\infty}\color{blue}{f_X(\tau)}\color{red}{f_{-Y}(-\tau+z)}d\tau$$
When $z<0$:
When $z>0$:
$$\begin{align} f_Z(z)&=\int_z^\infty\frac{1}{2}e^{-\tau/2}.\frac{1}{3}e^{(z-\tau)/3}\mathrm d\tau\\ &=\frac{e^{z/3}}{6}\int_z^\infty\frac{1}{6}e^{-5\tau/6}\mathrm d\tau\\ &=\frac{e^{z/3}}{6}\left(\frac{-6}{5}\right)(0-e^{-5z/6})\\ &=\frac{1}{5}e^{-z/2} \end{align}$$