- Define sample space, outcome, and event, and use the classical, empirical (long-run), and subjective interpretations of probability.
- Explain the law of large numbers and avoid the gambler's fallacy.
- Apply the complement rule, the addition rule, the multiplication rule, and the law of total probability.
- Compute conditional probabilities, use tree diagrams and two-way tables, and test for independence.
- Use Bayes' theorem, especially in screening-test problems, and explain the base rate fallacy with natural frequencies.
- Count outcomes with the multiplication principle, permutations, and combinations, and use counting to find probabilities.
- Estimate probabilities by simulation and compare them with exact answers.
Statistics is the science of learning from data in the presence of uncertainty. Probability is the mathematics of uncertainty itself. It answers questions of the form "if the world works like this, how likely is that data?", which is exactly the direction of reasoning that inference (Chapters 9 to 14) will turn around. So this chapter is the foundation for everything that follows.
Randomness, sample spaces, and events
A phenomenon is random if individual outcomes are uncertain but there is nevertheless a regular distribution of outcomes in a large number of repetitions. A single coin flip cannot be predicted; the proportion of heads in a thousand flips can.
- A random process (or experiment) is any process whose outcome cannot be predicted with certainty in advance.
- The sample space \(S\) is the set of all possible outcomes.
- An event is a subset of the sample space (a collection of outcomes). We say the event occurs if the outcome is in it.
- The probability \(P(A)\) of an event \(A\) is a number between 0 and 1 measuring how likely it is that \(A\) occurs.
- The complement \(A^c\) ("not \(A\)") is the event that \(A\) does not occur. The union \(A \cup B\) means "A or B (or both)". The intersection \(A \cap B\) means "A and B". Two events are mutually exclusive (disjoint) if \(A \cap B = \varnothing\): they cannot both occur.
Example 5.1: Sample space for two dice
Roll two fair six-sided dice. The sample space has \(6 \times 6 = 36\) equally likely outcomes \((d_1, d_2)\). It helps to list them in a grid:
| \(d_1 \backslash d_2\) | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
The entries are sums. Counting cells: the sum 7 appears 6 times, so \(P(\text{sum} = 7) = 6/36 = 1/6\). The sum is at least 10 in 6 cells (10 appears 3 times, 11 twice, 12 once), so \(P(\text{sum} \ge 10) = 6/36 = 1/6\). Half the cells are even, so \(P(\text{even sum}) = 1/2\). Notice that the outcomes (the 36 pairs) are equally likely, but the sums are not: 7 is six times as likely as 2.
Three ways to think about probability
| Interpretation | Idea | Example |
|---|---|---|
| Classical (theoretical) | If all \(N\) outcomes are equally likely, \(P(A) = \dfrac{\text{number of outcomes in } A}{N}\). | Fair die: \(P(\text{even}) = 3/6\). |
| Empirical (long-run relative frequency) | \(P(A)\) is the proportion of times \(A\) occurs in a very large number of repetitions. | A basketball player made 780 of her last 1000 free throws: estimate 0.78. |
| Subjective (degree of belief) | A personal, informed judgment for one-off events that cannot be repeated. | "I think there is a 30 percent chance it rains tomorrow." |
All three obey the same rules, which is why we can use one calculus for them.
The law of large numbers
As the number of independent repetitions of a random process grows, the relative frequency of an event \(A\) settles down to (converges to) its true probability \(P(A)\).
Notice the wording: relative frequency, not count. After 10 flips you can be 3 heads away from balanced; after 10,000 flips you can be 30 heads away and still be very close in proportion (0.497 versus 0.5). The absolute difference in counts tends to grow like \(\sqrt{n}\) even though the proportion converges.
The law of large numbers does not say that a coin "owes" you tails after a run of heads. Independent trials have no memory: after five heads in a row the next flip is still 50 percent heads. The proportion converges because early fluctuations are swamped by later flips, not because the coin corrects itself.
Basic probability rules
- Range. \(0 \le P(A) \le 1\) for every event.
- Certainty. \(P(S) = 1\) and \(P(\varnothing) = 0\).
- Complement rule. \(P(A^c) = 1 - P(A)\).
- Addition rule for mutually exclusive events. If \(A\) and \(B\) cannot both occur, \(P(A \cup B) = P(A) + P(B)\).
- General addition rule. For any events, \(P(A \cup B) = P(A) + P(B) - P(A \cap B)\).
Why subtract the overlap in the general rule? Adding \(P(A)\) and \(P(B)\) counts the outcomes in both events twice, so we take one copy out. For three events the pattern continues (inclusion-exclusion): \(P(A \cup B \cup C) = P(A)+P(B)+P(C) - P(A\cap B) - P(A \cap C) - P(B \cap C) + P(A \cap B \cap C)\).
The event "at least one success" is the complement of "no successes". When trials are independent, \(P(\text{at least one}) = 1 - P(\text{none})\), which is usually a much shorter calculation than adding up all the ways to get one, two, three, ... successes.
Example 5.2: The general addition rule with a class survey
In a (hypothetical) class, 60 percent of students take math, 45 percent take statistics, and 25 percent take both. Let \(M\) = takes math, \(T\) = takes statistics.
\(P(M \cup T) = 0.60 + 0.45 - 0.25 = 0.80\).
By the complement rule, \(P(\text{neither}) = 1 - 0.80 = 0.20\).
\(P(M \cap T^c) = P(M) - P(M \cap T) = 0.60 - 0.25 = 0.35\).
A Venn diagram or two-way table is the easiest way to keep the four regions straight: both 0.25, math only 0.35, statistics only 0.20, neither 0.20 (these sum to 1).
Example 5.3: "At least one" with a complement (the Chevalier de Mere problems)
Which is more likely: at least one six in 4 rolls of one die, or at least one double-six in 24 rolls of two dice? (A gambler in the 1600s thought they were equal, and asked Pascal.)
One die: \(P(\text{no six in 4 rolls}) = (5/6)^4 = 0.4823\), so \(P(\text{at least one six}) = 1 - 0.4823 = 0.5177\).
Two dice: \(P(\text{no double-six in one roll}) = 35/36\), so \(P(\text{no double-six in 24 rolls}) = (35/36)^{24} = 0.5086\) and \(P(\text{at least one}) = 0.4914\).
The first bet is slightly favorable, the second slightly unfavorable, which is why the gambler lost money on the second bet in the long run.
Conditional probability and the multiplication rule
Probabilities change when we get new information. The probability that a card is a king is 4/52. If we learn it is a face card, the probability becomes 4/12. That is a conditional probability.
Read "the probability of \(B\) given \(A\)". We restrict the sample space to the outcomes in \(A\) and ask what fraction of them are also in \(B\).
Rearranging gives the general multiplication rule:
\[P(A \cap B) = P(A)\,P(B \mid A) = P(B)\,P(A \mid B).\]The probability that a person in the hospital was in a car crash is small, but the probability that a person who was in a serious car crash is in the hospital is large. Confusing these two directions (the "prosecutor's fallacy" in courts, the base rate fallacy in medicine) has caused real harm. Always identify which event is on which side of the bar. The two conditional probabilities share the numerator \(P(A \cap B)\) but have different denominators, and they are equal only when \(P(A) = P(B)\).
Example 5.4: Two aces without replacement
Draw two cards from a standard deck without replacement. What is the probability that both are aces?
Let \(A_1\) = first card is an ace and \(A_2\) = second card is an ace. \(P(A_1) = 4/52\). Given \(A_1\), there are 3 aces among 51 remaining cards, so \(P(A_2 \mid A_1) = 3/51\). By the multiplication rule,
\[P(A_1 \cap A_2) = \frac{4}{52}\cdot\frac{3}{51} = \frac{12}{2652} = \frac{1}{221} \approx 0.00452.\]If the first card were replaced and the deck reshuffled, the draws would be independent and the answer would be \((4/52)^2 = 1/169 \approx 0.0059\).
Tree diagrams
A tree diagram lays out a multi-step random process. Each branch carries a (conditional) probability, and the probability of a complete path is the product of the branch probabilities along it (multiplication rule). The probability of an event that can happen along several paths is the sum of those path probabilities (addition rule).
- Probabilities out of any single node sum to 1.
- Multiply along a path; add across paths.
- Second-stage probabilities are conditional on the first stage.
Independence
Events \(A\) and \(B\) are independent if knowing that one occurred does not change the probability of the other:
\[P(B \mid A) = P(B) \quad\Longleftrightarrow\quad P(A \cap B) = P(A)\,P(B).\]If \(A\) and \(B\) are mutually exclusive and both have positive probability, they are dependent: if \(A\) happens, \(B\) certainly did not, so \(P(B \mid A) = 0 \ne P(B)\). Mutual exclusivity is about the outcomes overlapping; independence is about probabilities not being influenced by the other event.
Example 5.5: Checking independence
Continue Example 5.2: \(P(M) = 0.60\), \(P(T) = 0.45\), \(P(M \cap T) = 0.25\). If math and statistics enrollment were independent we would expect \(P(M \cap T) = 0.60 \times 0.45 = 0.27\). The actual value 0.25 differs, so the events are not independent (but nearly so). Equivalently, \(P(T \mid M) = 0.25/0.60 = 0.4167\), which is not \(P(T) = 0.45\): math students are slightly less likely than average to be taking statistics.
In real problems, independence is an assumption justified by how the data were collected: random sampling with a small sample relative to the population, coin flips, dice, separate machines. Multiplying probabilities without checking independence is a common source of error. (Famous example: the erroneous use of a 1 in 73 million figure in the trial of Sally Clark treated two infant deaths in one family as independent events.)
Example 5.6: Series and parallel systems
A machine has two independent components, each working with probability 0.90.
Series (the machine works only if both work): \(P = 0.90 \times 0.90 = 0.81\).
Parallel (the machine works if at least one works): \(P = 1 - (0.10)(0.10) = 0.99\).
Redundancy improves reliability; chains of dependencies reduce it. The multiplication rule for independent events and the complement rule solve both.
Total probability and Bayes' theorem
Suppose the sample space is divided into mutually exclusive events \(B_1, B_2, \dots, B_k\) that together cover everything (a partition). Then any event \(A\) can happen along one of \(k\) routes.
Bayes' theorem reverses the conditioning: from the probability of the evidence given each cause, it computes the probability of each cause given the evidence. \(P(B_j)\) is the prior, \(P(B_j \mid A)\) is the posterior.
Example 5.7: Which factory made the defective part?
A company buys parts from three factories (hypothetical numbers): Factory 1 supplies 50 percent of parts and 1 percent of its parts are defective; Factory 2 supplies 30 percent with a 2 percent defect rate; Factory 3 supplies 20 percent with a 3 percent defect rate.
\(P(D) = 0.50(0.01) + 0.30(0.02) + 0.20(0.03) = 0.005 + 0.006 + 0.006 = 0.017\).
Although Factory 1 makes half the parts, it accounts for only 29.4 percent of the defects because its defect rate is lowest. The posterior probabilities sum to 1.
Screening tests and the base rate fallacy
Bayes' theorem explains why a positive result on an accurate test can still be probably wrong when the condition is rare. Two properties of a test matter:
- Sensitivity = \(P(\text{positive} \mid \text{has condition})\): how well the test catches true cases.
- Specificity = \(P(\text{negative} \mid \text{no condition})\): how well it clears healthy people.
What you actually want to know is the positive predictive value, \(\text{PPV} = P(\text{has condition} \mid \text{positive})\), and this depends heavily on the prevalence (the base rate) \(P(\text{has condition})\).
Example 5.8: A screening test with natural frequencies
A condition has prevalence 1 percent. A screening test has sensitivity 90 percent and specificity 95 percent (hypothetical). A person tests positive. What is the probability they have the condition?
- 100 have the condition; the test catches 90 of them (true positives).
- 9,900 do not; 5 percent of them, 495, test positive anyway (false positives).
- Total positives: \(90 + 495 = 585\). Only 90 of them are true.
\(\text{PPV} = 90/585 = 0.154\). Only about 15 percent of positives are real.
There are 99 healthy people for every sick one. Even a 5 percent false-positive rate applied to the large healthy group produces many more false alarms (495) than the small sick group produces true alarms (90). If the prevalence were 30 percent, the same test would have PPV about 89 percent. Try the calculator below.
Studies of doctors and students find that reasoning with counts ("out of 1,000 people...") produces far more correct answers than reasoning with conditional probabilities. Whenever a Bayes problem appears, rebuild it with a hypothetical population of 1,000 or 10,000 people.
Going deeper: Derivation of Bayes' theorem and the Monty Hall problem
From the multiplication rule, \(P(B_j \cap A) = P(A \mid B_j)P(B_j) = P(B_j \mid A)P(A)\). Solving for \(P(B_j \mid A)\) gives \(P(B_j \mid A) = P(A \mid B_j)P(B_j)/P(A)\), and the law of total probability supplies the denominator.
Monty Hall. Three doors hide one car and two goats. You pick door 1. The host, who knows where the car is, always opens a door with a goat that you did not pick, and offers you a switch. Let \(C_i\) be "car behind door \(i\)", each with prior 1/3, and let \(H_3\) be "host opens door 3". Then \(P(H_3 \mid C_1) = 1/2\) (host chooses randomly between doors 2 and 3), \(P(H_3 \mid C_2) = 1\) (host must open 3), \(P(H_3 \mid C_3) = 0\). So \(P(H_3) = \tfrac13\cdot\tfrac12 + \tfrac13 \cdot 1 + 0 = \tfrac12\) and \(P(C_1 \mid H_3) = \dfrac{(1/3)(1/2)}{1/2} = \dfrac13\) while \(P(C_2 \mid H_3) = \dfrac{(1/3)(1)}{1/2} = \dfrac23\). Switching doubles your chance. The key is that the host's action is informative because he never opens the car door.
Counting methods
When all outcomes are equally likely, probability is a counting problem: \(P(A) = |A|/|S|\). Counting cleverly avoids listing everything.
- Multiplication principle. If a task has \(k\) stages with \(n_1, n_2, \ldots, n_k\) choices at the successive stages (regardless of earlier choices), the total number of ways is \(n_1 n_2 \cdots n_k\).
- Factorial. \(n! = n(n-1)\cdots 2 \cdot 1\), the number of ways to arrange \(n\) different items in a row. \(0! = 1\).
- Permutations (order matters, no repeats): choosing and arranging \(r\) of \(n\) distinct items, \(\;{}_nP_r = \dfrac{n!}{(n-r)!}\).
- Combinations (order does not matter, no repeats): choosing a set of \(r\) of \(n\) items, \(\;{}_nC_r = \dbinom{n}{r} = \dfrac{n!}{r!\,(n-r)!}\).
- Relationship: \(\dbinom{n}{r} = \dfrac{{}_nP_r}{r!}\), because each set of size \(r\) can be arranged in \(r!\) orders. Also \(\dbinom{n}{r} = \dbinom{n}{n-r}\).
Ask: if I swap two of the chosen items, do I get a different result? Picking a president, vice president, and treasurer from 10 people: yes (permutation, \(10 \cdot 9 \cdot 8 = 720\)). Picking a committee of 3 from 10 people: no (combination, \(\binom{10}{3} = 120\)).
Example 5.9: Passwords, committees, and the lottery
(a) A four-digit PIN using digits 0 to 9 with repeats allowed: \(10^4 = 10{,}000\) possibilities. A random guess succeeds with probability \(1/10{,}000\).
(b) Awarding gold, silver, and bronze among 5 runners: \({}_5P_3 = 5 \cdot 4 \cdot 3 = 60\).
(c) A committee of 3 from 10 people: \(\binom{10}{3} = \dfrac{10 \cdot 9 \cdot 8}{3 \cdot 2 \cdot 1} = 120\).
(d) A lottery draws 6 numbers from 49 (order irrelevant). Number of tickets: \(\binom{49}{6} = 13{,}983{,}816\). One ticket wins the jackpot with probability \(1/13{,}983{,}816 \approx 7.2 \times 10^{-8}\).
(e) A random committee of 3 from 6 women and 4 men has exactly 2 women. Count: \(\binom{6}{2}\binom{4}{1} = 15 \cdot 4 = 60\) of the 120 committees, so the probability is \(60/120 = 0.5\). (This "choose from each group" pattern is the hypergeometric setting of Chapter 6.)
The birthday problem
How many people must be in a room before there is a better than even chance that two share a birthday? Most people guess about 180. The answer is 23. Ignoring leap years and assuming all 365 birthdays equally likely, \(P(\text{no match among } n) = \dfrac{365}{365}\cdot\dfrac{364}{365}\cdots\dfrac{365 - n + 1}{365}\), so \(P(\text{match}) = 1 - \dfrac{{}_{365}P_n}{365^n}\). For \(n = 23\) this is 0.5073. The surprise arises because there are \(\binom{23}{2} = 253\) pairs of people, each a chance for a match.
Simulation
When a probability is hard to compute exactly, we can simulate it: program the random process, repeat it many times, and use the relative frequency of the event as an estimate. By the law of large numbers, more repetitions give better estimates. Simulation also gives an honest check on your algebra: if your exact answer is 0.157 and 10,000 simulations give 0.3, you have made a mistake.
The tools in this chapter (the law of large numbers simulator, the experiment lab, the Monty Hall simulator, the birthday tool) are all simulations of this kind. In later chapters we will simulate sampling distributions (Chapter 8), bootstrap intervals (Chapter 9), and permutation tests (Chapter 11).
- State how a single trial works and what a "success" is.
- Generate random numbers to mimic one trial.
- Repeat a large number of times, recording success or failure.
- Estimate the probability as (successes)/(trials) and note its uncertainty, about \(\sqrt{p(1-p)/n}\).
Chapter summary
- Sample space, events; classical \(P(A) = |A|/|S|\) for equally likely outcomes; empirical and subjective interpretations.
- Law of large numbers: relative frequencies converge to probability. No gambler's fallacy: independent trials have no memory.
- \(0 \le P(A) \le 1\); \(P(A^c) = 1 - P(A)\); \(P(A \cup B) = P(A) + P(B) - P(A \cap B)\).
- \(P(B \mid A) = P(A \cap B)/P(A)\); \(P(A \cap B) = P(A)P(B \mid A)\).
- Independent: \(P(A \cap B) = P(A)P(B)\), equivalently \(P(B \mid A) = P(B)\). Not the same as mutually exclusive.
- Total probability: \(P(A) = \sum P(A \mid B_i)P(B_i)\). Bayes: \(P(B_j \mid A) = \dfrac{P(A \mid B_j)P(B_j)}{P(A)}\).
- Screening: sensitivity, specificity, prevalence, PPV. Use natural frequencies. Low prevalence means many false positives.
- Counting: \(n_1 n_2 \cdots n_k\), \(n!\), \({}_nP_r = \dfrac{n!}{(n-r)!}\), \(\binom{n}{r} = \dfrac{n!}{r!(n-r)!}\).
- "At least one": \(1 - P(\text{none})\).
Key terms
| Term | Meaning |
|---|---|
| Sample space | Set of all possible outcomes of a random process |
| Event | A set of outcomes (a subset of the sample space) |
| Mutually exclusive | Cannot occur together: \(A \cap B = \varnothing\) |
| Independent | Occurrence of one does not change the probability of the other |
| Conditional probability | Probability of an event given that another has occurred |
| Partition | Mutually exclusive events that together make up the whole sample space |
| Prior and posterior | Probability before and after seeing evidence |
| Sensitivity, specificity | \(P(+ \mid \text{condition})\), \(P(- \mid \text{no condition})\) |
| PPV | \(P(\text{condition} \mid +)\), the chance a positive is a true positive |
| Permutation, combination | Ordered and unordered selections |