Sample spaces, events, and the Kolmogorov axioms
Set up a probability space from the three axioms and compute probabilities of compound events.
Before any random variable, distribution, or expectation, probability needs a foundation: what is the set of things that can happen, and what rule assigns each of them a number between 0 and 1? Kolmogorov's three axioms answer this[1, 2], and every later result is a consequence of them.
Sample space and events
The sample space is the set of all possible outcomes of an experiment. A single roll of a die has ; a coin flip has .
An event is a subset : a collection of outcomes we want to assign a probability to. "The die shows an even number" is the event . Events combine with set operations: (" or "), (" and "), and ("not ").
For technical reasons (uncountable sample spaces have non-measurable subsets), the events form a -algebra [2]: a collection of subsets closed under complement and countable union, containing . For a finite or countable one can take to be all subsets, and the technical layer never intrudes.
The three axioms
A probability measure is a function satisfying:
- Nonnegativity: for every event .
- Normalization: .
- Countable additivity: for pairwise disjoint events (meaning when ),
The triple is a probability space. Everything else is derived.
Consequences
Probability of the complement. Since and are disjoint and their union is , axioms 2 and 3 give , so
Setting gives .
Monotonicity. If , write as a disjoint union. Then by nonnegativity.
Inclusion-exclusion. For any two events,
Derivation. Split into three disjoint pieces: , , and . Additivity gives . Also and similarly for . Substituting and collecting terms yields the formula: the intersection is added twice when summing , so it is subtracted once.
Equally likely outcomes
When is finite and every outcome is equally likely, axioms 2 and 3 force , so for any event
Probability reduces to counting. This is the classical model behind dice, cards, and uniform sampling.
Check it on arrays
A probability is the long-run fraction of trials in which an event occurs. Monte Carlo sampling makes the axioms tangible: simulate many trials, count, and watch the empirical frequencies obey the rules above.
import numpy as np
rng = np.random.default_rng(0)
N = 1_000_000
# Two independent dice
d1 = rng.integers(1, 7, size=N)
d2 = rng.integers(1, 7, size=N)
A = (d1 + d2 == 7) # event: sum is 7
B = (d1 == d2) # event: doubles
pA = A.mean()
pB = B.mean()
pAB = (A & B).mean() # sum 7 AND doubles is impossible
pA_or_B = (A | B).mean()
print(f"P(A) = {pA:.4f} (exact 6/36 = {6/36:.4f})")
print(f"P(B) = {pB:.4f} (exact 6/36 = {6/36:.4f})")
print(f"P(A and B) = {pAB:.4f} (exact 0)")
print(f"P(A or B) = {pA_or_B:.4f}")
# Inclusion-exclusion: P(A or B) = P(A) + P(B) - P(A and B)
print(f"incl-excl = {pA + pB - pAB:.4f}")
# Complement rule: P(not A) = 1 - P(A)
print(f"P(not A) = {(~A).mean():.4f} 1 - P(A) = {1 - pA:.4f}")The empirical frequencies match the counting probabilities, and inclusion-exclusion and the complement rule hold to sampling precision.
Exercises
Exercise 1. A fair die is rolled once. Let (even) and (greater than 3). Compute two ways: by counting the union directly, and by inclusion-exclusion.
Solution
Step 1. By counting: has 4 outcomes out of 6, so .
Step 2. By inclusion-exclusion: , , and the intersection has . Then
Both routes agree, as the inclusion-exclusion derivation guarantees.
Exercise 2. Prove Boole's inequality (the union bound) for two events: , using only the axioms and the results derived in this lesson.
Solution
Step 1. Inclusion-exclusion gives the exact identity
Step 2. By nonnegativity (axiom 1), . Subtracting a nonnegative quantity can only decrease the right side:
Step 3. Chaining the two lines,
with equality exactly when (the events overlap on a probability-zero set). The bound trades the exact overlap correction for a one-sided estimate.
Exercise 3 (code). Simulate one million rolls of two fair dice. Estimate for and , and check that the Monte Carlo estimate matches the inclusion-exclusion value computed from the empirical pieces.
Solution
import numpy as np
rng = np.random.default_rng(2)
N = 1_000_000
d1 = rng.integers(1, 7, size=N)
d2 = rng.integers(1, 7, size=N)
A = (d1 + d2 == 8) # sum is 8
B = (d1 == 6) | (d2 == 6) # at least one 6
pA, pB, pAB = A.mean(), B.mean(), (A & B).mean()
direct = (A | B).mean()
incl_excl = pA + pB - pAB
assert np.isclose(direct, incl_excl, atol=1e-12)
print("P(A or B) direct:", round(direct, 4),
" incl-excl:", round(incl_excl, 4))The direct union frequency and the inclusion-exclusion reconstruction agree exactly, since both are computed from the same simulated trials.
With a probability space in place, the next lesson attaches numbers to outcomes through random variables.
References
- [1]Wasserman, L. (2004). All of Statistics. Springer. Ch. 1, sample spaces and the probability axioms. doi:10.1007/978-0-387-21736-9↩
- [2]Billingsley, P. (1995). Probability and Measure (3rd ed.). Wiley. The measure-theoretic treatment of probability spaces and -algebras.↩