0
$\begingroup$

Task: How many passwords of 5 characters contain at least one character multiple?

Like: $a\quad a \quad b \quad c \quad \% \qquad$ or $ \quad b \quad 9 \quad d \quad i \quad d \qquad$ or $\quad d \quad d \quad d \quad a \quad a$

I have two ways I think that could be solved.

For each possibility: one character twice, threefold, fourfold ... a multiplication of possibilities. After that I create a sum of that:

Summarization of( twice: $95 \cdot 1 \cdot 94 \cdot 93 \cdot 92$ + threefold: $95 \cdot 1 \cdot 1 \cdot 94 \cdot 93$ + fourfold: $95 \cdot 1 \cdot 1 \cdot 1 \cdot 94$ ) $= 7 6405080 + 830490 + 8930= 77244500$

And another solution with variations: $|Var_5(95)|-|Var_5(94)| = 95^5- 94^4 = 398769151$

Question: I think both versions are not really correct because they do not cover the case if more than one character has multiples of itself like $\quad d \quad d \quad d \quad a \quad a$

How can I solve that problem ? I would appreciate every hint.

1 Answers 1

2

One can easily use the complement-rule here. Let $A$ denote the set of all possible passwords and $A_1$ denote the set of all possible passwords without any multiple characters. Then it should be clear that:

$A = A_1 \cup A_1^c$

It then follows that (because $A_1$ and $A_1^c$ are disjunct and finitely countable):

$\vert A \vert=\vert A_1 \vert + \vert A_1^c \vert$.

This easily gives you the number of password with at least one multiple.