[Math] possible combinations of 3-digit

combinatoricspermutations

How many possible combinations can a 3-digit safe code have?

Because there are 10 digits and we have to choice 3 digits from this,
then we may get $10^P3$ but A author used the formula $n^r$, why is that. What the problem in my calculations?

Best Answer

The error is exactly the one that I suspected in my comment. $_{10}P_3=\frac{10!}{3!}=10\cdot9\cdot8$. This is the number of ways of choosing a $3$-digit combination in which the three digits are all distinct: there are $10$ ways to choose the first digit, but then only $9$ choices remain for the second digit, and once those have been chosen only $8$ choices remain for the last digit.

The problem, however, does not require the digits to be distinct. Thus, there are $10$ choices for the first digit, and since you’re allowed to repeat digits, there are still $10$ choices available for the second digit, and again $10$ for the third. These choices can be made in $10\cdot10\cdot10=10^3$ different ways, so that’s the number of $3$-digit combinations.

As an independent check, notice that the $3$-digit combinations are just the integers from $0$ through $999$, padded on the left with zeros to bring them up to $3$ digits. There are $999$ integers from $1$ through $999$, and $000$ makes the thousandth, so there are $1000=10^3$ such integers.