# $\mathbb{E}[S_n]$, when $S_n$ takes $X_1+…+X_n$ or $Y_1+…+Y_n$? [duplicate]

How does one evaluate $$\mathbb{E}[S_n]$$ if

$$S_n = \left\{ \begin{array}{lr} X_1+X_2+...+X_n & : \text{with probability } \frac{1}{2}\\ Y_1+Y_2+...+Y_n & : \text{with probability } \frac{1}{2} \end{array} \right.\\$$

where, $X_i$, $Y_i$ are random variables.

Does the expectation "reduce" into the $X_i$s and $Y_i$s?

I.e.

$$\mathbb{E}[S_n]=\frac{1}{2}(\mathbb{E}[X_1]+...+\mathbb{E}[X_n]) + \frac{1}{2}(\mathbb{E}[Y_1]+...+\mathbb{E}[Y_n])$$?

Is this called "conditional expectation"?

## marked as duplicate by Xi'an, kjetil b halvorsen, gung♦, Nick Cox, SycoraxDec 1 '15 at 14:29

• The presence of "case 1" and "case 2" in your equation says nothing--please tell us what you intend this to mean. Otherwise, you already asked essentially the same question at stats.stackexchange.com/questions/184189/…, which has been answered. – whuber Dec 1 '15 at 2:22
• @whuber I meant to say that there are two cases and the probability of each is $\frac{1}{2}$. This is closely related to that other question, but I can't see the jump from that other question, in order to understand this one. Since $S_n$ does not take a single value in this case. – mavavilj Dec 1 '15 at 2:23
• I'm thinking an equivalent interpretation could be: $\mathbb{E}[S_n]=\frac{1}{2}(X_1+...+X_n) + \frac{1}{2}(Y_1+...+Y_n)$, but then one'd wonder how to actually evaluate the r.v.s. Or is $\mathbb{E}(X_i)=X_i$ necessarily? – mavavilj Dec 1 '15 at 2:29
• Perhaps the reasoning is actually this way: $\mathbb{E}[S_n]=\frac{1}{2}(X_1+...+X_n) + \frac{1}{2}(Y_1+...+Y_n)$ $=\text{(what is the value of each X_i and Y_i?)}$ $=\frac{1}{2}(\mathbb{E}[X_1]+...+\mathbb{E}[X_n]) + \frac{1}{2}(\mathbb{E}[Y_1]+...+\mathbb{E}[Y_n])$ – mavavilj Dec 1 '15 at 2:47
• I fully agree that this should be closed, but perhaps more as "not a real question" than as a duplicate of the other question. To see why, assume for example that $X$ and $Y$ are i.i.d. with a continuous distribution and define $S=\max(X,Y)$. Then indeed $S=X$ with probability $\frac12$ and $S=Y$ with probability $\frac12$, but $E(S)\ne\frac12E(X)+\frac12E(Y)$. – Did Dec 27 '15 at 20:00

Let $Z$ be $0$ with probability $\frac12$ and $1$ with probability $\frac12$, and let it represent the thing that's choosing between the x-sum and the y-sum.
Then use the Law of total expectation , $\:\operatorname{E} (X) = \sum_{i=1}^{n}{\operatorname{E}(X \mid A_i) \operatorname{P}(A_i)},$ where the $A_i$ are mutually exclusive and exhaustive events.
Here the events are just $Z=0$ and $Z=1$ and you're using it to find $E(S_n)$.