# Pdf and Mgf of random variable

Suppose that $$X$$ and $$Y$$ are independent random variables that follow an exponential distribution with mean $$1$$ and let $$W = Y - X$$.

(i) Using the cumulative distribution function (cdf), find the probability density function (pdf) of $$W$$, $$f_W(w)$$ for $$w > 0$$. (No need to compute $$w \leq 0$$).

(ii) Determine the moment generating function (mgf) of $$W$$ by finding the mgfs of $$Y$$ and $$-X$$. Justify where the mgf is defined.

I'm not quite sure how to do this problem but here is what I did:

(i)

Suppose $$X, Y$$ have means $$\lambda_1$$ and $$\lambda_2$$. If $$W = Y - X$$ then (I think)

$$P(W \leq w) = \int_0^\infty \int_{0}^{x+z} \lambda_1 e^{-\lambda_1 x} \lambda_2 e^{-\lambda_2 y}\,dy \ \ dx$$

If we substitute $$\lambda_1 = \lambda_2 = 1$$ then

$$P(W \leq w) = \int_0^\infty \int_{0}^{x+z} e^{-x - y}\,dy \ \ dx$$

(ii)

The moment generating function for an exponential distribution is $$M(t) = \frac{1}{1- \theta t}$$ where $$\theta > 0$$ and $$t < \frac{1}{\theta}$$.

If the mean $$\theta = 1$$ then we know that for $$Y$$

$$M_Y(t) = \frac{1}{1-t}$$

As for $$-X$$, I'm not sure.

I'm not sure about the formula in (i) or how to derive it, and I'm confused on finding the mgf of $$-X$$ in (ii). But in any case I am stuck. Any assistance will be much appreciated.

For the formula in (i), $$\mathbb{P}(W \leq w) = \mathbb{P}(f(X,Y) \in ]-\infty,w]) = \mathbb{P}((X,Y) \in f^{-1}(]-\infty,w]))$$ where $$f(x,y) = y-x$$. Since $$X \sim \mathcal{E}(\lambda_1)$$ and $$Y \sim \mathcal{E}(\lambda_2)$$ are independent and admit both density, denoted $$f_X$$ and $$f_Y$$, the couple $$(X,Y)$$ admites the density $$f_{(X,Y)}(x,y) = f_X(x)f_Y(y)$$ and thus \begin{align} \mathbb{P}((X,Y) \in f^{-1}(]-\infty,w])) &= \int_{f^{-1}(]-\infty,w])} \lambda_1e^{-\lambda_1x}\lambda_2e^{-\lambda_2y}1_{x >0}1_{y>0}dxdy\\ &= \int_{\mathbb{R}^2} 1_{y-x \leq w} \lambda_1e^{-\lambda_1x}\lambda_2e^{-\lambda_2y}1_{x >0}1_{y>0}dxdy\\ &= \int_0^{\infty} \int_0^{\infty} 1_{y \leq x+w}\lambda_1e^{-\lambda_1x}\lambda_2e^{-\lambda_2y}dxdy \\ &= \int_0^{\infty} \int_0^{\infty} 1_{y \leq x+w}\lambda_1e^{-\lambda_1x}\lambda_2e^{-\lambda_2y}dydx \\ &= \int_0^{\infty} \int_0^{\infty} 1_{y \leq x+w}1_{x+w \geq 0}\lambda_1e^{-\lambda_1x}\lambda_2e^{-\lambda_2y}dydx \\ \end{align} and now you can adapt the rest of the computations depending on the sign of $$w$$.

For (ii), for all $$t \in ]-1,1[$$, $$M_{-X}(t) = \mathbb{E}[e^{-tX}] = M_X(-t) = \frac{1}{1+t}.$$

• Unfortunately, I am relatively new to distributions and thus not familiar with these theorems..
– user902292
Mar 18, 2021 at 21:05
• Which part are you unfamiliar with? Mar 18, 2021 at 21:07
• Part (i). I have no idea what Lebesgue measures are or the Fubini-Tonelli theorem etc. I don't think I am supposed to use these for this problem.
– user902292
Mar 18, 2021 at 21:08
• Ok let me rewrite this into a probabilistic language Mar 18, 2021 at 21:09
• Yes it is, note that the fourth equality holds because $X$ and $Y$ are independent. Mar 18, 2021 at 21:41