Lecture notes · Introduction to Mathematical Statistics · Chapter 2

Chapter 2. Probability

Probability turns a random experiment into mathematics in three steps: list what can happen (the sample space), assign numbers to collections of outcomes so that three or four axioms hold, and then derive everything else. This chapter builds the axioms and their immediate consequences (including inclusion–exclusion), conditional probability with the law of total probability and Bayes' theorem, independence, the counting rules of combinatorics and the way equally likely outcomes turn counts into probabilities. It ends with Monte Carlo, the use of simulated frequencies. The book proves little beyond the first consequences of the axioms and leaves many facts to a remark or a picture; these notes prove them: why a frequency tends to a probability, the algebra of sets, finite additivity, inclusion–exclusion with the Bonferroni bounds, conditioning as a probability, the role of the host in the Monty Hall problem, why a better test barely helps a rare condition, independence of complements and its pitfalls, Stirling's formula, the birthday problem for unequal birthdays and the ten poker hands.

Course home Ch. 1 Introduction Ch. 2 Probability Ch. 3 Random variables Ch. 4 Special distributions Ch. 5 Estimation Ch. 6 Hypothesis testing Ch. 7 Normal-based inference Ch. 8 Types of data Ch. 9 Two-sample inference Ch. 10 Goodness of fit Ch. 11 Regression Ch. 12 Analysis of variance Ch. 13 Randomized blocks Ch. 14 Nonparametric statistics

How to use the gap boxes and selected questions

Each Filling the gap box completes a step or a proof the book leaves out, and each selected question asks you to apply the chapter. Try it yourself first. When you are stuck, open Hint 1; the next hint unlocks one minute after you open the previous one, so take one hint at a time and think about it before moving on: the key idea first, then the tools, then the steps, with intermediate results to aim for. The full proof or solution appears after the last hint and unlocks two minutes later: use it to check your own argument. If you use a generative AI assistant, use it the same way: ask for a hint or for the next step only, then check what it says against these notes (why I teach this way). Spotted a mistake? Use the Report an error link at the end of each box: confirmed errors are corrected and listed, with thanks, in the errata.

How to read these notes

They follow the book. Sections carry the book's numbers (2.1 to 2.8) and numbered items keep the book's numbers (Definition 2.4.1, Theorem 2.6.2, Example 2.7.6, Case Study 2.4.1, Question 2.7.15). Equation numbers in parentheses are the book's.

Filling the gaps. Wherever the book says "it can be shown", draws a picture instead of proving, quotes a fact from algebra or leaves an argument to the reader, an orange Filling the gap box gives the full argument. Proofs and derivations start hidden: open one with its bar, or use the button below.

Figures, demonstrations and questions. The three computable figures of the chapter (2.1.1, 2.2.1, 2.6.17) are reproduced and three figures of my own (x2-1 to x2-3) illustrate gaps; all are computed by the Python code. The ▶ Demo boxes open an interactive demonstration already set to the case being discussed. Twelve questions of the chapter are solved at the end, each with graded hints.

Main reference

R. J. Larsen and M. L. Marx, An Introduction to Mathematical Statistics and Its Applications, 6th edition, Pearson (2018), Chapter 2, pages 15–101. Section, equation, example and question numbers below refer to this book. Further reading is listed in the references.

The explanations, derivations, figures and code are my own; equations and results are cited by their numbers in the book.

Companion courses

Probability appears at several levels on this site. The overlapping material is:

  • First-year course, Estimation and Hypothesis Testing: its advanced notes build probability from the axioms in the form needed for inference; this chapter supplies the counting and conditioning techniques that sit underneath.
  • Graduate course, Probability and Statistical Inference (Wasserman), Chapter 1: the same axioms with σ-fields (Filling the gap 1.5: why countable additivity), inclusion–exclusion by atoms and the matching problem (1.3), the counting rules and the birthday problem (1.6), independence of several events (1.8), conditional probability (1.10) and the base rate in Bayes' theorem (1.11). Where that chapter proves a result in full, these notes give the statement, a short proof at second-year level and a link.
  • Bayesian and Probabilistic Machine Learning, Volume 1, Chapter 2: conditional probability and independence (Section 2.1.3.4) and Bayes' rule with the Monty Hall problem (Section 2.3).

New here, in the sense of not appearing in the book: a Chebyshev answer to "how large must n be" for the frequency view (Filling the gap 2.1), inclusion–exclusion with the Bonferroni bounds (2.4), the Monty Hall problem with a host who has a preference (2.7), a ceiling on what a better test can achieve (2.9), the sandwich that justifies Caesar's breath (2.14), Stirling's formula with error bounds (2.15), the proof that unequal birthdays raise the chance of a match (2.18) and a complete derivation of the poker table (2.19).

The chapter at a glance

  • 2.1 Three definitions of probability: classical, frequency and axiomatic (Figure 2.1.1, Filling the gap 2.1).
  • 2.2 Sample spaces, events and the algebra of sets (Figure 2.2.1, 2.2).
  • 2.3 Kolmogorov's axioms and their consequences, Theorems 2.3.1 to 2.3.7 (2.3, 2.4, 2.5).
  • 2.4 Conditional probability, the multiplication rule, the law of total probability (Theorem 2.4.1) and Bayes' theorem (Theorem 2.4.2); the Monty Hall problem (Case Study 2.4.1, 2.6 to 2.9).
  • 2.5 Independence of two and of several events, repeated trials (2.10 to 2.14).
  • 2.6 The multiplication rule, permutations, combinations and the binomial coefficients (2.15, 2.16).
  • 2.7 Probability as a quotient of counts: the birthday problem, poker and lotteries (2.17 to 2.20).
  • 2.8 Monte Carlo estimates of probabilities and their precision (2.21).

Notation. \(S\) is the sample space, \(\P(A)\) the probability of an event \(A\), \(\co A\) its complement, \(\P(A\given B)\) a conditional probability, \(\binom nk\) a binomial coefficient and \((n)_k=n(n-1)\cdots(n-k+1)\) the number of permutations of length \(k\) from \(n\) objects (the book writes \({}_nP_k\)). \(\one_A\) is the indicator of \(A\): 1 on \(A\), 0 off it.

Prerequisites. The sets of high-school mathematics, the sum of a geometric series and a first idea of a limit. Expected values are not needed until Chapter 3; the only place they are anticipated is the second proof of Filling the gap 2.1, which uses finite sums only.

Derivations start hidden: click any bar to open one.

2.1 Introduction

pp. 15–17 The book opens with a list of questions that probability answers (how likely is a genuine UFO among ten thousand sightings, how unlikely is a 44-game hitting streak, what are the chances of a full house) and then recounts how the definition of probability changed. Three definitions are worth keeping apart.

Four jagged curves of the proportion of heads against the number of tosses on a log axis from 1 to 1000. They start anywhere between 0 and 1, swing widely over the first ten tosses and then settle near the horizontal line at one half, inside two dashed curves one half plus and minus one over root n that close in on the line.
Figure 2.1.1. The running proportion \(m/n\) of heads in four simulated sequences of 1000 tosses of a fair coin. The book draws this convergence schematically; here it is computed. The dashed curves are \(\tfrac12\pm1/\sqrt n\), two standard deviations of \(m/n\): the proportion leaves this envelope rarely, and the envelope itself shrinks like \(1/\sqrt n\). Reproduces Larsen and Marx (2018), Figure 2.1.1. Code: ch02_probability.py, fig_2_1_1.

Filling the gap 2.1: how fast does a frequency settle? p. 16

The book criticises the frequency definition because "how large must \(n\) be" is left open. Once probability is defined by the axioms the question has an answer, a theorem. Let \(X_1,\dots,X_n\) be independent trials (Section 2.5), each a success with probability \(p\), and let \(m_n=X_1+\dots+X_n\) be the number of successes. Then for every \(\varepsilon>0\)

\[ \P\Big(\Big|\frac{m_n}{n}-p\Big|\ge\varepsilon\Big)\ \le\ \frac{p(1-p)}{n\varepsilon^2}\ \le\ \frac1{4n\varepsilon^2}. \]
Hint 1 of 5: the key idea

Chebyshev's idea: the squared distance \(D^2\) is at least \((n\varepsilon)^2\) on the bad event. What does averaging that inequality over all outcomes give, and what is the average of \(D^2\)?

Hint 2 of 5: tools you will need
  • The indicator \(\one\{|D|\ge n\varepsilon\}\) and the fact that an average of a non-negative quantity is at least the average over a sub-event.
  • Independence, Definition 2.5.1: averages of products factor.
  • Chebyshev's inequality in the graduate course.
Hint 3 of 5: step 1

Write \(m_n-np=\sum_iY_i\) with \(Y_i=X_i-p\) and expand the square. Aim for: a sum of \(n\) squares plus cross terms \(Y_iY_j\).

Hint 4 of 5: step 2

Compute the average of \(Y_i^2\) and of \(Y_i\), then of \(Y_iY_j\) for \(i\ne j\) using independence. Aim for: the average of \(D^2\) equals \(np(1-p)\).

Hint 5 of 5: step 3

Divide by \((n\varepsilon)^2\) and bound \(p(1-p)\) by \(\tfrac14\) with a completed square.

Proof and what it says about \(n\)

The sample space is the finite set of \(2^n\) sequences of successes and failures and every probability below is a finite sum. Write \(Y_i=X_i-p\) and \(D=m_n-np=\sum_iY_i\). Write \(\mathrm{Av}(Q)\) for the probability-weighted average of a quantity \(Q\) over the sample space (these averages are developed as expected values in Chapter 3). For every outcome \(D^2\ge(n\varepsilon)^2\one\{|D|\ge n\varepsilon\}\), so averaging over outcomes gives \((n\varepsilon)^2\,\P(|D|\ge n\varepsilon)\le\mathrm{Av}(D^2)\). Expand \(D^2=\sum_iY_i^2+\sum_{i\ne j}Y_iY_j\). The average of \(Y_i^2\) is \(p(1-p)^2+(1-p)p^2=p(1-p)\). The average of \(Y_i\) is \(p(1-p)-(1-p)p=0\), and, by independence of trials \(i\) and \(j\), the average of \(Y_iY_j\) is the product of the averages, 0. So \(\mathrm{Av}(D^2)=np(1-p)\) and \(\P(|D|\ge n\varepsilon)\le p(1-p)/(n\varepsilon^2)\). Finally \(p(1-p)\le\frac14\) since \(\tfrac14-p(1-p)=(p-\tfrac12)^2\). \(\qquad\blacksquare\)

Reading it. To be within \(\varepsilon\) of \(p\) with probability at least \(1-\delta\) it is enough that \(n\ge1/(4\varepsilon^2\delta)\): for \(\varepsilon=0.05\) and \(\delta=0.05\), \(n=2000\). The bound is crude: for a fair coin and \(n=400\) it gives 0.25 while the exact probability of missing by 0.05 or more is 0.051. The theorem also shows that "\(m/n\to p\)" is a statement of the kind \(\P(\text{far})\to0\), not an ordinary limit; the strong form (almost surely) is in the graduate course, Result 1.H, and the weak law with a general proof of Chebyshev's inequality in Theorem 5.6 there and Theorem 4.2.

▶ DemoLong-run frequenciesOne coin, 1000 tosses: the path wanders and settles; the band around the true value narrows like \(1/\sqrt n\).

2.2 Sample Spaces and the Algebra of Sets

pp. 17–26 An experiment is a procedure that could be repeated and has a well-defined list of possible results. Each result is a sample outcome \(s\), the set of all of them is the sample space \(S\), and an event is any collection of outcomes, including single outcomes, \(S\) itself and the empty set \(\emptyset\); an event occurs if the outcome belongs to it. A sample space can be listed (three tosses of a coin), characterised by a pattern (Example 2.2.4, tossing until the first tail: \(S=\{T,HT,HHT,\dots\}\), infinite) or defined by a formula (Example 2.2.5, the coefficients \((a,b,c)\) of a quadratic, with the event "equal roots" given by \(b^2-4ac=0\)).

Example 2.2.1. Three tosses of a coin: \[S=\{HHH,HHT,HTH,THH,HTT,THT,TTH,TTT\}\;,\] eight outcomes, and the event "majority heads" has four. Example 2.2.2. Two dice, one red and one green: the 36 ordered pairs of Figure 2.2.1; "the sum is 7" contains the six pairs \((1,6),\dots,(6,1)\).

A six by six grid with the red die's face down the left side and the green die's face across the top; each cell is labelled with its pair, and the six cells (1,6), (2,5), (3,4), (4,3), (5,2), (6,1) along the anti-diagonal are shaded.
Figure 2.2.1. The sample space of a red and a green die: 36 equally likely ordered pairs. The shaded cells form the event A: the sum of the faces is 7. Reproduces Larsen and Marx (2018), Figure 2.2.1. Code: ch02_probability.py, fig_2_2_1.

Example 2.2.3 (what counts as an outcome). Hiring two co-anchors from three women and two men gives \(\binom52=10\) outcomes if the two jobs are interchangeable (unordered pairs) and \(5\cdot4=20\) if they are different jobs (ordered pairs). The choice of sample space is part of the model, and Section 2.7 shows which choices make outcomes equally likely.

Operations. Definitions 2.2.1 to 2.2.3 The intersection \(A\cap B\) holds the outcomes in both events, the union \(A\cup B\) those in at least one, the complement \(\co A\) those of \(S\) not in \(A\), and \(A,B\) are mutually exclusive if \(A\cap B=\emptyset\). Unions and intersections of \(k\) events are written \(\bigcup_{i=1}^kA_i\) and \(\bigcap_{i=1}^kA_i\) (Example 2.2.11: \(A_i=[0,1/i)\) telescope, so the union is \(A_1\) and the intersection \(A_k\)). Two phrases recur: "exactly one of \(A,B\) occurs" is \((A\cap\co B)\cup(\co A\cap B)\), equivalently \((A\cap B)^{\mathrm c}\cap(A\cup B)\), and "at most one occurs" is \((A\cap B)^{\mathrm c}\) (Example 2.2.12). In circuits, switches in series fail as a union and switches in parallel as an intersection (Example 2.2.8: \(A=(A_1\cup A_2)\cap(A_3\cup A_4)\)).

Venn diagrams. The book draws Venn diagrams (Figures 2.2.4 to 2.2.8) to suggest identities, and then proves the distributive law \(A\cap(B\cup C)=(A\cap B)\cup(A\cap C)\) (2.2.1) element by element in Example 2.2.13, noting that a picture is not a proof because it may not show the degenerate configurations. Questions 2.2.32 to 2.2.34 ask for the other laws.

Filling the gap 2.2: the laws of the algebra of sets, for any number of events pp. 22–25

For events \(A,B,C,A_1,A_2,\dots\) on the same \(S\): (i) De Morgan, \(\co{(A\cap B)}=\co A\cup\co B\) and \(\co{(A\cup B)}=\co A\cap\co B\), and for any finite or countable family \(\co{\big(\bigcup_iA_i\big)}=\bigcap_i\co{A_i}\), \(\co{\big(\bigcap_iA_i\big)}=\bigcup_i\co{A_i}\); (ii) distributive laws, \(A\cap\bigcup_iB_i=\bigcup_i(A\cap B_i)\) and \(A\cup\bigcap_iB_i=\bigcap_i(A\cup B_i)\); (iii) if \(A_1,A_2,\dots\) partition \(S\) (mutually exclusive, union \(S\)), then every event \(B\) satisfies \(B=\bigcup_i(B\cap A_i)\) with the pieces mutually exclusive.

Hint 1 of 5: the key idea

Two sets are equal when each is contained in the other, and membership of a union or intersection is a statement about 'some' and 'all'. How does negating 'some' change it?

Hint 2 of 5: tools you will need
  • Element-wise proof by double inclusion, as in the book's Example 2.2.13.
  • Negation of 'there exists' is 'for all'.
  • Definitions of union, intersection and complement (Section 2.2).
Hint 3 of 5: step 1

For De Morgan, take an outcome \(s\) in the complement of the union and unwind the definitions one at a time. Aim for: \(s\notin A_i\) for every \(i\).

Hint 4 of 5: step 2

Run the same chain backwards to get the reverse inclusion; then obtain the second De Morgan law by applying the first to the complements.

Hint 5 of 5: step 3

For the distributive laws and the partition statement, ask which index \(i\) is responsible for \(s\) being in \(B_i\) (resp. \(A_i\)), and check the pieces \(B\cap A_i\) cannot overlap.

Proof

Two sets are equal when each contains the other, which one checks outcome by outcome; "\(s\in\bigcup_iA_i\)" means "\(s\in A_i\) for some \(i\)" and "\(s\in\bigcap_iA_i\)" means "\(s\in A_i\) for all \(i\)". (i) \(s\in\co{(\bigcup_iA_i)}\) iff it is not true that \(s\in A_i\) for some \(i\), iff \(s\notin A_i\) for all \(i\), iff \(s\in\bigcap_i\co{A_i}\). Applying this to the complements \(\co{A_i}\) and taking complements again gives the other law. (ii) \(s\in A\cap\bigcup_iB_i\) iff \(s\in A\) and \(s\in B_i\) for some \(i\), iff for some \(i\) both \(s\in A\) and \(s\in B_i\), iff \(s\in\bigcup_i(A\cap B_i)\). The second law follows from the first and (i) by taking complements. (iii) If \(s\in B\), then \(s\in S\) lies in some \(A_i\), so \(s\in B\cap A_i\); conversely each \(B\cap A_i\subset B\). The pieces \(B\cap A_i\) are mutually exclusive because the \(A_i\) are. \(\qquad\blacksquare\)

Part (iii) is the step behind the law of total probability (Theorem 2.4.1), and the countable versions of (i) and (ii) are what is needed to speak of probabilities of infinite unions (Axiom 4 below). The graduate course collects the same material in Filling the gap 1.1.

2.3 The Probability Function

pp. 26–31 A probability function assigns to each event \(A\) a number \(\P(A)\). Kolmogorov's axioms:

The book says Axioms 1 to 3 suffice when \(S\) is finite and a fourth is needed when it is infinite. The consequences, with the book's proofs summarised:

Filling the gap 2.3: finite additivity from countable additivity pp. 26–27

The book presents Axioms 1 to 3 for finite \(S\) and adds Axiom 4 for infinite \(S\), and says Theorem 2.3.5 is "a straightforward induction". Two points deserve to be spelled out. First, with Axiom 4 in force, Axiom 3 is not an extra assumption. Second, the proof of Theorem 2.3.2 (\(\P(\emptyset)=0\)) uses Axiom 3, so the order of the derivation matters.

Hint 1 of 5: the key idea

A union of countably many events can be made into a union of exactly \(n\) events by adding empty sets. Which axiom then applies, and what must you know about \(\P(\emptyset)\)?

Hint 2 of 5: tools you will need
Hint 3 of 5: step 1

Use \(A_1=S\) and \(A_i=\emptyset\) for \(i\ge2\) in Axiom 4. Aim for: \(\P(\emptyset)=0\) without Axiom 3.

Hint 4 of 5: step 2

Pad a finite family \(A_1,\dots,A_n\) with empty sets and apply Axiom 4 again. Aim for: Theorem 2.3.5, with Axiom 3 as the case \(n=2\).

Hint 5 of 5: step 3

For the last paragraph, sum the geometric series \(\sum 2^{-k}\) and say why this sum needs the countable axiom.

Proof

\(\P(\emptyset)=0\) from Axioms 1, 2, 4. Take \(A_1=S\) and \(A_i=\emptyset\) for \(i\ge2\): these are mutually exclusive with union \(S\). Axiom 4 gives \(1=\P(S)=1+\sum_{i\ge2}\P(\emptyset)\), so \(\sum_{i\ge2}\P(\emptyset)=0\), and as each term is \(\ge0\) (Axiom 1), \(\P(\emptyset)=0\).

Theorem 2.3.5. For mutually exclusive \(A_1,\dots,A_n\) put \(A_i=\emptyset\) for \(i>n\). The union is unchanged and Axiom 4 gives \[\P(\bigcup_{i\le n}A_i)=\sum_{i\le n}\P(A_i)+\sum_{i>n}\P(\emptyset)=\sum_{i\le n}\P(A_i)\;.\] The case \(n=2\) is Axiom 3. (When \(S\) is finite the only mutually exclusive sequences with non-empty terms are finite, which is why the book needs Axiom 3 and not Axiom 4 there.)

Why the fourth axiom is not cosmetic. In Example 2.2.4 let the first tail occur on toss \(k\) with probability \(2^{-k}\). Each outcome \(H^{k-1}T\) is a separate event and the whole space is their countable union; the probabilities add to \(\sum_{k\ge1}2^{-k}=1\) only because Axiom 4 allows the sum to be taken. Finite additivity alone cannot decide, and there are strange finitely additive "probabilities" on the integers that give every single integer probability 0 and the whole set probability 1 (see graduate Filling the gap 1.5). Axiom 4 excludes them and is what makes limits of events well behaved. \(\qquad\blacksquare\)

Filling the gap 2.4: a proof of inclusion–exclusion, and the Bonferroni inequalities p. 28 and Example 2.6.24

Let \(S_j=\sum_{i_1<\cdots<i_j}\P(A_{i_1}\cap\cdots\cap A_{i_j})\) be the sum over all \(j\)-fold intersections. Then \[\P(\bigcup_iA_i)=S_1-S_2+\cdots+(-1)^{n+1}S_n\] (Theorem 2.3.7), and the Bonferroni inequalities hold: the partial sum \(T_J=S_1-S_2+\cdots+(-1)^{J+1}S_J\) satisfies \(T_J\ge\P(\bigcup_iA_i)\) for odd \(J\) and \(T_J\le\P(\bigcup_iA_i)\) for even \(J\). In particular \(\P(\bigcup_iA_i)\le\sum_i\P(A_i)\) (Boole's inequality).

Hint 1 of 5: the key idea

Prove the formula one outcome at a time. If an outcome lies in exactly \(k\) of the events, how many times does the right-hand side count it?

Hint 2 of 5: tools you will need
  • Counting subsets: an outcome in \(k\) events lies in \(\binom kj\) of the \(j\)-fold intersections (Theorem 2.6.4).
  • Pascal's rule \(\binom kj=\binom{k-1}j+\binom{k-1}{j-1}\).
  • Additivity over outcomes, Filling the gap 2.3.
Hint 3 of 5: step 1

Show \(\sum_{j=1}^J(-1)^{j+1}\binom kj=1+(-1)^{J+1}\binom{k-1}J\). Split \(\binom kj\) with Pascal's rule and watch the terms cancel in pairs. Aim for: a single surviving term.

Hint 4 of 5: step 2

Take \(J=n\geq k\): the surviving term is 0, so each outcome of the union is counted exactly once. Aim for: Theorem 2.3.7.

Hint 5 of 5: step 3

Look at the sign of the surviving term for \(J<n\) and sum over outcomes with weights \(\P(\{s\})\). Aim for: \(T_J\) above the union for odd \(J\), below for even \(J\).

Proof

An identity for one outcome. Fix an outcome \(s\) and let \(k\) be the number of events \(A_i\) that contain it. If \(k=0\), \(s\) is in no event and every \(j\)-fold intersection omits it. If \(k\ge1\), exactly \(\binom kj\) of the \(j\)-fold intersections contain \(s\). The claim to prove is that \[ \sum_{j=1}^{J}(-1)^{j+1}\binom kj=1+(-1)^{J+1}\binom{k-1}{J}\qquad(k\ge1,\ J\ge1). \] For \(J\ge k\) the last binomial is 0 and the left side is \(1-(1-1)^k=1\) by the binomial theorem (Filling the gap 2.16), which is the book's argument in Example 2.6.24. In general, use Pascal's rule \(\binom kj=\binom{k-1}j+\binom{k-1}{j-1}\) (Example 2.6.22) to write \[\sum_{j=0}^J(-1)^j\binom kj=\sum_{j=0}^J(-1)^j\binom{k-1}j+\sum_{j=0}^{J}(-1)^j\binom{k-1}{j-1}\;.\] The second sum is \(-\sum_{j=0}^{J-1}(-1)^j\binom{k-1}j\), so everything telescopes to \((-1)^J\binom{k-1}J\). Hence \(\sum_{j=1}^J(-1)^{j+1}\binom kj=1-(-1)^J\binom{k-1}J\), the claim.

Summing over outcomes. Let \(w(s)=\P(\{s\})\) when \(S\) is finite or countable. Then \(S_j=\sum_sw(s)\binom{k(s)}{j}\) (each outcome counted once per \(j\)-fold intersection containing it) and so \[T_J=\sum_{s:\,k(s)\ge1}w(s)\big(1+(-1)^{J+1}\binom{k(s)-1}J\big)=\P(\bigcup_iA_i)+(-1)^{J+1}\sum_{s:\,k(s)\ge1}w(s)\binom{k(s)-1}J\] where the last sum is \(\ge0\) and vanishes for \(J\ge n\). So \(T_J-\P(\bigcup A_i)\) has the sign \((-1)^{J+1}\) and equals 0 at \(J=n\): this is both Theorem 2.3.7 and the Bonferroni inequalities. For an uncountable \(S\) apply the same identity to the indicators \(\one_{A_i}\), namely \[\one_{\bigcup A_i}=1-\prod_i(1-\one_{A_i})=\sum_j(-1)^{j+1}\sum_{|I|=j}\one_{\bigcap_{i\in I}A_i}\;,\] and use that probability is linear, which Chapter 3 provides. \(\qquad\blacksquare\)

Use. The partial sums bracket the answer: for the matching problem of Example 2.6.24, \(S_j=1/j!\) and \[\P(\text{some letter is right})=1-\tfrac12+\tfrac16-\cdots\to1-e^{-1}\] (demo); when the events are strong (large \(S_1\)) the partial sums are useless, as the demo shows. The graduate course proves the same by atoms in Filling the gap 1.3.

▶ DemoInclusion–exclusion and matchingThree letters: \(1-\tfrac12+\tfrac16=\tfrac23\); presets 2 to 5 give eight letters, Question 2.3.5, strong events and the Poisson limit.

Examples 2.3.1 to 2.3.4 The theorems are used mostly by solving for an unknown. If \(\P(A)=0.3\), \(\P(B)=0.5\), \(\P(A\cup B)=0.7\), then \(\P(A\cap B)=0.3+0.5-0.7=0.1\), \(\P(\co A\cup\co B)=1-\P(A\cap B)=0.9\) and \(\P(\co A\cap B)=\P(B)-\P(A\cap B)=0.4\) (Example 2.3.1). Example 2.3.2 shows \(\P(A\cap B)\ge1-\P(\co A)-\P(\co B)\), the case \(n=2\) of the Bonferroni lower bound. Biff's two applications (Example 2.3.4: \(\P(A)=0.7\), \(\P(B)=0.4\), \(\P(\co A\cup\co B)=0.75\)) give \(\P(A\cap B)=0.25\) and \(\P(A\cup B)=0.85\).

Example 2.3.3 (two cards). p. 30 Two cards are drawn from a deck without replacement; what is the probability that the second is higher in rank than the first? The events "first is lower", "first is higher" and "equal ranks" are mutually exclusive and exhaustive, \(\P(\text{equal})=3/51\) (three cards share the first card's rank), and "by symmetry" the first two have equal probability, so \(2p+3/51=1\) and \(p=8/17\). The symmetry is justified next.

Filling the gap 2.5: why drawing without replacement is symmetric pp. 30 and 43

Draw \(k\) objects in order, without replacement, from \(N\) distinct objects, "at random": every ordered sequence of \(k\) different objects is equally likely, and there are \((N)_k\) of them (Theorem 2.6.1). Then for every rearrangement of the positions, the rearranged draw has the same probability law. In particular (a) \(\P(X_i\in B)=\P(X_1\in B)\) for every position \(i\) and every set \(B\) of objects; (b) the pair \((X_1,X_2)\) has the same law as \((X_2,X_1)\).

Hint 1 of 5: the key idea

Rearranging the positions of an ordered sample is a one-to-one map of the set of equally likely sequences onto itself. What does that do to probabilities?

Hint 2 of 5: tools you will need
  • Number of ordered samples without replacement, Theorem 2.6.1.
  • Equally likely outcomes: probability = number of outcomes in the event over the total.
  • A bijection preserves counts.
Hint 3 of 5: step 1

Define the map that swaps the entries in positions \(1\) and \(i\). Aim for: it sends the event \(\{x_i\in B\}\) onto \(\{x_1\in B\}\).

Hint 4 of 5: step 2

Conclude that the two events contain the same number of sequences. For (b), use the swap of positions 1 and 2.

Hint 5 of 5: step 3

Apply it: for Example 2.3.3 the swap turns 'first lower' into 'second lower'; for the keys and the chips it gives the same probability at every position.

Proof and uses

Let \(\pi\) be a permutation of the positions \(1,\dots,k\). The map sending a sequence \((x_1,\dots,x_k)\) to \((x_{\pi(1)},\dots,x_{\pi(k)})\) is a bijection of the set of ordered sequences of distinct objects onto itself, so every sequence has exactly one preimage and the probability of an event \(E\) of sequences equals that of its image, since both are (number of sequences)\(/(N)_k\). Taking \(E=\{x_1\in B\}\) and a \(\pi\) that puts position \(i\) first gives (a); taking the transposition \((1\,2)\) gives (b). \(\qquad\blacksquare\)

Uses. (1) Example 2.3.3: \(\P(X_1<X_2)=\P(X_2<X_1)\) by (b), since the transposition turns one event into the other. (2) Example 2.4.8: the probability that the second card of a shuffled deck is an ace is \(4/52\), the same as for the first, because nothing is known about the first (the book recovers this from the law of total probability: \(\tfrac3{51}\cdot\tfrac4{52}+\tfrac4{51}\cdot\tfrac{48}{52}=\tfrac4{52}\)). (3) Question 2.4.22: in a random order of trying \(n\) keys the good key is equally likely to come at every position, so the probability that it opens the door on the \(j\)th try is \(1/n\). (4) Question 2.4.34: the 7th chip drawn from forty red and sixty white is red with probability \(40/100\). The principle, "what you don't know doesn't matter", fails the moment anything about the earlier draws is observed.

2.4 Conditional Probability

pp. 31–50 Knowing that an event \(B\) has occurred changes the sample space from \(S\) to \(B\). With a fair die, the probability of a 6 is \(1/6\), but given that the number is even it is \(1/3\) (the book's Figure 2.4.1). For equally likely outcomes the reduced probability is the ratio of the counts \(c/b\), where \(b=|B|\) and \(c=|A\cap B|\), which is \((c/n)/(b/n)\), and this is taken as the general definition.

Definition 2.4.1. If \(\P(B)>0\), the conditional probability of \(A\) given \(B\) is \[ \P(A\given B)=\frac{\P(A\cap B)}{\P(B)},\qquad\text{equivalently}\qquad\P(A\cap B)=\P(A\given B)\P(B). \tag{2.4.1, 2.4.2} \]

Examples: Example 2.4.1 a club given a king: \(\tfrac{1/52}{4/52}=\tfrac14\), the same as the unconditional \(\P(\text{club})\), which is independence (Section 2.5). Example 2.4.2, "two boys": among families with two children, with the four birth orders equally likely, the probability that both are boys given that at least one is a boy is \(\tfrac{1/4}{3/4}=\tfrac13\), not \(\tfrac12\); given that the older child is a boy it is \(\tfrac12\). (Question 2.4.5 shows that collapsing to three unordered family types does not give three equally likely outcomes.) Example 2.4.3 from \(\P(A\cap\co B)=0.2\), \(\P(\co A\cap B)=0.1\), \(\P(\text{neither})=0.6\) gets \(\P(A\cap B)=0.1\) and \(\P(A\given B)=0.1/0.2=0.5\). Example 2.4.4 multiplies an accident probability \(8/50000\) by a spill probability \(3/15000\) to get \(3.2\times10^{-8}\). Example 2.4.5 (the myopic hunters, \(\P(A)=0.2\), \(\P(B)=0.3\), \(\P(A\cap B)=0.06\)) gives \[\P(B\given\text{exactly one hit})=\tfrac{0.3-0.06}{0.2+0.3-0.12}=0.63\;.\]

Filling the gap 2.6: \(\P(\cdot\given B)\) is a probability, and the multiplication rule pp. 33 and 38

For fixed \(B\) with \(\P(B)>0\), the function \(A\mapsto\P(A\given B)\) satisfies the four axioms, so every result of Section 2.3 holds with "given \(B\)" added: \(\P(\co A\given B)=1-\P(A\given B)\), \[\P(A\cup C\given B)=\P(A\given B)+\P(C\given B)-\P(A\cap C\given B)\;,\] and so on. Moreover, for events \(A_1,\dots,A_n\) with \(\P(A_1\cap\cdots\cap A_{n-1})>0\), \[ \P(A_1\cap\cdots\cap A_n)=\P(A_1)\,\P(A_2\given A_1)\,\P(A_3\given A_1\cap A_2)\cdots\P(A_n\given A_1\cap\cdots\cap A_{n-1}). \tag{2.4.3} \]

Hint 1 of 5: the key idea

Check Axioms 1, 2 and 4 one at a time for the function \(A\mapsto\P(A\cap B)/\P(B)\). Then build the chain rule by peeling off one event at a time.

Hint 2 of 5: tools you will need
  • Definition 2.4.1 of conditional probability.
  • Distributive law \((\bigcup A_i)\cap B=\bigcup(A_i\cap B)\), Filling the gap 2.2.
  • Induction, and monotonicity (Theorem 2.3.3).
Hint 3 of 5: step 1

For Axiom 4 note that disjointness of \(A_i\) passes to \(A_i\cap B\), then divide the additivity of \(\P\) by \(\P(B)\). Aim for: \(\P(\bigcup A_i\given B)=\sum\P(A_i\given B)\).

Hint 4 of 5: step 2

For (2.4.3), put \(D=A_1\cap\cdots\cap A_{n-1}\) and use (2.4.2) with \(D\) in the role of \(B\). Aim for: the induction step.

Hint 5 of 5: step 3

Explain why every conditioning event has positive probability: it contains \(D\).

Proof

Axioms. Axiom 1: \(\P(A\cap B)/\P(B)\ge0\). Axiom 2: \(\P(S\cap B)/\P(B)=1\). Axiom 4: if \(A_1,A_2,\dots\) are mutually exclusive so are \(A_1\cap B,A_2\cap B,\dots\), with union \((\bigcup_iA_i)\cap B\) (Filling the gap 2.2), so \[\P(\bigcup_iA_i\given B)=\sum_i\P(A_i\cap B)/\P(B)=\sum_i\P(A_i\given B)\;.\] (Axiom 3 and the theorems follow, Filling the gap 2.3.)

Multiplication rule. Induction on \(n\). For \(n=2\) it is (2.4.2). Suppose it holds for \(n-1\) events; write \(D=A_1\cap\cdots\cap A_{n-1}\), so \(\P(D)>0\) and \(\P(A_n\cap D)=\P(A_n\given D)\P(D)\) by (2.4.2), then expand \(\P(D)\) by the case \(n-1\). Note that every conditioning event \(A_1\cap\cdots\cap A_{j}\) has positive probability because it contains \(D\) (Theorem 2.3.3), so every factor is defined. \(\qquad\blacksquare\)

For Example 2.4.6 (an urn with five white, four black, three red chips; the sequence white, red, white, black) the factors are \(\tfrac5{12},\tfrac3{11},\tfrac4{10},\tfrac4{9}\), whose product is \(240/11880=0.0202\). Case Study 2.4.2 multiplies three conditional probabilities, \(\P(\text{life})=\tfrac13\), \(\P(\text{technical civilization}\given\text{life})=\tfrac1{100}\), \[\P(\text{flourishing now}\given\text{both})\in[10^{-8},10^{-2}]\;,\] to get a range \(3.3\times10^{-11}\) to \(3.3\times10^{-5}\) per habitable planet and, for \(3\times10^{11}\) planets, between about 10 and 10,000,000 civilizations: the chain rule is exact, and the answer is only as good as its three guessed factors.

Case Study 2.4.1 (Let's Make a Deal, the Monty Hall problem). pp. 36–37 A prize is behind one of three doors. You choose door 2; the host, who knows where the prize is, opens door 3, which is empty, and offers you the choice to switch to door 1. The book's outcomes are (prize door, door opened): \((1,3)\) with probability \(\tfrac13\) (the host is forced), \((3,1)\) with \(\tfrac13\) (forced), and \((2,1)\), \((2,3)\) with \(\tfrac16\) each (if you chose right, the host picks one of his two empty doors with equal probability). Given that he opened door 3, \[ \P(\text{prize at 2}\given\text{door 3 opened})=\frac{1/6}{1/3+1/6}=\frac13,\qquad\P(\text{prize at 1}\given\text{door 3 opened})=\frac{1/3}{1/3+1/6}=\frac23, \] so switching doubles the chance of winning. The opening of door 3 is not "removing a door at random": the host's constraint carries information.

Filling the gap 2.7: the answer depends on how the host chooses p. 36

The book's table silently assumes that a host with a choice opens either door with probability \(\tfrac12\). Let \(q\) be the probability that, when the prize is behind your door 2, the host opens door 3. Then given that he opened door 3, \[ \P(\text{prize at 2}\given\text{door 3})=\frac{q}{1+q},\qquad\P(\text{prize at 1}\given\text{door 3})=\frac1{1+q}. \] The book's case is \(q=\tfrac12\) (stay \(\tfrac13\), switch \(\tfrac23\)). Switching is never worse than \(\tfrac12\), and the strategy "always switch" wins with probability \(\tfrac23\) whatever \(q\) is.

Hint 1 of 5: the key idea

List the four situations (prize door, door opened) with their probabilities, now with an unknown \(q\) for the host's choice when you were right. Which ones survive the observation 'door 3'?

Hint 2 of 5: tools you will need
  • Definition 2.4.1 and the multiplication rule (2.4.2).
  • Law of total probability, Theorem 2.4.1.
  • The Monty Hall demo with a host who has a preference.
Hint 3 of 5: step 1

Prize at 1 forces the host to door 3; prize at 3 forbids door 3; prize at 2 gives door 3 with probability \(q\). Aim for: the joint probabilities \(\tfrac13,\ \tfrac q3,\ 0\).

Hint 4 of 5: step 2

Divide by the total \(\P(\text{door 3})\). Aim for: \(\tfrac q{1+q}\) and \(\tfrac1{1+q}\); check \(q=\tfrac12\).

Hint 5 of 5: step 3

For 'always switch', forget which door was opened and ask when switching wins. Aim for: exactly when the prize was not behind your door.

Proof

The prize is behind each door with probability \(\tfrac13\). Prize at 1: the host must open 3 (he cannot open your door or the prize door). Prize at 3: he must open 1, never 3. Prize at 2: he opens 3 with probability \(q\). So \(\P(\text{prize at 1},\text{opens 3})=\tfrac13\), \(\P(\text{prize at 2},\text{opens 3})=\tfrac q3\), \(\P(\text{prize at 3},\text{opens 3})=0\), and the total is \(\tfrac{1+q}3\); divide (Definition 2.4.1). The case \(q=0\) says the host would have opened door 1 if you had been right, so seeing door 3 proves the prize is at 1; \(q=1\) is a host who always prefers door 3, and then his action only rules out door 3 and does not favour door 1 over door 2, \(\tfrac12\) each. For "always switch": you win exactly when the prize is not behind your original door (the host never opens the prize door, so the only other closed door is the prize door), and that has probability \(\tfrac23\) before anything is opened. The conditional probability given the specific door opened can differ, but never drops below \(\tfrac12\) because \(1/(1+q)\ge\tfrac12\) for \(q\le1\). \(\qquad\blacksquare\)

The same structure is in Question 2.4.20 (the prisoner and the guard). Related demonstrations: the standard game and a host who prefers a door; a probabilistic machine learning treatment is in Section 2.3 of Volume 1.

▶ DemoMonty HallStay against switch, with the exact probabilities and a simulation; preset 3 gives the host a preference.

Total probability and Bayes. pp. 41–49 Events \(A_1,\dots,A_n\) partition \(S\) if they are mutually exclusive and their union is \(S\).

Theorem 2.4.1 (law of total probability). If \(\P(A_i)>0\) for all \(i\), for every event \(B\), \(\displaystyle\P(B)=\sum_{i=1}^n\P(B\given A_i)\P(A_i)\). The proof writes \(B=\bigcup_i(B\cap A_i)\) and adds.

Theorem 2.4.2 (Bayes). Under the same conditions and \(\P(B)>0\), for each \(j\), \[ \P(A_j\given B)=\frac{\P(B\given A_j)\P(A_j)}{\sum_{i=1}^n\P(B\given A_i)\P(A_i)}. \] The numerator is \(\P(A_j\cap B)\) (2.4.2) and the denominator is \(\P(B)\) by Theorem 2.4.1.

Three practical hints of the book: decide whether the question asks for an unconditional probability (use Theorem 2.4.1, and let \(B\) be the event whose probability is wanted) or a conditional one (Theorem 2.4.2, with \(B\) the event that has already happened); then read the problem again to find the partition \(A_i\), the information of the type "given the interview went well, the chance of an offer is 70%". Examples: 2.4.7 (urn transfer: \(\tfrac45\cdot\tfrac26+\tfrac35\cdot\tfrac46=\tfrac23\)), 2.4.8 (the second card an ace, \(\tfrac4{52}\); see Filling the gap 2.5), 2.4.9 (the interview, \(0.7\cdot0.1+0.2\cdot0.9=0.25\)), 2.4.10 (the three chips: if the colour showing is red, the one underneath is red with probability \(\tfrac{1/3}{1/2}=\tfrac23\), a con game that wins two times in three; see Section 2.8) and 2.4.11 (the biased coin and two urns, \(\P(\text{tails}\given\text{white})=\tfrac7{16}\)).

Example 2.4.12 (polygraph). p. 47 The test is 90% reliable for guilty and 98% for innocent suspects; 12 of 100 suspects are guilty. Given a "guilty" reading, the probability the suspect is innocent is \(\tfrac{0.02\cdot0.88}{0.9\cdot0.12+0.02\cdot0.88}=0.14\).

Examples 2.4.13 and 2.4.14 (screening and the burglar alarm). pp. 47–49 With prevalence \(\P(A_1)=0.0001\), sensitivity \(\P(B\given A_1)=0.9\) and false-positive rate \(\P(B\given\co{A_1})=0.001\), a positive result gives \[\P(A_1\given B)=\tfrac{0.9\cdot0.0001}{0.9\cdot0.0001+0.001\cdot0.9999}=0.0826\]: only 8% of positives are real. The burglar alarm (\(\P(B\given\text{burglary})=0.95\), false alarms 5 nights in 730, burglary on a given night \(2/10000\)) rings with \(\P(\text{burglary}\given\text{alarm})=0.027\). Tables 2.4.2 and 2.4.3 of the book show how this posterior moves with the inputs; Figure x2-2 redraws both.

Two panels. Left: the probability of the condition given a positive test, against prevalence on a log axis from 0.00001 to 0.3, for false positive rates 0.01 (red), 0.001 (orange) and 0.0001 (blue); each curve rises from near zero to one, the red curve far to the right of the blue; marked points: Example 2.4.13 at 0.08 and Question 2.4.48 at 0.25. Right: the alarm's posterior against its sensitivity from 0.5 to 1, a nearly straight rising line from 0.0145 to 0.0284 with a dashed ceiling at 0.0284 and four dots at the Table 2.4.3 sensitivities near the ceiling.
Figure x2-2 (supplementary). (a) \(\P(A_1\given B)\) against the prevalence \(\P(A_1)\) for sensitivity 0.9 and three false-positive rates; Example 2.4.13 and Question 2.4.48 are marked. A positive test is convincing only when the prevalence is large compared with the false-positive rate. (b) The posterior of Example 2.4.14 against the sensitivity of the alarm: Table 2.4.3 (dots) sits against a ceiling of 0.0284. Own figure. Code: ch02_probability.py, fig_x2_2.
▶ DemoBayes and the base rateA 90% accurate test and a 1% base rate, drawn as areas; further presets repeat the test.

Filling the gap 2.8: total probability and Bayes for infinite partitions, and the odds form pp. 41–46

(a) Theorems 2.4.1 and 2.4.2 hold for a countably infinite partition \(A_1,A_2,\dots\), with the sum an infinite series. (b) For two events \(H,H'\) with positive probability and \(\P(B)>0\), \(\displaystyle\frac{\P(H\given B)}{\P(H'\given B)}=\frac{\P(H)}{\P(H')}\cdot\frac{\P(B\given H)}{\P(B\given H')}\): posterior odds = prior odds × likelihood ratio. (c) If a second report \(B_2\) is independent of \(B_1\) given each hypothesis, odds multiply once more.

Hint 1 of 5: the key idea

Everything is the same as in the finite case once you can add infinitely many disjoint pieces. Where does that come from? For the odds form, what cancels when you divide two Bayes formulas?

Hint 2 of 5: tools you will need
  • Axiom 4 and the partition identity \(B=\bigcup(B\cap A_i)\), Filling the gap 2.2.
  • Bayes' theorem, Theorem 2.4.2.
  • Conditional independence: \(\P(B_1\cap B_2\given H)=\P(B_1\given H)\P(B_2\given H)\).
Hint 3 of 5: step 1

Prove (a) by applying Axiom 4 to the pieces \(B\cap A_i\), then rewrite each with (2.4.2). Aim for: the series for \(\P(B)\).

Hint 4 of 5: step 2

For (b), write \(\P(H\given B)\) and \(\P(H'\given B)\) by Bayes and divide. Aim for: prior odds times a ratio of likelihoods.

Hint 5 of 5: step 3

Use (c) on Example 2.4.13: multiply the odds by the likelihood ratio 900 twice and convert odds back to a probability.

Proof and a use

(a) By Filling the gap 2.2(iii), \(B=\bigcup_i(B\cap A_i)\) with mutually exclusive pieces, so Axiom 4 gives \[\P(B)=\sum_i\P(B\cap A_i)=\sum_i\P(B\given A_i)\P(A_i)\;;\] events with \(\P(A_i)=0\) can be left out since they add nothing. Bayes' theorem follows by dividing, as in the finite case. (b) Divide \(\P(H\given B)=\P(B\given H)\P(H)/\P(B)\) by the same for \(H'\); \(\P(B)\) cancels. (c) Apply (b) twice, with \[\P(B_1\cap B_2\given H)=\P(B_1\given H)\P(B_2\given H)\] by assumption.

Use. Example 2.4.13: prior odds \(0.0001/0.9999\), likelihood ratio \(0.9/0.001=900\), so posterior odds \(0.09001\) and probability \(0.09001/1.09001=0.0826\). A second positive result from an independent repetition of the test (assuming conditional independence given the true state) multiplies the odds by 900 again: odds \(81.0\), probability \(0.988\). Repeating a cheap test with a small false-positive rate is how screening programs confirm positives. \(\qquad\blacksquare\)

Filling the gap 2.9: a ceiling on what a better test can do p. 49 (Table 2.4.3)

Table 2.4.3 shows the burglar alarm's posterior unchanged at 0.028 as its sensitivity \(s=\P(B\given A_1)\) rises from 0.95 to 0.999. In general, with prevalence \(\pi=\P(A_1)\) and false-positive rate \(f=\P(B\given\co{A_1})\), the posterior \(g(s)=\dfrac{\pi s}{\pi s+(1-\pi)f}\) is increasing in \(s\) and satisfies \[ s\,g(1)\ \le\ g(s)\ \le\ g(1)=\frac{\pi}{\pi+(1-\pi)f}. \] So no improvement in sensitivity can raise the posterior by more than the factor \(1/s\); the levers are \(\pi\) and \(f\).

Hint 1 of 5: the key idea

Write the posterior as a function of the sensitivity \(s\) alone. What happens to numerator and denominator when \(s\) is replaced by its largest possible value 1?

Hint 2 of 5: tools you will need
Hint 3 of 5: step 1

Show that \(g(s)=\pi s/(\pi s+(1-\pi)f)\) is increasing in \(s\). Aim for: \(g(s)\le g(1)\).

Hint 4 of 5: step 2

Compare denominators for \(s\) and for 1. Aim for: \(g(s)\ge s\,g(1)\).

Hint 5 of 5: step 3

Insert \(\pi=2/10000\), \(f=5/730\), \(s=0.95\) and compare with Table 2.4.3.

Proof

Increasing: \(g(s)=\big(1+\tfrac{(1-\pi)f}{\pi s}\big)^{-1}\) increases with \(s\). So \(g(s)\le g(1)\). For the lower bound, \(\pi s+(1-\pi)f\le\pi+(1-\pi)f\) because \(s\le1\), hence \[g(s)=\dfrac{\pi s}{\pi s+(1-\pi)f}\ge\dfrac{\pi s}{\pi+(1-\pi)f}=s\,g(1)\;.\] \(\qquad\blacksquare\)

For the alarm \(\pi=2/10000\) and \(f=5/730\), so \(g(1)=0.02838\) and the posterior is at least \(0.95\cdot0.02838=0.0270\) already at \(s=0.95\): Table 2.4.3's \(0.027,0.028,0.028,0.028\). Lowering the false-alarm rate does what better sensitivity cannot: \(f=5/7300\) would give \(g(0.95)=0.22\). In screening terms, \(\pi\) is fixed by the population and \(f\) is what technology can lower. Figure x2-2(b) draws this. Question 2.4.48 applies it.

2.5 Independence

pp. 50–65 Sometimes \(\P(A\given B)=\P(A)\) whatever \(B\) is: learning \(B\) does not change the probability of \(A\).

Definition 2.5.1. Events \(A,B\) are independent if \(\P(A\cap B)=\P(A)\,\P(B)\). (This agrees with \(\P(A\given B)=\P(A)\) when \(\P(B)>0\), and has the advantage of also covering \(\P(B)=0\).)

Examples 2.5.1 to 2.5.4 A king and a diamond are independent in a deck (\(\tfrac1{52}=\tfrac14\cdot\tfrac1{13}\)). If \(A,B\) are independent so are \(\co A,\co B\) (Example 2.5.2, proved through \(\P(\co A\cup\co B)\) and De Morgan; the general statement is Filling the gap 2.10). A staffing table is made to give independence of "female" and "black" by adding \(x=24\) black women (Example 2.5.3: \(\tfrac x{120+x}=\tfrac{40+x}{120+x}\cdot\tfrac{30+x}{120+x}\)). Mutually exclusive events with positive probability are never independent (Example 2.5.4): \(\P(A\cap B)=0<\P(A)\P(B)\). Independence is usually deduced from the physical set-up: two proofreaders working alone (Myra finds 50% of errors, Carlos 80%, an error is missed by both with probability \(0.5\cdot0.2=0.10\), Example 2.5.5), or the two alleles passed on by random Mendelian mating (Example 2.5.6: if a parent passes on \(w\) with probability \(r+q/2\), an offspring is \(ww\) with probability \((r+q/2)^2\)).

Filling the gap 2.10: replacing events by their complements keeps independence pp. 51–52

If \(A_1,\dots,A_n\) are independent (Definition 2.5.2 below), then so are the events obtained by replacing any of them by its complement. In particular \(A\) and \(\co B\), and \(\co A\) and \(B\), are independent when \(A\) and \(B\) are, which the book asserts after Example 2.5.3 but proves only for \(\co A,\co B\).

Hint 1 of 5: the key idea

Replace one event at a time by its complement. If \(E\) is the intersection of the others in the chosen index set, how do \(A_1\cap E\) and \(\co{A_1}\cap E\) relate to \(E\)?

Hint 2 of 5: tools you will need
  • Definition 2.5.2 (independence of several events).
  • Additivity: \(\P(\co{A}\cap E)=\P(E)-\P(A\cap E)\).
  • De Morgan laws, Filling the gap 2.2.
Hint 3 of 5: step 1

Fix an index set \(I\) containing 1 and set \(E=\bigcap_{i\in I\setminus\{1\}}A_i\). Aim for: \(\P(\co{A_1}\cap E)=\P(E)-\P(A_1\cap E)\).

Hint 4 of 5: step 2

Factor both terms by independence of the original events, then collect the common product. Aim for: \(\P(\co{A_1})\prod\P(A_i)\).

Hint 5 of 5: step 3

Repeat for each event you want to complement, and note that index sets without event 1 are unaffected.

Proof

It is enough to replace one event, say \(A_1\), by \(\co{A_1}\); repeat to replace several. Let \(I\) be any set of indices. If \(1\notin I\) nothing changed. If \(1\in I\), write \(I'=I\setminus\{1\}\) and \(E=\bigcap_{i\in I'}A_i\) (\(E=S\) if \(I'=\emptyset\)). The events \(A_1\cap E\) and \(\co{A_1}\cap E\) partition \(E\), so \[\P(\co{A_1}\cap E)=\P(E)-\P(A_1\cap E)=\prod_{i\in I'}\P(A_i)-\P(A_1)\prod_{i\in I'}\P(A_i)=\P(\co{A_1})\prod_{i\in I'}\P(A_i)\;.\] Thus every intersection of the new family factors into the product of the probabilities. \(\qquad\blacksquare\)

The corollary used throughout repeated-trials problems is that for independent events, the probability that none of them occurs is \(\prod_i(1-\P(A_i))\) (Examples 2.5.5 and 2.5.10).

Example 2.5.7 (the crooked gambler: independence can fail where one expects it). p. 54 Of nine dice three are fair and six are loaded so that a six has probability \(\tfrac12\). A die is picked at random and rolled twice, \(A\): six on roll 1, \(B\): six on roll 2. Then \(\P(A\cap B)=\tfrac1{36}\cdot\tfrac13+\tfrac14\cdot\tfrac23=\tfrac{19}{108}\) but \(\P(A)\P(B)=(\tfrac7{18})^2=\tfrac{49}{324}\): not independent. Filling the gap 2.11 explains why in general.

Filling the gap 2.11: conditionally independent is not independent p. 54

Suppose a "type" \(T\) (here, which die) is chosen at random and, given the type, the events \(A,B\) are independent with the same probability \(p(T)\). Then \(\P(A)=\P(B)=\overline p\), \(\P(A\cap B)=\overline{p^2}\) (bars denote the average over the type, weighted by \(\P(T)\)) and \[ \P(A\cap B)-\P(A)\P(B)=\overline{p^2}-\overline p^{\,2}=\mathrm{Var}(p)\ \ge0, \] with equality only if \(p(T)\) is constant. So not knowing the type makes the events positively dependent.

Hint 1 of 5: the key idea

Condition on the type, then average. What is the average of the product \(p(T)^2\) compared with the square of the average of \(p(T)\)?

Hint 2 of 5: tools you will need
  • Law of total probability, Theorem 2.4.1.
  • Conditional independence given \(T\).
  • Non-negativity of a sum of squares around the mean.
Hint 3 of 5: step 1

Compute \(\P(A\cap B)\) and \(\P(A)\) by splitting over the die used. Aim for: \(\overline{p^2}\) and \(\overline p\).

Hint 4 of 5: step 2

Write \(\overline{p^2}-\overline p^2\) as \(\sum_t(p(t)-\overline p)^2\P(T=t)\). When is it zero?

Hint 5 of 5: step 3

Insert \(p\in\{\tfrac16,\tfrac12\}\) with probabilities \(\tfrac13,\tfrac23\) and compare with \(\tfrac{19}{108}-\tfrac{49}{324}\).

Proof and the numbers

By the law of total probability over the partition \(\{T=t\}\) (Theorem 2.4.1) and conditional independence, \[\P(A\cap B)=\sum_t\P(A\cap B\given T=t)\P(T=t)=\sum_tp(t)^2\P(T=t)=\overline{p^2}\;;\] similarly \(\P(A)=\overline p\). The difference \[\overline{p^2}-\overline p^2=\sum_t(p(t)-\overline p)^2\P(T=t)\ge0\;,\] a sum of non-negative terms, zero iff each \(p(t)=\overline p\). For the gambler, \(p=\tfrac16\) with probability \(\tfrac13\) and \(p=\tfrac12\) with probability \(\tfrac23\): \(\overline p=\tfrac7{18}\), \(\overline{p^2}=\tfrac{19}{108}\) and the variance is \(\tfrac{19}{108}-\tfrac{49}{324}=\tfrac2{81}=0.0247\). Hence \(\P(B\given A)=\tfrac{19/108}{7/18}=\tfrac{19}{42}=0.452\) against \(\P(B)=0.389\): a six on the first roll is evidence that the die is loaded. This is the shape of statistical inference: a parameter that is unknown makes independent observations dependent until it is learned. \(\qquad\blacksquare\)

Several events. pp. 55–57 For three events neither \(\P(A\cap B\cap C)=\P(A)\P(B)\P(C)\) (2.5.3) nor the three pairwise product rules (2.5.4) is enough alone (Questions 2.5.11 and 2.5.12 give examples), so:

Definition 2.5.2. \(A_1,\dots,A_n\) are independent if for every subset of indices \(i_1,\dots,i_k\), \[\P(A_{i_1}\cap\cdots\cap A_{i_k})=\P(A_{i_1})\cdots\P(A_{i_k})\;.\]

Filling the gap 2.12: pairwise independence is weaker than mutual independence pp. 55 and 64 (Questions 2.5.11 to 2.5.15)

Definition 2.5.2 asks for \(2^n-n-1\) equations (one for every subset of two or more events), which for \(n=4\) is 11 (Question 2.5.13). Pairwise independence (only the \(\binom n2\) equations for pairs) does not imply independence. Example: roll a red and a green die and let \(A\): red is odd, \(B\): green is odd, \(C\): the sum is odd (Question 2.5.15). Then every pair is independent, but the three are not.

Hint 1 of 5: the key idea

Count the equations in Definition 2.5.2 by counting subsets. For the counterexample, notice that the third event is a function of the other two.

Hint 2 of 5: tools you will need
Hint 3 of 5: step 1

Which subsets of \(\{1,\dots,n\}\) give no condition? Aim for: \(2^n-n-1\).

Hint 4 of 5: step 2

Compute \(\P(A\cap B)\), \(\P(A\cap C)\), \(\P(B\cap C)\) for 'red odd', 'green odd', 'sum odd' by counting outcomes. Aim for: all equal to \(\tfrac14\).

Hint 5 of 5: step 3

Check \(A\cap B\cap C\): what is the parity of a sum of two odd numbers?

Proof

Counting. There are \(2^n\) subsets of \(\{1,\dots,n\}\); the empty set and the \(n\) singletons give no condition, leaving \(2^n-n-1\). The example. Each of \(A,B,C\) has probability \(\tfrac12\). \(A\cap B\) has \(3\cdot3=9\) of the 36 outcomes, probability \(\tfrac14=\tfrac12\cdot\tfrac12\). \(A\cap C\): red odd and sum odd means green even, again \(9\) outcomes, \(\tfrac14\); likewise \(B\cap C\), \(\tfrac14\). So the three pairs satisfy the product rule. But a sum of two odd numbers is even, so \(A\cap B\cap C=\emptyset\) and \(\P(A\cap B\cap C)=0\ne\tfrac18\). The reason: \(C\) occurs exactly when one, not both, of \(A,B\) occurs, so \(C\) is determined by the other two, although it is independent of either alone. The converse failure. In Question 2.5.11 the triple product rule \(\P(A\cap B\cap C)=\tfrac13\cdot\tfrac12\cdot\tfrac16=\tfrac1{36}\) holds while \(\P(B\cap C)=\tfrac2{36}\ne\tfrac12\cdot\tfrac16=\tfrac3{36}\). \(\qquad\blacksquare\)

This is the same as Bernstein's example with two coins (first coin heads, second coin heads, the two coins agree); see the pairwise independence demo and the graduate Filling the gap 1.8.

▶ DemoPairwise against mutual independenceTwo coins: three events that are pairwise but not mutually independent.

Examples with several events. Examples 2.5.8 to 2.5.10 Three insured persons survive with probabilities \(0.7,0.9,0.3\); the probability that exactly one dies is \[0.7\cdot0.9\cdot0.7+0.7\cdot0.1\cdot0.3+0.3\cdot0.9\cdot0.3=0.543\;.\] A six-person approval circuit with \(\P(\text{yes})=0.5,0.7,0.7,0.7,0.5,0.5\) passes a budget with probability \[0.5\{0.637+0.5-0.637\cdot0.5\}0.5=0.205\] (series is an intersection, parallel a union; \(1-(1-0.7)(1-0.7)=0.91\)). A string of 24 bulbs each working with probability \(0.999\) fails with probability \(1-0.999^{24}=0.0237\).

Repeated independent trials. Examples 2.5.11 to 2.5.15 Pete Rose's streak: a .300 hitter with four at bats per game gets a hit in a game with probability \(1-0.7^4=0.76\) and in 44 games with probability \(0.76^{44}=5.7\times10^{-6}\); the book cautions that the model (the same probability every at bat) is only a rough approximation. In craps the shooter wins on 7 or 11 (probability \(\tfrac8{36}\)) or by making a point; Filling the gap 2.13 gives the point probabilities of Table 2.5.3 and the total 0.493. In the relay problem (Example 2.5.13), a signal reversed with probability \(\tfrac14\) at each of three stations is received as a + with probability \(\tfrac{36}{64}\) if a + was sent (all right, or two errors) and \(\tfrac{28}{64}\) if a − was sent (one or three errors), and with 60% pluses sent, \[\P(+\text{ sent}\given+\text{ received})=\tfrac{0.6\cdot36/64}{0.6\cdot36/64+0.4\cdot28/64}=0.66\;.\] In the three-cornered duel (Example 2.5.14) Andy (hits 30%), Charley (50%) and Bob (100%) fire in the order A, B, C; if Andy shoots Bob and hits, Andy then survives the duel with Charley with probability \(\tfrac{0.5\cdot0.3}{1-0.5\cdot0.7}=\tfrac3{13}\) against the \(\tfrac3{10}\) he gets by deliberately missing (Bob then shoots Charley, and Andy fires first): the surprising optimum is to miss.

Filling the gap 2.13: infinite sums of products by first-step analysis pp. 58–62 (Table 2.5.3)

In craps, let \(a=\P(\text{sum}=x)\) for the point \(x\) and \(s=\P(\text{sum}=7)=\tfrac16\). Once the point is set, the shooter wins before a 7 with probability \(a/(a+s)\), so \[\P(\text{point is }x\text{ and it is made})=a^2/(a+s)\;.\] For \(x=4,5,6,8,9,10\) this gives \(\tfrac1{36},\tfrac{16}{360},\tfrac{25}{396},\tfrac{25}{396},\tfrac{16}{360},\tfrac1{36}\) (Table 2.5.3) and the total probability of winning is \(\tfrac{244}{495}=0.4929\).

Hint 1 of 5: the key idea

After the point is set, the game is a repeated trial with three outcomes. Condition on the very next roll and write the winning probability in terms of itself.

Hint 2 of 5: tools you will need
Hint 3 of 5: step 1

Let \(a=\P(\text{point})\), \(s=\tfrac16\), and \(w\) the probability of winning after the point is set. Condition on the next roll. Aim for: \(w=a+(1-a-s)w\).

Hint 4 of 5: step 2

Solve for \(w\) and multiply by the chance \(a\) that the first roll sets the point \(x\). Aim for: \(a^2/(a+s)\).

Hint 5 of 5: step 3

Evaluate at \(a=\tfrac3{36},\tfrac4{36},\tfrac5{36}\), double for the symmetric points, and add \(\tfrac8{36}\).

Proof and the total

After the point is established, each further roll is, independently, the point (probability \(a\), win), a 7 (probability \(s\), loss) or something else (probability \(1-a-s\), roll again). Let \(w\) be the probability of eventually winning. Conditioning on the next roll (Theorem 2.4.1): \(w=a+(1-a-s)w\), so \(w=a/(a+s)\), since \(1-(1-a-s)=a+s>0\). (Equivalently the book's series \(a\sum_{k\ge0}(1-a-s)^ka=a^2/(a+s)\), and the game ends with probability 1 because \((1-a-s)^k\to0\).) With the numbers of ways to roll each sum, \(3,4,5\) for sums \(4,5,6\) (and symmetrically \(5,4,3\) for \(8,9,10\)): point 10 (or 4): \(a=\tfrac3{36}\), \(a^2/(a+s)=\tfrac{9/1296}{9/36}=\tfrac1{36}\); point 5 (or 9): \(\tfrac{(4/36)^2}{10/36}=\tfrac{16}{360}\); point 6 (or 8): \(\tfrac{(5/36)^2}{11/36}=\tfrac{25}{396}\). Adding \(\tfrac{8}{36}=\tfrac{110}{495}\) (win on 7 or 11) to \(2(\tfrac1{36}+\tfrac{16}{360}+\tfrac{25}{396})=\tfrac{134}{495}\) gives \(\tfrac{244}{495}\). The house edge is \(1-2\cdot\tfrac{244}{495}=\tfrac{7}{495}=1.4\%\). \(\qquad\blacksquare\)

The same first-step argument settles Question 2.5.20 and the duel above: write the answer in terms of itself and solve.

Example 2.5.15 (Caesar's last breath). pp. 62–63 Take \(10^{44}\) molecules in the atmosphere, \(2\times10^{22}\) of which were in Caesar's last breath, spread uniformly by now; your next breath is \(2\times10^{22}\) molecules drawn without replacement. The probability that none comes from Caesar's breath is \(\prod_{i=0}^{k-1}\tfrac{N-k-i}{N-i}\) with \(N=10^{44}\), \(k=2\times10^{22}\); the book replaces each factor by \(1-k/N\) and \(1-x\) by \(e^{-x}\) to get \(\P(\text{at least one})\approx1-e^{-4}=0.98\). The approximation is justified next.

Filling the gap 2.14: Caesar's breath, rigorously pp. 62–63

With \(N\) molecules and \(k\) marked, a sample of size \(k\) misses all marked ones with probability \(Q=\prod_{i=0}^{k-1}\big(1-\tfrac k{N-i}\big)\), and \[ \Big(1-\frac k{N-k+1}\Big)^k\ \le\ Q\ \le\ \Big(1-\frac kN\Big)^k\ \le\ e^{-k^2/N}. \] For \(N=10^{44}\), \(k=2\times10^{22}\) the two ends agree with \(e^{-4}\) to about 21 digits, so \(\P(\text{at least one})=1-e^{-4}=0.98168\).

Hint 1 of 5: the key idea

Each factor of the product is squeezed between its largest and smallest possible values. Then use an elementary inequality for \(\log(1-x)\) to turn the bounds into exponentials.

Hint 2 of 5: tools you will need
  • The product \(\prod_{i<k}(1-k/(N-i))\) of the proof.
  • \(1-x\le e^{-x}\) and \(\log(1-y)\ge-y/(1-y)\).
  • Independence is not needed: only counting without replacement.
Hint 3 of 5: step 1

For \(0\le i<k\), bound \(N-i\) between \(N-k+1\) and \(N\). Aim for: \((1-\tfrac k{N-k+1})^k\le Q\le(1-\tfrac kN)^k\).

Hint 4 of 5: step 2

Use \(1-x\le e^{-x}\) for the upper bound. Aim for: \(Q\le e^{-k^2/N}=e^{-4}\).

Hint 5 of 5: step 3

For the lower bound set \(y=k/(N-k+1)\) and compute \(ky/(1-y)\). Aim for: \(4(1+4\times10^{-22})\).

Proof

For \(0\le i\le k-1\), \(N-k+1\le N-i\le N\), so each factor lies between \(1-\tfrac k{N-k+1}\) (the smallest) and \(1-\tfrac kN\) (the largest); multiply the \(k\) factors. The inequality \(1-x\le e^{-x}\) (the tangent line at 0 of the convex function \(e^{-x}\)) gives \((1-k/N)^k\le e^{-k^2/N}=e^{-4}\). For the lower end put \(y=k/(N-k+1)\) and use \(\log(1-y)\ge-y/(1-y)\) for \(0\le y<1\) (integrate \(1/(1-t)\) over \([0,y]\) and compare with \(1/(1-y)\)): \(Q\ge\exp\{-ky/(1-y)\}\) where \[ky/(1-y)=k^2/(N-2k+1)=4(1+4\times10^{-22}+\cdots)\;.\] Hence \(e^{-4(1+10^{-21})}\le Q\le e^{-4}\). \(\qquad\blacksquare\)

So the book's "\(\approx\)" is far more accurate than it looks; what is idealised is the model, not the arithmetic: the numbers \(10^{44}\) and \(2\times10^{22}\) are orders of magnitude, and perfect mixing is assumed. As the book remarks, the answer is surprising because the breath has \(2\times10^{22}\) chances at \(2\times10^{22}\) targets.

2.6 Combinatorics

pp. 65–89 Counting is the engine of the classical definition. Four tools do almost all the work.

The multiplication rule. If operation A can be done in \(m\) ways and operation B in \(n\) ways, the sequence (A, B) can be done in \(mn\) ways; Corollary 2.6.1 for \(k\) operations with \(n_1,\dots,n_k\) options, \(n_1\cdots n_k\) ways. The proof is the tree of the book's Figure 2.6.1: each of the \(m\) first branches has \(n\) continuations. Examples: a briefcase lock with two dials of sixteen notches and two directions has \(2\cdot16\cdot2\cdot16=1024\) settings (Example 2.6.1: more dials with fewer notches each give far more settings, \(2\cdot10\cdot2\cdot10\cdot2\cdot10\cdot2\cdot10=160{,}000\) for four dials of ten); \(3^{11}=177{,}147\) Bertillon configurations, so a city of 177,148 adults must contain two people with the same one (Example 2.6.2, an application of the pigeonhole principle); \(2^6-1=63\) Braille characters (Example 2.6.3); \(2^{32}2^{16}\cdots2^1=2^{63}\) ways a 64-team knockout tournament can play out (Example 2.6.4). In Example 2.6.5 (nine-digit zip codes) the number with at least one 7 among the first five digits is \(10^9-9^5\cdot10^4\), the number with at least one 7 in the last four is \(10^9-10^5\cdot9^4\), the number with both is \((10^5-9^5)(10^4-9^4)\), and inclusion–exclusion gives \(N(A\cup B)=10^9-9^9=612{,}579{,}511\), as a check.

The book's three problem-solving hints: draw the structure; test a formula on a small analogue you can list; and if the outcomes fall into structurally different categories, add the counts of the categories.

Theorem 2.6.1 (permutations of distinct objects). The number of ordered arrangements of length \(k\) from \(n\) distinct objects, without repetition, is \[(n)_k=n(n-1)\cdots(n-k+1)=\dfrac{n!}{(n-k)!}\;;\] Corollary 2.6.2 \(n!\) orderings of all \(n\). Position \(j\) can be filled in \(n-j+1\) ways whatever came before, then multiply. Examples: \(8\cdot7\cdot6\cdot5=1680\) four-verse cards from eight "ways" (2.6.7); \(16!\) arrangements of a sliding puzzle (2.6.8; not all are reachable, as the book notes); \(49\cdot4!\cdot48!=24\cdot49!\approx1.46\times10^{64}\) shuffles of 52 cards with the four aces adjacent (2.6.9: treat the aces as a block that can sit in 49 places); \(8!\,8!\) arrangements of eight distinct non-attacking rooks (2.6.10); \(n!(m!)^n\) photographs of \(n\) families of \(m\) kept together, \(5!(4!)^5=955{,}514{,}880\) (2.6.11); and, by symmetry, a fraction \(4/24\) of the orderings of nine digits put 1 and 2 before 3 and 4, \(\tfrac{4}{24}9!=60{,}480\) (2.6.12).

Stirling's formula (comment after Example 2.6.9): \(n!\approx\sqrt{2\pi}\,n^{n+1/2}e^{-n}\), used with logarithms for large \(n\). The book quotes it without proof.

Filling the gap 2.15: Stirling's formula, with error bounds p. 74 and Question 2.6.19

Let \(a_n=n!\,e^n/n^{n+1/2}\). Then \(a_n\) decreases to \(\sqrt{2\pi}\), and \(\sqrt{2\pi}<a_n<\sqrt{2\pi}\,e^{1/(12n)}\). So \(n!\) exceeds the approximation by a relative error of at most \(\tfrac1{12n}\): \(0.28\%\) at \(n=30\) (the book's Question 2.6.19: \(2.645\times10^{32}\) against the exact \(2.6525\times10^{32}\)).

Hint 1 of 6: the key idea

Study the ratio \(a_n/a_{n+1}\) of consecutive terms of \(n!/(n^{n+1/2}e^{-n})\); a series for \(\log\frac{1+x}{1-x}\) shows it decreases and is trapped. The limit is then identified from Wallis' integrals.

Hint 2 of 6: tools you will need
  • The series \(\log\frac{1+x}{1-x}=2(x+x^3/3+x^5/5+\cdots)\) and a geometric-series bound.
  • Integration by parts for \(W_m=\int_0^{\pi/2}\sin^m\theta\,d\theta\).
  • The central binomial coefficient \(\binom{2n}n\).
Hint 3 of 6: step 1

With \(x=1/(2n+1)\) write \(\log(a_n/a_{n+1})\) as a series. Aim for: it is positive and below \(\tfrac1{12n}-\tfrac1{12(n+1)}\).

Hint 4 of 6: step 2

Deduce that \(a_n\) decreases, \(a_ne^{-1/(12n)}\) increases and both have the same limit \(c\). Aim for: \(c<a_n<ce^{1/(12n)}\).

Hint 5 of 6: step 3

Show \(W_{2n}/W_{2n+1}\to1\) and read off \(\binom{2n}n\sqrt n/4^n\to1/\sqrt\pi\). Aim for: the Wallis limit.

Hint 6 of 6: step 4

Express \(a_n^2/a_{2n}\) through \(\binom{2n}n\) and let \(n\to\infty\). Aim for: \(c=\sqrt{2\pi}\).

Proof

Monotone limit. \(\log\dfrac{a_n}{a_{n+1}}=\big(n+\tfrac12\big)\log\dfrac{n+1}n-1\). With \(x=\tfrac1{2n+1}\), \(\tfrac{n+1}n=\tfrac{1+x}{1-x}\) and \(n+\tfrac12=\tfrac1{2x}\), and \(\log\tfrac{1+x}{1-x}=2\big(x+\tfrac{x^3}3+\tfrac{x^5}5+\cdots\big)\), so \(\log\tfrac{a_n}{a_{n+1}}=\tfrac{x^2}3+\tfrac{x^4}5+\cdots\). It is positive, so \(a_n\) decreases; and it is less than \[\tfrac13(x^2+x^4+\cdots)=\tfrac{x^2}{3(1-x^2)}=\tfrac1{12n(n+1)}=\tfrac1{12n}-\tfrac1{12(n+1)}\;.\] Hence \(b_n=a_ne^{-1/(12n)}\) increases. Since \(a_n\) decreases and \(a_n>b_n\ge b_1\), the limit \(c=\lim a_n\) exists and is positive, and \(b_n<c<a_n<c\,e^{1/(12n)}\).

The constant (Wallis). Let \(W_m=\int_0^{\pi/2}\sin^m\theta\,\d\theta\). Integration by parts gives \(W_m=\tfrac{m-1}mW_{m-2}\), so \(W_{2n}=\tfrac\pi2\binom{2n}n4^{-n}\) and \(W_{2n+1}=\dfrac{4^n}{(2n+1)\binom{2n}n}\). Because \(0\le\sin\theta\le1\), \(W_m\) decreases in \(m\), and \(W_{2n+1}\le W_{2n}\le W_{2n-1}=\tfrac{2n+1}{2n}W_{2n+1}\), so \(W_{2n}/W_{2n+1}\to1\). That says \(\tfrac\pi2\binom{2n}n^2\tfrac{2n+1}{16^n}\to1\), i.e. \(\binom{2n}n\sqrt n\,4^{-n}\to\tfrac1{\sqrt\pi}\). On the other hand, writing \(\binom{2n}n=(2n)!/(n!)^2\) in terms of \(a_n,a_{2n}\) gives \(\dfrac{a_n^2}{a_{2n}}=\dfrac{\sqrt2\,4^n}{\sqrt n\binom{2n}n}\to\sqrt2\sqrt\pi\). But \(a_n^2/a_{2n}\to c^2/c=c\), so \(c=\sqrt{2\pi}\). \(\qquad\blacksquare\)

Numerically \(a_{30}/\sqrt{2\pi}=1.00278\) against the bound \(e^{1/360}=1.00278\); the bound is sharp to three digits. The book's example \(24\cdot49!=1.46\times10^{64}\) agrees with the logarithm worked there (\(\log_{10}49!\approx62.783\)).

Theorem 2.6.2 (permutations of non-distinct objects). The number of arrangements of \(n\) objects of which \(n_1\) are of one kind, \(n_2\) of a second, ..., \(n_r\) of an \(r\)th kind (\(\sum n_i=n\)) is \(\dfrac{n!}{n_1!\,n_2!\cdots n_r!}\), a multinomial coefficient. The book's proof calls the rearrangements of the "similar" objects "(Why?)"; Filling the gap 2.16 answers it. Examples: the letters of a word (Examples 2.6.13, 2.6.14: Huygens' anagram of 62 letters has about \(3.6\times10^{60}\) arrangements); the coefficient of \(x^{23}\) in \((1+x^5+x^9)^{100}\), which arises only from two \(x^9\), one \(x^5\) and ninety-seven \(1\)s (since \(5a+9b=23\) with \(a,b\ge0\) forces \((a,b)=(1,2)\)), \(\tfrac{100!}{2!1!97!}=485{,}100\) (Example 2.6.15; this uses the multinomial theorem proved in Filling the gap 2.16); palindromes made of four A's, six B's, two C's: arrange the first half, \(\tfrac{6!}{2!3!1!}=60\) (2.6.16); delivery routes made of nine easts and two norths then five easts and three norths, \(\tfrac{11!}{9!2!}\cdot\tfrac{8!}{5!3!}=55\cdot56=3080\) (2.6.17); and Stacy's passwords (Example 2.6.18): four letters of either case, four digits and two symbols out of eight in any positions, \(10^4\,8^2\,26^4\,2^4\tfrac{10!}{4!4!2!}=1.474\times10^{16}\), against an attacker who tries \(7.776\times10^{15}\) per month, so one month's success probability is \(0.5275\) and six months' is \(1-0.4725^6=0.989\).

Theorem 2.6.3 (circular permutations). \(n\) distinct objects can be arranged around a circle in \((n-1)!\) ways: fix one object at the top and permute the other \(n-1\). Example 2.6.19: \(5!=120\) firing orders for six cylinders. The comment on Josephus is a history aside.

Filling the gap 2.16: the binomial and multinomial theorems, the "Why?" of Theorem 2.6.2, and compositions pp. 77–88

(i) \(\dfrac{n!}{n_1!\cdots n_r!}\) equals \(\dbinom n{n_1}\dbinom{n-n_1}{n_2}\cdots\dbinom{n_r}{n_r}\). (ii) Binomial theorem (quoted from algebra by the book): \((x+y)^n=\sum_{k=0}^n\binom nkx^ky^{n-k}\). (iii) Multinomial theorem: \[(x_1+\cdots+x_r)^n=\sum\frac{n!}{n_1!\cdots n_r!}x_1^{n_1}\cdots x_r^{n_r}\;,\] summed over all \((n_1,\dots,n_r)\) with \(\sum n_i=n\). (iv) The number of solutions of \(x_1+\cdots+x_r=n\) in positive integers is \(\binom{n-1}{r-1}\) (Question 2.6.56).

Hint 1 of 6: the key idea

Expand the product of \(n\) factors and ask what a term records: one chosen letter from each factor. How many choices give the same monomial?

Hint 2 of 6: tools you will need
  • Counting arrangements with repeated objects, Theorem 2.6.2.
  • Combinations, Theorem 2.6.4.
  • Comparing coefficients of two equal polynomials.
Hint 3 of 6: step 1

Choose the positions of kind 1, then kind 2 among the rest, and so on. Aim for: a product of binomial coefficients that telescopes to the multinomial coefficient.

Hint 4 of 6: step 2

For the multinomial theorem identify a term with a sequence of variables of length \(n\). Aim for: coefficient \(=n!/\prod n_i!\); binomial theorem as \(r=2\).

Hint 5 of 6: step 3

Get \(2^n\) from \(x=y=1\), and Vandermonde from \((1+t)^d(1+t)^e=(1+t)^{d+e}\).

Hint 6 of 6: step 4

For compositions, place \(r-1\) bars into the \(n-1\) gaps between \(n\) ones.

Proof

(i) and the book's "(Why?)". An arrangement of the \(n\) objects with identical copies is determined by which positions hold each kind: choose the \(n_1\) positions of kind 1 in \(\binom n{n_1}\) ways, then the \(n_2\) positions of kind 2 among the remaining \(n-n_1\), and so on. Algebraically \(\tfrac{n!}{n_1!(n-n_1)!}\cdot\tfrac{(n-n_1)!}{n_2!(n-n_1-n_2)!}\cdots\) telescopes to the multinomial coefficient. This also explains Theorem 2.6.2's argument: if the copies were labelled, each unlabelled arrangement would split into exactly \(n_1!\cdots n_r!\) labelled ones (permute the labels within each kind), whichever arrangement it is, so \(N\cdot n_1!\cdots n_r!=n!\).

(iii) Expanding the product of \(n\) factors \((x_1+\cdots+x_r)\), each term chooses one variable from each factor, i.e. a sequence of length \(n\) over the alphabet \(\{x_1,\dots,x_r\}\); the term is \(x_1^{n_1}\cdots x_r^{n_r}\) exactly when variable \(i\) was chosen in \(n_i\) factors, and the number of such sequences is the number of arrangements of \(n_1\) copies of \(x_1\), ..., which is the multinomial coefficient by Theorem 2.6.2. (ii) is the case \(r=2\): the number of ways to choose which \(k\) of the \(n\) factors contribute \(x\) is \(\binom nk\) (Theorem 2.6.4). Consequences: \(x=y=1\) gives \(\sum_k\binom nk=2^n\); \(x=-1,y=1\) gives \(\sum_{k=0}^{n}(-1)^k\binom nk=0\); comparing the coefficients of \(t^m\) in \((1+t)^d(1+t)^e=(1+t)^{d+e}\) gives Vandermonde's identity \(\sum_j\binom dj\binom e{m-j}=\binom{d+e}m\) (used in Filling the gap 2.20).

(iv) Write \(n\) as a row of \(n\) ones and put a bar in \(r-1\) of the \(n-1\) gaps between neighbours; the \(r\) blocks have sizes \(x_1,\dots,x_r\geq1\) summing to \(n\), and every solution arises from exactly one choice of gaps. For \(n=20\), \(r=3\): \(\binom{19}2=171\). \(\qquad\blacksquare\)

Theorem 2.6.4 (combinations). The number of subsets of size \(k\) of an \(n\)-set is \(\binom nk=\dfrac{n!}{k!(n-k)!}\). Proof: each subset can be ordered in \(k!\) ways and the ordered samples number \((n)_k\), so \(k!\binom nk=(n)_k\). Examples: eight politicians shake hands \(\binom82=28\) times (2.6.20); a chemist builds a polymer of ten E, six M and five P radicals with no two M adjacent: place the E's and P's in \(\tfrac{15!}{10!5!}\) ways, giving 16 gaps, choose six for the M's, \(\binom{16}6\tfrac{15!}{10!5!}=8008\cdot3003=24{,}048{,}024\) (2.6.21).

Example 2.6.22 (Pascal's triangle). The identity \(\binom{n+1}k=\binom nk+\binom n{k-1}\) (2.6.1): split the \(k\)-subsets of \(\{A_1,\dots,A_{n+1}\}\) into those that contain \(A_1\) (choose \(k-1\) more of the other \(n\), \(\binom n{k-1}\)) and those that do not (\(\binom nk\)). Figure 2.6.17 shows the triangle.

Pascal's triangle with rows 0 to 8, each entry in a small box and centred under the two entries above it; the entries 4 and 6 in row 4 and the entry 10 in row 5 are shaded, showing 10 = 4 + 6.
Figure 2.6.17. Pascal's triangle, rows 0 to 8. Every entry is the sum of the two above it, \(\binom{n+1}k=\binom nk+\binom n{k-1}\) (2.6.1); the shaded entries show \(10=4+6\). Reproduces Larsen and Marx (2018), Figure 2.6.17. Code: ch02_probability.py, fig_2_6_17.

Examples 2.6.23 to 2.6.25 (two ways to count). A sandwich with eight optional toppings: each topping is in or out, \(2^8=256\) sandwiches, or count by the number of toppings, \(\sum_k\binom8k=256\); the two answers agree, which proves \(\sum_k\binom nk=2^n\) (2.6.2). Example 2.6.24 is the proof of Theorem 2.3.7: an outcome in exactly \(k\) of the events is counted \(\binom k1-\binom k2+\cdots\) times, which equals \(1-(1-1)^k=1\) by the binomial theorem; it is carried out, with the Bonferroni bounds, in Filling the gap 2.4. Example 2.6.25 proves \(\sum_kk\binom nk=n2^{n-1}\) by differentiating \((1+x)^n\) and \(\sum_k\binom nk^2=\binom{2n}n\) by choosing \(n\) objects from two groups of \(n\) (Vandermonde with \(d=e=m=n\)).

2.7 Combinatorial Probability

pp. 89–101 When the outcomes of a counting problem are equally likely, \(\P(A)=m/n\) is the number of outcomes in \(A\) over the number in \(S\). The book's hints: build the answer as a quotient of two counts rather than by multiplying position-by-position probabilities, keep numerator and denominator consistent (both ordered or both unordered), and remember the standard denominators: \(6^n\) for \(n\) dice, \(2^n\) for \(n\) coin tosses, \(\binom{52}n\) for an \(n\)-card hand.

Filling the gap 2.17: when are outcomes equally likely? Ordered against unordered samples p. 98 (hint 2)

Draw \(k\) objects from \(N\) distinct ones at random without replacement. If the ordered sequences are equally likely (each has probability \(1/(N)_k\)), then the unordered samples (subsets) are also equally likely, each with probability \(1/\binom Nk\), so a probability may be computed either way provided numerator and denominator use the same convention. Counting unordered outcomes of an experiment whose unordered outcomes are not equally likely gives wrong answers.

Hint 1 of 5: the key idea

Count how many ordered samples correspond to one unordered sample. If that number is the same for every subset, what happens to equal likelihood?

Hint 2 of 5: tools you will need
  • Permutations and combinations, Theorem 2.6.1 and Theorem 2.6.4.
  • Classical probability: favourable over total, both counted in the same way.
  • Two distinguishable dice.
Hint 3 of 5: step 1

Each \(k\)-subset gives \(k!\) orderings, so its probability is \(k!/(N)_k\). Aim for: \(1/\binom Nk\) for every subset.

Hint 4 of 5: step 2

Write the 21 unordered outcomes of two dice and the number of ordered pairs behind each. Aim for: \(\{a,a\}\) has weight 1, \(\{a,b\}\) weight 2.

Hint 5 of 5: step 3

Use this to see why \(\tfrac3{21}\) is the wrong probability that the sum is 7.

Proof and a classical trap

Each \(k\)-subset corresponds to exactly \(k!\) ordered sequences, so its probability is \(k!/(N)_k=1/\binom Nk\) (Theorem 2.6.4). In the other direction, in rolling two distinguishable dice the 36 ordered pairs are equally likely, but the 21 unordered outcomes \(\{a,b\}\) are not: \(\{a,a\}\) arises from one ordered pair (probability \(\tfrac1{36}\)) and \(\{a,b\}\) with \(a\ne b\) from two (\(\tfrac2{36}\)). Treating the 21 as equally likely would give the sum 7 probability \(\tfrac3{21}\) instead of \(\tfrac6{36}=\tfrac16\). The same slip makes "two boys" come out \(\tfrac12\) in Question 2.4.5. A good test is to ask whether swapping the labels of the objects maps outcomes to outcomes of equal probability. \(\qquad\blacksquare\)

Examples 2.7.1 to 2.7.5. The largest of three chips drawn from eight is a 5 with probability \(\tfrac{\binom11\binom42}{\binom83}=\tfrac6{56}=0.107\) (2.7.1); with \(n\) red, \(n\) white and \(n\) blue chips each numbered \(1\) to \(n\), two chips have the same colour or number with probability \(\tfrac{3\binom n2+n\binom32}{\binom{3n}2}\), these being mutually exclusive when the two chips are different (2.7.2); twelve dice show each face exactly twice with probability \(\tfrac{12!}{(2!)^6\,6^{12}}=0.0034\) (2.7.3); \(n\) dice sum to \(n+2\) with probability \(\tfrac{n+\binom n2}{6^n}\) (2.7.4); and the monkey who permutes the 59 Scrabble tiles at random writes Byron's couplet with probability \(\big(59!/\prod n_i!\big)^{-1}\approx1.7\times10^{-61}\) (2.7.5).

Example 2.7.6 (the birthday problem). pp. 92–94 With \(k\) people and 365 equally likely birthdays, the \(365^k\) ordered lists of birthdays are equally likely, and \((365)_k\) of them have no repeat, so \[ \P(\text{at least two share a birthday})=1-\frac{365\cdot364\cdots(365-k+1)}{365^k}. \] Table 2.7.1: \(0.253\) for \(k=15\), \(0.476\) for 22, \(0.507\) for 23, \(0.891\) for 40, \(0.970\) for 50, \(0.999\) for 70. There are \(\binom{23}2=253\) pairs of people, each matching with probability \(\tfrac1{365}\); \(253/365=0.693=\ln2\) is why 23 is the answer. The book remarks that real births are not uniform and that this only raises the probability of a match; Filling the gap 2.18 proves that, and proves the bounds that make \(k=23\) exact.

Two panels. Left: the probability of a shared birthday against the number of people from 0 to 80: an S-shaped curve through 0.5 at 23 people and 0.97 at 50, with the exponential approximation almost on top of it, a seasonal-births curve slightly above, six dots for Table 2.7.1 and six squares for simulated groups lying on the curves. Right: on log axes, the smallest group size with probability at least one half against the number of equally likely days from 5 to one million, a straight line of slope one half, with the 365-day point marked at 23.
Figure x2-1 (supplementary). (a) The birthday problem: exact probability (blue), \(1-e^{-k(k-1)/730}\) (dashed), a seasonal distribution of births with a peak in August (orange), the entries of Table 2.7.1 (dots) and simulated frequencies from 4000 random groups (squares). (b) People needed for a probability of at least \(\tfrac12\) against the number \(d\) of equally likely days; it grows like \(\sqrt{2\ln2\;d}\). Own figure. Code: ch02_probability.py, fig_x2_1.
▶ DemoThe birthday problemExact and simulated probabilities, the seasonal distribution (preset 3), birth months (preset 4) and exactly one shared pair (preset 5, Question 2.7.15).

Filling the gap 2.18: the birthday problem for unequal birthdays, and bounds that settle \(k=23\) pp. 93–94

Let day \(i\) have probability \(p_i\) (\(i=1,\dots,d\), \(\sum p_i=1\)). Then \[ \P(\text{no shared birthday among }k)=k!\,e_k(p_1,\dots,p_d),\qquad e_k=\sum_{i_1<\cdots<i_k}p_{i_1}\cdots p_{i_k}, \] and (a) this is at most its value \(\binom dk k!/d^k=(d)_k/d^k\) for equally likely days, with equality only for the uniform case (the book's claim that "any deviation raises the chance of a match"); (b) for equally likely days \[\exp\!\big(-\tfrac{k(k-1)}{2(d-k+1)}\big)\le\prod_{j<k}(1-\tfrac jd)\le\exp\!\big(-\tfrac{k(k-1)}{2d}\big)\;.\] For \(d=365\) the bounds show that 23 people suffice and 22 do not.

Hint 1 of 6: the key idea

Bound the product \(\prod_{j<k}(1-j/d)\) from above and below with exponentials; for unequal days, smooth two probabilities toward their average and watch what happens to the elementary symmetric polynomial.

Hint 2 of 6: tools you will need
  • \(1-x\le e^{-x}\) and \(\log(1-x)\ge-x/(1-x)\).
  • The elementary symmetric polynomial \(e_k\) and its split \(p_ip_je_{k-2}+(p_i+p_j)e_{k-1}+e_k\).
  • Graduate Filling the gap 1.6.
Hint 3 of 6: step 1

Prove the two bounds on \(\prod(1-j/d)\) and sum \(j\) from 1 to \(k-1\). Aim for: exponents \(k(k-1)/2d\) and \(k(k-1)/(2(d-k+1))\).

Hint 4 of 6: step 2

Check \(k=23\) and \(k=22\) against \(\ln 2\). Aim for: 23 suffices, 22 does not.

Hint 5 of 6: step 3

For \(P(\text{no match})=k!e_k(p)\), average \(p_i,p_j\). Aim for: \(e_k\) does not decrease, since \(p_ip_j\le m^2\).

Hint 6 of 6: step 4

Use compactness to take a maximiser, show it has at least \(k\) positive entries and that averaging any two unequal ones would increase \(e_k\) strictly. Conclude it is uniform.

Proof

(b), the bounds. From \(1-x\le e^{-x}\): \[\prod_{j<k}(1-\tfrac jd)\le\exp(-\sum_{j<k}\tfrac jd)=\exp(-\tfrac{k(k-1)}{2d})\;.\] From \(\log(1-x)\ge-\tfrac x{1-x}\) (\(0\le x<1\)): \[\sum_{j<k}\log(1-\tfrac jd)\ge-\sum_{j<k}\tfrac j{d-j}\ge-\tfrac1{d-k+1}\sum_{j<k}j=-\tfrac{k(k-1)}{2(d-k+1)}\;.\] \(k=23\) and \(22\). \(\tfrac{23\cdot22}{730}=0.693151>\ln2=0.693147\), so \(\P(\text{no match})\le e^{-0.693151}<\tfrac12\) for \(k=23\); for \(k=22\), \(\tfrac{22\cdot21}{2\cdot344}=0.6715<\ln 2\) shows \(\P(\text{no match})\ge e^{-0.6715}=0.511>\tfrac12\). The threshold is exactly 23, with no table needed.

(a), unequal days. The probability that \(k\) people have distinct birthdays is the sum over ordered \(k\)-tuples of distinct days of \(\prod p\), i.e. \(k!\,e_k(p)\). Fix two days \(i\ne j\) and let \(r\) be the other \(d-2\) probabilities. Splitting by how many of \(i,j\) are used, \[e_k(p)=p_ip_j\,e_{k-2}(r)+(p_i+p_j)\,e_{k-1}(r)+e_k(r)\;.\] Replace \(p_i,p_j\) by their average \(m=(p_i+p_j)/2\): the sum \(p_i+p_j\) is unchanged and \(p_ip_j\le m^2\) with equality iff \(p_i=p_j\) (because \(m^2-p_ip_j=(p_i-p_j)^2/4\)), so \(e_k\) does not decrease and increases strictly if \(p_i\ne p_j\) and \(e_{k-2}(r)>0\). The function \(e_k\) is continuous on the compact set of probability vectors, so it has a maximum at some \(p^*\), and its value there is at least the uniform value \(\binom dk d^{-k}>0\) (here \(k\le d\)). Hence \(p^*\) has at least \(k\) positive entries. If two entries of \(p^*\) differed, the other \(d-2\) entries would contain at least \(k-2\) positive ones (we removed at most two), so \(e_{k-2}(r)>0\) and averaging them would strictly increase \(e_k\), contradicting the maximum. So \(p^*\) is uniform, and any non-uniform \(p\) has \(e_k(p)<\binom dkd^{-k}\) or (if \(p\) has fewer than \(k\) positive entries) \(e_k(p)=0\), giving a strictly larger match probability. \(\qquad\blacksquare\)

For a seasonal distribution (day \(i\) proportional to \(1+0.6\cos(2\pi(i-230)/365)\)) the match probability for 23 people is \(0.566\) against \(0.507\), and 22 people already give more than one half (demo, preset 3). The graduate course treats the same problem in Filling the gap 1.6.

Question 2.7.15 (exactly one pair) is on the demonstration's preset 5; its solution is in the selected questions.

Example 2.7.7 (poker). pp. 94–95 A hand is five cards from 52, \(\binom{52}5=2{,}598{,}960\) equally likely hands. A full house (three of one rank, two of another) has \(\binom{13}1\binom43\binom{12}1\binom42=3744\) hands, probability \(0.00144\). One pair (a pair and three singles of three other ranks) has \(\binom{13}1\binom42\binom{12}3\binom41^3=1{,}098{,}240\) hands, probability \(0.4226\) (the three single ranks can be chosen as a set, \(\binom{12}3\), not as an ordered list \(12\cdot11\cdot10\): Question 2.7.16). A straight (five consecutive ranks, ace high or low, not all one suit) has \(10\cdot4^5-40=10{,}200\) hands, probability \(0.00392\), the 40 subtracted being straight flushes. Table 2.7.2 lists all types. (The book's text in part (b) says to divide by \(\binom{52}2\); the displayed formula correctly has \(\binom{52}5\), see Notes on the book.)

Filling the gap 2.19: every hand type of Table 2.7.2, and a check that they add up pp. 94–95

The book computes three of the ten rows and says the others are "gotten in much the same way". Here are all of them. Ranks 2 to ace are the 13 ranks; a hand is classified by its pattern of ranks and suits.

HandCountNumberProbability
Royal flush\(4\)40.0000015
Straight flush (not royal)\(10\cdot4-4\)360.000014
Four of a kind\(13\cdot48\)6240.00024
Full house\(13\binom43\cdot12\binom42\)37440.00144
Flush (not straight)\(4\binom{13}5-40\)51080.0020
Straight (not flush)\(10\cdot4^5-40\)10,2000.0039
Three of a kind\(13\binom43\binom{12}2\cdot4^2\)54,9120.021
Two pairs\(\binom{13}2\binom42^2\cdot44\)123,5520.048
One pair\(13\binom42\binom{12}3\cdot4^3\)1,098,2400.42
No pair\(\big(\binom{13}5-10\big)(4^5-4)\)1,302,5400.50
Total2,598,9601
Hint 1 of 6: the key idea

Classify hands by the pattern of ranks, then count rank choices and suit choices separately. Finally check that all ten rows add to \(\binom{52}5\).

Hint 2 of 6: tools you will need
Hint 3 of 6: step 1

Do four of a kind, three of a kind, two pairs: rank choices as sets, then suits. Aim for: 624, 54,912, 123,552.

Hint 4 of 6: step 2

Count the 5148 same-suit hands and the 10,200+40 consecutive-rank hands, and subtract the 40 straight flushes. Aim for: flush 5108, straight 10,200.

Hint 5 of 6: step 3

For no pair, choose five different ranks that are not a run and suits that are not all equal.

Hint 6 of 6: step 4

Add all rows, or add the rank pattern \((1,1,1,1,1)\) in two ways to check the total.

Derivations and the check

Four of a kind: choose the rank (13), take all four suits, and any of the other 48 cards as the fifth. Three of a kind: the rank (13) and three suits \(\binom43\), two other ranks as a set \(\binom{12}2\), each with any suit (\(4^2\)). Two pairs: the two paired ranks as a set \(\binom{13}2\), two suits for each pair \(\binom42^2\), and the fifth card from the 11 other ranks (44 cards). Straight flush: 10 runs of five consecutive ranks (the ace low or high) and 4 suits, 40 hands, of which the four starting at the 10 are royal flushes (the book lists them separately, hence 0.000014 and 0.0000015). Flush: a suit (4) and five of its 13 ranks \(\binom{13}5=1287\), \(5148\) hands, minus the 40 straight flushes. Straight: 10 runs and \(4^5\) suit choices, minus the 40 that are one suit.

No pair: five different ranks (\(\binom{13}5=1287\) sets) that are not one of the 10 runs, with suits \(4^5\) but not all one suit (\(4^5-4\)): \(1277\cdot1020=1{,}302{,}540\).

Check: by rank pattern, a hand is of one and only one of the patterns \[(4,1),(3,2),(3,1,1),(2,2,1),(2,1,1,1),(1,1,1,1,1)\;,\] and the pattern \((1,1,1,1,1)\) contains \(\binom{13}5\,4^5=1{,}317{,}888\) hands, the sum of the rows no pair, straight, flush, straight flush and royal flush: \[1{,}302{,}540+10{,}200+5108+40=1{,}317{,}888\;.\] Adding all rows: \[624+3744+54{,}912+123{,}552+1{,}098{,}240+1{,}317{,}888=2{,}598{,}960=\binom{52}5\;.\] \(\qquad\blacksquare\)

The demonstration deals hands and compares the frequencies with these probabilities, which also shows how many deals a rare hand needs.

▶ DemoPoker hands and lottery prizesExact probabilities as quotients of counts, against simulated deals; presets 1 to 3 are Example 2.7.7, preset 4 the Powerball prize.

Example 2.7.8 (a drunkard's walk). p. 96 After \(n\) steps, each one forward or backward with probability \(\tfrac12\), the walker has moved \(r\) steps forward with probability \(\binom n{(n+r)/2}/2^n\). The formula applies when \(n+r\) is even and \(|r|\le n\) (then there are \((n+r)/2\) forward steps), and the probability is \(0\) otherwise. It is the binomial distribution of the number of forward steps, with mean \(n/2\), so the position has mean 0 and variance \(n\) and spreads like \(\sqrt n\); in higher dimensions and for biased steps the picture changes (random walk demo).

Example 2.7.9 (Powerball). pp. 96–97 A ticket has five distinct numbers from 59 and one number from 35 (the extra ball); five white balls and one extra ball are drawn. There are \(\binom{59}5\cdot35=175{,}223{,}510\) equally likely tickets. A ticket matching exactly \(w\) white balls and the extra ball has probability \(\binom5w\binom{54}{5-w}\cdot1/175{,}223{,}510\), without the extra ball \(\binom5w\binom{54}{5-w}\cdot34/175{,}223{,}510\). The fourth prize (four white, no extra) has \(\binom54\binom{54}1\binom{34}1=9180\) tickets, probability \(5.24\times10^{-5}\). Table 2.7.3 lists nine prizes; the probability of winning something is \(0.0314\) and of the jackpot \(5.7\times10^{-9}\). The book's comment that many players bet on birthdays (small numbers) does not change the probabilities but does change how many people share a prize.

Filling the gap 2.20: the lottery classes partition the tickets pp. 96–97

For \(m\) white balls drawn from \(N\), a ticket (a set of \(m\) numbers) matches exactly \(w\) of them in \(\binom mw\binom{N-m}{m-w}\) ways, and these numbers add up over \(w=0,\dots,m\) to \(\binom Nm\). With \(M\) extra balls the classes \((w,\text{extra matches})\) have \(\binom mw\binom{N-m}{m-w}\) and \(\binom mw\binom{N-m}{m-w}(M-1)\) tickets and add up to \(\binom Nm M\), so Table 2.7.3 is a complete probability distribution once the losing classes (zero, one or two white balls without the extra ball) are added.

Hint 1 of 5: the key idea

Classify a ticket by how many of its numbers are in the drawn set; the counts must add up to the number of tickets. Which identity says that?

Hint 2 of 5: tools you will need
  • Choosing \(w\) from the drawn \(m\) and \(m-w\) from the other \(N-m\).
  • Vandermonde's identity, Filling the gap 2.16.
  • Independence of the white balls and the extra ball.
Hint 3 of 5: step 1

Count tickets with exactly \(w\) matches. Aim for: \(\binom mw\binom{N-m}{m-w}\).

Hint 4 of 5: step 2

Sum over \(w\) using Vandermonde. Aim for: \(\binom Nm\); then include the extra ball: \(1+(M-1)=M\).

Hint 5 of 5: step 3

Add the nine prize classes of Table 2.7.3 and the three losing classes. Aim for: total 1, with the prizes about 0.0314 of it.

Proof and numbers

Fix the drawn set \(D\) of size \(m\). A ticket \(T\) of size \(m\) has \(|T\cap D|=w\) iff it contains \(w\) elements of \(D\) (\(\binom mw\) choices) and \(m-w\) elements of the other \(N-m\) (\(\binom{N-m}{m-w}\) choices), so the classes are disjoint and exhaustive, and \(\sum_w\binom mw\binom{N-m}{m-w}=\binom Nm\) by Vandermonde's identity (Filling the gap 2.16: compare the coefficients of \(t^m\) in \((1+t)^m(1+t)^{N-m}\)). A ticket's extra number equals the drawn extra ball in 1 of \(M\) ways and differs in \(M-1\), independently of the white balls. \(\qquad\blacksquare\)

For \(N=59\), \(m=5\), \(M=35\) the nine prize classes of Table 2.7.3 have \(5.7\times10^{-9}\), \(1.94\times10^{-7}\), \(1.54\times10^{-6}\), \(5.24\times10^{-5}\), \(8.17\times10^{-5}\), \(0.002777\), \(0.001416\), \(0.009024\), \(0.018048\) (jackpot, five white only, four white and extra, ..., zero white and extra), adding to \(0.03140\), and the expected number of white balls matched is \(m^2/N=0.42\). The demonstration lets \(N\), \(m\) and \(M\) vary and counts simulated tickets (preset 4).

2.8 Taking a Second Look at Statistics (Monte Carlo Techniques)

pp. 98–101 By the frequency view, \(\P(E)\approx m/n\) when \(E\) occurs in \(m\) of \(n\) repetitions. Estimating probabilities by simulating repetitions (Monte Carlo) is useful when an exact calculation is hard, and it can arbitrate between two proposed answers. The book returns to Example 2.4.10, the chip with a red face and a blue face and the two single-colour chips: if blue shows, is the other side blue with probability \(\tfrac12\) (model (a): "a chip was drawn; the red/red chip is out, so one of two remaining chips is blue/blue") or \(\tfrac23\) (model (b): "a side was drawn; three blue sides, two of them with blue behind")? Table 2.8.1 records 100 plays of the game; in 52 of them blue was showing and in 36 of those blue was underneath, \(36/52=0.69\), "much more consistent with 2/3 than 1/2". Model (b) is right (Example 2.4.10): the draw is of a chip and a side, and the three blue faces are equally likely to be the one showing.

Two panels. Left: proportion of trials with blue underneath against the number of trials with blue showing, on a log axis from 1 to 3000. Four simulated paths and a thick black step line for the book's 100 trials (52 with blue on top) wander widely at first and settle near the red horizontal line at 2/3, inside a grey funnel that narrows like one over root m; a dashed red line marks 1/2, far below the paths for large m. Right: a histogram of the estimate from 100 trials over 8000 repetitions, centred near 0.67 with spread from about 0.5 to 0.85, a black line at the book's 0.69 and red lines at 2/3 and 1/2.
Figure x2-3 (supplementary). Monte Carlo for the two-sided chip. (a) The running proportion of trials with blue underneath among those with blue showing: four simulated paths, the 100 trials of Table 2.8.1 (black steps) and an approximate 95% funnel \(\tfrac23\pm2\sqrt{(2/9)/m}\). (b) The estimate that a 100-trial experiment produces, over 8000 repetitions: the book's 0.69 is typical of \(p=\tfrac23\), while \(\tfrac12\) lies in the extreme left tail. Own figure; data: Table 2.8.1. Code: ch02_probability.py, fig_x2_3.

Filling the gap 2.21: how precise is a Monte Carlo probability? pp. 99–101

If \(n\) independent repetitions each have the event with probability \(p\), the estimate \(\hat p=m/n\) has standard error \(\sqrt{p(1-p)/n}\le\tfrac1{2\sqrt n}\) (Filling the gap 2.1: the variance of \(m\) is \(np(1-p)\)). For a conditional probability such as \(\P(\text{blue under}\mid\text{blue showing})\) the number \(M\) of usable trials is itself random, about \(n/2\) here, and conditional on \(M=m\) the count of successes is binomial with \(m\) trials and success probability \(p=\tfrac23\).

Hint 1 of 5: the key idea

A Monte Carlo estimate is a sample proportion. What is its standard error, and for a conditional probability, what is random about the number of trials you can use?

Hint 2 of 5: tools you will need
Hint 3 of 5: step 1

Compute \(\hat p=36/52\) and \(\sqrt{\hat p(1-\hat p)/52}\). Aim for: 0.064.

Hint 4 of 5: step 2

Count standard errors from \(\tfrac12\) and from \(\tfrac23\). Aim for: about 3.0 and 0.4.

Hint 5 of 5: step 3

Solve \(\sqrt{p(1-p)/m}\le0.01\) for \(m\) and double it, since half the trials are lost to the condition.

The book's 100 trials, and how many are enough

Standard error. By the variance computation of Filling the gap 2.1, \(\hat p=m/n\) has standard deviation \(\sqrt{p(1-p)/n}\) (estimated by plugging in \(\hat p\)). With \(\hat p=36/52=0.692\), \(\mathrm{se}=\sqrt{0.692\cdot0.308/52}=0.064\). Then \((0.692-\tfrac12)/0.064=3.0\) standard errors above \(\tfrac12\), but only \((0.692-\tfrac23)/0.064=0.4\) above \(\tfrac23\): the data are very far from model (a) and entirely consistent with model (b). An exact check: if \(p=\tfrac12\) the probability of 36 or more successes in 52 trials is \(0.0039\).

Sample size. To have standard error \(0.01\) for \(p=\tfrac23\) one needs \(m\ge p(1-p)/0.01^2=2222\) trials with blue showing, i.e. about 4444 plays; for a small probability \(p\) the relative error \(\sqrt{(1-p)/(np)}\approx1/\sqrt{np}\) shows why rare events (a full house, one in 694) need many trials, as in the demonstration. A simulation that draws the conditioning event on purpose, e.g. always starts with a blue face up, would use all trials. The Monte Carlo error is also the topic of the Monte Carlo error demo. \(\qquad\blacksquare\)

▶ DemoMonte Carlo errorThe error of a simulated probability, \(\Phi(2)\) with \(N=10{,}000\), against the exact standard error.

Notes on the book

Misprints and points to read with care

  • Example 2.7.7(b), page 94. The sentence before the displayed formula says the product is divided by \(\binom{52}2\). The count in the numerator is of five-card hands, so the denominator must be \(\binom{52}5\), as the displayed formula has it, and the stated value 0.42 is \(1{,}098{,}240/2{,}598{,}960=0.4226\).
  • Answer to Question 2.4.31 (page 702). The book's answer is "0.01%". With \(\P(\text{HIV})=0.0001\), \(\P(+\given\text{HIV})=0.999\), \(\P(+\given\text{no HIV})=0.0001\), \[\P(+)=0.0001\cdot0.999+0.9999\cdot0.0001=0.00019989\approx0.02\%\;.\] The false positives (\(0.9999\cdot0.0001\)) contribute as much as the true positives.
  • Table 2.7.2 and Table 2.7.3. The "straight flush" row (0.000014) excludes the royal flush, listed on its own at 0.0000015, while the count of straights, \(10\cdot4^5-40\), excludes all 40 straight flushes including the royal ones; the table is consistent, but only if read this way (Filling the gap 2.19).
  • Example 2.3.3 and the other "by symmetry" arguments are correct but depend on the exchangeability of draws without replacement, which the book does not state (Filling the gap 2.5).
  • Case Study 2.4.1. The table of outcomes assumes a host with no preference between two empty doors; the stated 2/3 holds then and depends on the host's rule otherwise (Filling the gap 2.7).

Selected questions

Twelve of the questions of Chapter 2 (Larsen and Marx, 2018, pp. 18–100), restated in my own words, with complete solutions (hidden) and graded hints. They cover every section from 2.2 to 2.7; Sections 2.1 and 2.8 have no questions of their own, and Section 2.8 is exercised by the Monte Carlo figure above. Where the book gives an answer to an odd-numbered question it agrees with the one below.

  1. Question 2.2.37 (medical school admissions). Of 1200 graduates admitted to medical school, 1000 scored 27 or above on the MCAT, 400 had a GPA of 3.5 or above, and 300 had both. What proportion had an MCAT below 27 and a GPA below 3.5?

    Hint 1 of 4: the key idea

    The students in neither group are what is left after removing the union. How many are in the union?

    Hint 2 of 4: tools you will need
    • Counting version of Theorem 2.3.6.
    • Complements: \(N(\co E)=N(S)-N(E)\).
    Hint 3 of 4: step 1

    Compute the size of \(M\cup G\) by adding and subtracting the overlap. Aim for: 1100.

    Hint 4 of 4: step 2

    Subtract from 1200 and divide by 1200.

    Solution

    Let \(M\) be the set with MCAT \(\ge27\) and \(G\) the set with GPA \(\ge3.5\). Then \[N(M\cup G)=N(M)+N(G)-N(M\cap G)=1000+400-300=1100\] (the two-event inclusion–exclusion, Theorem 2.3.6, applied to counts). The graduates in neither set are \(\co{(M\cup G)}\), which has \(1200-1100=100\) members, a proportion \(100/1200=1/12\approx0.083\).

  2. Question 2.3.5 (a six on three dice). Three fair dice are rolled and \(A_i\) is the event that die \(i\) shows a six. Is \(\P(A_1\cup A_2\cup A_3)=\tfrac12\)?

    Hint 1 of 4: the key idea

    Adding probabilities is correct only for mutually exclusive events. Are 'a six on die 1' and 'a six on die 2' exclusive? What is the easiest event to compute instead?

    Hint 2 of 4: tools you will need
    Hint 3 of 4: part (a)

    Compute the probability of no six on three dice. Aim for: \(125/216\).

    Hint 4 of 4: part (b)

    Verify with \(S_1-S_2+S_3\), counting the pairs and the triple. Aim for: \(91/216\ne\tfrac12\).

    Solution

    No. The sum \(\P(A_1)+\P(A_2)+\P(A_3)=\tfrac12\) would be the probability of the union only if the \(A_i\) were mutually exclusive (Theorem 2.3.5), and they are not: two sixes can occur together. By complements, \(\P(\text{no six})=(5/6)^3=125/216\) (independent dice), so \(\P(\cup A_i)=91/216\approx0.421\). The same from Theorem 2.3.7 with \(S_1=3\cdot\tfrac16=\tfrac12\), \(S_2=3\cdot\tfrac1{36}=\tfrac1{12}\), \(S_3=\tfrac1{216}\): \(\tfrac{108}{216}-\tfrac{18}{216}+\tfrac1{216}=\tfrac{91}{216}\). The first partial sum \(\tfrac12\) is the union bound, an overestimate, as in the Bonferroni inequalities (demo, preset 3).

  3. Question 2.3.14 (smallest chance of none). Events \(A,B,C\) have probabilities \(0.2,0.1,0.3\). What is the smallest possible value of \(\P[\co{(A\cup B\cup C)}]\)?

    Hint 1 of 4: the key idea

    The complement of the union is smallest when the union is largest. How large can the probability of a union of three events be?

    Hint 2 of 4: tools you will need
    Hint 3 of 4: step 1

    Bound \(\P(A\cup B\cup C)\) above by \(\P(A)+\P(B)+\P(C)\). Aim for: a lower bound for the complement.

    Hint 4 of 4: step 2

    Show it is attained by building three mutually exclusive events with the given probabilities, for example intervals of \([0,1)\).

    Solution

    \(\P[\co{(A\cup B\cup C)}]=1-\P(A\cup B\cup C)\), so we need the largest possible \(\P(A\cup B\cup C)\). By Boole's inequality (the first Bonferroni bound, Filling the gap 2.4), \[\P(A\cup B\cup C)\le\P(A)+\P(B)+\P(C)=0.6\;.\] The bound is attained when the events are mutually exclusive (Theorem 2.3.5): on \(S=[0,1)\) with uniform probability take \(A=[0,0.2)\), \(B=[0.2,0.3)\), \(C=[0.3,0.6)\). So the smallest value of the probability that none occurs is \(1-0.6=0.4\).

  4. Question 2.4.20 (the prisoners and the guard). Andy, Bob and Charley are in prison; two of the three, chosen at random, will be released. A guard offers to tell Andy the name of one other prisoner who will be released. Andy declines, reasoning that once he hears, say, "Bob", only Andy and Charley remain for the second place, so his chance would fall from \(\tfrac23\) to \(\tfrac12\). Is he right?

    Hint 1 of 5: the key idea

    List the three equally likely pairs that may be released and what the guard says in each. What is the probability of each statement?

    Hint 2 of 5: tools you will need
    • Definition 2.4.1 of conditional probability.
    • Law of total probability for the guard's statement.
    • The structure of Filling the gap 2.7 (Monty Hall).
    Hint 3 of 5: step 1

    State the guard's rule when both others are released (assume he picks at random). Aim for: \(\P(N_B)=\tfrac12\).

    Hint 4 of 5: step 2

    Compute \(\P(\{A,B\}\cap N_B)\div\P(N_B)\). Aim for: \(\tfrac23\).

    Hint 5 of 5: step 3

    Say why the two remaining prisoners are not equally likely, and what changes if the guard always names Bob when he can.

    Solution

    No. The three pairs \(\{A,B\},\{A,C\},\{B,C\}\) are released with probability \(\tfrac13\) each, so \(\P(\text{Andy released})=\tfrac23\). The guard names someone other than Andy who is released. If the pair is \(\{A,B\}\) he must say "Bob", if \(\{A,C\}\) he must say "Charley", and if \(\{B,C\}\) he may say either; assume he chooses at random, probability \(\tfrac12\) each. Let \(N_B\) be the event that he says "Bob". Then \(\P(N_B)=\tfrac13+\tfrac13\cdot\tfrac12=\tfrac12\) and \[ \P(\text{Andy released}\given N_B)=\frac{\P(\{A,B\}\cap N_B)}{\P(N_B)}=\frac{1/3}{1/2}=\frac23. \] His chance is unchanged: the remaining two candidates, Andy and Charley, are not equally likely to be the other one, because the guard's rule is more likely to produce "Bob" when Andy is released (certainty) than when he is not (probability \(\tfrac12\)). If the guard always said "Bob" whenever Bob is released the answer would change (\(\tfrac12\)), so the problem depends on the guard's rule, exactly as in Filling the gap 2.7 (Monty Hall).

  5. Question 2.4.47 (Josh's exam). Josh sits a twenty-question multiple-choice test with five options per question. He knows the answers to some questions and guesses at random on the rest. For a randomly chosen question, the probability that he knew the answer given that he answered it correctly is 0.92. For how many questions was he prepared?

    Hint 1 of 5: the key idea

    This is Bayes' theorem backwards: the posterior 0.92 is given and the prior, the fraction of questions Josh knew, is unknown. Write the equation for it.

    Hint 2 of 5: tools you will need
    • Bayes' theorem, Theorem 2.4.2.
    • The partition 'knew', 'did not know' and \(\P(\text{right}\mid\text{guess})=\tfrac15\).
    Hint 3 of 5: step 1

    Set \(p=\P(K)\) and write \(\P(K\given R)=p/(p+(1-p)/5)\). Aim for: an equation in \(p\).

    Hint 4 of 5: step 2

    Solve it. Aim for: \(p=0.697\).

    Hint 5 of 5: step 3

    Multiply by 20 and round.

    Solution

    Let \(K\) be the event he knew the answer, \(p=\P(K)\), and \(R\) the event he answered correctly. Then \(\P(R\given K)=1\) and \(\P(R\given\co K)=\tfrac15\). By Bayes' theorem \[ 0.92=\P(K\given R)=\frac{p}{p+(1-p)/5}. \] Solving: \(p=0.92p+0.184(1-p)\), so \(p(1-0.92+0.184)=0.184\) and \(p=0.184/0.264=0.697\). Of twenty questions he knew about \(20p=13.9\approx14\) (the book's answer).

  6. Question 2.4.48 (screening for child abuse). Consultants estimate that one child in ninety is abused, that a screening program detects an abused child 90% of the time and that it wrongly labels 3% of non-abused children as abused. What is the probability that a child labelled abused really is? How does it change if the incidence is one in one thousand, or one in fifty?

    Hint 1 of 5: the key idea

    The base rate matters more than the 90%. Write Bayes' theorem with the incidence \(\pi\) as a variable.

    Hint 2 of 5: tools you will need
    Hint 3 of 5: step 1

    Write \(\P(A\given B)=0.9\pi/(0.9\pi+0.03(1-\pi))\). Aim for: a formula in \(\pi\) only.

    Hint 4 of 5: step 2

    Evaluate at \(\pi=\tfrac1{90},\tfrac1{1000},\tfrac1{50}\). Aim for: about 0.25, 0.03, 0.38.

    Hint 5 of 5: step 3

    Comment on what fraction of the labelled children are false positives.

    Solution

    Let \(A\) be "abused" and \(B\) "labelled abused": \(\P(B\given A)=0.9\), \(\P(B\given\co A)=0.03\). With incidence \(\pi\), Bayes' theorem gives \(\P(A\given B)=\dfrac{0.9\pi}{0.9\pi+0.03(1-\pi)}\). For \(\pi=1/90\): \(\dfrac{0.01}{0.01+0.03\cdot\tfrac{89}{90}}=\dfrac{0.01}{0.03967}=0.252\). For \(\pi=1/1000\): \(\dfrac{0.0009}{0.0009+0.02997}=0.029\). For \(\pi=1/50\): \(\dfrac{0.018}{0.018+0.0294}=0.380\). So even at the highest incidence three quarters of the labelled children are false positives, and at one in a thousand the label is wrong 97% of the time: the posterior is limited by the false-positive rate relative to the incidence, not by the sensitivity (Filling the gap 2.9; Figure x2-2).

  7. Question 2.5.15 (odd dice). A red and a green fair die are rolled. \(A\): red is odd; \(B\): green is odd; \(C\): the sum is odd. Show that each pair of these events is independent but the three are not mutually independent.

    Hint 1 of 5: the key idea

    Check three pair equations and one triple equation. Which of the four fails, and why can it never hold here?

    Hint 2 of 5: tools you will need
    Hint 3 of 5: step 1

    Compute \(\P(A),\P(B),\P(C)\). Aim for: all \(\tfrac12\).

    Hint 4 of 5: step 2

    Count \(A\cap B\), \(A\cap C\), \(B\cap C\). Aim for: 9 outcomes each, \(\tfrac14\).

    Hint 5 of 5: step 3

    Look at the parity of the sum when both dice are odd to find \(\P(A\cap B\cap C)\).

    Solution

    Each event has probability \(\tfrac12\). \(A\cap B\) is "both odd": \(3\cdot3=9\) of 36 outcomes, \(\tfrac14=\tfrac12\cdot\tfrac12\). \(A\cap C\): red odd and the sum odd means green even, again 9 outcomes, \(\tfrac14\). Likewise \(B\cap C\) has probability \(\tfrac14\). So all three pairs satisfy the product rule. But the sum of two odd numbers is even, so \(A\cap B\cap C=\emptyset\) and \[\P(A\cap B\cap C)=0\ne\tfrac18=\P(A)\P(B)\P(C)\;.\] Definition 2.5.2 therefore fails (Filling the gap 2.12; demo).

  8. Question 2.5.20 (who throws the first head). Players A, B and C toss a fair coin in turn, in the order A, B, C, A, B, ... The first to throw a head wins. Find each player's probability of winning.

    Hint 1 of 5: the key idea

    If the first player tosses a tail, the game starts again with the second player in the first player's place. Use that to relate the three winning probabilities.

    Hint 2 of 5: tools you will need
    Hint 3 of 5: step 1

    Write the probability that A wins on toss \(3k+1\) and sum over \(k\). Aim for: \(\tfrac47\).

    Hint 4 of 5: step 2

    Do the same for B and C, or use \(\P(B)=\tfrac12\P(A)\) and \(\P(C)=\tfrac14\P(A)\). Aim for: \(\tfrac27,\tfrac17\).

    Hint 5 of 5: step 3

    Check that the three probabilities add to 1.

    Solution

    A wins on toss \(1,4,7,\dots\), i.e. when the first \(3k\) tosses are tails and toss \(3k+1\) is a head: \[\P(A)=\sum_{k\ge0}(\tfrac12)^{3k+1}=\tfrac12\cdot\tfrac1{1-1/8}=\tfrac47\;.\] B wins on tosses \(2,5,\dots\): \(\P(B)=\sum_{k\ge0}(\tfrac12)^{3k+2}=\tfrac14\cdot\tfrac87=\tfrac27\); C wins on tosses \(3,6,\dots\): \(\tfrac18\cdot\tfrac87=\tfrac17\). Check: \(\tfrac47+\tfrac27+\tfrac17=1\), so someone wins with probability 1. First-step version: if A tosses a tail the game restarts with B in A's place, so \(\P(B)=\tfrac12\P(A)\), \(\P(C)=\tfrac14\P(A)\) and \(\P(A)(1+\tfrac12+\tfrac14)=1\).

  9. Question 2.6.57 (MISSISSIPPI). In how many ways can the letters of MISSISSIPPI be arranged so that no two I's are adjacent?

    Hint 1 of 5: the key idea

    Place the letters that are not I first; the I's then go into gaps between them. Why does one I per gap guarantee non-adjacency?

    Hint 2 of 5: tools you will need
    Hint 3 of 5: step 1

    Arrange M, S, S, S, S, P, P. Aim for: 105.

    Hint 4 of 5: step 2

    Count the gaps (including the two ends) and choose 4 of them. Aim for: 70.

    Hint 5 of 5: step 3

    Multiply and compare with the book's answer.

    Solution

    First arrange the seven letters that are not I: one M, four S, two P, in \(\dfrac{7!}{1!\,4!\,2!}=105\) ways (Theorem 2.6.2). These create 8 gaps (before, between and after). Choosing 4 different gaps for the four identical I's guarantees that no two I's touch, and every admissible arrangement arises exactly once, so there are \(\binom84=70\) choices. Total \(105\cdot70=7350\) (the book's answer).

  10. Question 2.6.60 (a binomial identity). Show that \(n(n-1)2^{n-2}=\sum_{k=2}^nk(k-1)\binom nk\) for \(n\ge2\).

    Hint 1 of 4: the key idea

    Two proofs are possible: differentiate the binomial theorem twice, or count one set of objects in two ways (committee with a chair and a secretary).

    Hint 2 of 4: tools you will need
    • Binomial theorem, Filling the gap 2.16.
    • Derivative of \(x^k\) twice; set \(x=1\).
    • The multiplication rule.
    Hint 3 of 4: part (a)

    Differentiate \((1+x)^n=\sum\binom nkx^k\) twice. Aim for: \(n(n-1)(1+x)^{n-2}=\sum k(k-1)\binom nkx^{k-2}\); then \(x=1\).

    Hint 4 of 4: part (b)

    Count (committee, chair, secretary) first by committee size, then by choosing the two officers first and the other members as any subset.

    Solution

    Algebraic. Differentiate the binomial theorem \((1+x)^n=\sum_k\binom nkx^k\) twice: \[n(n-1)(1+x)^{n-2}=\sum_{k\ge2}k(k-1)\binom nkx^{k-2}\;,\] and set \(x=1\). Combinatorial. Count the ways to choose a committee of any size from \(n\) people and from it a chair and a (different) secretary. Choosing the size \(k\), the committee (\(\binom nk\)) and then the ordered pair (\(k(k-1)\)) gives the right side. Choosing the chair and the secretary first (\(n(n-1)\) ways) and then any subset of the remaining \(n-2\) people to fill out the committee (\(2^{n-2}\) ways) gives the left side.

  11. Question 2.7.13 (broken sticks). Ten sticks are each broken into a long part and a short part. The twenty parts are then paired at random and glued into ten sticks again. What is the probability that every long part is glued to a short part?

    Hint 1 of 5: the key idea

    Count the equally likely ways to pair 20 parts, then the ways that pair every long part with a short one.

    Hint 2 of 5: tools you will need
    • Counting pairings: arrange in a row, then divide out the order within and between pairs (Theorem 2.6.2).
    • The multiplication rule and \(n!\).
    • Classical probability, Filling the gap 2.17.
    Hint 3 of 5: step 1

    Show the number of ways to split 20 distinct parts into 10 unordered pairs is \(20!/(2^{10}10!)\). Aim for: the denominator.

    Hint 4 of 5: step 2

    Count the pairings that match each long part with a short one. Aim for: \(10!\).

    Hint 5 of 5: step 3

    Simplify to \(2^{10}/\binom{20}{10}\).

    Solution

    The number of ways to divide 20 distinct parts into 10 unordered pairs is \(\dfrac{20!}{2^{10}\,10!}\) (arrange the parts in a row and read off consecutive pairs, \(20!\) ways; each division is counted \(2^{10}\) times for the order within pairs and \(10!\) for the order of the pairs). The favourable pairings match the 10 long parts with the 10 short parts, \(10!\) ways. Hence \[ \P=\frac{10!\cdot2^{10}\,10!}{20!}=\frac{2^{10}}{\binom{20}{10}}=\frac{1024}{184756}=0.00554. \] A sequential check: the first long part has 10 short partners among the 19 others, the next unpaired long part has 9 among 17, and so on: \(\prod_{j=0}^{9}\frac{10-j}{19-2j}\), which is the same number. (In the book's biological reading, a cell survives only if each centromere fragment recombines with a fragment without one; with ten chromosomes this happens with probability about 0.55%.)

  12. Question 2.7.15 (exactly one shared birthday). Among \(k\) randomly chosen people, what is the probability that exactly one pair shares a birthday (two people have the same birthday and everyone else's birthday is different)?

    Hint 1 of 5: the key idea

    Count birthday lists of length \(k\) with exactly one repeated pair, choosing the two people, their shared day and then distinct days for everybody else.

    Hint 2 of 5: tools you will need
    Hint 3 of 5: step 1

    Choose which two people match and which day they share. Aim for: \(\binom k2\cdot365\).

    Hint 4 of 5: step 2

    Give the other \(k-2\) people different days, all different from the shared day. Aim for: \(364\cdot363\cdots(365-k+2)\).

    Hint 5 of 5: step 3

    Divide by \(365^k\) and evaluate at \(k=23\). Aim for: about 0.363.

    Solution

    The \(365^k\) ordered lists of birthdays are equally likely. Choose the two people who match, \(\binom k2\); choose their common birthday, 365; give the remaining \(k-2\) people different birthdays, all different from that one and from each other, \(364\cdot363\cdots(365-k+2)\) ways. So \[ \P=\frac{\binom k2\cdot365\cdot364\cdot363\cdots(365-k+2)}{365^k} \] (the book's answer). For \(k=23\) this is \(0.3634\), against \(\P(\text{at least one match})=0.5073\) and \(\P(\text{no match})=0.4927\): the remaining \(0.144\) is three or more people sharing, or two or more separate pairs. The first-pair factor \(\binom k2/365\) is the expected number of matching pairs, so for small \(k\) nearly all matches are single pairs. See demo, preset 5.

Demonstrations for this chapter

Each demonstration runs in the browser and links back to these notes. The ▶ Demo boxes above open them already set to the case under discussion.

DemonstrationWhat you can seeSections and results
The birthday problemExact probability of a shared birthday for 7 to 1000 days, equally likely or seasonal, against \(1-e^{-\lambda}\) and simulated groups, with the distribution of the number of matching pairs. Presets: 1 Example 2.7.6; 2 Table 2.7.1, 40 people; 3 seasonal births; 4 twelve months; 5 Question 2.7.15.2.7, 2.18, Q 2.7.15
Poker hands and lottery prizesThe ten poker hand types and the prize classes of a Powerball-style lottery with adjustable parameters: exact probabilities from binomial coefficients on a log scale against simulated deals and tickets. Presets: 1 full house; 2 one pair; 3 straight; 4 Powerball fourth prize; 5 a small lottery.2.7, 2.19, 2.20
Inclusion–exclusion and the matching problemThe alternating partial sums of Theorem 2.3.7 against the exact union for the matching problem and for independent events, with the simulated number of events that occur. Presets: 1 three letters; 2 eight letters; 3 Question 2.3.5; 4 strong events; 5 twelve letters, Poisson limit.2.3, 2.4, Q 2.3.5

Demonstrations of other courses on this site that illustrate this chapter: long-run frequencies (Section 2.1), Monty Hall and Bayes and the base rate (Section 2.4), pairwise against mutual independence (Section 2.5), random walks (Example 2.7.8) and Monte Carlo error (Section 2.8). The Python code that produces every figure is in code/ch02_probability.py.

References

  1. Larsen, R. J. and Marx, M. L. (2018). An Introduction to Mathematical Statistics and Its Applications, 6th edition. Pearson, Boston. Chapter 2, pp. 15–101.
  2. Diaconis, P. and Mosteller, F. (1989). Methods for studying coincidences. Journal of the American Statistical Association, 84(408), 853–861.
  3. Feller, W. (1968). An Introduction to Probability Theory and Its Applications, Volume I, 3rd edition. Wiley, New York.
  4. Kolmogorov, A. N. (1933). Grundbegriffe der Wahrscheinlichkeitsrechnung. Springer, Berlin.
  5. Metropolis, N. and Ulam, S. (1949). The Monte Carlo method. Journal of the American Statistical Association, 44(247), 335–341.
  6. Robbins, H. (1955). A remark on Stirling's formula. The American Mathematical Monthly, 62(1), 26–29.
  7. Selvin, S. (1975). A problem in probability (letter to the editor). The American Statistician, 29(1), 67.
  8. Wasserman, L. (2004). All of Statistics: A Concise Course in Statistical Inference. Springer, New York. Chapter 1.