Expected value is a linear operator? Under what conditions is median also a linear operator?

First question: By definition, on a probability space ($\Omega,\mathcal{F},P$), the expected value of a random variable $X:\Omega\to \mathbb{R}$ is defined as $$E(X)=\int_\Omega X(\omega) dP(\omega).$$ Note that it is only well-defined if the integral converges absolutely, i.e. $$\int_\Omega |X(\omega)| dP(\omega)<\infty$$

(The integrals above are Lebesgue integrals. If $X$ is discrete, $P$ is the point measure and this integral turns into a sum.)

Therefore, if the expected values of both $X$ and $Y$ exist, then $E(X+Y)$ exists (triangle inequality) and, for $a,b\in \mathbb{R}$, we can use the linearity of the Lebesgue integral to conclude $$E(aX+bY)=\int_\Omega aX +bYdP=a\int_\Omega X dP+b\int_\Omega YdP=aE(X)+bE(Y).$$


EXTENDED/REVISED ANSWER

Some general points concerning the second question. By definition, $m$ is a median of $X$ if ${\rm P}(X \ge m) \geq 1/2$ and ${\rm P}(X \le m) \geq 1/2$. While a median is uniquely determined for any common example of a continuous random variable, it is not uniquely determined in general. For example, any number $m \in [-1,1]$ is a median for random variable $X$ with ${\rm P}(X=1) = {\rm P}(X=-1) = 1/2$. Hence my previous answer to this question (see below), where I assumed that $m(X)=0$ since $X$ is symmetric, should be revised. This is done simply as follows. We define $X$ and $Y$ exactly as before, and introduce another random variable $\tilde X$ defined to be equal to $X$ with probability $1-1/n$ and to $0$ with probability $1/n$. It is immediately checked that the symmetric random variables $\tilde X$ and $Y$ have a unique median, equal to $0$. Thus $m(\tilde X) + m(Y) = 0$, as required. On the other hand, one easily verifies that ${\rm P}(\tilde X + Y = 1) \to 3/4$ as $n \to \infty$ (cf. my previous answer), which implies that $\tilde X + Y$ has a unique median, equal to $1$. So, $m(\tilde X + Y) \neq m(\tilde X) + m(Y)$, as required.

In view of this example, we now give a counterexample for the case where $X$ and $Y$ are independent. Let $X$ and $Y$ be i.i.d. random variables with common probability mass function given by $p(2)= p(-1) = \frac{1}{2}(1 - \frac{1}{n})$, $p(0) = \frac{1}{n}$. Then, $X$ and $Y$ have a unique median, equal to $0$. On the other hand, one verifies that both ${\rm P}(X+Y \geq 1)$ and ${\rm P}(X+Y \leq 1)$ tend to $3/4$ as $n \to \infty$; hence, $X + Y$ has a unique median, equal to $1$. So, $m(X + Y) \neq m(X) + m(Y)$, as required.

In view of the preceding examples, we finally consider the case where $X$ and $Y$ are both symmetric and independent. Assuming both $X$ and $Y$ have a unique median, it must obviously be equal to $0$. For any fixed numbers $a$ and $b$, $aX + bY$ is also symmetric. Moreover, $aX + bY$ has a unique median, equal to $0$. This can be carried out straightforwardly, upon observing that ${\rm P}(X \in (-\varepsilon,\varepsilon), Y \in (-\varepsilon,\varepsilon)) > 0$ for any $\varepsilon > 0$. Hence, $m(aX+bY)=am(X)+bm(Y)=0$. From this, it easy to establish the following generalization. Suppose that $X$ and $Y$ are independent and symmetric around arbitrary points, say $m_1$ and $m_2$, respectively. Assume that both $X$ and $Y$ have a unique median (these medians are necessarily given by $m(X)=m_1$ and $m(Y)=m_2$). Then, for any fixed numbers $a$ and $b$, $m(aX+bY)$ has a unique median, equal to $am(X)+bm(Y)=am_1+bm_2$.

PREVIOUS ANSWER

For the second question, let us show that even if $X$ and $Y$ are symmetric random variables, then $m(X+Y)$ might be different from $m(X)+m(Y)$ (where $m$ denotes median). Suppose that ${\rm P}(X=1) = {\rm P}(X=-1) = 1/2$; hence $X$ is symmetric. Define $Y$ as follows: if $X=1$ then $Y=0$, whereas if $X=-1$ then $Y=2$ or $-2$ with probability $1/2$ each. Then, ${\rm P}(Y=0)=1/2$, ${\rm P}(Y=2)=1/4$, and ${\rm P}(Y=-2)=1/4$. Hence $Y$ is symmetric and, in turn, $m(X)+m(Y)=0+0=0$. However, ${\rm P}(X+Y=1) = 3/4$ (and ${\rm P}(X+Y=-3) = 1/4)$. In particular, $m(X+Y)=1$ (since ${\rm P}(X+Y=1) \geq 1/2$).


An intuitive and highly informal (do not look for math rigor here) argument for the linearity of the expectation operator, heavily inspired by the formulation of Meyer and Rubinfeld and somehow restating Troy's argument in discrete terms.

  • Let us have a set of possible states of the world $S$.
  • Let us have a mapping $Pr : S \rightarrow [0,1]$, that associate every state of the world $s\in S$ with a probability $Pr(s)$ (with usuals conditions on probability mappings applying to $Pr(\cdot)$).
  • Let $R_1$ and $R_2$ be random variables, which take real values in each and every state of the world $s\in S$.
  • Let $T$, another random variable taking values in $s\in S$, be defined by $T = R_1 + R_2$ .

Then we have:

$$E[T] = \sum_{s\in S} T(s) Pr(s)$$ $$~~~~~~~~~~~~~~~~~~~~~~~~~~= \sum_{s\in S} [R_1(s) + R_2(s)] Pr(s)$$ $$~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= \sum_{s\in S} [R_1(s) Pr(s)] + \sum_{s\in S} [R_2(s) Pr(s)]$$ $$~~~~~~~~~~~~= E[R_1] + E[R_2]$$


Intuitive (and somewhat informal) justification for the linearity of expectation. Suppose that random variables $X$ and $Y$ have expectation ${\rm E}(X)$ and ${\rm E}(Y)$, respectively. Suppose also that $(X_n,Y_n)$ is a sequence of i.i.d. random vectors having the (joint) distribution of $(X,Y)$. Then, in particular, $X_n$, $Y_n$, and $aX_n + bY_n$ are sequences of i.i.d. random variables having the distribution of $X$, $Y$, and $aX + bY$, respectively. Thus, from $$ a{\rm E}(X) + b{\rm E}(Y) \stackrel{{\rm a.s.}}{=} a\mathop {\lim }\limits_{n \to \infty } \frac{{\sum\nolimits_{i = 1}^n {X_i } }}{n} + b\mathop {\lim }\limits_{n \to \infty } \frac{{\sum\nolimits_{i = 1}^n {Y_i } }}{n}, $$ we conclude that $$ {\rm E}(aX + bY) \stackrel{{\rm a.s.}}{=} \mathop {\lim }\limits_{n \to \infty } \frac{{\sum\nolimits_{i = 1}^n {(aX_i + bY_i )} }}{n} \stackrel{{\rm a.s.}}{=} a{\rm E}(X) + b{\rm E}(Y), $$
where $\stackrel{{\rm a.s.}}{=}$ stands for `almost surely equal', and where we have used the strong law of large numbers, namely, if $Z_n$ is a sequence of i.i.d. random variables having the distribution of a random variable $Z$ with finite expectation, then ${\rm E}(Z) \stackrel{{\rm a.s.}}{=} \mathop {\lim }\limits_{n \to \infty } \frac{{\sum\nolimits_{i = 1}^n {Z_i } }}{n}$.


HINT: Use the definition of $$ E(X) = \sum\limits_{x} x P(X)$$