The **expectation** (also called *expected value* or just the *mean*) of a discrete r.v. $X$ is a weighted average of all the possible values of $X$. the weight is the probability that a value occurs.

For a r.v. $X$ with $n$ possible values $x_{1},x_{2},…,x_{n}$, we have

$E(X)=i=1∑n x_{i}⋅P(X=x_{i})$This also applies when $n=∞$, but only when the infinite series converges absolutely (otherwise, $E(X)$ is undefined). We usually assume $E(X)$ is well-defined.

Tip

Remember that $E(X)$ is

nota function. It’s a real number and aconstant, and does not depend on anything. Given a r.v. $X$, we have a $E(X)$ that (usually) exists and is a single number.

One important and useful property is the Linearity of expectation.

## Finding the expectation

### “Adam’s law”

Also known as the Law of Iterated Expectations (LIE), Law of Total Expectation, or the Tower property. “Adam’s law” is a joke from Harvard relating it to “Eve’s law.”

For any random variables $X$ and $Y$,

$E(Y)=E(E(Y∣X))$where $E(Y∣X)$ is the conditional expectation of $X$ and $Y$.

### Sum of indicator variables

To calculate the expectation of $X$, we can use the following strategy:

- Represent $X$ as a sum of Indicator variables. To figure out what the indicators are, think about what $X$ is exactly counting.
- Calculate the expected value of each indicator.
- By LOE, we sum up all the expectations to get $E(X)$.

### Darth Vader rule

“This is not a reference to a discoverer. But the designation may capture the somewhat counterintuitive—if not slightly unsettling and surreal—impression which the result can evoke on first encounter.” from P. Muldowney et al. (2012)

We can also calculate the expectation via a survival function. Let $X$ be a r.v. with support $[0..b]∈Z$. then we can write

$E(X)=k=1∑b P(X≥k)$