The Expectation Operator
Introduction

The expectation operator $E[X]$ is ultimately a fancy generalization of the mean of a random variable. It often isn't used until graduate courses or research papers though, making it a difficult concept to grapple with initially. It's generalization though is quite nice, as it describes the behavior for a variety of different random variables (think discrete and continuous number lines).

The Discrete Time Case

A discrete random variable $X$ can only take on a finite amount of values $x_1, x_2, x_3, ... , x_n$, where $n$ is the total amount of possible values that it can assume. Each of these possibilities has a associated probability: $p_1, p_2, p_3, ... , p_n$. The expected value of $x$ is the weighted sum of each of the possible values:

$$\begin{equation} E[X] = \sum_{i=1}^{n} x_i p_i \textit{.} \end{equation}$$

A nice property, is that if $p_1 = p_2 = p_3 = ... = p_n$, then the expected value of $x$ is simply the average of all possibilities.

The Countable Infinity Case

Cantor defined the difference between different types of infinity. This gives rise to the two different cases for random variables in infinite sets. The first is the countable infinite set, like the integers. This would have been equivalent to the definition above, except for infinite things don't always like to behave well.

If $X$ is non-negative random variable with outcomes $x_1, x_2, ...,$ and probabilities $p_1, p_2, ...,$ then the expected value of $x$ is represented by the

$$\begin{equation} E[X] = \sum_{i=1}^{\infty} x_i p_i \textit{.} \end{equation}$$

For a more general solution, where $X$ is not necessarily a non-negative random variable, that is defined as $E[X] = E[X^+] - E[X^-]$. Remember too that because this is an infinite set, the mean has the possibility of either converging or diverging, meaning that there is the possibility of either a finite or infinite mean.

The Absolutely Continuous Case

I was going to call this the uncountable infinity case, but apparently I can't because it would be wrong. This is the the fun case though, because calculus! If $X$ is a random variable with a probability function $f(x)$ then the expected value of $X$ is

$$\begin{equation} E[X] = \int_{-\infty}^{\infty} x f(x) dx \textit{.} \end{equation}$$

Chances are if you stare at this long enough, then you'll realize that this is the definition of the mean that you were taught in your first college statistics class.

For more information, take a look at Wikipedia!