Conditional distribution of $X$ given that $X+Y=2$ I have $X$ and $Y$ independent $\Gamma(2,a)$-distributed random variables. I am trying to find conditional distribution of $X$ given that $X+Y=2$.
My solution: set $U = X+Y, V = X.$ Inversion yields $ X=V, Y=U-V.$
$$f_{X,Y}(x,y)=f_X(x)\cdot f_Y(y) = \frac{1}{a^4}\cdot xy\cdot e^{-(x+y)/a} $$
$J = -1$, so $|J| = 1$, thus
$$f_{U,V}(u,v) = f_{X,Y}(v, u-v)\cdot 1 = \frac{1}{a^4} \cdot v(u-v)\cdot e^{-u/a},$$
from which I got the $f_U(u) = \frac{1}{a^4}\cdot e^{-u/a}\cdot \left( u-\frac{v^3} 3 \right)$, then
$$f_{V\mid U=2}(v) = \frac{f_{U,V}(2,v)}{f_U(2)} = \frac{e^{-2/a} \cdot(2v-v^2)}{a^4} \cdot \frac{a^4}{e^{-2/a}\cdot(2-v^3/3)} = \frac{3v(2-v)}{6-v^3},$$
but the book gives $\frac{3x}{2}\cdot(1-\frac{x}{2})$
Since $V=X$, the above $2$ should match, but not sure where I made the mistake.Checked multiple times, but no luck.
Please help. Thank you.
 A: Your calculation of the marginal distribution $f_U(u)$ appears to be incorrect.  I get $$f_U(u) = \int_{v=0}^u f_{U,V}(u,v) \, dv = \frac{u^3 e^{-u/a}}{6a^4}.$$  Note that the interval of integration is on $v \in [0,u]$, since $Y \ge 0$ implies $U - V \ge 0$ or $V \le U$.  Furthermore, the marginal distribution cannot be a function of $v$.  From this, we get $$f_{V \mid U = 2}(v) = \frac{f_{U,V}(2,v)}{f_U(2)} = \frac{v(2-v)e^{-2/a}}{a^4} \cdot \frac{3a^4}{4e^{-2/a}} = \frac{3}{2} v(1-v/2),$$ as claimed.
A: I wouldn't bother with the marginal distribution of $U$. You have
$$
\text{constant} \cdot v(u-v)\cdot e^{-u/a} = \text{constant} \cdot v(2-v) \text{ for } 0\le v\le 2.
$$
The second "constant" is the first "constant" times $e^{-u/a};$ that latter quantity is "constant" because it does not depend on $v$.
That's the conditional density of $V$ given that $U=2$, and that's what you're looking for. Finding the constant is routine.
(Note that this is the same as what the book gives: $(2-v) = 2\left( 1 - \frac v 2 \right).$)
