# Find the Conditional Expectation $\mathbb{E}[X=k|Y=n]$

Suppose $X$ and $Y$ are stochastic variables with a simultaneous distribution $$\mathbb{P}(X=k, Y=n) = \frac{e^{-1}2^{n-k}}{3^nk!(n-k)!},\ \ \ \ \text{for 0 \leq k \leq n and n \geq 0 }$$ Determine the conditional expectation $\mathbb{E}[X=k|Y=n]$.

Now my reasoning is the following: $$\mathbb{E}[X=k|Y=n]=\sum_{k=0}^nk\cdot \mathbb{P}(X=k|Y=n),$$ Where $$\mathbb{P}(X=k|Y=n)=\frac{\mathbb{P}(X=k,Y=n)}{\mathbb{P}(Y=n)}$$ Since I can rewrite $$\mathbb{P}(X=k, Y=n) = \frac{e^{-1}2^{n-k}}{3^nk!(n-k)!}=\frac{1}{e(n!)}\sum^{n}_{k=0}\binom{n}{k}\left(\frac{2}{3}\right)^{n-k}\left(\frac{1}{3}\right)^k,$$ Using the Binomium of Newton, I've found $$\mathbb{P}(Y=n)=\frac{1}{e(n!)}$$ Which brings me back to the conditional probability: $$\mathbb{E}[X=k|Y=n]=\sum_{k=0}^nk\cdot \mathbb{P}(X=k|Y=n) = \sum_{k=0}^nk\ \binom{n}{k}\left(\frac{2}{3}\right)^{n-k}\left(\frac{1}{3}\right)^k$$

Now I'm stuck. Is my reasoning correct and how can I solve this last equation?

Technically speaking, you should write $$\mathbb{E}[X | Y = n] = \sum_{k=0}^{n} k \mathbb{P}[X=k|Y=n].$$ Now, you can do a similar 'trick' as for the calculation of $\mathbb{P}(Y = n)$: $$k \binom{n}{k} = k \frac{n!}{k!(n-k)!} = k \frac{n(n-1)!}{k(k-1)!(n-k)!} =n \frac{(n-1)!}{(k-1)!(n-k)!} = n \binom{n-1}{k-1}$$