For this (and all) counting problems, we need to ask if order matters. In this password question, we essentially need to know if these two 9-digit long passwords are different:
123456789 vs. 987654321.
Each has the same 9 digits, but arranged differently. Well, as we know from PIN numbers and email passwords, these two values are different passwords. Hence, order matters and we’re dealing with a permutation question.
Great! Our next step is to tackle the at least 9-digits long part of our question. First, let’s list all the possible digits. They are:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
In total, there are 10 digits from 0 - 9. Since no digit may repeat, and the password must be at least 9-digits long we have only two possible lengths: 9 digits long, or the full 10 digits long password.
For the 9-Digits long password, we lay out 9 slots:
_ _ _ _ _ _ _ _ _ .
In the first slot, we have 10 digits to choose from; in the second, we have 9 digits to choose from, and so on. So, we’re left with:
9-Digits = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2
This is the same as 10P9 = 10!
For the 10-Digits long password, we lay out 10 slots:
_ _ _ _ _ _ _ _ _ _ .
Again, in the first slot, we have 10 digits to choose from; in the second, we have 9 digits to choose from, and so on until we fill the 10th slot. We have:
Finally, we add these two distinct sets of possible password arrangements together to have 10! + 10! = 2 x 10! passwords. Voila! That is our answer :)
Frequently Asked Questions
FAQ: Just to clarify—can the first number in this password be 0?
A: Yes, the first digit CAN be 0. If we changed from numbers to letters, any single letter could be the start of our password. In the same way, 0 is allowed to be the first digit in a string of digits for a password even though if we were simply making a number we wouldn't include it. This isn't quite a number —it's a password. On your computer, it's possible to type in a number starting with 0 as your password, so we can do it here as well. :)
Watch the lessons below for more detailed explanations of the concepts tested in this question.
And don't worry, you'll be able to return to this answer from the lesson page.