# Does $E[X+Y]=E[X]+E[Y]$?

I have an exercise where I want to calculate $E[X-Y]$ where $X,Y$ are discrete R.V.

Since the mean is defined with a sum I hope that $E[X-Y]=E[X]-E[Y]$ but I am having a hard time checking it.

$X,Y$ are discrete so $$E[X]=\sum_{i=1}^N x_i p_i,\quad E[Y]=\sum_{j=1}^M y_i q_j$$ where $p_{i},q_{j}>0$ and $\sum p_{i}=\sum q_i = 1$.

So $$E[X]+E[Y]=\sum_{i=1}^N x_i p_i + \sum_{j=1}^M y_i q_j$$ and $$E[X+Y]=\sum_{i,j}(x_i+y_j)p'_{ij}.$$ But I don't know what $p'_{ij}$ is or how to continue.

I would appreciate any help here!

-
Much more is true, always $E(\sum a_iX_i)=\sum a_i E(X_i)$. – André Nicolas Dec 2 '12 at 18:21
@AndréNicolas - good to hear that! for some reason I'm having problems with this. I checked this for the continues case and I think that it was trivial since it was the same $x$ that multiplys the density functions, but in this case there are different probabilitys so it doesn't add up like in the continues case – Belgi Dec 2 '12 at 18:24
Maybe try conditional probability – Lior B-S Dec 2 '12 at 18:25
@MichaelHardy - thanks for the edit. are you using lyx ? I wonder how to do sums display like this... – Belgi Dec 2 '12 at 18:38
I've never used LyX and I've just barely ever heard of it. If you write \Sigma_{i=1}^N and \sum_{i=1}^N in a "displayed" setting, they get rendered like this: $\displaystyle\Sigma_{i=1}^N$ and $\displaystyle\sum_{i=1}^N$. In an "inline" setting, they look like this: $\Sigma_{i=1}^N$ and $\sum_{i=1}^N$. Using \sum in this context is standard. – Michael Hardy Dec 2 '12 at 18:56

I suspect that in your exercise you are supposed to already use, as a known-proven fact, the linearity of expectation: $E[aX+bY]=a E[X] + b E[Y]$, but anyway:
With your notation, $E[X+Y]=\sum_{i,j}(x_i+y_j)p'_{ij} =\sum_{i,j}x_{i}p'_{ij}+\sum_{i,j}y_{j}p'_{ij}$ where $p'_{ij}$ is the probability that $X$ takes the value $x_i$ and $Y$ takes the value $y_j$.
But the first term is $\sum_i \sum_j x_i p'_{ij}= \sum_i x_i (\sum_j p'_{ij}) = \sum_i x_i p_i = E(X)$, and analogously the second is $E(Y)$.
Updated: $\sum_j p'_{ij}=p_i$ because it's the sum of probabilities for a fixed $x_i$ and for all the possible values of $y_j$; this is known (both for discrete and continuous distributions) as the "marginal distribution". http://en.wikipedia.org/wiki/Marginal_distribution
I don't understand the equality on the last paragraph, can you please add some more details ? what is $p'_{i,j}$ ? is it $p_{i}p_{j}$ ? – Belgi Dec 2 '12 at 18:29
No, $p'_{i,j}$ is what I defined in the second parag., it's the joint probabilty. You don't know its form, and don't need to. – leonbloy Dec 2 '12 at 18:33