insideout Get Pro
Learn
Quant engineering · Module 01

Probability

The maths of chance that every quant interview starts with.

Start here · Lesson 01

Counting outcomes

Permutations and combinations: how many ways something can happen.

Start lesson

LessonsAll lessons

  1. 01 Counting outcomesPermutations and combinations: how many ways something can happen. Free
  2. 02 Probability is countingFavourable outcomes over possible ones, and when that rule breaks. Free
  3. 03 Conditional probabilityHow the odds change once you know something. Free
  4. 04 Bayes' ruleTurning a test result into what you actually want to know. Pro
  5. 05 IndependenceWhen knowing one thing tells you nothing, and the traps around it. Pro
  6. 06 Expected valueThe average outcome, and why it decides almost every bet. Pro
  7. 07 Variance and riskSame average, different ride: why spread matters as much as the mean. Pro
  8. 08 Distributions you meet dailyBinomial, Poisson and normal, and where each one shows up. Pro
  9. 09 Large numbers and the CLTWhy averages settle down, and why the bell curve keeps appearing. Pro
  10. 10 Betting gamesFair games, edges, and how much to bet when the odds favour you. Pro
  11. 11 Random walksGambler's ruin, hitting times, and how far a random path wanders. Pro
  12. 12 Interview puzzles, workedClassic interview puzzles, solved step by step. Pro

Build it yourself · on your own machine

Interview puzzles, checked by simulation

A small test suite that solves ten probability puzzles exactly and checks each answer against a million simulated trials.
  1. Pick ten puzzles from across the module, such as a poker hand, a positive test, the three doors, matching hats, 23 birthdays, and gambler's ruin from $10 to $20 at 49% a bet.
  2. Solve each one exactly, by counting, conditioning or first-step analysis, and write the answer as a Python Fraction.
  3. Simulate each with NumPy over a million trials, with no Python loop over the trials, and report the estimate with its standard error.
  4. Write one pytest test per puzzle that passes when the exact answer sits within three standard errors of the simulation.
  5. Simulate 1,000 bettors making 1,000 even-money bets on a coin that wins 55% of the time, at full, half and double the Kelly fraction, and plot their median wealth.

How you'll know it worksTen tests that pass with a fixed seed, and a chart where half Kelly's median wealth ends above double Kelly's.

Python with NumPy, matplotlib and pytest. There's no data to download, and it runs in seconds. Uses lessons 01 to 12.