✖

How many different PINs are there?

Imagine you have a combination lock on your bike where you can set a four-digit code. Or imagine you want to set a similar four-digit code on a bank card. How many possibilities are there? Let’s work it out.

The number of four-digit codes

How many combinations would there be if the code consisted of just one digit from zero to nine? There would be ten combinations in total: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

How many possibilities would we get if we added another digit, so that we had a two-digit code? Let’s imagine that we set the first dial to zero and try all the digits from zero to nine on the second dial in turn:

00, 01, 02, 03, 04, 05, 06, 07, 08, 09

We would get ten combinations. Now we change the first dial from zero to one and do the same:

10, 11, 12, 13, 14, 15, 16, 17, 18, 19

That gives us another ten combinations. We carry on like this until we have tried every digit on the first dial and end with nine:

90, 91, 92, 93, 94, 95, 96, 97, 98, 99

In total we get ten such rows, with ten combinations in each row. If we add up all the combinations in all the rows, a two-digit lock gives us 10 · 10 combinations, that is, a hundred.

We carry on in the same way. If we add a third digit to the lock, the number of combinations is multiplied by ten again. A three-digit code will therefore have 10 · 10 · 10, that is, a thousand combinations. And finally a four-digit code will contain

10⋅10⋅10⋅10=10 000

combinations. All along we have simply been using the product rule for counting. So if we have a four-digit lock in which each position can be any of ten different digits, we can work out the number of combinations using powers as

104=10⋅10⋅10⋅10

If we had 3 dials, and on each of them we could choose one letter of the alphabet, that is, the letters from A to Z, of which there are 26, we would get a total of

263=17 576

possibilities.

How to try every combination of a PIN

If you ever need to try every combination of a combination lock or a PIN, the most important thing is to be systematic. If you have a four-digit lock with the digits 0 to 9, start at 0000 and then increase the last digit one step at a time:

0000, 0001, 0002, …, 0009

Then turn the second dial from the right and again try all the options by turning the last digit:

0010, 0011, 0012, …, 0019

Then turn the second dial from the right again, and again go through all the combinations:

0020, 0021, 0022, …, 0029

When you get to 0099, turn the third dial from the right and carry on in the same way:

0100, 0101, 0102, …, 0199

The last combination you can try is 9999. Then you can be sure that you have tried them all.

Chapters: Combinatorics, Arrangements (k-permutations), Permutations, Combinations, Arrangements with repetition, Combinations with repetition, How many different PINs are there?