Number of possibilites for $4$ digit code with two identical digits

2.1k Views Asked by At

We have $4$ digit code or number. Every digit can be integers from $[0,5]$, i.e. $6$ different values. Question is two find number of possibilities where exactly two of the digits are the same. e.g. 1231,1132,2311,..are some of results.

2

There are 2 best solutions below

0
On

We need to choose three digits, and distinguish one of them as the repeated digit; the number of ways to do this is $$ \binom{6}{3}\cdot3=20\cdot3=60 $$ ways to do this.

Now, we have to position the digits. The repeated digits can take up any two out of the four spaces; so, there are $\binom{4}{2}=6$ ways to do this. Now, let's position the smaller of the remaining digits; there are two ways to do that. And finally, the last remaining digit only has one place to go.

So, all in all, there are $$ \binom{6}{3}\cdot3\cdot\binom{4}{2}\cdot2=720 $$ different combinations possible.

2
On

Question is to find the count of possibilities where exactly two of the digits are the same.

That is: a double and two singletons.

Count the ways to select $2$ from $4$ places for the repeated digit, select $1$ from $6$ digits to repeat, and then select $2$ distinct digits from the remaining $5$ digits to be the singletons and the order to put them.

$$\binom 4 2\binom 6 1\binom 5 2\cdotp2!$$