# Conditional MGF of the difference of two exponentially distributed random variables

let $$X$$ and $$Y$$ be two exponential random variables with the same parameter $$\lambda$$. I try to calculate the MGF of random variable $$V=X-Y$$ given that $$X>Y$$. We know that the MGF of Exponential random variables are $$M_X(t)=M_Y(t)=\frac{\lambda}{\lambda-t}$$. Further, because of the memoryless property of exponential random variables, if $$X$$ and $$Y$$ are independent, then $$V$$ is an exponential random variable with parameter $$\lambda$$. However, I try to calculate the MGF of $$V$$ directly as follows:

$$E[e^{tV}|X>Y]=\int_0^\infty E[e^{t(X-Y)}|X>Y=y]dF_Y(y)$$ $$E[e^{t(X-Y)}|X>Y=y]=\int_y^\infty e^{t(X-y)}\lambda e^{-\lambda x} dx=\frac{\lambda e^{-\lambda y}}{\lambda-t}$$ therefore: $$M_V(t)=E[e^{tV}|X>Y]=\int_0^\infty \frac{\lambda e^{-\lambda y}}{\lambda-t}dF_Y(y)=\int_0^\infty \frac{\lambda e^{-\lambda y}}{\lambda-t}\lambda e^{-\lambda y} dy=\frac{1}{2}\frac{\lambda}{\lambda-t}$$ i dont know why the final result is different from $$M_X(t)$$ by factor of$$\frac{1}{2}$$

This is incorrect: $$E[e^{t(X-Y)}|X>Y=y]=\int_y^\infty e^{t(X-y)}\lambda e^{-\lambda x} dx$$
The reason is becuase $$\operatorname{E}[g(X) \mid X > y] \ne \int_{x=y}^\infty g(x) f_X(x) \, dx,$$ because $$\int_{x=y}^\infty f_X(x) \, dx \ne 1.$$ The expectation must always be calculated over a proper density that integrates to $$1$$.
Instead, $$\operatorname{E}[e^{t(X-y)} \mid X > y] = \int_{x=y}^\infty e^{t(x-y)} \lambda e^{-\lambda(x\color{red}{-y})} \, dx.$$ This however, still implicitly uses the memoryless property as justification. You could also write
$$\operatorname{E}[g(X) \mid X > y] = \frac{\int_{x=y}^\infty g(x) f_X(x) \, dx}{\int_{x=y}^\infty f_X(x) \, dx}.$$ Here, the conditional distribution is $$X \mid X > y$$ and has density $$f_{X \mid X > y}(x) = \frac{f_X(x)}{S_X(y)}$$ where $$S_X = 1 - F_X$$ is the survival function.
• Excuse me, here we cant write $E[e^{t(X-Y)}|X>Y]$ piecewise like $E[e^{tX}|X>Y]E[e^{-tY}|X>Y]$, is it right? Mar 28, 2022 at 6:06