[Math] moment generating function of the difference between two random variables

moment-generating-functions

I need to find the moment generating function of $G = Y – X$ where $Y$ ~ exp($\frac{1}{2}$) and $X$ ~ exp(1). X and Y are independent.

I read in another topic that $m_{Y-X}(r) = \frac{m_Y(r)}{m_X(r)}$ but I couldn't find a proof.

I started as follows but I guess the last step is incorrect:

$m_G(r)=E[e^{rG}] = E[e^{r(Y-X)}] =E[e^{rY}e^{-rX}] = E[e^{rY}]E[e^{-rX}]=m_Y(r) m_X(-r)$.

Can somebody explain what is the correct answer and maybe give a proof?

Best Answer

The method you have 'read somewhere' works if $Y-X$ and $X$ are independent but not otherwise. [$Ee^{rX}=Ee^{r(X-Y)}e^{rY}=Ee^{r(X-Y)}Ee^{rY}$ by independence. Hence $Ee^{r(X-Y)}=\frac {Ee^{rX}} {Ee^{Y}}$]

Here is the correct solution: $Ee^{r(Y-X)}=Ee^{rY}Ee^{-rX}=\int_0^{\infty} \frac 1 2 e^{ry} e^{-y/2}dy \int_0^{\infty} e^{-rx} e^{-x}dx=(\frac 1 {1-2r}) (\frac 1{r+1}$).