1
  • Password has $4$ digits
  • Each placeholder can take value from $0$ to $9$
  • Must contain digits ($1$ AND $2$ AND $3$)
  • Valid sequences are ($1123, 0231, 1023, \ldots$)
  • Invalid sequences are ($0010, 9999, 0023, \ldots$)

How many valid permutations are there? What concept is this? Initially I thought it was a simple problem, but I can't figure out.

N. F. Taussig
  • 76,571
Zanko
  • 215
  • (a) Is 1,2,3 an example or are these to necessarily be the distinct digits (b) Can the remaining digit be from one of the $3$ or does it have to exclude them ? – true blue anil Sep 07 '17 at 08:56

2 Answers2

3

The password will have $1$, $2$, $3$, and a fourth digit. We can do casework on the value of the fourth digit:


Case 1: The fourth digit is not $1$, $2$, or $3$.

In this case, there are $7$ choices for the value of the fourth digit. For each of these $7$ choices, there are $4!$ ways to arrange the digits into a password:

$$7 \cdot 4! \,= \,168$$

Case 2: The fourth digit is $1$.

In this case, there would be $4!$ ways to arrange the digits if the $1$s were distinguishable, but since the $1$s are not distinguishable, we are overcounting by a factor of $2$ and we need to divide:

$$\frac{4!}{2} = 12$$

Case 3: The fourth digit is $2$.

In this case, the reasoning is the same as for Case 2:

$$\frac{4!}{2} = 12$$

Case 4: The fourth digit is $3$.

In this case, the reasoning is the same as for Cases 1 and 2:

$$\frac{4!}{2} = 12$$


This gives a final answer of

$$168 + 12 \cdot 3 \, = \, \boxed{204\,}$$

1

Let $A$ be the set of all passwords that contain 1, $B$, those contain 2 and $C$, those contain 3. We need the number of elements in $A\cap B \cap C$. Now, by inclusion exclusion formula, \begin{align*} |A^c \cup B^c \cup C^c| &= \binom{3}{1}9^4 - \binom{3}{2}8^4 + \binom{3}{3} 7^4 \end{align*} Hence \begin{align*} |A\cap B \cap C| = 10^4 - |A^c \cup B^c \cup C^c| = 204 \end{align*}