Definitions

# Expected value

In probability theory the expected value (or expectation value, or mathematical expectation, or mean) of a discrete random variable is the sum of the probability of each possible outcome of the experiment multiplied by the outcome value (or payoff). Thus, it represents the average amount one "expects" as the outcome of the random trial when identical odds are repeated many times. Note that the value itself may not be expected in the general sense - the "expected value" itself may be unlikely or even impossible.

## Examples

The expected value from the roll of an ordinary six-sided die is


operatorname{E}(X) = frac{1 + 2 + 3 + 4 + 5 + 6}{6} = 3.5

which is not among the possible outcomes.

A common application of expected value is to gambling. For example, an American roulette wheel has 38 places where the ball may land, all equally likely. A winning bet on a single number pays 35-to-1, meaning that the original stake is not lost, and 35 times that amount is won, so you receive 36 times what you've bet. Considering all 38 possible outcomes, the expected value of the profit resulting from a dollar bet on a single number is the sum of what you may lose times the odds of losing and what you will win times the odds of winning, that is,


operatorname{E}(X) = left(-\$1 times frac{37}{38} right) + left(\$35 times frac{1}{38} right) = -\$frac{1}{19} approx -\$0.0526.

The change in your financial holdings is −\$1 when you lose, and \$35 when you win. Thus one may expect, on average, to lose about five cents for every dollar bet, and the expected value of a one-dollar bet is \$0.9474. In gambling, an event of which the expected value equals the stake (of which the bettor's expected profit is zero) is called a "fair game."

## Mathematical definition

In general, if $X,$ is a random variable defined on a probability space $\left(Omega, Sigma, P\right),$, then the expected value of $X,$, denoted $operatorname\left\{E\right\}\left(X\right),$, or sometimes $langle X rangle$, or $mathbb\left\{E\right\}\left(X\right)$, is defined as

$operatorname\left\{E\right\}\left(X\right) = int_Omega X, operatorname\left\{d\right\}P$

where the Lebesgue integral is employed. Note that not all random variables have an expected value, since the integral may not exist (e.g., Cauchy distribution). Two variables with the same probability distribution will have the same expected value, if it is defined.

If $X$ is a discrete random variable with probability mass function $p\left(x\right)$, then the expected value becomes

$operatorname\left\{E\right\}\left(X\right) = sum_i x_i p\left(x_i\right) ,$

as in the gambling example mentioned above.

If the probability distribution of $X$ admits a probability density function $f\left(x\right)$, then the expected value can be computed as

$operatorname\left\{E\right\}\left(X\right) = int_\left\{-infty\right\}^infty x f\left(x\right), operatorname\left\{d\right\}x .$

It follows directly from the discrete case definition that if $X$ is a constant random variable, i.e. $X = b$ for some fixed real number $b$, then the expected value of $X$ is also $b$.

The expected value of an arbitrary function of X, g(X), with respect to the probability density function f(x) is given by the inner product of f and g:

$operatorname\left\{E\right\}\left(g\left(X\right)\right) = int_\left\{-infty\right\}^infty g\left(x\right) f\left(x\right), operatorname\left\{d\right\}x .$

## Conventional terminology

• When one speaks of the "expected price", "expected height", etc. one means the expected value of a random variable that is a price, a height, etc.
• When one speaks of the "expected number of attempts needed to get one successful attempt," one might conservatively approximate it as the reciprocal of the probability of success for such an attempt. Cf. expected value of the geometric distribution.

## Properties

### Constants

The expected value of a constant is equal to the constant itself; i.e., if 'c' is a constant, then E(c) = c

### Monotonicity

If X and Y are random variables so that $X le Y$ almost surely, then $operatorname\left\{E\right\}\left(X\right) le operatorname\left\{E\right\}\left(Y\right)$.

### Linearity

The expected value operator (or expectation operator) $operatorname\left\{E\right\}$ is linear in the sense that
$operatorname\left\{E\right\}\left(X + c\right)= operatorname\left\{E\right\}\left(X\right) + c,$
$operatorname\left\{E\right\}\left(X + Y\right)= operatorname\left\{E\right\}\left(X\right) + operatorname\left\{E\right\}\left(Y\right),$
$operatorname\left\{E\right\}\left(aX\right)= a operatorname\left\{E\right\}\left(X\right),$

Combining the results from previous three equations, we can see that -

$operatorname\left\{E\right\}\left(aX + b\right)= a operatorname\left\{E\right\}\left(X\right) + b,$
$operatorname\left\{E\right\}\left(a X + b Y\right) = a operatorname\left\{E\right\}\left(X\right) + b operatorname\left\{E\right\}\left(Y\right),$

for any two random variables $X$ and $Y$ (which need to be defined on the same probability space) and any real numbers $a$ and $b$.

### Iterated expectation

#### Iterated expectation for discrete random variables

For any two discrete random variables $X,Y$ one may define the conditional expectation:

$operatorname\left\{E\right\}\left(X|Y\right)\left(y\right) = operatorname\left\{E\right\}\left(X|Y=y\right) = sumlimits_x x cdot operatorname\left\{P\right\}\left(X=x|Y=y\right).$

which means that $operatorname\left\{E\right\}\left(X|Y\right)\left(y\right)$ is a function on $y$.

Then the expectation of $X$ satisfies


operatorname{E} left(operatorname{E}(X|Y) right)= sumlimits_y operatorname{E}(X|Y=y) cdot operatorname{P}(Y=y) ,

$=sumlimits_y left\left(sumlimits_x x cdot operatorname\left\{P\right\}\left(X=x|Y=y\right) right\right) cdot operatorname\left\{P\right\}\left(Y=y\right),$

$=sumlimits_y sumlimits_x x cdot operatorname\left\{P\right\}\left(X=x|Y=y\right) cdot operatorname\left\{P\right\}\left(Y=y\right),$

$=sumlimits_y sumlimits_x x cdot operatorname\left\{P\right\}\left(Y=y|X=x\right) cdot operatorname\left\{P\right\}\left(X=x\right) ,$

$=sumlimits_x x cdot operatorname\left\{P\right\}\left(X=x\right) cdot left\left(sumlimits_y operatorname\left\{P\right\}\left(Y=y|X=x\right) right\right) ,$

$=sumlimits_x x cdot operatorname\left\{P\right\}\left(X=x\right) ,$

$=operatorname\left\{E\right\}\left(X\right).,$

Hence, the following equation holds:

$operatorname\left\{E\right\}\left(X\right) = operatorname\left\{E\right\} left\left(operatorname\left\{E\right\}\left(X|Y\right) right\right).$

The right hand side of this equation is referred to as the iterated expectation and is also sometimes called the tower rule. This proposition is treated in law of total expectation.

#### Iterated expectation for continuous random variables

In the continuous case, the results are completely analogous. The definition of conditional expectation would use inequalities, density functions, and integrals to replace equalities, mass functions, and summations, respectively. However, the main result still holds:
$operatorname\left\{E\right\}\left(X\right) = operatorname\left\{E\right\} left\left(operatorname\left\{E\right\}\left(X|Y\right) right\right).$

### Inequality

If a random variable X is always less than or equal to another random variable Y, the expectation of X is less than or equal to that of Y:

If $X leq Y$, then $operatorname\left\{E\right\}\left(X\right) leq operatorname\left\{E\right\}\left(Y\right)$.

In particular, since $X leq |X|$ and $-X leq |X|$, the absolute value of expectation of a random variable is less than or equal to the expectation of its absolute value:

$|operatorname\left\{E\right\}\left(X\right)| leq operatorname\left\{E\right\}\left(|X|\right)$

### Representation

The following formula holds for any nonnegative real-valued random variable X (such that $operatorname\left\{E\right\}\left(X\right) < infty$), and positive real number $alpha$:

$operatorname\left\{E\right\}\left(X^alpha\right) = alpha int_\left\{0\right\}^\left\{infty\right\} t^\left\{alpha -1\right\}operatorname\left\{P\right\}\left(X>t\right) , operatorname\left\{d\right\}t.$

In particular, for $alpha=1$, this reduces to:

$operatorname\left\{E\right\}\left(X\right) = int_\left\{0\right\}^\left\{infty\right\} lbrace 1-F\left(t\right) rbrace , operatorname\left\{d\right\}t.$

### Non-multiplicativity

In general, the expected value operator is not multiplicative, i.e. $operatorname\left\{E\right\}\left(X Y\right)$ is not necessarily equal to $operatorname\left\{E\right\}\left(X\right) operatorname\left\{E\right\}\left(Y\right)$. If multiplicativity occurs, the $X$ and $Y$ variables are said to be uncorrelated (independent variables are a notable case of uncorrelated variables). The lack of multiplicativity gives rise to study of covariance and correlation.

### Functional non-invariance

In general, the expectation operator and functions of random variables do not commute; that is

$operatorname\left\{E\right\}\left(g\left(X\right)\right) = int_\left\{Omega\right\} g\left(X\right), operatorname\left\{d\right\}P neq g\left(operatorname\left\{E\right\}\left(X\right)\right),$

A notable inequality concerning this topic is Jensen's inequality, involving expected values of convex (or concave) functions.

## Uses and applications of the expected value

The expected values of the powers of $X$ are called the moments of $X$; the moments about the mean of $X$ are expected values of powers of $X - operatorname\left\{E\right\}\left(X\right)$. The moments of some random variables can be used to specify their distributions, via their moment generating functions.

To empirically estimate the expected value of a random variable, one repeatedly measures observations of the variable and computes the arithmetic mean of the results. If the expected value exists, this procedure estimates the true expected value in an unbiased manner and has the property of minimizing the sum of the squares of the residuals (the sum of the squared differences between the observations and the estimate). The law of large numbers demonstrates (under fairly mild conditions) that, as the size of the sample gets larger, the variance of this estimate gets smaller.

In classical mechanics, the center of mass is an analogous concept to expectation. For example, suppose $X$ is a discrete random variable with values $x_i$ and corresponding probabilities $p_i$. Now consider a weightless rod on which are placed weights, at locations $x_i$ along the rod and having masses $p_i$ (whose sum is one). The point at which the rod balances is $operatorname\left\{E\right\}\left(X\right)$.

Expected values can also be used to compute the variance, by means of the computational formula for the variance

$operatorname\left\{Var\right\}\left(X\right)= operatorname\left\{E\right\}\left(X^2\right) - \left(operatorname\left\{E\right\}\left(X\right)\right)^2.$

A very important application of the expectation value is in the field of quantum mechanics. The expectation value of a quantum mechanical operator $hat\left\{A\right\}$ operating on a quantum state vector $|psirangle$ is written as $langlehat\left\{A\right\}rangle = langlepsi|A|psirangle$. The uncertainty in $hat\left\{A\right\}$ can be calculated using the formula $\left(Delta A\right)^2 = langlehat\left\{A\right\}^2rangle - langlehat\left\{A\right\}rangle^2$.

## Expectation of matrices

If $X$ is an $m times n$ matrix, then the expected value of the matrix is defined as the matrix of expected values:


operatorname{E}(X) = operatorname{E} begin{pmatrix} x_{1,1} & x_{1,2} & cdots & x_{1,n} x_{2,1} & x_{2,2} & cdots & x_{2,n}
`vdots `
x_{m,1} & x_{m,2} & cdots & x_{m,n} end{pmatrix} = begin{pmatrix} operatorname{E}(x_{1,1}) & operatorname{E}(x_{1,2}) & cdots & operatorname{E}(x_{1,n}) operatorname{E}(x_{2,1}) & operatorname{E}(x_{2,2}) & cdots & operatorname{E}(x_{2,n})
`vdots `
operatorname{E}(x_{m,1}) & operatorname{E}(x_{m,2}) & cdots & operatorname{E}(x_{m,n}) end{pmatrix}.

This is utilized in covariance matrices.

## Computation

It is often useful to update a computed expected value as new data come in. This can be done as follows, where $new_value$ is the $count$-th value, and we use the previous estimate $operatorname\left\{E\right\}_mathrm\left\{prev\right\}\left(X\right)$ to compute $operatorname\left\{E\right\}_mathrm\left\{new\right\}\left(X\right)$:


operatorname{E}_mathrm{new}(X) = [(count-1) cdot operatorname{E}_mathrm{prev}(X) + new_value]/count

## Formula for non-negative integral values

When a random variable takes only values in $\left\{0,1,2,3,...\right\}$ we can use the following formula for computing its expectation:

operatorname{E}(X)=sumlimits_{i=1}^infty P(Xgeq i). For example, suppose we toss a coin where the probability of heads is $p$. How many tosses can we expect until the first heads? Let $X$ be this number. Note that we are counting only the tails and not the heads which ends the experiment; in particular, we can have $X=0$. The expectation of $X$ may be computed by $sum_\left\{i= 1\right\}^infty \left(1-p\right)^i=frac\left\{1-p\right\}\left\{p\right\}$. This is because the number of tosses is at least $i$ exactly when the first $i$ tosses yielded tails. This matches the expectation of a random variable with an Exponential distribution. We used the formula for Geometric progression: $sum_\left\{k=1\right\}^infty r^k=frac\left\{r\right\}\left\{\left(1-r\right)\right\}.$