Probability & Expectation

Study Sheet

Probability & Expectation

Indicators, linearity, geometric probability, random walks, coupon collecting

Expectation Without Distributions

Tip
Linearity and indicators

E[Xi]=E[Xi]E[\sum X_i] = \sum E[X_i] with NO independence assumption. Write a count as a sum of 0/10/1 indicators, and expectation becomes a sum of probabilities.

Expected fixed points of a random permutation: n1n=1n\cdot\tfrac1n = 1. Expected number of adjacent equal letters, expected number of records in a random sequence (HnH_n), expected inversions ((n2)/2\binom n2/2) — all indicator sums. The distribution may be a nightmare; the expectation is a one-liner. Coupon collector: waits are geometric with expectations nnk\tfrac{n}{n-k}, summing to nHnnH_n (253\tfrac{25}{3} for n=4n = 4).

Tip
Geometric probability and random walks

Probability == favorable measure ÷\div total measure; expectations become integrals. A ±1\pm1 walk returns to 00 after 2n2n steps with probability (2nn)/4n1πn\binom{2n}{n}/4^n \approx \tfrac{1}{\sqrt{\pi n}}.

Two uniform points on [0,1][0,1]: EXY=13E|X - Y| = \tfrac13, E[max]=23E[\max] = \tfrac23, P(XY<14)=716P(|X - Y| < \tfrac14) = \tfrac{7}{16} (unit-square pictures). Broken-stick triangle: 14\tfrac14. Buffon's needle: 2πd\tfrac{2\ell}{\pi d}. Random walk returns: (42)/16=38\binom42/16 = \tfrac38 after four steps; the 1πn\tfrac{1}{\sqrt{\pi n}} decay is why P(return at 2n)=\sum P(\text{return at } 2n) = \infty and the 1D walk is recurrent, while in 3D it is not.

Tip
Conditioning and first-step analysis

For expected times and absorption probabilities, condition on the first step: Ei=1+jpijEjE_i = 1 + \sum_jp_{ij}E_j — a small linear system.

Expected rolls until two consecutive sixes: 4242. Expected steps for a walker advancing with probability 23\tfrac23 else staying, to go 33 steps: 332=4.53\cdot\tfrac32 = 4.5. Gambler's ruin from kk with target NN (fair coin): ruin probability 1kN1 - \tfrac kN, expected duration k(Nk)k(N - k). Markov-chain steady states (the Linear Algebra course) are the long-run version of the same conditioning.

Side note
When independence is not there

Indicators handle dependence for expectations, but NOT for variances: Var(Xi)=Var(Xi)+2i<jCov(Xi,Xj)\mathrm{Var}(\sum X_i) = \sum\mathrm{Var}(X_i) + 2\sum_{i<j}\mathrm{Cov}(X_i, X_j). Putnam problems that ask for a variance or a probability of a specific count usually intend inclusion–exclusion or a generating function, not linearity.

Try it
Try it: an indicator sum

A fair coin is flipped 1010 times. What is the expected number of times a head is immediately followed by a tail?

Nine adjacent pairs, each HT with probability 14\tfrac14: expectation 94\tfrac94. The pairs overlap and are dependent — linearity does not care.

Proofs & Why It Matters

Tip
Proof: linearity of expectation

E[X+Y]=E[X]+E[Y]E[X + Y] = E[X] + E[Y] for ANY random variables with finite expectations.

For discrete variables, E[X+Y]=x,y(x+y)P(X=x,Y=y)=xxyP(X=x,Y=y)+yyxP(X=x,Y=y)=xxP(X=x)+yyP(Y=y)E[X + Y] = \sum_{x,y}(x + y)P(X = x, Y = y) = \sum_xx\sum_yP(X=x, Y=y) + \sum_yy\sum_xP(X=x,Y=y) = \sum_xxP(X = x) + \sum_yyP(Y = y) — the joint distribution marginalizes, and no independence was used. \blacksquare Significance: the ENTIRE indicator method rests on this; it is worth stating in a solution that independence is not required, because graders check that you know.

Tip
Proof: the coupon collector expectation

Collecting all nn equally likely coupons takes nHnnH_n draws on average.

After kk distinct coupons are held, each draw is new with probability nkn\tfrac{n-k}{n}, independently of the past; the number of draws until the next new one is geometric with mean nnk\tfrac{n}{n-k}. Sum over k=0,,n1k = 0, \ldots, n - 1 (linearity): n(1n+1n1++1)=nHnn\left(\tfrac1n + \tfrac{1}{n-1} + \cdots + 1\right) = nH_n. \blacksquare Significance: nHnnlnnnH_n \approx n\ln n is the universal cost of "cover everything by random sampling" — hashing, epidemic spreading, and randomized algorithms all hit this bound.

Going Deeper: Worked Problems

Example
Worked: expected value of a maximum

Three numbers are chosen independently and uniformly from [0,1][0,1]. Find the expected value of the largest.

Step 1 — the CDF of the max: P(maxt)=t3P(\max \le t) = t^3.

Step 2 — for a nonnegative variable, E[M]=01P(M>t)dt=01(1t3)dt=114=34E[M] = \int_0^1P(M > t)\,dt = \int_0^1(1 - t^3)dt = 1 - \tfrac14 = \tfrac34.

Step 3 — general pattern: E[max of n]=nn+1E[\max\text{ of }n] = \tfrac{n}{n+1} and E[min]=1n+1E[\min] = \tfrac{1}{n+1}; the nn order statistics split [0,1][0,1] into n+1n + 1 pieces of equal expected length.

Step 4 — the tail-integral formula E[X]=0P(X>t)dtE[X] = \int_0^\infty P(X > t)\,dt is the fastest route to expectations of maxima, minima, and waiting times.

Example
Worked: gambler's ruin by first-step analysis

A fair-coin gambler starts with $3\$3 and stops at $0\$0 or $10\$10. Find the probability of reaching $10\$10 and the expected number of bets.

Step 1 — let pkp_k be the probability of reaching 1010 from kk: pk=12pk1+12pk+1p_k = \tfrac12p_{k-1} + \tfrac12p_{k+1}, p0=0p_0 = 0, p10=1p_{10} = 1. The recurrence forces pkp_k linear: pk=k10p_k = \tfrac{k}{10}, so p3=0.3p_3 = 0.3.

Step 2 — let EkE_k be the expected duration: Ek=1+12Ek1+12Ek+1E_k = 1 + \tfrac12E_{k-1} + \tfrac12E_{k+1} with E0=E10=0E_0 = E_{10} = 0; the particular solution of the constant inhomogeneity is k2-k^2, so Ek=k(10k)E_k = k(10 - k) and E3=21E_3 = 21.

Step 3 — sanity: from the midpoint E5=25E_5 = 25 is the longest expected game; near the boundaries games end fast.

Step 4 — conditioning on one step turned a random process into two linear recurrences — the whole method.