Overview

A random variable is defined as a number whose value is determined by a random process, like a die roll. The expected value of a random variable is a fancy way of saying its average value.

Let P(e)P(e) be the probability of event ee happening. If we have a random variable XX with outcomes x1,x2,…,xnx_1, x_2, \ldots, x_n occurring with probabilities p1,p2,…,pnp_1, p_2, \ldots, p_n, then the expected value is the weighted average

E[X]=x1p1+x2p2+⋅⋅⋅+xnpn.E[X] = x_1p_1+x_2p_2+\cdot\cdot\cdot+x_np_n.

From this definition we clearly have:

  1. E[X+c]=E[X]+cE[X+c]=E[X]+c
  2. E[cX]=cE[X]E[cX] = cE[X]

for some constant cc.

There are also two other very important, but a bit less obvious, facts about expected value.

  1. If X,YX, Y are two independent random variables, then E[XY]=E[X]E[Y]E[XY] = E[X]E[Y].
  2. Linearity of Expectation: If X,YX,Y are two random variables, then E[X+Y]=E[X]+E[Y]E[X+Y]=E[X]+E[Y]. This is true regardless of whether or not X,YX,Y are independent. This is arguably the most important property of expected value.

A Simple Example

In a dice roll, the possible outcomes are 1,2,3,4,5,61,2,3,4,5,6 and the probability of each is 16\frac{1}{6}, so the expected value is

16⋅1+16⋅2+16⋅3+16⋅4+16⋅5+16⋅6=3.5\frac{1}{6}\cdot1+\frac{1}{6}\cdot2+\frac{1}{6}\cdot3+\frac{1}{6}\cdot4+\frac{1}{6}\cdot5+\frac{1}{6}\cdot6 = 3.5

The expected sum of two dice rolls is 3.5+3.5=73.5+3.5=7. The expected product of two dice rolls is 3.5×3.5=12.253.5\times3.5=12.25, as the dice rolls are independent.

Worked Example #1

Suppose there are nn people, each of whom has a name tag. The name tags are shuffled, and each person is randomly given a name tag. What is the expected number of people who received their own name tag?

Solution

Label the people 1,2,…,n1,2,\dots,n. Define the indicator variable XiX_i to be 11 if person ii receives their own name tag and 00 otherwise. Then

X=X1+X2+⋅⋅⋅+XnX = X_1 + X_2 + \cdot\cdot\cdot + X_n

represents the total number of people who receive their own name tag.

Using indicator variables is powerful because it turns counting problems into expectation problems.

For each ii,

E[Xi]=1nE[X_i] = \frac{1}{n}.

Hence,

E[X]=E[X1]+E[X2]+⋅⋅⋅+E[Xn]E[X] = E[X_1] + E[X_2] + \cdot\cdot\cdot + E[X_n]

=n⋅1n=1= n \cdot \frac{1}{n} = \boxed{1}.

Worked Example #2 (2021 Fall AMC 10B #16)

Five balls are arranged around a circle. Chris chooses two adjacent balls at random and swaps them. Then Silva does the same independently. What is the expected number of balls that occupy their original positions after both swaps?

Solution

Label the balls 1,2,3,4,51,2,3,4,5. Define XiX_i to be 11 if ball ii is in its original position after both swaps, and 00 otherwise. Then

X=X1+X2+X3+X4+X5X = X_1 + X_2 + X_3 + X_4 + X_5.

Consider a fixed ball. It is not touched by a swap with probability 35\frac{3}{5}. Thus the probability it is untouched in both steps is (35)2\left(\frac{3}{5}\right)^2.

Additionally, there is a chance it is swapped and then swapped back. This occurs with probability 25⋅15\frac{2}{5} \cdot \frac{1}{5}.

So,

E[Xi]=(35)2+25⋅15=1125E[X_i] = \left(\frac{3}{5}\right)^2 + \frac{2}{5}\cdot\frac{1}{5} = \frac{11}{25}.

Hence,

E[X]=5⋅1125=2.2E[X] = 5 \cdot \frac{11}{25} = \boxed{2.2}.

Worked Example #3 (2021 Fall AMC 12B #23)

What is the average number of pairs of consecutive integers in a randomly selected subset of 55 distinct integers chosen from 1,2,3,…,30{1,2,3,\dots,30}?

Solution

There are 2929 consecutive pairs:

p1=1,2,p2=2,3,…,p29=29,30p_1={1,2}, p_2={2,3}, \dots, p_{29}={29,30}.

Define XiX_i to be 11 if both numbers in pair pip_i are in the chosen subset, and 00 otherwise.

Then

X=X1+X2+⋅⋅⋅+X29X = X_1 + X_2 + \cdot\cdot\cdot + X_{29}.

For a fixed pair pip_i, the number of subsets containing it is (283)\binom{28}{3} out of (305)\binom{30}{5} total subsets. Thus,

E[Xi]=(283)(305)=129⋅23E[X_i] = \frac{\binom{28}{3}}{\binom{30}{5}} = \frac{1}{29}\cdot\frac{2}{3}.

Hence,

E[X]=29⋅129⋅23=23E[X] = 29 \cdot \frac{1}{29}\cdot\frac{2}{3} = \boxed{\frac{2}{3}}.

Expected value allows complicated counting problems to be reduced to simple probability computations.

Worked Example #4

An Alien starts at square 11 on a normal number line. Every millisecond, he moves either 11 step to the right with probability of 12\frac{1}{2} OR 33 steps to the right with probability of 12\frac{1}{2}. Now, after 2020 moves, we let XX denote his current position. What is E[X]E[X]?

Solution

First, define XiX_i as the distance the Alien moved on step ii. Then, we have that

X=1+X1+X2+⋅⋅⋅+X20X = 1 + X_1 + X_2 + \cdot\cdot\cdot + X_{20}.

Next, for each step,

E[Xi]=12(1)+12(3)=2E[X_i] = \frac{1}{2}(1) + \frac{1}{2}(3) = 2.

And so, we get the answer from here,

E[X]=1+20⋅2=41E[X] = 1 + 20 \cdot 2 = \boxed{41}.

Worked Example #5

A peculiar and very skibidi magician has 1212 skibidi cubes. Each skibidi cube is RED with probability of 13\frac{1}{3}, BLUE with probability of 12\frac{1}{2}, and GREEN otherwise. Red gives 55 skibidi points, blue gives −2-2 skibidi points, and green gives 00 skibidi points. If S is the total score, find E[S]E[S].

Solution

First, we define XiX_i to be the score from skibidi cube ii. Then, we have that

S=X1+X2+⋅⋅⋅+X12S = X_1 + X_2 + \cdot\cdot\cdot + X_{12}.

Now, notice that for one cube, we have

E[Xi]=5(13)−2(12)+0(16)E[X_i] = 5\left(\frac{1}{3}\right) - 2\left(\frac{1}{2}\right) + 0\left(\frac{1}{6}\right)

=53−1=23= \frac{5}{3} - 1 = \frac{2}{3}.

So, as a result,

E[S]=12⋅23=8E[S] = 12 \cdot \frac{2}{3} = \boxed{8}.

Worked Example #6

An skibidi integer is chosen uniformly and randomly from 1,2,…,100{1,2,\dots,100}. If XX is the number of divisors of the integer, your job is to find E[X]E[X].

Solution

To start off, like usual, we will define some variables. Here, we will define IkI_k to be 11 IF kk divides the integer that was chosen, and 00 otherwise. Then we have that

X=I1+I2+⋅⋅⋅+I100X = I_1 + I_2 + \cdot\cdot\cdot + I_{100}.

By using the powerful linearity of expectation, we obtain,

E[X]=∑k=1100E[Ik]E[X] = \sum_{k=1}^{100} E[I_k].

From here, notice that for fixed kk, the probability that it divides a random integer is simply

E[Ik]=⌊100k⌋100E[I_k] = \frac{\left\lfloor \frac{100}{k} \right\rfloor}{100}.

Thus, we have

E[X]=1100∑k=1100⌊100k⌋E[X] = \frac{1}{100} \sum_{k=1}^{100} \left\lfloor \frac{100}{k} \right\rfloor.

Now, this sum equals 482482, so we can get our answer easily from here

E[X]=482100=24150E[X] = \frac{482}{100} = \frac{241}{50}.

Worked Example #7

Eight extremely skibidi, extraterrestrial players each play one very skibidi game against EVERY other player. Each skibidi player independently gets a skibidi toy with probability 14\frac{1}{4}. If XX is the number of games where BOTH players have skibidi toys, your goal is to find E[X]E[X].

Solution

First, notice that there are simply (82)=28\binom{8}{2}=28 games. Next, we will define IgI_g to be 11 IF both players in game gg have skibidi toys, and 00 otherwise.

Then, from here, it is easy to see that

X=∑IgX = \sum I_g.

So, for ANY game,

P(both have skibidi toys)=(14)2=116P(\text{both have skibidi toys}) = \left(\frac{1}{4}\right)^2 = \frac{1}{16}.

So, as result, we get

E[Ig]=116E[I_g] = \frac{1}{16}.

And thus, the ansewr follows:

E[X]=28⋅116=74E[X] = 28 \cdot \frac{1}{16} = \boxed{\frac{7}{4}}.

Worked Example #8 (Challenge: It requires a bit of calculus!)

A fair (not skibidi) coin is flipped UNTIL the first tails appears. If tails appears on flip nn, the payout is n2n^2. If XX is the payout, your job is to find E[X]E[X].

Solution

First, realize that the probability that the first tails occurs on flip nn is simply

(12)n\left(\frac{1}{2}\right)^n.

As a result, we have that,

E[X]=∑n=1∞n2(12)nE[X] = \sum_{n=1}^{\infty} n^2 \left(\frac{1}{2}\right)^n.

Then, using a identity which can be proven from taking a geometric series and differentiating it, we get

∑n=1∞n2xn=x(x+1)(1−x)3\sum_{n=1}^{\infty} n^2 x^n = \frac{x(x+1)}{(1-x)^3},

and substitute x=12x=\frac{1}{2}:

E[X]=12⋅32(12)3=3/41/8=6E[X] = \frac{\frac{1}{2}\cdot\frac{3}{2}}{\left(\frac{1}{2}\right)^3} = \frac{3/4}{1/8} = 6.

Therefore, the expected payout is 6\boxed{6}!

Practice Problems

StatusSourceProblem NameDifficultyTags
MathNetHard
Show TagsExpected values
Berkeley Math Circle: Monthly Contest 6Hard
Show TagsExpected values
Berkeley Math Circle: Monthly Contest 7Hard
Show TagsCombinatorial Geometry, Expected values
Berkeley Math Circle: Monthly Contest 2Hard
Show TagsColoring schemes, extremal arguments, Expected values, Induction / smoothing, Sums and products
BAMOHard
Show TagsCounting two ways, Expected values
Harvard-MIT Math TournamentHard
Show TagsExpected values
Harvard-MIT Mathematics TournamentHard
Show TagsAlgebraic properties of binomial coefficients, Counting two ways, Expected values
Harvard-MIT Mathematics TournamentHard
Show TagsExpected values
Harvard-MIT Mathematics TournamentHard
Show TagsExpected values
Harvard-MIT Mathematics TournamentHard
Show TagsExpected values
Harvard-MIT Mathematics TournamentHard
Show TagsExpected values, Prime numbers
10th Annual Harvard-MIT Mathematics TournamentHard
Show TagsExpected values
Harvard-MIT Mathematics TournamentHard
Show TagsEnumeration with symmetry, Expected values
1st Annual Harvard-MIT November TournamentHard
Show TagsExpected values
1st Annual Harvard-MIT November TournamentHard
Show TagsExpected values
Harvard-MIT November TournamentHard
Show TagsExpected values, Recursion, bijection
Harvard-MIT November TournamentHard
Show TagsExpected values, Recurrence relations
12th Annual Harvard-MIT Mathematics TournamentHard
Show TagsExpected values, Invariants / monovariants, Recursion, bijection
$12^{\text {th }}$ Annual Harvard-MIT Mathematics TournamentHard
Show TagsEnumeration with symmetry, Expected values
12th Annual Harvard-MIT Mathematics TournamentHard
Show TagsAngle chasing, Expected values
12th Annual Harvard-MIT Mathematics TournamentHard
Show TagsExpected values, Sums and products
$12^{\text {th }}$ Annual Harvard-MIT Mathematics TournamentHard
Show TagsExpected values
13th Annual Harvard-MIT Mathematics TournamentHard
Show TagsExpected values
Harvard-MIT November TournamentHard
Show TagsExpected values
13th Annual Harvard-MIT Mathematics TournamentHard
Show TagsExpected values, Factorization techniques, Sums and products

Module Progress:

Join the Discord Community!

Stuck on a problem, or don't understand a module? Join the Discord and get help with your doubts while making more math friends.