Key Takeaways: Probability Thinking

This is your reference card for Chapter 20. Probability is a language for reasoning under uncertainty — and now you speak it.


What Is Probability?

A number between 0 and 1 that quantifies how likely an event is.

Interpretation How It Works Example
Classical Count favorable outcomes / total outcomes P(hearts) = 13/52 = 0.25
Frequentist Long-run proportion from repeated experiments 5,023 heads in 10,000 flips = 0.5023
Subjective Personal degree of belief "70% chance it rains tomorrow"

The Core Rules

Rule Formula Plain English
Complement P(not A) = 1 - P(A) The probability of something NOT happening = 1 minus the probability it happens
Addition (OR) P(A or B) = P(A) + P(B) - P(A and B) Add the individual probabilities, subtract the overlap
Multiplication (AND, independent) P(A and B) = P(A) * P(B) Multiply the probabilities (ONLY if events are independent)
Conditional P(A|B) = P(A and B) / P(B) Zoom in on cases where B happened; how many are also A?

Bayes' Theorem

$$P(A|B) = \frac{P(B|A) \times P(A)}{P(B)}$$

Component Name What It Means
P(A) Prior What you believed before seeing evidence
P(B|A) Likelihood How likely the evidence is if A is true
P(B) Evidence Total probability of seeing this evidence
P(A|B) Posterior Your updated belief after seeing evidence

The medical test takeaway: A "99% accurate" test on a rare disease (1 in 1,000) gives only about 5% probability of actually having the disease when the test is positive. The base rate matters enormously.

The key error to avoid: P(A|B) is NOT the same as P(B|A). Confusing them is called the "confusion of the inverse" or the "prosecutor's fallacy."


The Law of Large Numbers

As you repeat an experiment more times, the proportion of outcomes converges to the true probability.

  • This is why casinos win in the long run
  • This is why polls work
  • This is why larger samples give better estimates
  • This does NOT mean that future events "balance out" past events (gambler's fallacy)

Expected Value

The long-run average if you repeat the experiment forever:

$$E(X) = \sum x_i \times P(x_i)$$

Example: Fair die → E(X) = 1(1/6) + 2(1/6) + 3(1/6) + 4(1/6) + 5(1/6) + 6(1/6) = 3.5


Probability Traps Your Brain Falls Into

Trap What Your Brain Does The Reality
Gambler's fallacy "Tails is due after 5 heads" Each flip is independent
Base rate neglect "99% accurate test = 99% chance I'm sick" Depends on how rare the disease is
Confusion of inverse P(A|B) = P(B|A) They're usually very different
Birthday problem "You'd need 365 people for a match" Only 23 for a 50% chance

Monte Carlo Simulation — Your Swiss Army Knife

import numpy as np

def estimate_probability(experiment_func, n_simulations=100000):
    """Estimate any probability by running many simulations."""
    successes = sum(experiment_func() for _ in range(n_simulations))
    return successes / n_simulations

When the math is hard, simulate. Generate random outcomes, count what you care about, divide by total. This works for almost any probability question.


Key Python Tools

import numpy as np

# Basic random generation
np.random.random()                    # Uniform [0, 1)
np.random.randint(1, 7)              # Random integer 1-6
np.random.choice(['H', 'T'])         # Random selection
np.random.choice(items, size=5)      # Multiple selections
np.random.choice(items, size=5,
                 replace=False)       # Without replacement
np.random.binomial(n, p)             # Binomial random variable
np.random.seed(42)                   # Reproducible randomness

What You Should Be Able to Do Now

  • [ ] Define probability and distinguish classical, frequentist, and subjective interpretations
  • [ ] Use np.random to simulate random experiments
  • [ ] Apply complement, addition, and multiplication rules
  • [ ] Compute conditional probability
  • [ ] Apply Bayes' theorem and explain why base rates matter
  • [ ] Explain the law of large numbers (and what it does NOT say)
  • [ ] Compute expected value
  • [ ] Recognize and explain the gambler's fallacy, base rate neglect, and the prosecutor's fallacy
  • [ ] Use Monte Carlo simulation to estimate probabilities that would be hard to compute analytically

If all of these feel solid, you're ready for Chapter 21: Distributions and the Normal Curve.