The Password Problem
You could start listing them: Aa00, Aa01, Aa02...
You'd be at it for a while. There's a faster way.
Start smaller
Tap the items on and off. Watch the total change.
With 3 shirts and 2 pants, you get 6 outfits. Not because you listed them, but because each shirt pairs with every pair of pants.
The rule
If you have ways to make the first choice, ways to make the second, and so on, then the total number of ways is:
This works because the choices are independent. Picking the purple shirt doesn't eliminate any pants.
Back to passwords
With vs. without replacement
| Type | How it works | 4-digit PIN count |
|---|---|---|
| With replacement | 10, 10, 10, 10 | 10,000 |
| Without replacement | 10, 9, 8, 7 | 5,040 |
With replacement: every position has the same choices.
Without replacement: the numbers shrink: , then , then ...
Why this matters for security
| Password Type | Possibilities | Time to Crack @ 1B/sec |
|---|---|---|
| 4-digit PIN | 10,000 | Instant |
| 6-char (a-z) | 309 million | < 1 second |
| 8-char (a-z, A-Z, 0-9) | 218 trillion | ~2.5 days |
| 12-char (a-z, A-Z, 0-9) | 3 × 10²¹ | ~96,000 years |
Each additional character multiplies the count by the alphabet size, which is why longer passwords are exponentially more secure.
The shrinking pattern
When choices shrink at each step:
This pattern comes up so often that mathematicians gave it a name and a symbol. This is covered in the combinations vs permutations lesson.
The next lesson covers factorials, permutations, and combinations.