# Why does the distribution of the exponential random variable change to uniform distribution in this case?

I came across this very interesting question in a forum:

If both X and Y are independent and exponentially distributed with parameter $$\lambda$$, find $$E[X^2|X+Y]$$

Someone gave the solution and stated that $$X|X+Y$$ ~ Uniform$$[0,X+Y]$$. Why does the distribution change to uniform distribution in this case?

## 1 Answer

Let $$Z=X+Y$$. $$f_{X|X+Y=z}(x)=\frac{f_{Z,X}(z,x)}{f_Z(z)}=\frac{f_{Y,X}(z-x,x)}{\lambda^2z e^{-\lambda z}}=\frac{\lambda e^{-\lambda (z-x)}\lambda e^{-\lambda x}}{\lambda^2z e^{-\lambda z}}=\frac{1}{z}$$

Assuming $$z-x\geq 0$$ and $$x\geq 0$$, which means $$0\leq x\leq z$$ and the PDF is $$1/z$$. This is $$U[0,z]$$, i.e. $$U[0,X+Y]$$.

Note: the variable change in joint PDFs requires a Jacobian multiplier, but it is $$1$$ in this case.

• Thank you. Can you give more details on how to calculate E[X^2|X+Y]? I would like to see your way of solving it if you don't mind sharing. – Dennis Sep 9 '20 at 0:14
• It's the second moment of uniform distribution where $a=0,b=z$: $z^2/3$ en.wikipedia.org/wiki/Uniform_distribution_(continuous)#/… – gunes Sep 9 '20 at 8:17
• @Dennis is the answer clear for you? – gunes Sep 15 '20 at 21:20
• Thanks for the explanation. Now I understand the second moment part. But I am stuck at the transformation from f_{Z,X} (z,x) to f_{Y,X} (z-x, x). Z = X+Y, so shouldn't it be transformed to f_{Y,X} (x+y, x)? – Dennis Sep 18 '20 at 0:40
• @dennis we want to write the joint pdf of $Z,X$ in terms of joint pdf of $Y,X$. So, here $f_{Z,X}$ is unknown and $f_{Y,X}$ is known, which means we transform $Y,X$ to $Z,X$ and try to find the joint dist. of transformed pair. – gunes Sep 18 '20 at 20:53