NapkinCalc

Probability — Chance & Counting

Counting — permutations & combinations

continues from lesson 1 — values defined earlier in the course stay live here

ELI5: before you can take a fraction of outcomes, you must count them.

  • Permutations = arrangements where order matters (a podium: gold, silver, bronze).
  • Combinations = groups where order does not (a committee of 3).

The engine has both built in.

podiums=permutations(10,3)podiums = \mathrm{permutations}\left(10, 3\right) = 720720 10 runners, ordered top-3: 720
committees=combinations(10,3)committees = \mathrm{combinations}\left(10, 3\right) = 120120 unordered groups of 3: 120
✓ pass podiums==6committeespodiums == 6 * committees each unordered trio can be ordered 3! = 6 ways

Real-world hook: combinations give lottery odds (combinations(49, 6) ≈ 14 million) and the number of possible poker hands; permutations count passwords and race finishes.

Try it yourself: a pizza shop has 6 toppings. How many ways can you choose 3 of them (order doesn't matter)?

waysyou=combinations(6,3)ways_{you} = \mathrm{combinations}\left(6, 3\right) = 2020 ✏️ Your turn: count the 3-topping choices from 6. Order doesn't matter, so use combinations(6, 3).
✓ pass abs(waysyoucombinations(6,3))<109\mathrm{abs}\left(ways_{you} - \mathrm{combinations}\left(6, 3\right)\right) < 10^{-9} green when it matches combinations(6, 3)