Skip to main content

Expectation

The expected value of random variable XX is defined as

E[X]=aΩX(a)P[a]{\mathbb E}[X] = \sum_{a \in \Omega} X(a) {\mathbb P}[a]

It is easy to check that

E[X]=uRuP[X=u]=urange(X)uP[X=u]{\mathbb E}[X] = \sum_{u \in {\mathbb R}} u \cdot {\mathbb P}[X= u] = \sum_{u \in {\sf range}(X)} u \cdot {\mathbb P}[X=u]

where the notation range(X){\sf range}(X) is defined as {X(a):aΩ}\{X(a): a \in \Omega\}. Since we consider a finite sample space, the range of XX is always finite. Denote by minX\min X and maxX\max X the minimum and maximum values in range(X){\sf range}(X) respectively.

Example 40

It is easy to check that minXE[X]maxX\min X \leq {\mathbb E}[X] \leq \max X. This is simply because for every urange(X)u \in {\sf range}(X), we have uminXu \geq \min X, so

E[X]=urange(X)uP[X=u](minX)urange(X)P[X=u]=minX{\mathbb E}[X] =\sum_{u \in {\sf range}(X)} u \cdot {\mathbb P}[X=u] \geq (\min X) \cdot \sum_{u \in {\sf range}(X)} {\mathbb P}[X=u] = \min X

Theorem 41 (Additivity of expectation)

Let XX and YY be random variables. Then

E[X+Y]=E[X]+E[Y]{\mathbb E}[X+Y] = {\mathbb E}[X] + {\mathbb E}[Y]

Exercise 107 (Linearity of expectation)

If c1,,ckc_1,\ldots, c_k are real numbers and X1,,XkX_1,\ldots, X_k are random variables, then

E[iciXi]=iciE[Xi]{\mathbb E}[\sum_i c_i X_i] = \sum_i c_i {\mathbb E}[X_i]

The indicator variable of event EΩE \subseteq \Omega is a random variable that takes 0/10/1 values, i.e., ζE:Ω{0,1}\zeta_E: \Omega \rightarrow \{0,1\} such that

ζE(a)={1,if aE0,otherwise\zeta_E(a) = \begin{cases} 1, & \text{if}\ a \in E \\ 0, & \text{otherwise} \end{cases}

In other words, this is the (random) predicate indicating whether aEa \in E. It is easy to check that the expected value of an indicator variable ζE\zeta_E is the probability of EE (do you see why?).

E[ζE]=P[E]{\mathbb E}[\zeta_E] = {\mathbb P}[E]

Indicator variables play a central role in probability.

Exercise 108

Prove: Every random variable can be written as a linear combination of indicator variables.

Example 41

Let X=iXiX = \sum_i X_i where XiX_i is an indicator random variable ζEi\zeta_{E_i} for event EiE_i. Therefore, E[X]=iP[Ei]{\mathbb E}[X] = \sum_i {\mathbb P}[E_i]. This just follows from the linearity of expectation.

Example 42

In a random graph probability space (Γn,P)(\Gamma_n, {\mathbb P}), calculate the expected number of edges.

Proof:

Let XX be the number of edges. So we can write XX as a sum of the pairs X(i,j)X(i,j) where X(i,j)X(i,j) is an indicator of whether there is an edge connecting ii and jj. That is, X={i,j}([n]2)X(i,j)X= \sum_{\{i,j\} \in {[n] \choose 2}} X(i,j). By the linearity of expectation:

E[X]=i,jE[X(i,j)]=(n2)/2{\mathbb E}[X] = \sum_{i,j} {\mathbb E}[X(i,j)] = {n \choose 2}/2

Exercise 109

Calculate the following expectations for the probability space ({0,1}n,fp)(\{0,1\}^n, f_p) (see Coin tossing).

  • The number of heads.
  • The number of runs of kk consecutive heads (e.g., 110111110111 has 3 runs of 22 consecutive heads).
Exercise 110

Calculate the expected number of Hamiltonian cycles (contain every vertex) in a random graph.