Introduction

Why Probability Theory?

Probability is the mathematics of uncertainty. It provides the rigorous foundation for statistics, machine learning, and stochastic modeling. Understanding probability deeply — beyond plugging formulas — is what separates practitioners from engineers who truly understand their models.

  • Machine learning — loss functions, Bayesian inference, generative models, and RL all speak the language of probability distributions.
  • Quantitative finance — option pricing, risk models, and algorithmic trading depend on stochastic processes and random variables.
  • Science — hypothesis testing, confidence intervals, and Bayesian updating all rest on a probabilistic foundation.
  • Computer science — probabilistic algorithms, hashing, randomized data structures, and information theory.

What You'll Build

This course takes a hands-on approach. In each lesson you will implement the key probability concepts in Python from scratch — no scipy shortcuts until you understand what's beneath them.

  1. Sample spaces & axioms — enumerate outcomes, compute probabilities from first principles, verify Kolmogorov axioms.
  2. Conditional probability & Bayes — implement Bayes' theorem, solve classic problems (Monty Hall, medical tests).
  3. Random variables — write PMFs and PDFs, compute expectations and variances analytically.
  4. Distributions — implement Bernoulli, Binomial, Poisson, Exponential, Normal, Gamma, Beta from scratch.
  5. Limit theorems & Markov chains — verify the Law of Large Numbers, simulate Central Limit Theorem, build Markov chain simulators.

In-Browser Runtime

All code runs live in your browser via Pyodide — CPython compiled to WebAssembly. NumPy loads automatically from your import statements.

Next →