Conditional Probability, Independence, and Bayes' Formula

Conditional probability, reduced sample spaces, and P(.|A) as a probability measure; the multiplication (chain) rule and the exactly-k- matches identity; independence of two, three, and n events, physical vs probabilistic independence, and why pairwise independence does not imply mutual independence; independent trials, binomial probabilities, parallel systems, and the probabilistic method; independent discrete random variables and pmf factorization; the law of total probability, first-step analysis (5 before 7, the problem of the points, gambler's ruin, drug testing, runs), Bayes' formula, odds form and likelihood ratios, the base-rate fallacy, the three-card and two-child puzzles, DNA evidence, conditional independence, and Laplace's rule of succession; conditional expectation and the law of total expectation (red-faced dice, die-then-coins, smoking and lung cancer, socks, two boxes, two-coin mixtures).

· 29 min read · 5,716 words

Motivation: updating on partial information

A second limitation of the event-level view of probability-foundations motivates this note: information arrives partially. Once we learn the first die shows 3, probabilities should change. Sometimes, though, conditioning on a cleverly chosen event makes a hard unconditional probability easy — and sometimes we want to run this backwards, updating a hypothesis’s probability given evidence rather than an event’s probability given a cause.

IntuitionThe central questions

How should probabilities change when we learn that some event occurred, when do they not change, and how do we reverse a conditional probability to reason from evidence back to causes?

ToolPackagesSummary statistics / rules
conditional probabilityan update given AAchain rule; P(⋅∣A)P(\cdot\mid A) is itself a probability
independence”the update changes nothing”product rules for events and pmfs
total probability + Bayesreasoning by cases; inverting conditionalsodds × likelihood ratio

NoteRandom variables and their distributions live in a companion note

This note assumes only the sample-space/event machinery of probability-foundations. Random variables, pmfs, expectation, and the named discrete distributions (Bernoulli, binomial, geometric, …) are covered in discrete-random-variables-and-distributions; the “independent random variables” section below borrows that note’s pmf notation.


Conditional probabilities

DefinitionConditional probability

P(B∣A)={P(AB)P(A)P(A)>0,undefinedP(A)=0.P(B\mid A) = \begin{cases}\dfrac{P(AB)}{P(A)} & P(A) > 0,\\[4pt] \text{undefined} & P(A) = 0.\end{cases}

IntuitionReduced sample space

Knowing AA occurred means ω∈A\omega\in A. Whether BB holds now depends only on ABAB, renormalized so that AA itself has probability 1. When outcomes are equally likely, conditioning on AA makes the outcomes of AA equally likely, so you can just count inside AA.

WarningUndefined means undefined

Hajek: a routine computing P(B∣A)P(B\mid A) from P(AB)=0P(AB) = 0 and P(A)=0P(A) = 0 should raise an error (“conditioning on an event of probability zero”), not return 0. The error helps catch bugs upstream.

ExampleConditioning can lower, raise, or leave unchanged (Hajek)

Two dice. AA = “sum is 6” ={15,24,33,42,51}= \{15,24,33,42,51\}, so P(A)=536P(A) = \frac5{36}.

Event BBP(B)P(B)P(B∣A)P(B\mid A)Effect
numbers differ56\frac564/365/36=45\frac{4/36}{5/36} = \frac45lowered
numbers equal16\frac161/365/36=15\frac{1/36}{5/36} = \frac15raised

With EE = “first die even” and FF = “sum is 7”: P(F∣E)=3/361/2=16=P(F)P(F\mid E) = \frac{3/36}{1/2} = \frac16 = P(F). Unchanged.

ExampleClassic warm-ups (Ross)

  • Key in a pocket: 80% sure it’s in one of two pockets, 40% each. The left pocket is empty, so P(R∣Lc)=.4.6=23P(R\mid L^c) = \frac{.4}{.6} = \frac23.
  • First die is 3, sum is 8: in the reduced space {(3,1),…,(3,6)}\{(3,1),\dots,(3,6)\}, the probability is 16\frac16.
  • Bridge: North–South hold 8 spades, so East–West share 26 cards with 5 spades. P(East has 3)=(53)(2110)/(2613)≈.339P(\text{East has 3}) = \binom53\binom{21}{10}/\binom{26}{13} \approx.339.

Warning“At least one” is not “the first”

Two coin flips: P(both heads∣first heads)=12P(\text{both heads}\mid\text{first heads}) = \frac12, but P(both heads∣at least one head)=13P(\text{both heads}\mid\text{at least one head}) = \frac13. “At least one head” leaves three equally likely outcomes (HH, HT, TH), not two equally likely cases (“both” vs “one”).

TheoremP(⋅∣A)P(\cdot\mid A) is a probability measure (Ross Prop. 5.1)

For fixed AA with P(A)>0P(A) > 0:

  1. 0≤P(B∣A)≤10\le P(B\mid A)\le1;
  2. P(Ω∣A)=1P(\Omega\mid A) = 1;
  3. for disjoint E1,E2,…E_1, E_2, \dots: P(⋃iEi∣A)=∑iP(Ei∣A)P\big(\bigcup_iE_i\mid A\big) = \sum_iP(E_i\mid A).

So every theorem about probabilities holds for conditional probabilities: complements, inclusion–exclusion, the total-probability rule below. In particular, Q(E1∣E2)=P(E1∣E2A)Q(E_1\mid E_2) = P(E_1\mid E_2A) when Q=P(⋅∣A)Q = P(\cdot\mid A).

ProofCheck the axioms

(1) 0≤P(BA)≤P(A)0\le P(BA)\le P(A) since BA⊆ABA\subseteq A. (2) P(ΩA)/P(A)=1P(\Omega A)/P(A) = 1. (3) (⋃iEi)A=⋃iEiA\big(\bigcup_iE_i\big)A = \bigcup_iE_iA, a disjoint union, so countable additivity of PP passes through the division by P(A)P(A).

∎

IntuitionA new view of the experiment

Learning AA replaces the probability measure PP with P(⋅∣A)P(\cdot\mid A), a genuine probability measure on the same space.

NoteFrequency interpretation

In nn repetitions, AA occurs about nP(A)nP(A) times and ABAB about nP(AB)nP(AB) times. Among the runs where AA occurs, the fraction with BB is about P(AB)/P(A)P(AB)/P(A). So the definition matches long-run frequencies.

The multiplication (chain) rule

FormulaChain rule

P(AB)=P(A)P(B∣A),P(E1E2⋯En)=P(E1)P(E2∣E1)P(E3∣E1E2)⋯P(En∣E1⋯En−1).P(AB) = P(A)P(B\mid A),\qquad P(E_1E_2\cdots E_n) = P(E_1)P(E_2\mid E_1) P(E_3\mid E_1E_2)\cdots P(E_n\mid E_1\cdots E_{n-1}).
ProofTelescoping

Apply the definition to each factor: P(E1)P(E1E2)P(E1)P(E1E2E3)P(E1E2)⋯P(E_1)\frac{P(E_1E_2)}{P(E_1)}\frac{P(E_1E_2E_3)}{P(E_1E_2)}\cdots. All the intermediate terms cancel.

∎

IntuitionBuild the event one stage at a time

The chain rule is the probabilistic counting principle: multiply the chance of each stage, given everything before it.

ExampleChain-rule computations (Ross)

  • Celine takes chemistry with probability 12\frac12 and then gets an A with probability 23\frac23: P(CA)=13P(CA) = \frac13.
  • Two reds from 8 red + 4 white: 812⋅711=1433\frac8{12}\cdot\frac7{11} = \frac{14}{33}. If balls are drawn with probability proportional to weight (rr for red, ww for white), the answer is 8r8r+4w⋅7r7r+4w\frac{8r}{8r+4w}\cdot\frac{7r}{7r+4w}.
  • Each of 4 piles of 13 gets an ace: place the aces one by one. The ace of hearts avoids the ace of spades’ pile with probability 3951\frac{39}{51}, the next ace with 2650\frac{26}{50}, the last with 1349\frac{13}{49}: P=39⋅26⋅1351⋅50⋅49≈.105.P = \frac{39\cdot26\cdot13}{51\cdot50\cdot49}\approx.105.
  • No two of the 4 strong teams meet among 8 random quarterfinalists: 47⋅35⋅23⋅1=835\frac47\cdot\frac35\cdot\frac23\cdot1 = \frac8{35}.

ExampleExactly kk matches in the hat problem (Ross)

Let PN=∑i=0N(−1)i/i!P_N = \sum_{i=0}^N(-1)^i/i! be the no-match probability (probability-foundations). For a specified set of kk people, by the chain rule, P(all k match)=1N1N−1⋯1N−k+1=(N−k)!N!P(\text{all }k\text{ match}) = \frac1N\frac1{N-1}\cdots\frac1{N-k+1} = \frac{(N-k)!}{N!}. Given that, the rest form an (N−k)(N-k)-person problem. So

P(exactly k matches)=(Nk)(N−k)!N!PN−k=PN−kk!  ≈  e−1k!.P(\text{exactly }k\text{ matches}) = \binom Nk\frac{(N-k)!}{N!}P_{N-k} = \frac{P_{N-k}}{k!}\;\approx\;\frac{e^{-1}}{k!}.

Mutually independent events

Motivation. If P(B∣A)=P(B)P(B\mid A) = P(B), learning AA tells us nothing about BB. That is equivalent to P(AB)=P(A)P(B)P(AB) = P(A)P(B). What about P(A)=0P(A) = 0? Then P(B∣Ac)=P(AcB)/1=P(B)−P(AB)=P(B)P(B\mid A^c) = P(A^cB)/1 = P(B) - P(AB) = P(B). Learning “not AA” changes nothing, so AA should count as independent of BB.

DefinitionIndependence of two events

AA and BB are (mutually) independent if P(AB)=P(A)P(B).P(AB) = P(A)P(B). This definition is symmetric and works even when P(A)=0P(A) = 0. Independence is a property of a pair of events; a single event isn’t “independent” by itself.

ImportantPhysical vs probabilistic independence

Physically separate parts of an experiment (two dice, a coin and a die) are modeled as independent. But independence is just one equation, and it can hold without physical separation. On one die, A={2,4,6}A = \{2,4,6\} and B={3,6}B = \{3,6\} have P(AB)=16=12⋅13P(AB) = \frac16 = \frac12\cdot \frac13, so they are independent.

ExampleIndependent or not? (Ross)

ExperimentEventsIndependent?
one cardace, spadeyes: 152=452⋅1352\frac1{52} = \frac4{52}\cdot\frac{13}{52}
two coinsfirst heads, second tailsyes: 14=12⋅12\frac14 = \frac12\cdot\frac12
two dicesum 6, first die 4no: 136≠536⋅16\frac1{36}\ne\frac5{36}\cdot\frac16
two dicesum 7, first die 4yes: 136=16⋅16\frac1{36} = \frac16\cdot\frac16

IntuitionWhy “sum 7” is special

Whatever the first die shows, exactly one face of the second die completes a 7. So the first die gives no information. For “sum 6,” a first die of 6 kills the chance entirely.

PropositionComplements preserve independence

If AA and BB are independent, so are AcA^c and BB, AA and BcB^c, and AcA^c and BcB^c. All four conditions are equivalent.

ProofSubtract off the intersection

P(AcB)=P(B)−P(AB)=(1−P(A))P(B)=P(Ac)P(B)P(A^cB) = P(B) - P(AB) = (1 - P(A))P(B) = P(A^c)P(B). Apply the same argument again for the other two.

∎

Three or more events

DefinitionPairwise independence

A,B,CA, B, C are pairwise independent if each pair satisfies the product rule.

WarningPairwise does not imply independent

Two coins (Hajek): AA = first heads, BB = second heads, CC = both coins match. Each has probability .5, and each pairwise intersection has probability .25, so they are pairwise independent. But P(A∣BC)=1≠P(A)P(A\mid BC) = 1\ne P(A).

Two dice (Ross): EE = sum 7, FF = first die 4, GG = second die 3. Again pairwise independent, but P(E∣FG)=1P(E\mid FG) = 1.

DefinitionIndependence of nn events

A1,…,AnA_1,\dots,A_n are independent if for every subcollection 1≤i1<⋯<ik≤n1\le i_1 < \cdots < i_k\le n with k≥2k\ge2, P(Ai1⋯Aik)=P(Ai1)⋯P(Aik).P(A_{i_1}\cdots A_{i_k}) = P(A_{i_1})\cdots P(A_{i_k}). For three events this is four equations: three pairs plus the triple. An infinite family is independent if every finite subfamily is.

TheoremGrouping

If A1,…,AnA_1,\dots,A_n are independent, then events built by Boolean operations from disjoint blocks of them are again independent. For example, AA is independent of BCBC and of B∪CB\cup C.

ProofAA independent of B∪CB\cup C P(A(B∪C))=P(AB)+P(AC)−P(ABC)=P(A)[P(B)+P(C)−P(B)P(C)]=P(A)P(B∪C).P(A(B\cup C)) = P(AB) + P(AC) - P(ABC) = P(A)\big[P(B) + P(C) - P(B)P(C)\big] = P(A)P(B\cup C).

∎

Independent trials

DefinitionIndependent subexperiments and trials

Subexperiments are independent if events EiE_i, each determined only by the ii-th subexperiment, are always independent. When every subexperiment has the same outcome set, they are called trials.

FormulaSuccess probabilities in independent trials

With success probability pp per trial:

  • P(at least one success in n)=1−(1−p)nP(\text{at least one success in }n) = 1 - (1-p)^n;
  • P(exactly k successes in n)=(nk)pk(1−p)n−kP(\text{exactly }k\text{ successes in }n) = \binom nkp^k(1-p)^{n-k} (the binomial probability);
  • P(all trials succeed)=lim⁡npn=0P(\text{all trials succeed}) = \lim_np^n = 0 if p<1p < 1, by probability-foundations.
DerivationThe binomial probability

Any particular sequence with kk successes and n−kn-k failures has probability pk(1−p)n−kp^k(1-p)^{n-k} by independence. There are (nk)\binom nk such sequences, and they are disjoint.

ExampleParallel system (Ross)

The system works if any of nn independent components works (probabilities pip_i): P(works)=1−P(⋂iAic)=1−∏i(1−pi).P(\text{works}) = 1 - P\Big(\bigcap_iA_i^c\Big) = 1 - \prod_i(1 - p_i).

ExampleThe probabilistic method (Ross)

Color each edge of the complete graph KnK_n red or blue independently with probability 12\frac12. A fixed kk-set of vertices is monochromatic with probability 2⋅2−(k2)2\cdot2^{-\binom k2}. By Boole’s inequality, P(some monochromatic k-set)≤(nk)21−k(k−1)/2<1if(nk)<2k(k−1)/2−1.P(\text{some monochromatic }k\text{-set})\le\binom nk2^{1-k(k-1)/2} < 1\quad\text{if}\quad\binom nk < 2^{k(k-1)/2-1}. Then a coloring with no monochromatic kk-set exists. The argument proves existence without constructing one. (The same method gives the lower bound in cost-sharing.)


Independent random variables (of discrete type)

DefinitionIndependence of random variables (Hajek Def. 2.4.8)

XX and YY are independent if every event {X∈A}\{X\in A\} is independent of every event {Y∈B}\{Y\in B\}. More generally, X1,…,XnX_1,\dots,X_n are mutually independent if {X1∈A1},…,{Xn∈An}\{X_1\in A_1\},\dots,\{X_n\in A_n\} are always independent events.

TheoremFactorization of the joint pmf

Discrete X,YX, Y are independent iff P{X=i,Y=j}=pX(i) pY(j)for all i,j.P\{X = i, Y = j\} = p_X(i)\,p_Y(j)\quad\text{for all }i,j.

ProofPoint masses suffice

(⇒) Take A={i}A = \{i\} and B={j}B = \{j\}.

(⇐) For any A,BA, B:

P{X∈A,Y∈B}=∑i∈A∑j∈BpX(i)pY(j)=(∑i∈ApX(i))(∑j∈BpY(j))=P{X∈A}P{Y∈B}.P\{X\in A, Y\in B\} = \sum_{i\in A}\sum_{j\in B}p_X(i)p_Y(j) = \Big(\sum_{i\in A}p_X(i)\Big)\Big(\sum_{j\in B}p_Y(j)\Big) = P\{X\in A\} P\{Y\in B\}.

The key step: a double sum of products factors into a product of sums.

∎

ExampleCoin and die (Hajek)

A flip NN and a roll XX, with all 12 outcomes equally likely: P{N=H,X=6}=112=12⋅16P\{N = H, X = 6\} = \frac1{12} = \frac12\cdot\frac16. Every (N,X)(N,X) pair factors, so any event about NN is independent of any event about XX.

RemarkWhy E[X1X2]=E[X1]E[X2]E[X_1X_2] = E[X_1]E[X_2] for dice

The factorization 136=16⋅16\frac1{36} = \frac16\cdot\frac16 is what let ∑i,jij\sum_{i,j}ij split into (∑i)(∑j)\big(\sum i\big)\big(\sum j\big) in the product example. The general statement (E[XY]=E[X]E[Y]E[XY] = E[X]E[Y] for independent X,YX,Y) comes later in Hajek, Section 4.4.


The law of total probability, and Bayes’ formula

Total probability

TheoremLaw of total probability

For any event FF with 0<P(F)<10 < P(F) < 1: P(E)=P(E∣F)P(F)+P(E∣Fc)[1−P(F)].(3.1)P(E) = P(E\mid F)P(F) + P(E\mid F^c)\big[1 - P(F)\big]. \tag{3.1} More generally, for a partition F1,…,FnF_1,\dots,F_n of Ω\Omega: P(E)=∑i=1nP(E∣Fi)P(Fi).(3.4)P(E) = \sum_{i=1}^nP(E\mid F_i)P(F_i). \tag{3.4}

ProofSplit EE along the partition

E=⋃iEFiE = \bigcup_iEF_i with the pieces disjoint, so P(E)=∑iP(EFi)=∑iP(E∣Fi)P(Fi)P(E) = \sum_iP(EF_i) = \sum_iP(E\mid F_i)P(F_i) by the chain rule.

∎

IntuitionReason by cases

P(E)P(E) is a weighted average of the conditional probabilities, each weighted by the probability of its case. Choose the cases so that each conditional is easy.

ExampleReasoning by cases (Ross)

  • Accident-prone policyholders: 30% are accident prone (accident rate .4), the rest have rate .2. So P(accident)=.4⋅.3+.2⋅.7=.26P(\text{accident}) = .4\cdot.3 + .2\cdot.7 = .26.
  • Flashlights of 3 types: 20%, 30%, 50% of stock with lifetime probabilities .7, .4, .3: P(lasts)=.14+.12+.15=.41P(\text{lasts}) = .14 + .12 + .15 = .41.
  • Twins: identical twins are always the same sex, fraternal twins are the same sex with probability 12\frac12. So P(SS)=P(I)+12(1−P(I))P(SS) = P(I) + \frac12(1 - P(I)). Observing P(SS)≈.64P(SS)\approx.64 gives P(I)=2P(SS)−1≈.28P(I) = 2P(SS) - 1\approx.28. This estimates something unobservable (DNA identity) from something cheap (sex).
  • Card after the first ace: condition on the ordering O\mathbf O of the other 51 cards. Given O\mathbf O, the specified card is equally likely to be in any of 52 slots, and exactly one follows the first ace. So P=1/52P = 1/52, matching the counting argument.

ExampleEvery strategy wins with probability 1/n1/n (Ross)

Cards are turned over one at a time, and you may once predict “the next card is the ace of spades.” If you never guess, you win if the ace is last. Claim: for an nn-card deck, every strategy wins with probability 1/n1/n.

Induction: let pp be the probability your strategy guesses on card 1. Guessing wins with probability 1/n1/n. Not guessing requires the first card not to be the ace, n−1n\frac{n-1}n, and then you face an (n−1)(n-1)-card deck, 1n−1\frac1{n-1}. So P(win)=p⋅1n+(1−p)n−1n1n−1=1n.P(\text{win}) = p\cdot\frac1n + (1-p)\frac{n-1}n\frac1{n-1} = \frac1n.

Conditional expectation and total expectation

DefinitionConditional mean given an event (Hajek §2.10)

For an event AA with P(A)>0P(A) > 0,

E[X∣A]=∑iui P(X=ui∣A),E[g(X)∣A]=∑ig(ui) P(X=ui∣A).E[X\mid A] = \sum_iu_i\,P(X = u_i\mid A),\qquad E[g(X)\mid A] = \sum_i g(u_i)\,P(X = u_i\mid A).

This is the ordinary mean computed with the conditional pmf. Conditional LOTUS holds because P(⋅∣A)P(\cdot\mid A) is a probability measure.

TheoremLaw of total expectation

For a partition E1,…,EJE_1,\dots,E_J of Ω\Omega with each P(Ej)>0P(E_j) > 0, E[X]=∑j=1JE[X∣Ej] P(Ej).E[X] = \sum_{j=1}^JE[X\mid E_j]\,P(E_j).

ProofTotal probability inside the mean

Substitute P(X=ui)=∑jP(X=ui∣Ej)P(Ej)P(X = u_i) = \sum_jP(X = u_i\mid E_j)P(E_j) into E[X]=∑iuiP(X=ui)E[X] = \sum_iu_iP(X = u_i) and swap the order of summation.

∎

NoteAlready in use

First-step analysis of the geometric mean and variance (discrete-random-variables-and-distributions) is exactly this rule, with the partition {first trial succeeds, fails}.

ExampleDice with red faces (Hajek)

A bag holds three dice with 1, 2 and 3 red faces. One is drawn at random and rolled repeatedly. Let EiE_i = the die with ii red faces, and RjR_j = red on roll jj.

  • P(R1)=13(16+26+36)=13P(R_1) = \frac13\big(\frac16 + \frac26 + \frac36\big) = \frac13.
  • P(R1R2)=13(136+436+936)=754P(R_1R_2) = \frac13\big(\frac1{36} + \frac4{36} + \frac9{36}\big) = \frac7{54}, so P(R2∣R1)=718>13P(R_2\mid R_1) = \frac7{18} > \frac13.
  • P(R1R2R3)=13⋅1+8+27216=118P(R_1R_2R_3) = \frac13\cdot\frac{1 + 8 + 27}{216} = \frac1{18} and P(E3R1R2R3)=13(12)3=124P(E_3R_1R_2R_3) = \frac13\big(\frac12\big)^3 = \frac1{24}, so P(E3∣R1R2R3)=34P(E_3\mid R_1R_2R_3) = \frac34.

The rolls are conditionally independent given the die, but not independent: red makes the redder die, and hence more red, likelier.

ExampleA die, then that many coins (Hajek)

Roll a die (XX), then flip XX fair coins, and let YY = the number of heads. By total probability,

P{Y=3}=16[0+0+18+416+1032+2064]=16,P\{Y = 3\} = \frac16\Big[0 + 0 + \frac18 + \frac4{16} + \frac{10}{32} + \frac{20}{64}\Big] = \frac16,

and P(X=3∣Y=3)=1/481/6=18P(X = 3\mid Y = 3) = \frac{1/48}{1/6} = \frac18.

ExampleSmoking and lung cancer (Hajek, CDC figures)

Women who smoke are about 13 times likelier to develop lung cancer, and about 15% of women smoke. If nonsmokers’ rate is cc,

P(smoker∣cancer)=.15⋅13c.15⋅13c+.85c=1.952.80≈70%.P(\text{smoker}\mid\text{cancer}) = \frac{.15\cdot13c}{.15\cdot13c + .85c} = \frac{1.95}{2.80}\approx70\%.

The unknown baseline cc cancels. Also, if 18% of adults and 15% of women smoke, and half of adults are women, then 21% of men smoke, and the fraction of smokers who are women is 1515+21=512\frac{15}{15+21} = \frac5{12}.

ExampleSocks and boxes (Hajek)

  • Socks: 4 black, 6 red and 8 yellow, draw 2. P(same color)=6+15+28153=49153P(\text{same color}) = \frac{6 + 15 + 28}{153} = \frac{49}{153} and P(yellow∣same)=2849=47P(\text{yellow}\mid\text{same}) = \frac{28}{49} = \frac47.
  • Two boxes: box 1 has 3 black and 2 white balls, box 2 has 2 and 2. Move a random ball from box 1 to box 2 (WW = it was white), then draw from box 2 (BB = black). P(B)=25⋅25+35⋅35=1325P(B) = \frac25\cdot\frac25 + \frac35\cdot\frac35 = \frac{13}{25} and P(W∣B)=4/2513/25=413<25P(W\mid B) = \frac{4/25}{13/25} = \frac4{13} < \frac25. Transferring a white ball makes a black draw less likely, so seeing black makes WW less likely.

ExampleA mixture of two coins (Hajek)

Pick one of two coins with heads probabilities pp and q=1−pq = 1-p (p<12p < \frac12), each with probability 12\frac12, then flip it nn times. Let XX be the number of heads.

pX(k)=12(nk)(pkqn−k+qkpn−k),E[X]=np2+nq2=n2.p_X(k) = \frac12\binom nk\big(p^kq^{n-k} + q^kp^{n-k}\big),\qquad E[X] = \frac{np}2 + \frac{nq}2 = \frac n2.

Using E[X2∣coin]=(its mean)2+npqE[X^2\mid\text{coin}] = (\text{its mean})^2 + npq for each coin,

Var(X)=(n(1−2p)2)2+np(1−p),σX≥(1−2p)n2.\mathrm{Var}(X) = \Big(\frac{n(1-2p)}2\Big)^2 + np(1-p),\qquad \sigma_X\ge \frac{(1-2p)n}2.

ImportantUncertainty about the model does not average out

A single binomial has σ∝n\sigma\propto\sqrt n. The mixture has σ∝n\sigma\propto n, because not knowing which coin is being flipped is a fixed uncertainty that more flips of the same coin cannot remove.

First-step analysis

Condition on the first trial. If the process restarts afresh afterward, you get an equation for the unknown probability.

ExampleA sum of 5 before a sum of 7 (Ross)

P(5)=436P(5) = \frac4{36}, P(7)=636P(7) = \frac6{36}, and neither with probability 2636\frac{26}{36}. Conditioning on the first roll:

P(E)=436⋅1+636⋅0+2636P(E)  ⇒  P(E)=25.P(E) = \frac4{36}\cdot1 + \frac6{36}\cdot0 + \frac{26}{36}P(E) \;\Rightarrow\; P(E) = \frac25.

In general, for mutually exclusive E,FE, F in repeated independent trials, P(E before F)=P(E)P(E)+P(F).P(E\text{ before }F) = \frac{P(E)}{P(E) + P(F)}.

ExampleThe problem of the points (Pascal–Fermat, 1654)

Trials succeed with probability pp. What is the probability Pn,mP_{n,m} of nn successes before mm failures? This is the fair split of stakes in an interrupted game.

  • Pascal (first step): Pn,m=pPn−1,m+(1−p)Pn,m−1P_{n,m} = pP_{n-1,m} + (1-p)P_{n,m-1}, with Pn,0=0P_{n,0} = 0 and P0,m=1P_{0,m} = 1.
  • Fermat (imagine playing on): nn successes precede mm failures iff the first m+n−1m+n-1 trials contain at least nn successes: Pn,m=∑k=nm+n−1(m+n−1k)pk(1−p)m+n−1−k.P_{n,m} = \sum_{k=n}^{m+n-1}\binom{m+n-1}kp^k(1-p)^{m+n-1-k}.

IntuitionFermat’s trick: play past the end

Pretend the game always runs a fixed number of trials. Extra trials after the decision can’t change the outcome, and a fixed-length game has a binomial count. The same trick shows that “winner serves” and “alternating serve” give the same match-win probability in serve-and- rally games (Ross): with 2n−12n-1 rallies played, the first server always serves nn of them.

ExampleGambler’s ruin (Ross)

AA starts with ii units and BB with N−iN - i. Each flip moves one unit to AA with probability pp (let q=1−pq = 1-p). Conditioning on the first flip gives Pi=pPi+1+qPi−1P_i = pP_{i+1} + qP_{i-1}, with P0=0P_0 = 0 and PN=1P_N = 1. Therefore

Pi={1−(q/p)i1−(q/p)Np≠12,iNp=12.(4.5)P_i = \begin{cases}\dfrac{1 - (q/p)^i}{1 - (q/p)^N} & p\ne\frac12,\\[6pt] \dfrac iN & p = \frac12.\end{cases} \tag{4.5}
DerivationSolving the recurrence

Step 1: Increments are geometric. From pPi+qPi=pPi+1+qPi−1pP_i + qP_i = pP_{i+1} + qP_{i-1} we get Pi+1−Pi=qp(Pi−Pi−1)=(qp)iP1.P_{i+1} - P_i = \frac qp(P_i - P_{i-1}) = \Big(\frac qp\Big)^iP_1.

Step 2: Sum the increments. Pi=P1[1+qp+⋯+(qp)i−1]P_i = P_1\big[1 + \frac qp + \cdots + (\frac qp)^{i-1}\big], a geometric series (or iP1iP_1 if q=pq = p).

Step 3: Use PN=1P_N = 1 to find P1P_1.

Step 4: Nobody plays forever. BB’s win probability QiQ_i comes from the same formula with p↔qp\leftrightarrow q and i↔N−ii\leftrightarrow N-i. Algebra shows Pi+Qi=1P_i + Q_i = 1. So the third possibility, the game never ending, has probability 0.

ExampleNumbers and applications

  • Starting at 5 of 15 total units: AA wins with probability 13\frac13 at p=12p = \frac12, but about 0.870.87 at p=.6p = .6. A small edge compounds.
  • Huygens’ dice duel (12 coins each; 11 on three dice pays AA, 14 pays BB) is gambler’s ruin with p=1542p = \frac{15}{42}, i=12i = 12, N=24N = 24.
  • Sequential drug trial: stop when one drug’s cumulative cures lead the other’s by MM. The probability of wrongly declaring the worse drug better is 11+γM,γ=p1(1−p2)p2(1−p1).\frac1{1 + \gamma^M},\qquad\gamma = \frac{p_1(1-p_2)}{p_2(1-p_1)}. With p1=.6p_1 = .6 and p2=.4p_2 = .4: .017 at M=5M = 5 and .0003 at M=10M = 10.
ExampleEqual-fortune elimination (Ross)

Player ii holds nin_i units, n=∑nin = \sum n_i. Random pairs play fair one-unit games until one player holds everything. P(i wins)=ni/nP(i\text{ wins}) = n_i/n. Split each player into nin_i one-unit “sub-players.” By symmetry each of the nn sub-players is equally likely to end up with everything, and team ii wins exactly when one of its nin_i sub-players does. This holds however the pairs are chosen.

ExampleRuns before runs (Ross)

What is the probability that a run of nn successes comes before a run of mm failures? Condition on the first trial, then on whether the next n−1n-1 (or m−1m-1) trials continue the run. A broken run resets the problem:

P(E)=pn−1(1−qm)pn−1+qm−1−pn−1qm−1.(5.7)P(E) = \frac{p^{n-1}(1 - q^m)}{p^{n-1} + q^{m-1} - p^{n-1}q^{m-1}}. \tag{5.7}

For a fair coin, 2 heads before 3 tails has probability 710\frac7{10}, and 2 heads before 4 tails has probability 56\frac56. The two symmetric probabilities sum to 1, so one of the runs occurs eventually.

ExampleMatching problem by recursion (Ross)

Condition on whether person 1 takes their own hat. With PnP_n the no-match probability, Pn=n−1nPn−1+1nPn−2P_n = \frac{n-1}nP_{n-1} + \frac1nP_{n-2}, i.e. Pn−Pn−1=−1n(Pn−1−Pn−2)P_n - P_{n-1} = -\frac1n(P_{n-1} - P_{n-2}). With P1=0P_1 = 0 and P2=12P_2 = \frac12, this telescopes to Pn=12!−13!+⋯+(−1)nn!P_n = \frac1{2!} - \frac1{3!} + \cdots + \frac{(-1)^n}{n!}, matching the inclusion–exclusion answer.

Bayes’ formula

TheoremBayes’ formula (Ross Prop. 3.1)

For a partition F1,…,FnF_1,\dots,F_n and an event EE with P(E)>0P(E) > 0:

P(Fj∣E)=P(E∣Fj)P(Fj)∑i=1nP(E∣Fi)P(Fi).(3.5)P(F_j\mid E) = \frac{P(E\mid F_j)P(F_j)}{\sum_{i=1}^nP(E\mid F_i)P(F_i)}. \tag{3.5}
ProofDefinition over total probability

P(Fj∣E)=P(EFj)/P(E)P(F_j\mid E) = P(EF_j)/P(E). Write the numerator with the chain rule and the denominator with total probability.

∎

IntuitionPriors, likelihoods, posteriors

Think of the FjF_j as hypotheses, P(Fj)P(F_j) as priors, P(E∣Fj)P(E\mid F_j) as likelihoods of the evidence, and P(Fj∣E)P(F_j\mid E) as posteriors. Bayes’ formula says how evidence should revise belief: posterior ∝ likelihood × prior.

DefinitionOdds

odds(A)=P(A)P(Ac)=P(A)1−P(A).\text{odds}(A) = \frac{P(A)}{P(A^c)} = \frac{P(A)}{1 - P(A)}. Odds of α\alpha are said ”α\alpha to 1” in favour. For example, P(A)=23P(A) = \frac23 gives odds 2.

FormulaBayes in odds form

P(H∣E)P(Hc∣E)=P(H)P(Hc)⋅P(E∣H)P(E∣Hc).(3.3)\frac{P(H\mid E)}{P(H^c\mid E)} = \frac{P(H)}{P(H^c)}\cdot\frac{P(E\mid H)}{P(E\mid H^c)}. \tag{3.3}

New odds = old odds × likelihood ratio.

ImportantWhat counts as evidence for a hypothesis

EE raises the probability of HH iff P(E∣H)>P(E∣Hc)P(E\mid H) > P(E\mid H^c): the evidence must be more likely under HH than under its negation. “Consistent with HH” is not enough.

Reese–Schapiro bridge hearing (1965): the prosecution argued that play consistent with cheating counts toward guilt. But the same play was equally consistent with their standard line, a likelihood ratio of about 1, so it was no evidence at all.

ExampleThe base-rate fallacy — a good test for a rare disease (Ross)

The test detects the disease 95% of the time, gives false positives 1% of the time, and prevalence is 0.5%.

P(D∣+)=.95⋅.005.95⋅.005+.01⋅.995=95294≈.323.P(D\mid +) = \frac{.95\cdot.005}{.95\cdot.005 + .01\cdot.995} = \frac{95}{294}\approx.323.

Only about a third of positives are sick.

graph LR
  P["200 people tested"] -->|"prevalence 0.005"| D["1 has disease"]
  P -->|"0.995"| H["199 healthy"]
  D -->|"detects 0.95"| TP["0.95 true positive"]
  H -->|"false positive 0.01"| FP["1.99 false positives"]

IntuitionCount people, not probabilities

Per 200 people tested, about 0.95 true positives compete with about 1.99 false positives. The false positives win because the healthy group is about 200 times larger. A rare condition makes even a small false-positive rate dominate.

ExampleBelief updates (Ross)

SituationPriorLikelihoods (under HH / not HH)Posterior
accident prone, given an accident.3.4 / .2.12.26=613\frac{.12}{.26} = \frac6{13}
knew the answer, given correct (mm choices)pp1 / 1m\frac1mmp1+(m−1)p\frac{mp}{1 + (m-1)p}; 56\frac56 at m=5m = 5, p=12p = \frac12
disease, positive test, diabetic patient.61 / .3.6.72≈.833\frac{.6}{.72}\approx.833 (≥ .8, so operate)
guilty, suspect has the criminal’s trait (20% of population).61 / .2≈.882\approx.882
type-A coin (two A’s, one B), heads23\frac2314\frac14 / 34\frac34odds 23\frac23, probability 25\frac25
flashlight type 1, 2, 3 given it lasted.2, .3, .5.7, .4, .31441,1241,1541\frac{14}{41},\frac{12}{41},\frac{15}{41}
chimp father is male 1 (baby Aa; mother AA; males aa, Aa)pp1 / 12\frac122p1+p>p\frac{2p}{1+p} > p

ExampleSearching for a lost plane (Ross)

The plane is equally likely to be in one of 3 regions. A search of region ii misses the plane there with overlook probability βi\beta_i. After an unsuccessful search of region 1:

P(R1∣E)=β1β1+2,P(Rj∣E)=1β1+2 (j=2,3).P(R_1\mid E) = \frac{\beta_1}{\beta_1 + 2},\qquad P(R_j\mid E) = \frac1{\beta_1 + 2}\ (j = 2,3).

Region 1’s probability drops and the others’ rise. The drop is smaller when β1\beta_1 is large, since a miss is then more plausibly bad luck.

WarningThe three-card swindle (Ross)

The cards are red/red, black/black and red/black. A random card shows red on top. What is P(other side black)P(\text{other side black})? It is 13\frac13, not 12\frac12. Count sides, not cards: of the 3 equally likely red faces, only one belongs to the red/black card.

P(RB∣R)=12⋅131⋅13+12⋅13+0=13.P(RB\mid R) = \frac{\frac12\cdot\frac13}{1\cdot\frac13 + \frac12\cdot \frac13 + 0} = \frac13.

WarningThe two-child puzzle is underspecified (Ross)

A mother of two is seen with a daughter. What is P(two girls)P(\text{two girls})? It is P(G1G2∣G)=11+P(G∣G1B2)+P(G∣B1G2),P(G_1G_2\mid G) = \frac1{1 + P(G\mid G_1B_2) + P(G\mid B_1G_2)}, which depends on how the child walking with her was chosen.

  • The companion is the elder child with probability pp regardless of sex: answer 12\frac12.
  • With mixed sexes, she walks with the girl with probability qq: answer 11+2q\frac1{1+2q}. With q=1q = 1 this is 13\frac13, the “at least one girl” answer.

The sample space must include which child is seen, not just the children’s sexes.

ExampleDNA database match (Ross)

One culprit among 1,000,000 townspeople. Each of 10,000 ex-convicts has prior probability α=cβ\alpha = c\beta and everyone else β\beta, so α=c10,000c+990,000\alpha = \frac c{10{,}000c + 990{,}000}. An innocent person matches with probability 10−510^{-5}. A. J. Jones is the only match in the ex-convict database. Working it through,

P(G∣M)=αα+10−5(1−10,000α)=10.9+10−5/α.P(G\mid M) = \frac{\alpha}{\alpha + 10^{-5}(1 - 10{,}000\alpha)} = \frac1{0.9 + 10^{-5}/\alpha}.
Prior ratio ccP(guilty∣match)P(\text{guilty}\mid\text{match})
100.9099
10.5025
1.0917

The prior drives the conclusion. The same DNA evidence yields anywhere from 9% to 91%.

Conditional independence and sequential updating

DefinitionConditional independence

E1E_1 and E2E_2 are conditionally independent given FF if

P(E1∣E2F)=P(E1∣F),equivalentlyP(E1E2∣F)=P(E1∣F)P(E2∣F).P(E_1\mid E_2F) = P(E_1\mid F),\quad\text{equivalently}\quad P(E_1E_2\mid F) = P(E_1\mid F)P(E_2\mid F).

WarningConditionally independent ≠ independent

Accidents in successive years are conditionally independent given whether the policyholder is accident prone. Unconditionally, a first-year accident raises the posterior that the person is accident prone, which raises next year’s risk:

P(A2∣A1)=.4⋅613+.2⋅713≈.29>.26=P(A2).P(A_2\mid A_1) = .4\cdot\tfrac6{13} + .2\cdot\tfrac7{13}\approx.29 > .26 = P(A_2).

ExampleLaplace’s rule of succession (Ross)

The box holds coins i=0..ki = 0..k, where coin ii lands heads with probability i/ki/k. One is picked at random and lands heads nn times in a row. Flips are conditionally independent given the coin, so

P(Hn+1∣Hn)=P(Hn+1)P(Hn)=∑i(i/k)n+1∑i(i/k)n  ≈  ∫01xn+1dx∫01xndx=n+1n+2(k large).P(H_{n+1}\mid H_n) = \frac{P(H_{n+1})}{P(H_n)} = \frac{\sum_i(i/k)^{n+1}} {\sum_i(i/k)^n}\;\approx\;\frac{\int_0^1x^{n+1}dx}{\int_0^1x^ndx} = \frac{n+1}{n+2}\quad(k\text{ large}).

TheoremSequential Bayesian updating

If E1E_1 and E2E_2 are conditionally independent given each hypothesis HjH_j, then the posterior after E1E_1 can serve as the prior for E2E_2:

P(Hi∣E1E2)=P(E2∣Hi)P(Hi∣E1)∑jP(E2∣Hj)P(Hj∣E1).P(H_i\mid E_1E_2) = \frac{P(E_2\mid H_i)P(H_i\mid E_1)}{\sum_jP(E_2\mid H_j)P(H_j\mid E_1)}.

For example, tracking which of two coins is being flipped requires storing only the current posterior, not the whole history.

ProofFactor the joint likelihood

By conditional independence, P(E1E2∣Hi)=P(E2∣Hi)P(E1∣Hi)P(E_1E_2\mid H_i) = P(E_2\mid H_i)P(E_1\mid H_i). So

P(Hi∣E1E2)=P(E2∣Hi)P(E1∣Hi)P(Hi)P(E1E2)=P(E2∣Hi)P(Hi∣E1)Q,P(H_i\mid E_1E_2) = \frac{P(E_2\mid H_i)P(E_1\mid H_i)P(H_i)}{P(E_1E_2)} = \frac{P(E_2\mid H_i)P(H_i\mid E_1)}{Q},

with Q=P(E1E2)/P(E1)Q = P(E_1E_2)/P(E_1). Summing over ii (the posteriors sum to 1) identifies Q=∑jP(E2∣Hj)P(Hj∣E1)Q = \sum_jP(E_2\mid H_j)P(H_j\mid E_1).

∎


Quick reference

ObjectStatementNote
Conditional probabilityP(B∣A)=P(AB)/P(A)P(B\mid A) = P(AB)/P(A)undefined if P(A)=0P(A) = 0
P(⋅∣A)P(\cdot\mid A)a probability measureall rules carry over
Chain ruleP(E1⋯En)=∏kP(Ek∣E1⋯Ek−1)P(E_1\cdots E_n) = \prod_kP(E_k\mid E_1\cdots E_{k-1})aces in piles ≈.105\approx.105
Exactly kk matchesPN−k/k!→e−1/k!P_{N-k}/k!\to e^{-1}/k!
IndependenceP(AB)=P(A)P(B)P(AB) = P(A)P(B)complements preserve it
nn eventsproduct rule for every subfamilypairwise is not enough
Binomial(nk)pk(1−p)n−k\binom nkp^k(1-p)^{n-k}independent trials
Parallel system1−∏(1−pi)1 - \prod(1 - p_i)
Independent RVsjoint pmf factorizes⇒ E[X1X2]=E[X1]E[X2]E[X_1X_2] = E[X_1]E[X_2] for dice
Total probabilityP(E)=∑iP(E∣Fi)P(Fi)P(E) = \sum_iP(E\mid F_i)P(F_i)reason by cases
EE before FFP(E)/(P(E)+P(F))P(E)/(P(E) + P(F))5 before 7: 2/52/5
Problem of points∑k≥n(m+n−1k)pk(1−p)m+n−1−k\sum_{k\ge n}\binom{m+n-1}kp^k(1-p)^{m+n-1-k}play past the end
Gambler’s ruin1−(q/p)i1−(q/p)N\frac{1 - (q/p)^i}{1 - (q/p)^N} or i/Ni/Nends with probability 1
BayesP(Fj∣E)∝P(E∣Fj)P(Fj)P(F_j\mid E)\propto P(E\mid F_j)P(F_j)
Odds formposterior odds = prior odds × likelihood ratioevidence iff ratio > 1
Base ratesP(D∣+)≈.32P(D\mid +)\approx.32 for a 95%/1% test at 0.5% prevalence
Three cards1/31/3count sides
Conditional independenceP(E1E2∣F)=P(E1∣F)P(E2∣F)P(E_1E_2\mid F) = P(E_1\mid F)P(E_2\mid F)not unconditional
Rule of succession(n+1)/(n+2)(n+1)/(n+2)
Conditional meanE[X∣A]=∑u P(X=u∣A)E[X\mid A] = \sum u\,P(X = u\mid A)conditional LOTUS
Total expectationE[X]=∑jE[X∣Ej]P(Ej)E[X] = \sum_jE[X\mid E_j]P(E_j)behind first-step analysis
Coin mixtureVar=(n(1−2p)/2)2+np(1−p)\mathrm{Var} = (n(1-2p)/2)^2 + np(1-p)σ∝n\sigma\propto n, not n\sqrt n

Facts to keep to hand

  • Conditioning replaces PP with a new probability measure. Every rule survives. Most apparent paradoxes (at least one head, three cards, two children) come from a misspecified reduced sample space. Fix them by returning to the definition and counting outcomes, sides, or which child was seen.
  • Independence is algebra, not physics. Physical separation justifies assuming it, but it can hold by coincidence (even and multiple of 3 on one die). Pairwise independence does not imply mutual independence. And conditional independence given a hidden cause coexists with unconditional dependence (accident proneness).
  • Total probability plus a restart gives an equation. 5 before 7, gambler’s ruin, runs, matching, points, and the ace-guessing game all condition on the first step and exploit the fact that the process begins afresh. Fermat’s alternative is to extend the game to a fixed length so a binomial count applies.
  • Bayes is “posterior odds = prior odds × likelihood ratio.” Evidence supports HH only if it is likelier under HH than under not-HH. Rare hypotheses need very large likelihood ratios, which explains the base-rate fallacy, the DNA-database sensitivity to priors, and why “consistent with guilt” is not evidence of guilt.
  • Total expectation is total probability for means. Condition on a partition and average the conditional means. It underlies first-step analysis, and it shows that model uncertainty (which coin?) adds spread that grows like nn rather than n\sqrt n.

References

← All notes