How many ways are there of creating an $8$ character password with a digit, a lowercase letter, and $2$ capital letters?

616 Views Asked by At

A valid password for the bank's website consists of 8 characters (digits and letters in English) and must contain at least one digit, at least one small English letter, and at least two capital letters. How many legal passwords are there?

I considered four sets:

  • $|A|$ = number of ways for no digits appearing in the password = $52^8$,

  • $|B|$ = number of ways of no small letter in the password = $36^8$,

  • $|C|$ = number of ways of no capital letter in the password = $36^8$,

  • $|D|$ = number of ways of only 1 capital letter in the password = $26*36^7$, and

  • $|U|$ = number of ways of forming the bank's password without restriction = $62^8$.

Using the formula for inclusion and exclusion for 4 sets $|U| - [ |A| \cup |B| \cup |C|\cup |D|]$

such that

$$ \begin{align} &|A\cup B\cup C\cup D|\\[3pt] &=|A|+|B|+|C|+|D|\Big\}\text{ all singletons}\\ &-(|A\cap B|+|A\cap C|+|A\cap D|+|B\cap C|+|B\cap D|+|C\cap D|)\Big\}\text{ all pairs}\\ &+(|A\cap B\cap C|+|A\cap B\cap D|+|A\cap C\cap D|+|B\cap C\cap D|)\Big\}\text{ all triples}\\ &-|A\cap B\cap C\cap D|\Big\}\text{ all quadruples.}\\ \end{align} $$

Now what I'm stuck at is when it comes to triples and quadruples.

$|A\cap B\cap C\cap D|$, to find the number of ways of union of this is kinda contradicting because we have to find a password with no digits, no small letters, no big letters, but only 1 small letter..

or when

$|A\cap C\cap D|$ is also contradicting because how we can find number of ways of password with no big letters and also 1 big letter..

3

There are 3 best solutions below

5
On BEST ANSWER

There is no contradiction, just note that $C\cap D=\emptyset$ and therefore all intersection sets including $C\cap D$ have zero cardinality. Moreover, by a similar reason, also $A\cap B\cap C=\emptyset$ and $A\cap B\cap D=\emptyset$. Thus it remains to compute $$\begin{align} &|U|-(|A|+|B|+|C|+|D|)+(|A\cap B|+|A\cap C|+|A\cap D|+|B\cap C|+|B\cap D|) \end{align} $$ P.S. One more thing, your number for $|D|$ should be multiplied by $8$, i.e. the possible positions of the capital letter.

2
On

First, your evaluation of $|D|$ is incorrect. This is the number of ways to choose a capital letter for the first character, and then choose the remaining seven characters with no capitals. But in fact the single capital letter could be in any of $8$ positions, so actually $|D|=8\times 26\times 36^7$.

Secondly, the multiple events. Note that $C$ and $D$ cannot both occur, and no three events can occur (since if they include $A,B$ and one of $C,D$ then you have at most one character). So you only need to subtract the pairs of events (not including $|C\cup D|$), since the other terms are all $0$.

$|A\cap B|=26^8$, since this means all characters are capitals, and the other double events can be calculated similarly (ones involving $D$ are a bit more complicated, but no more so than the calculation for $D$ itself).

0
On

I would simplify the expression a bit by combining set of no capital letter and set of one capital letter as there is no intersection between them.

If $A$ is the set of passwords where we have at most one capital letter, $B$ is the set of passwords with no small letters and $C$ with no digits,

$|A| = 36^8 + 8 \times 26 \times 36^7$

$|B|= 36^8$

$|C| = 52^8$

$|A \cap B| = 10^8 + 8 \times 26 \times 10^7$

$|B \cap C| = 26^8$

$|A \cap C| = 26^8 + 8 \times 26 \times 26^7$

$|A \cap B \cap C| = 0$

$|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |B \cap C| - |A \cap C| + |A \cap B \cap C|$

And the answer will be $ \, \, 62^8 - |A \cup B \cup C|$