# 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?

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.
• 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 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