How to find $E[X^2\mid X+Y]$? Suppose $X$ and $Y$ are independent Poisson random variables with rates $\lambda_1, \lambda_2$ respectively, then how would we go about calculating:
$
E[X^2\mid X+Y] \text{ ?}
$$
 A: Since $X+Y\sim\mathrm{Poisson}(\lambda_1+\lambda_2)$, for any positive integer $n$ we have
$$
\begin{align*}
\mathbb P(X=k|X+Y=n) &= \frac{\mathbb P(X=k, X+Y=n)}{\mathbb P(X+Y=n)}\\
&= \frac{\mathbb P(X=k)\mathbb P(Y=n-k)}{\mathbb P(X+Y=n)}\\
&= \left(\frac{e^{-\lambda_1}\lambda_1^k}{k!}\right)\left(\frac{e^{-\lambda_2}\lambda_2^{n-k}}{(n-k)!}\right)\left({\frac{e^{-(\lambda_1+\lambda_2)}(\lambda_1+\lambda_2)^n}{n!}}\right)^{-1}\\
&= \frac{\lambda_1^k\lambda_2^{n-k} n!}{(\lambda_1+\lambda_2)^n k!(n-k)!}\\
&= \binom nk \left(\frac{\lambda_1}{\lambda_1+\lambda_2}\right)^k\left(\frac{\lambda_2}{\lambda_1+\lambda_2}\right)^{n-k}
\end{align*}
$$
so that $$X|X+Y=n\sim\mathrm{Bin}\left(n,\frac{\lambda_1}{\lambda_1+\lambda_2}\right).$$ It follows from linearity of conditional expectation that
$$
\begin{align*}
\mathbb E[X^2|X+Y=n] &= \mathbb E[X(X-1)|X+Y=n] + \mathbb E[X|X+Y=n]\\ &= n(n-1)\left(\frac{\lambda_1}{\lambda_1+\lambda_2}\right)^2  + \frac{n\lambda_1}{\lambda_1+\lambda_2}\\ &= \frac{n\lambda_1(n\lambda_1+\lambda_2)}{(\lambda_1+\lambda_2)^2}. 
\end{align*}$$
