Two lists that share a name#
Sixty students take calculus and forty-five take linear algebra. Twenty take both. Adding 60 and 45 counts those twenty twice.
Adding the 60 calculus students to the 45 linear algebra students counts the 20 in both classes twice, so 85 study at least one.
That correction is the whole of this week. A sample space lists every outcome. An event is the subset you asked about. A probability adds those outcomes once each.
The sample space holds every outcome, and an event is a subset of it.
Sample spaces and events#
A sample space is the set of outcomes an experiment can produce.
- A fair coin has .
- A six-sided die has .
- Tomorrow's temperature in °C has .
- Two coin tosses have .
An event is a subset of . On the die, "even" is and "at least 5" is .
Events are sets, so the set operations are the event operations.
- Union means or or both.
- Intersection means and .
- Complement means not .
- Disjoint events have . They cannot happen on the same roll.
On the die, and .
Kolmogorov axioms#
A probability assigns each event a number in . Kolmogorov (1933) required three rules.
- Non-negativity. for every event .
- Normalisation. . Some outcome occurs.
- Additivity. If are pairwise disjoint, then
Disjoint events add. The countable form is the same rule on an infinite list.
Four consequences fall out of the three rules.
- .
- Complement. .
- Monotonicity. If , then .
- Inclusion-exclusion.
The subtraction is the picture at the top of the page. In a class of 100, with , , and ,
The complement says .
Finite spaces and counting#
When is finite and every outcome is equally likely,
Roll two fair dice. There are 36 ordered pairs. The pairs that sum to 7 are , , , , , and .
The same counting identity, divided by , is inclusion-exclusion. .
Discrete and continuous#
A discrete space lists outcomes and adds them. A continuous space integrates a density . One real number has probability zero.
Week 2 builds the density, the mass function, and the cdf. The three axioms are the same in both settings. Discrete models add. Continuous models integrate.
| Discrete | Continuous |
|---|---|
| is finite or countable | is an interval or |
| One outcome can have positive probability | One outcome has probability zero |
| Coins, dice, cards | Measurements and sensor readings |
in a continuous model even when the density is positive. The density is probability per unit of . The probability is the area.
In a survey, 40% of respondents own a dog (A), 30% own a cat (B), and 15% own both. Using inclusion-exclusion, what percentage owns a dog or a cat (or both)?
Knowledge check#
Which of Kolmogorov's axioms would be violated if we assigned P(A) = −0.1 to some event?
Browser lab#
Simulate die rolls and compare empirical frequencies to the axiom-based probabilities of events.
import numpy as np
import matplotlib.pyplot as plt
def roll_die(n):
return np.random.randint(1, 7, size=n)
n_rolls = 6000
rolls = roll_die(n_rolls)
events = {
"Even (2,4,6)": (rolls % 2 == 0),
"≥ 5 (5,6)": (rolls >= 5),
"Prime (2,3,5)": np.isin(rolls, [2, 3, 5]),
"Divisible by 3 (3,6)": (rolls % 3 == 0),
}
true_probs = {"Even (2,4,6)": 0.5, "≥ 5 (5,6)": 1/3,
"Prime (2,3,5)": 0.5, "Divisible by 3 (3,6)": 1/3}
fig, axes = plt.subplots(2, 2, figsize=(8, 7))
for ax, (name, mask) in zip(axes.flat, events.items()):
empirical = mask.sum() / n_rolls
ax.bar(["Axiom (true)", "Empirical"], [true_probs[name], empirical],
color=["tab:blue", "tab:orange"])
ax.set_ylim(0, 1)
ax.set_title(name)
ax.set_ylabel("Probability")
fig.suptitle(f"Empirical vs True Probabilities ({n_rolls} rolls)", fontsize=13)
plt.tight_layout()
plt.show()
print("Empirical frequencies:")
for name, mask in events.items():
print(f" {name}: {mask.sum() / n_rolls:.4f} (true: {true_probs[name]:.4f})")
print("Notice: every empirical frequency tracks its true value (0.5087 vs 0.5, 0.3363 vs 1/3) — the remaining gaps are sampling noise.")
Key takeaways#
- A model is a sample space, events as subsets, and a measure obeying non-negativity, normalisation, and additivity.
- The complement rule is . Overlapping events use .
- Equally likely outcomes reduce probability to counting, .
- Discrete models add point masses. Continuous models integrate a density, and at every single point.
Further reading#
- Joseph K. Blitzstein & Jessica Hwang, Introduction to Probability (2nd ed., CRC Press, 2019): the axiomatic development plus counting, with worked examples.
- George Casella & Roger L. Berger, Statistical Inference (2nd ed., Duxbury, 2002): Chapter 1 sets up probability from set theory.
- Larry Wasserman, All of Statistics (Springer, 2004): a fast, modern tour that starts here and connects directly to statistics and ML.
Reading is free. PDF and ePub unlock with the newsletter. Join once and every lesson opens in this browser.