# How to calculate E[X+Y] and E[(X+Y)^2]

How do I calculate the above when I know that $$X \sim Poisson(2)$$ and $$Y \sim Geometric(1/3)$$ and X and Y are independent.

I have said that

$$E[X+Y] = E[X] + E[Y] = 2 + \frac{1}{1/3} = 2 + 3 = 5$$ Is this correct? $$E[(X+Y)^2] = E[X^2 + Y^2 + 2XY] = E[X^2] + E[Y^2] + 2E[X] + 2E[Y] = Var(X) + EX^2 + Var(Y) + EY^2 + 2E[X] + 2E[Y] = 2 + 2^2 + 6 + 9 + 4 + 6 = 31$$ Is this correct?

Thanks.

• How are you getting $E[XY] = E[X]+E[Y]$? I would expect $E[XY] = E[X]E[Y]$. Commented Dec 19, 2019 at 19:39
• If they are independent it should be $E[XY] = E[X]E[Y]$ Commented Dec 19, 2019 at 19:39
• Ah, that is right. I missed that. Indeed $\mathbb E[XY]=\mathbb E[X]\mathbb E[Y]$. And so there are no terms of the form $\mathbb E[X]$ or $\mathbb E[Y]$ so there is no cause to invoke the variance of $X$ and $Y$. Commented Dec 19, 2019 at 19:42
• Oh yeh, thats right so $E[2XY] = 2E[X]E[Y]$ is everyting else fine? Commented Dec 19, 2019 at 19:44

By linearity, we have

$$\mathbb{E}[X + Y] = \mathbb{E}[X] + \mathbb{E}[Y] = 2 + \frac{1}{1/3} = 5,$$

which agrees with what you found. Also,

$$\mathbb{E}[(X + Y)^{2}] = \mathbb{E}[X^{2}] + \mathbb{E}[Y^{2}] + 2\cdot \mathbb{E}[XY].$$

Now since we have $$\mathbb{E}[Z^{2}] = \text{Var}(Z) + (\mathbb{E}[Z])^{2}$$ for any random variable $$Z$$, we obtain

$$\mathbb{E}[X^{2}] = \text{Var}(X) + (\mathbb{E}[X])^{2} = 2 + 4 = 6.$$ Also,

$$\mathbb{E}[Y^{2}] = \text{Var}(Y) + (\mathbb{E}[Y])^{2} = 6 + 9 = 15.$$

Due to independence, we have $$\mathbb{E}[XY] = \mathbb{E}[X] \cdot \mathbb{E}[Y] = 6$$. Therefore,

$$\mathbb{E}[(X + Y)^2] = 6 + 15 + 2 \cdot 6 = 33.$$

• +1 but just so it is clear, independence is only required for breaking up $\mathbb{E}(XY)$ into factors. Linearity, $\mathbb{E}(X+Y)=\mathbb{E}(X)+\mathbb{E}(Y)$, holds for all (integrable) RVs. Commented Dec 19, 2019 at 20:52
• Thank you. I just updated my post to make it more clear. Commented Dec 19, 2019 at 20:53