Seyed Masoud Hosseini · Overview · Study log · Weekly summaries · Ideas · Search · Transcript · RSS feed

Probability · Lecture 48 of 76 · 17:19

A Random Number of Coin Flips

A Random Number of Coin Flips on YouTube

Study guide

What this lecture covers

This is a worked recitation problem on sums of a random number of random variables. A fair six-sided die is rolled to decide how many times a fair coin is flipped, and the problem finds the expectation and variance of the resulting number of heads. It builds on the law of iterated expectations and the law of total variance, applying them to a random sum expressed with Bernoulli indicator variables.

After watching, you should be able to set up a random-sum problem with indicator variables, correctly avoid misapplying linearity of expectation to a random number of terms, and compute both the mean and variance by conditioning on the number of trials.

Key ideas

  • Indicator variable setup: H = X1 + X2 + ... + XN, where each Xi is 1 if the i-th flip is heads and 0 otherwise, and N is the outcome of the die roll (discrete uniform on 1 to 6).
  • Linearity of expectation does not directly apply: since N itself is random, you cannot simply sum E[Xi] over a fixed number of terms; you must condition on N first.
  • Iterated expectation for the mean: E[H] = E[N] * E[Xi] = (7/2) * (1/2) = 7/4.
  • Law of total variance for the variance: Var(H) = Var(E[H|N]) + E[Var(H|N)], combining E[Xi]^2 * Var(N) and Var(Xi) * E[N], giving 77/48.
  • Discrete uniform formulas: for N uniform on integers a to b, E[N] = (a+b)/2 and Var(N) = (b-a)(b-a+2)/12.
  • Splitting one long random sum into independent, identical sums: rolling two dice and flipping the total number of times is equivalent to two independent single-die experiments added together, so the mean and variance of the two-die version simply double.

Walkthrough

Setting up the problem with indicator variables (0:00)

The problem defines N as the die outcome and each Xi as a Bernoulli indicator for whether the i-th coin flip is heads, expressing the total heads count H as a sum of a random number of Bernoulli variables, and warns against applying linearity of expectation naively to a random number of terms.

Computing the expectation by conditioning on N (3:05)

Conditioning on N reduces the problem to a fixed-length sum, giving E[H|N] = N * E[Xi]; applying the law of iterated expectations and plugging in E[Xi] = 1/2 and E[N] = 7/2 yields E[H] = 7/4.

Computing the variance with the law of total variance (6:08)

The problem derives Var(H) = E[Var(H|N)] + Var(E[H|N]), working out each term using the variance of a sum of independent Bernoulli trials and the discrete uniform variance formula for N, arriving at Var(H) = 77/48.

Two dice experiment (10:14)

The problem extends to two dice determining the total number of flips, and reframes the experiment as two independent copies of the single-die experiment run back to back, showing that both the mean and variance simply double to 7/2 and 77/24.

Before you watch

  • Watch the main lecture on iterated expectations (law of iterated expectations and law of total variance) before this problem.
  • Know the mean and variance of a Bernoulli random variable and of a discrete uniform random variable.

Check your understanding

  1. Why can't you apply linearity of expectation directly to X1 + X2 + ... + XN when N is random?
  2. Derive E[H] = 7/4 by conditioning on N.
  3. Walk through both terms of the law of total variance used to find Var(H).
  4. Why does reframing the two-dice experiment as two independent single-die experiments make the mean and variance simply double?

Vocabulary

indicator variable (phrase)
A variable that equals 1 if an event happens and 0 otherwise.
Each Xi is an indicator variable for heads on that flip.
misapply (verb)
To use a rule incorrectly in a situation where it does not work.
It's easy to misapply linearity of expectation to a random number of terms.
discrete uniform (phrase)
A distribution where each of a fixed, countable set of values is equally likely.
The die roll N is discrete uniform on the numbers 1 to 6.
reframe (verb)
To describe a problem in a new, often simpler, way.
We reframe the two-dice case as two independent single-die experiments.
back to back (phrase)
One right after the other, with no gap.
The two independent experiments run back to back.
law of iterated expectations (phrase)
A rule for finding an overall average by first averaging within each condition, then averaging across conditions.
The law of iterated expectations gives E[H] from E[H|N].
law of total variance (phrase)
A rule that splits an overall variance into a part from averages and a part from spread within each case.
The law of total variance is used to compute Var(H).
Bernoulli random variable (phrase)
A variable that takes the value 1 with some probability and 0 otherwise.
Each coin flip is modeled as a Bernoulli random variable.
expectation (noun)
The long-run average value of a random variable.
We compute the expectation of the total number of heads.
variance (noun)
A number that measures how spread out a random variable's values are.
The variance of H combines two separate sources of randomness.
conditioning (noun)
The act of assuming a variable's value is known while calculating something else.
Conditioning on N turns the sum into a fixed-length calculation.
plug in (phrasal verb)
To insert specific values into a formula.
We plug in E[Xi] = 1/2 and E[N] = 7/2 to get the final answer.
arrive at (phrase)
To reach a final result after a series of steps.
The calculation arrives at Var(H) = 77/48.
derive (verb)
To work out a formula step by step from known rules.
The problem derives the variance using the law of total variance.
fixed-length (adjective)
Having a set, unchanging number of terms.
Conditioning on N reduces the sum to a fixed-length sum.
double (verb)
To become twice as large.
Rolling two dice makes the mean and variance simply double.
independent (adjective)
Not affected by or related to another variable.
The two dice experiments are treated as independent.
identical (adjective)
Exactly the same in every way.
The two-dice case is split into two identical single-die experiments.
copy (noun)
A separate version of something that behaves exactly like the original.
The two-dice experiment becomes two independent copies of the single-die one.
extend (verb)
To apply an idea further, to a larger or new case.
The problem extends the setup to two dice determining the flips.
naively (adverb)
In an overly simple way that ignores an important complication.
You cannot naively apply linearity of expectation to a random number of terms.
warn (verb)
To point out a danger or mistake in advance.
The problem warns against misapplying linearity of expectation.
correctly (adverb)
In a way that matches the true or expected result.
You should correctly avoid misapplying linearity here.
term (noun)
One separate part of a mathematical expression.
Var(H) has two separate terms to compute.
expression (noun)
A combination of numbers and symbols representing a value.
The final expression for Var(H) combines two sources of variance.
reduce (verb)
To simplify a problem down to an easier form.
Conditioning on N reduces the problem to a fixed-length sum.

Chapters

From the YouTube description

MIT 6.041SC Probabilistic Systems Analysis and Applied Probability, Fall 2013
View the complete course: http://ocw.mit.edu/6-041SCF13
Instructor: Katie Szeto

License: Creative Commons BY-NC-SA
More information at http://ocw.mit.edu/terms
More courses at http://ocw.mit.edu

← Using the Conditional Expectation and Variance · A Coin with Random Bias →