Home page for accesible maths 4 Discrete random variables

Style control - access keys in brackets

Font (2 3) - + Letter spacing (4 5) - + Word spacing (6 7) - + Line spacing (8 9) - +

4.4 Expectation

Expectation is a simple measure to calculate the average value taken by a random variable.
Suppose the outcome of an experiment is the random variable R. If the experiment is repeated, we observe outcomes r1,r2,. The mean observed value of R is

r1+r2++rnn.

Let nr be the number of times that r is observed in the n experiments. Then

r1+r2++rn=r𝒮rnr.

We motivated probability with the notion (as yet unproved) that

nrnP(R=r)=pR(r)

as n. If this holds then

r1+r2++rnn = r𝒮rnrn
= r𝒮rnrn
r𝒮rpR(r).

This motivates the following definition:

The expected value or expectation of a discrete random variable R is E(R)=r=0rpR(r).

An equivalent expression of the expectation that can be useful if the pmf of a random variable is not known is the following:

E(R)=ωΩR(ω)P({ω}).

The equivalence between these two expressions can be shown using the way the pmf is defined, and is left as an exercise.

Example 4.14.

Recall the gambling exercise above, where the random variable R, profit, is defined by

R(ω) = -1 if ω=1,2,3
= 0 if ω=4
= 2 if ω=5,6

from the throw of a fair die. The induced sample space for R is 𝒮={-1,0,2}. The pmf of R is pR(-1)=3/6, pR(0)=1/6, pR(2)=2/6. Find the expected profit, using both definitions above.

Solution.

Using the first definition:

E[R] = -1×pR(-1)+0×pR(0)+2×pR(2)
= -1×3/6+0×1/6+2×2/6
= 1/6.

Using the second definition:

E[R] = -1×1/6+-1×1/6+-1×1/6+0×1/6+2×1/6+2×1/6
= 1/6.

Both give the same result of £1/6

Exercise 4.15.

Find the expected number of heads in 3 tosses of a fair coin.

Solution.
R(TTT)=0, pR(0)=1/8,
R(HTT)=R(THT)=R(TTH)=1, pR(1)=3/8,
R(HHT)=R(HTH)=R(THH)=2, pR(2)=3/8,
R(HHH)=3, pR(3)=1/8,
E(R) = r=03rpR(r)
= 0×18+1×38+2×38+3×18
= 12/8=1.5.

Note P({R=1.5})=0, which may seem surprising. The expected value of a random variable is not the value that you expect to obtain.

A similar calculation gives the expected number of tails is 1.5. This accords with intuition: we expect on average the same number of heads and tails for a fair coin.

Exercise 4.16.

Find the expected value of the score on a die.

Solution.

From equi-probability pR(1)=pR(2)==pR(6)=1/6. Let R represent the score, so that

E(R)=r=16rpR(r)=16(1+2++6)=3.5.
Example 4.17.

Suppose AΩ is an event. The indicator function of A is the function IA:Ω{0,1} such that IA(ω)=1 if ωA, and IA(ω)=0 otherwise. Since IA is a real-valued function on Ω, it is a random variable. What is its expected value?

Solution.

First find the pmf of IA.

pI(1) = P(IA=1)=P({ω:ωA})=P(A)
pI(0) = P(IA=0)=P({ω:ωAc})=1-P(A).

Therefore

E[IA]=0×pI(0)+1×pI(1)=P(A).

If g: is any real valued function, then g(R)=gR is a function from Ω, so is also a random variable. We can therefore work out its expected value:
Using the second definition of expectation:

E(g(R)) = ωΩg(R(ω))P({ω})
= r=0ω:R(ω)=rg(R(ω))P({ω})
= r=0g(r)ω:R(ω)=rP({ω})
= r=0g(r)pR(r)

where the last line follows from the definition of a pmf.

We have proved the following:

Lemma 4.18.

The expected value of a function g of a discrete random variable R is

E(g(R))=r=0g(r)pR(r).
Example 4.19.

If pR(r)=13 for r=0,1,2, find E(R2).

Solution.

The function here is g(r)=r2. So

E[g(R)] = r=02r2pR(r)
= 02pR(0)+12pR(1)+22pR(2)
= 13(02+12+22)=5/3.
Exercise 4.20.

Find E(R3+2R) if pR(1)=3/4 and pR(2)=1/4.

Solution.
E(R3+2R)=(13+2×1)34+(23+2×2)14=214.

Expectation obeys two important rules of linearity. For arbitrary functions g and h, and constant c:

E(g(R)+h(R)) = E(g(R))+E(h(R))
E(cg(R)) = cE(g(R)).

A special case is that E[c]=c.

These results can be verified using the definition of the expectation of a function. We show how to obtain the first identity; the others are obtained similarly.

E(g(R)+h(R)) = r=0(g(r)+h(r))pR(r)
= r=0g(r)pR(r)+r=0h(r)pR(r)
= E(g(R))+E(h(R))

Exercise 4.21.

Find E(R) if it is known that E(R(R-1))=4 and E(R2)=3.

Solution.
4=E(R(R-1)) = E(R2-R)
= E(R2+(-1)R)
= E(R2)+E((-1)R)
= E(R2)+(-1)E(R)
= 3-E(R)

Therefore E(R)=-1.