Discrete MathematicsProbability, Conditioning and Expectation6 of 9
Probability, Conditioning and Expectation · 6

Random Variables and Expected Value

Outcomes like coin flips (HHT\text{HHT} or TTT\text{TTT}) aren't numbers you can add or average, so to find an average payout we first need a rule that attaches a number to every outcome.

1

Random Variables and Distributions

A random variable is a rule (written with a capital letter like X\rv{X} or Y\rv{Y}) that assigns a number to each outcome of an experiment, and its distribution is the table pairing each possible number with its probability.

Suppose you flip 33 fair coins and win $0\val{\$0} for 00 heads, $1\val{\$1} for 11 head, $2\val{\$2} for 22 heads, and a $10\val{\$10} jackpot for all 33 heads. How do we turn those 88 coin-flip sequences into a probability distribution for your payout Y\rv{Y}?

Random Variables and Distributions
0 heads  →  $0\mathllap{\text{0 heads}\;}\to\mathrlap{\;\htmlClass{lc-blue}{\$0}}
1 head  →  $1\mathllap{\text{1 head}\;}\to\mathrlap{\;\htmlClass{lc-blue}{\$1}}
2 heads  →  $2\mathllap{\text{2 heads}\;}\to\mathrlap{\;\htmlClass{lc-blue}{\$2}}
3 heads  →  $10\mathllap{\text{3 heads}\;}\to\mathrlap{\;\htmlClass{lc-blue}{\$10}}
Price to play?   $2?$3?\text{Price to play? }\;\htmlClass{lc-orange}{\$2}?\quad \htmlClass{lc-orange}{\$3}?
Text solution
Assign a payout to each outcomeGroup the 88 equally likely coin-flip sequences by the dollar amount Y\rv{Y} they pay out.
TTT→Y=0HTT, THT, TTH→Y=1HHT, HTH, THH→Y=2HHH→Y=10\displaystyle \begin{aligned} \text{TTT} &\rv{\to} \rv{Y} = \val{0} \\ \text{HTT, THT, TTH} &\rv{\to} \rv{Y} = \val{1} \\ \text{HHT, HTH, THH} &\rv{\to} \rv{Y} = \val{2} \\ \text{HHH} &\rv{\to} \rv{Y} = \val{10} \end{aligned}
Count outcomes to find each probabilityDivide each group's count by 88 to get the probability P(Y=y)\prob{P(Y = y)} for every possible payout y\val{y}.
P(Y=0)=18,P(Y=1)=38,P(Y=2)=38,P(Y=10)=18\displaystyle \begin{aligned} P(\rv{Y} = \val{0}) &= \prob{\frac{1}{8}}, \\[6pt] P(\rv{Y} = \val{1}) &= \prob{\frac{3}{8}}, \\[6pt] P(\rv{Y} = \val{2}) &= \prob{\frac{3}{8}}, \\[6pt] P(\rv{Y} = \val{10}) &= \prob{\frac{1}{8}} \end{aligned}

The == sign inside P(Y=2)=38P(\rv{Y} = \val{2}) = \prob{\frac{3}{8}} asks for the chance that the rule Y\rv{Y} outputs the number 2\val{2}, and the probabilities across the entire distribution add up to 18+38+38+18=1\prob{\frac{1}{8}} + \prob{\frac{3}{8}} + \prob{\frac{3}{8}} + \prob{\frac{1}{8}} = \prob{1} because one of those payouts must happen.

2

Expected Value as a Balance Point

The expected value E[Y]\ev{E[Y]} is the long-run average value of a random variable over many repeats. Physically, it is the center of mass where the probability weights balance on a number-line seesaw.

Using the payout distribution from the three-coin game, what is the average payout E[Y]\ev{E[Y]} per game?

Expected Value as a Balance Point
distribution of Y\htmlClass{lc-green}{\text{distribution of }}\htmlClass{lc-violet}{Y}
y\htmlClass{lc-blue}{y}
P(Y=y)\htmlClass{lc-green}{P(Y = y)}
$0\htmlClass{lc-blue}{\$0}
18\htmlClass{lc-green}{\dfrac{1}{8}}
$1\htmlClass{lc-blue}{\$1}
38\htmlClass{lc-green}{\dfrac{3}{8}}
$2\htmlClass{lc-blue}{\$2}
38\htmlClass{lc-green}{\dfrac{3}{8}}
$10\htmlClass{lc-blue}{\$10}
18\htmlClass{lc-green}{\dfrac{1}{8}}
average payout\text{average payout}
E[Y]=  ?\htmlClass{lc-pink}{E[Y]} = \;?
18\htmlClass{lc-green}{\dfrac{1}{8}}
38\htmlClass{lc-green}{\dfrac{3}{8}}
38\htmlClass{lc-green}{\dfrac{3}{8}}
18\htmlClass{lc-green}{\dfrac{1}{8}}
0\htmlClass{lc-blue}{0}
1\htmlClass{lc-blue}{1}
2\htmlClass{lc-blue}{2}
33
44
55
66
77
88
99
10\htmlClass{lc-blue}{10}
E[Y]=2.375\htmlClass{lc-pink}{E[Y] = 2.375}
Text solution
Multiply each value by its probability and addWeight each possible dollar amount by the fraction of the time it occurs.
E[Y]=∑y⏟value⋅P(Y=y)⏟probability=0(18)+1(38)+2(38)+10(18)=0+3+6+108=198=$2.375\displaystyle \begin{aligned} \ev{E[Y]} &= \sum \underbrace{\val{y}}_{\val{\text{value}}} \cdot \underbrace{\prob{P(Y = y)}}_{\prob{\text{probability}}} \\ &= \val{0}\left(\prob{\frac{1}{8}}\right) + \val{1}\left(\prob{\frac{3}{8}}\right) \\ &\quad + \val{2}\left(\prob{\frac{3}{8}}\right) + \val{10}\left(\prob{\frac{1}{8}}\right) \\ &= \frac{0 + 3 + 6 + 10}{8} \\ &= \ev{\frac{19}{8}} = \ev{\$2.375} \end{aligned}

Over many games, your payout averages $2.375\ev{\$2.375} per game, even though a single game can only ever pay $0\val{\$0}, $1\val{\$1}, $2\val{\$2}, or $10\val{\$10}.

In this seesaw model, moving the 33-heads jackpot further out along the number line pulls the balance point E[Y]\ev{E[Y]} toward it in proportion to its 18\prob{\frac{1}{8}} weight, while E[Y]\ev{E[Y]} always stays between the lowest and highest payouts.

Dragging even an unlikely payout far out pulls the balance point with it, and the expected value doesn't have to equal any actual payout.
3

Entry Fees and Negative Values

Real games charge a price to play, so we want to find the expected net gain or loss when an entry fee turns some outcomes into negative numbers.

If the booth charges a $3\loss{\$3} entry fee every time you play the three-coin game, what is your expected net winnings E[W]\ev{E[W]} per round?

Entry Fees and Negative Values
Entry fee: $3\text{Entry fee: }\htmlClass{lc-orange}{\$3}
W=Y−3\htmlClass{lc-violet}{W} = \htmlClass{lc-violet}{Y} - \htmlClass{lc-orange}{3}
E[W]=  ?\htmlClass{lc-pink}{E[W]} = \;?
18\htmlClass{lc-green}{\dfrac{1}{8}}
38\htmlClass{lc-green}{\dfrac{3}{8}}
38\htmlClass{lc-green}{\dfrac{3}{8}}
18\htmlClass{lc-green}{\dfrac{1}{8}}
−3-3
0\htmlClass{lc-blue}{0}
1\htmlClass{lc-blue}{1}
2\htmlClass{lc-blue}{2}
10\htmlClass{lc-blue}{10}
E[Y]=2.375\htmlClass{lc-pink}{E[Y] = 2.375}
Text solution
Subtract the fee from each payoutReduce every payout Y\rv{Y} by $3\loss{\$3} to get the net winnings W=Y−3\rv{W} = \rv{Y} - \loss{3}, while keeping the probabilities the same.
P(W=−3)=18,P(W=−2)=38,P(W=−1)=38,P(W=7)=18\displaystyle \begin{aligned} P(\rv{W} = \val{-3}) &= \prob{\frac{1}{8}}, \\[6pt] P(\rv{W} = \val{-2}) &= \prob{\frac{3}{8}}, \\[6pt] P(\rv{W} = \val{-1}) &= \prob{\frac{3}{8}}, \\[6pt] P(\rv{W} = \val{7}) &= \prob{\frac{1}{8}} \end{aligned}
Weight the net outcomes by their probabilitiesMultiply each net gain or loss by its probability and add them together.
E[W]=(−3)(18)+(−2)(38)+(−1)(38)+7(18)=−3−6−3+78=−58=−$0.625\displaystyle \begin{aligned} \ev{E[W]} &= (\val{-3})\left(\prob{\frac{1}{8}}\right) + (\val{-2})\left(\prob{\frac{3}{8}}\right) \\ &\quad + (\val{-1})\left(\prob{\frac{3}{8}}\right) + \val{7}\left(\prob{\frac{1}{8}}\right) \\ &= \frac{-3 - 6 - 3 + 7}{8} \\ &= \ev{-\frac{5}{8}} = \ev{-\$0.625} \end{aligned}
Or shift the original balance point directlySliding every weight 3\loss{3} units left on the number line slides the center of mass 3\loss{3} units left as well.
E[Y−3]=E[Y]−3=$2.375−$3.00=−$0.625\displaystyle \begin{aligned} \ev{E[Y - \loss{3}]} &= \ev{E[Y]} - \loss{3} \\ &= \ev{\$2.375} - \loss{\$3.00} \\ &= \ev{-\$0.625} \end{aligned}

A negative expected value means you lose an average of 62.5\loss{62.5} cents per round in the long run.

As the entry fee shifts all four payout weights together along the number line, the balance point E[W]\ev{E[W]} moves by that exact same distance and crosses zero when the fee passes $2.375\loss{\$2.375}.

Taking the same fee off every payout slides all the weights together without changing their sizes or spacing, so the balance point shifts by that exact fee.
4

Expected Value with Conditional Probability

When outcomes occur in stages with different chances, we cannot find probabilities just by counting; we first use a tree diagram to find the probability of each prize and then take the expected value.

On a two-round game show, you have a 0.60.6 chance of passing Round 1 (missing it pays $0\val{\$0}). If you pass Round 1, you have a 0.250.25 conditional probability of passing Round 2 (missing it pays a $20\val{\$20} consolation prize, and passing it pays $100\val{\$100}). What is your expected payout E[X]\ev{E[X]}?

Expected Value with Conditional Probability
E[X]=  ?\htmlClass{lc-pink}{E[X]} = \;?
X=prize\htmlClass{lc-violet}{X} = \text{prize}
Round 1\text{Round 1}
Fail\text{Fail}
Pass 0.6\text{Pass }0.6
Round 2\text{Round 2}
Fail\text{Fail}
Pass 0.25\text{Pass }0.25
$0\htmlClass{lc-blue}{\$0}
$20\htmlClass{lc-blue}{\$20}
$100\htmlClass{lc-blue}{\$100}
Fail 0.4\text{Fail } 0.4
Pass 0.6\text{Pass } 0.6
Fail 0.75\text{Fail } 0.75
Pass 0.25\text{Pass } 0.25
Round 1\text{Round 1}
Round 2\text{Round 2}
X=$0\htmlClass{lc-violet}{X} = \htmlClass{lc-blue}{\$0}
P=0.40P = \htmlClass{lc-green}{0.40}
X=$20\htmlClass{lc-violet}{X} = \htmlClass{lc-blue}{\$20}
P=0.45P = \htmlClass{lc-green}{0.45}
X=$100\htmlClass{lc-violet}{X} = \htmlClass{lc-blue}{\$100}
P=0.15P = \htmlClass{lc-green}{0.15}
Text solution
Multiply along tree branches for each prize's probabilityUse conditional probabilities along each path to build the distribution of X\rv{X}.
P(X=0)=1−0.6=0.40P(X=20)=0.6×(1−0.25)=0.6×0.75=0.45P(X=100)=0.6×0.25=0.15\displaystyle \begin{aligned} P(\rv{X} = \val{0}) &= 1 - 0.6 = \prob{0.40} \\ P(\rv{X} = \val{20}) &= 0.6 \times (1 - 0.25) \\ &= 0.6 \times 0.75 = \prob{0.45} \\ P(\rv{X} = \val{100}) &= 0.6 \times 0.25 = \prob{0.15} \end{aligned}
Multiply each prize by its path probabilityCheck that the probabilities sum to 0.40+0.45+0.15=1.00\prob{0.40} + \prob{0.45} + \prob{0.15} = \prob{1.00}, then compute the weighted sum.
E[X]=0(0.40)+20(0.45)+100(0.15)=0+9+15=$24\displaystyle \begin{aligned} \ev{E[X]} &= \val{0}(\prob{0.40}) + \val{20}(\prob{0.45}) \\ &\quad + \val{100}(\prob{0.15}) \\ &= 0 + 9 + 15 \\ &= \ev{\$24} \end{aligned}

A contestant on this show walks away with an average of $24\ev{\$24}.

5

Infinite Distributions: Flipping Until Heads

A discrete random variable does not have to stop after a few rows; when we count how many trials it takes for an event to happen, the distribution table continues through all positive whole numbers 1,2,3,…\val{1, 2, 3, \dots} to infinity.

Suppose you flip a fair coin repeatedly until you get your first Heads on flip N\rv{N}. What is the probability distribution of N\rv{N}, and what is the expected number of flips E[N]\ev{E[N]}?

Infinite Distributions: Flipping Until Heads
Flip until the first H\text{Flip until the first }\htmlClass{lc-green}{\text{H}}
N=number of flips\htmlClass{lc-violet}{N} = \text{number of flips}
N=1\htmlClass{lc-violet}{N} = \htmlClass{lc-blue}{1}
H\htmlClass{lc-green}{\text{H}}
N=2\htmlClass{lc-violet}{N} = \htmlClass{lc-blue}{2}
T   H\htmlClass{lc-orange}{\text{T}}\;\,\htmlClass{lc-green}{\text{H}}
N=3\htmlClass{lc-violet}{N} = \htmlClass{lc-blue}{3}
T   T   H\htmlClass{lc-orange}{\text{T}}\;\,\htmlClass{lc-orange}{\text{T}}\;\,\htmlClass{lc-green}{\text{H}}
N=4\htmlClass{lc-violet}{N} = \htmlClass{lc-blue}{4}
T   T   T   H\htmlClass{lc-orange}{\text{T}}\;\,\htmlClass{lc-orange}{\text{T}}\;\,\htmlClass{lc-orange}{\text{T}}\;\,\htmlClass{lc-green}{\text{H}}
E[N]=  ?\htmlClass{lc-pink}{E[N]} = \;?
Text solution
Find the probability of stopping on flip n\val{n}Stopping on flip n\val{n} requires n−1\fail{n - 1} Tails followed by 1\success{1} Heads, multiplying 12\frac{1}{2} by itself n\val{n} times.
P(N=1)=12,P(N=2)=14,P(N=3)=18,…,P(N=n)=12n\displaystyle \begin{aligned} P(\rv{N} = \val{1}) &= \prob{\frac{1}{2}}, \\[6pt] P(\rv{N} = \val{2}) &= \prob{\frac{1}{4}}, \\[6pt] P(\rv{N} = \val{3}) &= \prob{\frac{1}{8}}, \\[6pt] \dots, \quad P(\rv{N} = \val{n}) &= \prob{\frac{1}{2^n}} \end{aligned}
Multiply by 12\frac{1}{2} and subtract column by columnShift the expected value sum one column to the right so that subtracting turns the growing numerators 1,2,3,4,…\val{1, 2, 3, 4, \dots} into 11s.
E[N]=12+24+38+416+…−12E[N]=12+14+28+316+…12E[N]=12+14+18+116+…⏟all probabilities sum to 112E[N]=1E[N]=2\displaystyle \begin{aligned} &\begin{aligned} &\ev{E[N]} = \\ &\quad \frac{\val{1}}{2} + \frac{\val{2}}{4} + \frac{\val{3}}{8} + \frac{\val{4}}{16} + \dots \\[4pt] &-\quad \ev{\frac{1}{2}E[N]} = \\ &\quad \phantom{\frac{1}{2} + {}} \frac{\val{1}}{4} + \frac{\val{2}}{8} + \frac{\val{3}}{16} + \dots \\ \hline & \\[-0.5em] &\ev{\frac{1}{2}E[N]} = \\ &\quad \underbrace{\prob{\frac{1}{2}} + \prob{\frac{1}{4}} + \prob{\frac{1}{8}} + \prob{\frac{1}{16}} + \dots}_{\text{all probabilities sum to } \prob{1}} \end{aligned} \\[4pt] &\begin{aligned} \ev{\frac{1}{2}E[N]} &= \prob{1} \\[4pt] \ev{E[N]} &= \ev{2} \end{aligned} \end{aligned}

Even though there is no upper limit on how long a streak of Tails could last, on average it takes 2\ev{2} flips to get your first Heads.

6

Waiting for the First Success

Rather than repeating the shift-and-subtract algebra for every waiting-time problem, we can run the same step once for any trial with success probability p\success{p} to find a direct formula for the expected number of tries E[N]\ev{E[N]}.

If each independent trial succeeds with probability p\success{p} and fails with probability q=1−p\fail{q} = 1 - \success{p}, how many trials E[N]\ev{E[N]} do we expect to wait for the first success?

Waiting for the First Success
success: p\text{success: }\htmlClass{lc-green}{p}
failure: q=1−p\text{failure: }\htmlClass{lc-orange}{q} = 1 - \htmlClass{lc-green}{p}
q\htmlClass{lc-orange}{q}
q\htmlClass{lc-orange}{q}
q\htmlClass{lc-orange}{q}
p\htmlClass{lc-green}{p}
N=4\htmlClass{lc-violet}{N} = \htmlClass{lc-blue}{4}
E[N]=  ?\htmlClass{lc-pink}{E[N]} = \;?
Text solution
Shift by the failure probability q\fail{q} and subtractStopping on trial n\val{n} takes n−1\fail{n - 1} failures followed by 1\success{1} success (P(N=n)=qn−1pP(\rv{N} = \val{n}) = \fail{q^{n-1}}\success{p}), so multiplying E[N]\ev{E[N]} by q\fail{q} lines up matching powers of q\fail{q}.
E[N]=1p+2qp+3q2p+4q3p+…−qE[N]=1p+1qp+2q2p+3q3p+…(1−q)E[N]=p+qp+q2p+q3p+…⏟=1pE[N]=1E[N]=1p\displaystyle \begin{aligned} &\begin{aligned} &\ev{E[N]} = \\ &\quad \val{1}\success{p} + \val{2}\fail{q}\success{p} + \val{3}\fail{q^2}\success{p} + \val{4}\fail{q^3}\success{p} + \dots \\[4pt] &-\quad \fail{q}\ev{E[N]} = \\ &\quad \phantom{1p + {}} \val{1}\fail{q}\success{p} + \val{2}\fail{q^2}\success{p} + \val{3}\fail{q^3}\success{p} + \dots \\ \hline & \\[-0.5em] &(1 - \fail{q})\ev{E[N]} = \\ &\quad \underbrace{\success{p} + \fail{q}\success{p} + \fail{q^2}\success{p} + \fail{q^3}\success{p} + \dots}_{= \prob{1}} \end{aligned} \\[4pt] &\begin{aligned} \success{p}\ev{E[N]} &= \prob{1} \\[4pt] \ev{E[N]} &= \ev{\frac{1}{p}} \end{aligned} \end{aligned}

Rolling a fair six-sided die until the first 66 (p=16\success{p} = \success{\frac{1}{6}}) takes an average of E[N]=116=6\ev{E[N]} = \frac{1}{\success{\tfrac{1}{6}}} = \ev{6} rolls, and guessing a password out of 100100 equally likely ones, where every guess is a fresh random pick that may repeat an earlier one (p=1100\success{p} = \success{\frac{1}{100}}), takes an average of 100\ev{100} tries. You can go straight to E[N]=1p\ev{E[N]} = \ev{\frac{1}{p}} whenever you are counting trials up to the first success, and save the shift-and-subtract steps for when a question specifically asks you to evaluate the infinite series.

In the unit probability square, taking the same fraction p\success{p} of whatever unshaded area remains on each trial always fills a total area of 1\prob{1}, while shrinking p\success{p} pushes the probability weights onto later trials so the balance point lands at E[N]=1p\ev{E[N]} = \ev{\frac{1}{p}}.

Taking the same fraction of whatever gap remains always fills the whole probability square, while shrinking that fraction shifts weight onto later tries and slides the balance point further out.

Key concepts

Every expected value problem starts by turning outcomes into numbers and finding the probability distribution, where the probabilities must add up to 1\prob{1}. For equally likely outcomes, count how many outcomes give each value (such as 3\prob{3} of the 88 coin sequences giving Y=1\rv{Y} = \val{1}, so P(Y=1)=38P(\rv{Y} = \val{1}) = \prob{\frac{3}{8}}); for multi-stage experiments, multiply along the branches of a tree (such as 0.6×0.75=0.450.6 \times 0.75 = \prob{0.45}) and add branches if more than one path gives the same number. Once you have the distribution, the expected value is the balance point

E[X]\displaystyle \ev{E[X]} =∑x⋅P(X=x)\displaystyle = \sum \val{x} \cdot \prob{P(X = x)}

If a fixed entry fee c\loss{c} is subtracted from every payout, don't rebuild the sum from scratch when you already know E[Y]\ev{E[Y]}. Shifting every weight by c\loss{c} shifts the balance point by the same amount, E[Y−c]=E[Y]−c\ev{E[Y - \loss{c}]} = \ev{E[Y]} - \loss{c}. And when N\rv{N} counts independent trials until the first success with single-trial probability p\success{p}, the probability of stopping on trial n\val{n} is P(N=n)=qn−1pP(\rv{N} = \val{n}) = \fail{q^{n-1}}\success{p} (where q=1−p\fail{q} = 1 - \success{p}) and the infinite series simplifies directly to

E[N]\displaystyle \ev{E[N]} =1p\displaystyle = \ev{\frac{1}{p}}

Only use 1p\ev{\frac{1}{p}} when repeating identical independent trials until the first success; for a fixed number of trials or a finite table of prizes, compute ∑x⋅P(X=x)\sum \val{x} \cdot \prob{P(X = x)} from the distribution table.

7

Practice

1

You roll two fair four-sided dice, each numbered 11 through 44, and let X\rv{X} be the larger of the two numbers rolled (or that shared number if they tie). Find the probability distribution of X\rv{X} and calculate its expected value E[X]\ev{E[X]}.

Write out or picture the 4×4=164 \times 4 = 16 ordered pairs and count how many pairs have largest number 1\val{1}, 2\val{2}, 3\val{3}, or 4\val{4}.

Out of the 1616 equally likely ordered pairs, count how many produce each maximum value (watch out: the four values of X\rv{X} are not equally likely at 14\wrong{\frac{1}{4}} each, which would give 2.5\wrong{2.5}, and you must count ordered pairs like (1,2)(1,2) and (2,1)(2,1) separately rather than treating them as a single unordered pair, which would give 110,210,310,410\wrong{\frac{1}{10}, \frac{2}{10}, \frac{3}{10}, \frac{4}{10}} and E[X]=3\ev{E[X]} = \wrong{3}):
P(X=1)=116,P(X=2)=316,P(X=3)=516,P(X=4)=716\displaystyle \begin{aligned} P(\rv{X} = \val{1}) &= \prob{\frac{1}{16}}, \\[6pt] P(\rv{X} = \val{2}) &= \prob{\frac{3}{16}}, \\[6pt] P(\rv{X} = \val{3}) &= \prob{\frac{5}{16}}, \\[6pt] P(\rv{X} = \val{4}) &= \prob{\frac{7}{16}} \end{aligned}
These probabilities sum to 1+3+5+716=1616=1\frac{1 + 3 + 5 + 7}{16} = \frac{16}{16} = \prob{1}. Multiplying each value by its probability gives:
E[X]=1(116)+2(316)+3(516)+4(716)=1+6+15+2816=5016=258=3.125\displaystyle \begin{aligned} \ev{E[X]} &= \val{1}\left(\prob{\frac{1}{16}}\right) + \val{2}\left(\prob{\frac{3}{16}}\right) \\ &\quad + \val{3}\left(\prob{\frac{5}{16}}\right) + \val{4}\left(\prob{\frac{7}{16}}\right) \\ &= \frac{1 + 6 + 15 + 28}{16} \\ &= \frac{50}{16} \\ &= \ev{\frac{25}{8}} = \ev{3.125} \end{aligned}
2

In a carnival game, you draw one card at random from a standard 5252-card deck. Drawing an Ace pays $10\val{\$10}, drawing a face card (Jack, Queen, or King) pays $3\val{\$3}, and any other card pays $0\val{\$0}. If the booth charges a $2\loss{\$2} entry fee to play, what is your expected net winnings E[W]\ev{E[W]} per game, and what would the Ace payout need to be for the game to break even (E[W]=0\ev{E[W]} = 0)?

Find the probabilities of the three card types out of 5252 (or reduced out of 1313), then either subtract the $2\loss{\$2} fee from every payout or subtract $2\loss{\$2} from the expected payout at the end.

The probabilities are 452=113\prob{\frac{4}{52}} = \prob{\frac{1}{13}} for an Ace, 1252=313\prob{\frac{12}{52}} = \prob{\frac{3}{13}} for a face card, and 3652=913\prob{\frac{36}{52}} = \prob{\frac{9}{13}} for any other card. Subtracting the $2\loss{\$2} entry fee gives net winnings W\rv{W} of +$8\val{+\$8}, +$1\val{+\$1}, and −$2\val{-\$2} (don't leave the $0\val{\$0}-payout cards at $0\wrong{\$0} instead of −$2\val{-\$2}, which would give +1113≈$0.85\wrong{+\frac{11}{13} \approx \$0.85}):
E[W]=8(113)+1(313)+(−2)(913)=−713 dollars≈−$0.54\displaystyle \begin{aligned} \ev{E[W]} &= \val{8}\left(\prob{\frac{1}{13}}\right) + \val{1}\left(\prob{\frac{3}{13}}\right) \\ &\quad + (\val{-2})\left(\prob{\frac{9}{13}}\right) \\ &= \ev{-\frac{7}{13}}\text{ dollars} \approx \ev{-\$0.54} \end{aligned}
For the game to break even (E[W]=0\ev{E[W]} = 0), the expected payout before the $2\loss{\$2} fee must equal $2\ev{\$2} (be careful not to solve for the net Ace profit A−2=15\val{A} - \loss{2} = 15 and stop at $15\wrong{\$15} without adding back the $2\loss{\$2} fee):
A(1)+3(3)+0(9)13=2  ⟹  A+9=26  ⟹  A=$17\displaystyle \begin{aligned} \frac{\val{A}(\prob{1}) + \val{3}(\prob{3}) + \val{0}(\prob{9})}{13} &= \ev{2} \\ \implies \val{A} + 9 &= 26 \\ \implies \val{A} &= \$17 \end{aligned}
3

A developer submits a new app to an automated review system. The app has a 0.80.8 probability of passing the initial security scan; if it fails, it is rejected immediately and earns $0\val{\$0}. If it passes the scan, a human reviewer classifies it as "Featured" with conditional probability 0.20.2 (earning $50,000\val{\$50{,}000}), "Standard" with conditional probability 0.50.5 (earning $10,000\val{\$10{,}000}), or "Rejected" with conditional probability 0.30.3 (earning $0\val{\$0}). Let X\rv{X} be the amount the app earns. Find the probability distribution of X\rv{X} and calculate E[X]\ev{E[X]}.

Multiply along the two-stage tree branches to find the probability of each outcome, and notice that two different paths result in $0\val{\$0}.

Two tree paths lead to X=$0\rv{X} = \val{\$0}: failing the initial scan (0.20\prob{0.20}) or passing the scan and being rejected by the reviewer (0.8×0.3=0.240.8 \times 0.3 = \prob{0.24}), which must be added together so the distribution sums to 1\prob{1} (leaving out the second path gives P(X=0)=0.20P(\rv{X} = \val{0}) = \wrong{0.20} and a total probability of only 0.76\wrong{0.76}). For the positive payouts, multiply each conditional probability by the 0.80.8 chance of passing the scan first (using 0.20.2 and 0.50.5 directly without multiplying by 0.80.8 gives the wrong answer $15,000\wrong{\$15{,}000}):
P(X=0)=0.20+0.24=0.44,P(X=10,000)=0.8×0.5=0.40,P(X=50,000)=0.8×0.2=0.16\displaystyle \begin{aligned} P(\rv{X} = \val{0}) &= \prob{0.20} + \prob{0.24} = \prob{0.44}, \\ P(\rv{X} = \val{10{,}000}) &= 0.8 \times 0.5 = \prob{0.40}, \\ P(\rv{X} = \val{50{,}000}) &= 0.8 \times 0.2 = \prob{0.16} \end{aligned}
Taking the weighted sum gives:
E[X]=0(0.44)+10,000(0.40)+50,000(0.16)=0+4,000+8,000=$12,000\displaystyle \begin{aligned} \ev{E[X]} &= \val{0}(\prob{0.44}) + \val{10{,}000}(\prob{0.40}) \\ &\quad + \val{50{,}000}(\prob{0.16}) \\ &= 0 + 4{,}000 + 8{,}000 \\ &= \ev{\$12{,}000} \end{aligned}
4

You roll a pair of fair six-sided dice repeatedly until the sum of the two dice is 99 or greater, and then you stop. Let N\rv{N} be the number of rolls it takes. Find the probability P(N=3)P(\rv{N} = \val{3}) that you stop on the third roll, and find the expected number of rolls E[N]\ev{E[N]}.

Count how many of the 3636 dice outcomes give a sum of 9,10,11,9, 10, 11, or 1212 to find the single-roll success probability p\success{p}.

On a single roll of two dice, 10\prob{10} of the 3636 equally likely outcomes have a sum of 99 or greater (4\prob{4} ways for 99, 3\prob{3} for 1010, 2\prob{2} for 1111, and 1\prob{1} for 1212; don't exclude a sum of 99 and count only 6\wrong{6} outcomes, which gives p=16\wrong{p = \frac{1}{6}} and E[N]=6\ev{E[N]} = \wrong{6}). This gives a success probability of p=1036=518\success{p} = \success{\frac{10}{36}} = \success{\frac{5}{18}} and a failure probability of q=1−518=1318\fail{q} = 1 - \success{\frac{5}{18}} = \fail{\frac{13}{18}}. Stopping on the third roll requires two failures followed by one success (watch out for swapping p\success{p} and q\fail{q} to get p2q=3255832\wrong{p^2 q = \frac{325}{5832}} or cubing p\success{p} to get p3=1255832\wrong{p^3 = \frac{125}{5832}}):
P(N=3)=q2p=(1318)2(518)=8455832\displaystyle \begin{aligned} P(\rv{N} = \val{3}) &= \fail{q^2} \success{p} \\ &= \fail{\left(\frac{13}{18}\right)^2}\success{\left(\frac{5}{18}\right)} \\ &= \frac{845}{5832} \end{aligned}
The expected number of rolls is:
E[N]=1p=1518=185=3.6\displaystyle \begin{aligned} \ev{E[N]} &= \ev{\frac{1}{p}} \\ &= \frac{1}{\success{\tfrac{5}{18}}} \\ &= \ev{\frac{18}{5}} = \ev{3.6} \end{aligned}
5

You flip a fair coin repeatedly until the first Heads appears on flip N\rv{N}, and a game pays you $1\val{\$1} for each Tails flipped before that first Heads, so your payout is Y=N−1\rv{Y} = \rv{N} - 1 dollars. Write the infinite series for E[Y]\ev{E[Y]}, evaluate it using the shift-and-subtract method, and check that your answer matches shifting E[N]\ev{E[N]} by 11.

Winning Y=k\rv{Y} = \val{k} dollars means the first Heads appeared on flip N=k+1\rv{N} = \val{k + 1}, which has probability 12k+1\prob{\frac{1}{2^{k+1}}}.

Since P(Y=k)=P(N=k+1)=12k+1P(\rv{Y} = \val{k}) = P(\rv{N} = \val{k + 1}) = \prob{\frac{1}{2^{k+1}}} for k=0,1,2,…\val{k} = \val{0, 1, 2, \dots} (don't pair Y=1,2,3,…\rv{Y} = \val{1, 2, 3, \dots} with 12,14,18,…\prob{\frac{1}{2}, \frac{1}{4}, \frac{1}{8}, \dots} by forgetting that Y=0\rv{Y} = \val{0} takes the 12\prob{\frac{1}{2}} probability, which would give $2\wrong{\$2}), the series for E[Y]\ev{E[Y]} and its shifted copy 12E[Y]\ev{\frac{1}{2}E[Y]} are:
E[Y]=0(12)+1(14)+2(18)+3(116)+…−12E[Y]=0(12)+1(14)+1(18)+2(116)+…12E[Y]=14+18+116+⋯=1−12=12\displaystyle \begin{aligned} &\ev{E[Y]} = \\ &\quad \val{0}\left(\prob{\tfrac{1}{2}}\right) + \val{1}\left(\prob{\tfrac{1}{4}}\right) + \val{2}\left(\prob{\tfrac{1}{8}}\right) + \val{3}\left(\prob{\tfrac{1}{16}}\right) + \dots \\[4pt] &-\quad \ev{\frac{1}{2}E[Y]} = \\ &\quad \phantom{0\left(\tfrac{1}{2}\right) + 1\left(\tfrac{1}{4}\right) + {}} \val{1}\left(\prob{\tfrac{1}{8}}\right) + \val{2}\left(\prob{\tfrac{1}{16}}\right) + \dots \\ \hline & \\[-0.5em] &\ev{\frac{1}{2}E[Y]} = \\ &\quad \prob{\frac{1}{4}} + \prob{\frac{1}{8}} + \prob{\frac{1}{16}} + \dots = 1 - \frac{1}{2} = \frac{1}{2} \end{aligned}
Multiplying by 22 gives E[Y]=$1\ev{E[Y]} = \ev{\$1}, which matches shifting the balance point for N\rv{N} left by 11 unit:
E[Y]=E[N]−1=2−1=$1\displaystyle \begin{aligned} \ev{E[Y]} &= \ev{E[N]} - 1 \\ &= \ev{2} - 1 \\ &= \ev{\$1} \end{aligned}