Skip to main content
© 2026 ePowerAI — free, open courseware. No login required.
CoursesContact
ePOWERAI
CoursesContact
Week 1: Probability Spaces and Events
Prob & Stats

Foundations

  1. 01Week 1: Probability Spaces and Events
  2. 02Week 2: Random Variables and Distributions
  3. 03Week 3: Expectation, Variance, and Covariance
  4. 04Week 4: Conditioning and Independence
  5. 05Week 5: Bayes' Rule and Generative Classification
  6. 06Week 6: Multivariate Gaussians

Inference

  1. 07Week 7: Laws of Large Numbers and the CLT
  2. 08Week 8: Point Estimation — Maximum Likelihood
  3. 09Week 9: Bayesian Estimation and MAP
  4. 10Week 10: Bias, Variance, and Uncertainty

ML interface

  1. 11Week 11: Information Theory for ML
  2. 12Week 12: Exponential Families (lite)
  3. 13Week 13: Graphical Models (lite)

Capstone

  1. 14Week 14: Capstone — Probabilistic Language of ML
Week 01· Prob & Stats· Foundations7 min read

Week 1: Probability Spaces and Events

Learning Outcomes
  • Define sample space, event, and probability measure via the three axioms
  • Compute probabilities for simple finite spaces using additivity
  • Distinguish discrete listing of outcomes from continuous setups (densities deferred to Week 2)
Prerequisites

Background: Linear Algebra complete (course index). High-school algebra, sets, and sums.

Later weeks: Conditioning, random variables, and estimation all rest on this sample space and the three rules for PPP.

  • Also see: Reinforcement Learning Week 1: Reinforcement Learning Problem Formulation, for stochastic environments in practice.

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.

CALCULUS 60 + ALGEBRA 45 − BOTH 20 = UNION 85 40 20 25 only calculus shared only algebra

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.

Ω A B A∩B P(A∪B) = P(A)+P(B)−P(A∩B) disjoint: P(A∩B) = 0 complement: P(Aᶜ) = 1 − P(A) events are sets; probability is a measure on them Kolmogorov's three axioms generate every rule below

The sample space holds every outcome, and an event is a subset of it.

Sample spaces and events#

A sample space Ω\OmegaΩ is the set of outcomes an experiment can produce.

  • A fair coin has Ω={H,T}\Omega = \{\text{H}, \text{T}\}Ω={H,T}.
  • A six-sided die has Ω={1,2,3,4,5,6}\Omega = \{1, 2, 3, 4, 5, 6\}Ω={1,2,3,4,5,6}.
  • Tomorrow's temperature in °C has Ω=R\Omega = \mathbb{R}Ω=R.
  • Two coin tosses have Ω={HH,HT,TH,TT}\Omega = \{\text{HH}, \text{HT}, \text{TH}, \text{TT}\}Ω={HH,HT,TH,TT}.

An event is a subset of Ω\OmegaΩ. On the die, "even" is E={2,4,6}E = \{2, 4, 6\}E={2,4,6} and "at least 5" is F={5,6}F = \{5, 6\}F={5,6}.

Events are sets, so the set operations are the event operations.

  • Union A∪BA \cup BA∪B means AAA or BBB or both.
  • Intersection A∩BA \cap BA∩B means AAA and BBB.
  • Complement Ac=Ω∖AA^c = \Omega \setminus AAc=Ω∖A means not AAA.
  • Disjoint events have A∩B=∅A \cap B = \varnothingA∩B=∅. They cannot happen on the same roll.

On the die, E∩F={6}E \cap F = \{6\}E∩F={6} and E∪F={2,4,5,6}E \cup F = \{2, 4, 5, 6\}E∪F={2,4,5,6}.

Kolmogorov axioms#

A probability PPP assigns each event a number in [0,1][0, 1][0,1]. Kolmogorov (1933) required three rules.

  1. Non-negativity. P(A)≥0P(A) \ge 0P(A)≥0 for every event AAA.
  2. Normalisation. P(Ω)=1P(\Omega) = 1P(Ω)=1. Some outcome occurs.
  3. Additivity. If A1,…,AkA_1, \ldots, A_kA1​,…,Ak​ are pairwise disjoint, then
P(A1∪⋯∪Ak)=P(A1)+⋯+P(Ak).P(A_1 \cup \cdots \cup A_k) = P(A_1) + \cdots + P(A_k).P(A1​∪⋯∪Ak​)=P(A1​)+⋯+P(Ak​).

Disjoint events add. The countable form is the same rule on an infinite list.

Four consequences fall out of the three rules.

  • P(∅)=0P(\varnothing) = 0P(∅)=0.
  • Complement. P(Ac)=1−P(A)P(A^c) = 1 - P(A)P(Ac)=1−P(A).
  • Monotonicity. If A⊆BA \subseteq BA⊆B, then P(A)≤P(B)P(A) \le P(B)P(A)≤P(B).
  • Inclusion-exclusion.
P(A∪B)=P(A)+P(B)−P(A∩B).P(A \cup B) = P(A) + P(B) - P(A \cap B).P(A∪B)=P(A)+P(B)−P(A∩B).

The subtraction is the picture at the top of the page. In a class of 100, with P(A)=60/100P(A) = 60/100P(A)=60/100, P(B)=45/100P(B) = 45/100P(B)=45/100, and P(A∩B)=20/100P(A \cap B) = 20/100P(A∩B)=20/100,

P(A∪B)=0.60+0.45−0.20=0.85.P(A \cup B) = 0.60 + 0.45 - 0.20 = 0.85.P(A∪B)=0.60+0.45−0.20=0.85.

The complement says P(neither)=1−0.85=0.15P(\text{neither}) = 1 - 0.85 = 0.15P(neither)=1−0.85=0.15.

Finite spaces and counting#

When Ω\OmegaΩ is finite and every outcome is equally likely,

P(A)=∣A∣∣Ω∣.P(A) = \frac{|A|}{|\Omega|}.P(A)=∣Ω∣∣A∣​.

Roll two fair dice. There are 36 ordered pairs. The pairs that sum to 7 are (1,6)(1,6)(1,6), (2,5)(2,5)(2,5), (3,4)(3,4)(3,4), (4,3)(4,3)(4,3), (5,2)(5,2)(5,2), and (6,1)(6,1)(6,1).

P(sum=7)=636=16.P(\text{sum} = 7) = \frac{6}{36} = \frac{1}{6}.P(sum=7)=366​=61​.

The same counting identity, divided by ∣Ω∣|\Omega|∣Ω∣, is inclusion-exclusion. ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B|∣A∪B∣=∣A∣+∣B∣−∣A∩B∣.

Discrete and continuous#

A discrete space lists outcomes and adds them. A continuous space integrates a density f(x)≥0f(x) \ge 0f(x)≥0. One real number has probability zero.

P(a≤X≤b)=∫abf(x) dx.P(a \le X \le b) = \int_a^b f(x)\, dx.P(a≤X≤b)=∫ab​f(x)dx.

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.

DiscreteContinuous
Ω\OmegaΩ is finite or countableΩ\OmegaΩ is an interval or R\mathbb{R}R
P(A)=∑ω∈Ap(ω)P(A) = \sum_{\omega \in A} p(\omega)P(A)=∑ω∈A​p(ω)P(A)=∫Af(x) dxP(A) = \int_A f(x)\, dxP(A)=∫A​f(x)dx
One outcome can have positive probabilityOne outcome has probability zero
Coins, dice, cardsMeasurements and sensor readings

P(X=3.7)=0P(X = 3.7) = 0P(X=3.7)=0 in a continuous model even when the density f(3.7)f(3.7)f(3.7) is positive. The density is probability per unit of xxx. The probability is the area.

Exercise · Fill in the blank

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#

Question 1 of 4

Which of Kolmogorov's axioms would be violated if we assigned P(A) = −0.1 to some event?

Non-negativity
Normalisation
Countable additivity
Complement rule

Browser lab#

Simulate die rolls and compare empirical frequencies to the axiom-based probabilities of events.

python · runs in browser
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 P(Ac)=1−P(A)P(A^c) = 1 - P(A)P(Ac)=1−P(A). Overlapping events use P(A∪B)=P(A)+P(B)−P(A∩B)P(A \cup B) = P(A) + P(B) - P(A \cap B)P(A∪B)=P(A)+P(B)−P(A∩B).
  • Equally likely outcomes reduce probability to counting, P(A)=∣A∣/∣Ω∣P(A) = |A| / |\Omega|P(A)=∣A∣/∣Ω∣.
  • Discrete models add point masses. Continuous models integrate a density, and P(X=c)=0P(X = c) = 0P(X=c)=0 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.

Next →
Week 2: Random Variables and Distributions
On this page
  • Two lists that share a name
  • Sample spaces and events
  • Kolmogorov axioms
  • Finite spaces and counting
  • Discrete and continuous
  • Knowledge check
  • Browser lab
  • Key takeaways
  • Further reading