0
$\begingroup$

A password of length 6 with upper case letters, lower case letters and digits. Password must contain at least 1 upper case, 1 lower case and 1 digit. How many possible passwords are there ?

What I did. Total are $62^{6}$.

Passwords in which upper and lower are mixed(no digits) = $ 52^{6} - 2(26^{6})$.

Passwords in which upper and digits are mixed(no lower) = $ 36^{6} - 10^{6} - 26^{6}$.

Passwords in which lower and digits are mixed(no upper) = $ 36^{6} - 10^{6} - 26^{6}$.

I subtracted all these from the total so get $ 62^{6} - 52^{6} - 2(36^{6}) + 2(26^{6}) + 10^{6}$. Is this the correct way.

What other ways could one think about ?

$\endgroup$
7
  • 1
    $\begingroup$ Your answer is correct but your working is missing details. You have correctly found all passwords with only two of them (LU, UD, DL) and subtracted. Then you also need to subtract passwords with only U, L or D which you seem to be doing but you have not written that anywhere in your working. $\endgroup$
    – Math Lover
    Commented Mar 7, 2021 at 15:01
  • $\begingroup$ They are in the cases. For example 36 ^6 has already all digit passwords etc $\endgroup$ Commented Mar 7, 2021 at 17:24
  • $\begingroup$ take digits and lowercase for example. When you subtract $10^6$ and $26^6$ from $36^6$, it gives you passwords that are made of both digits and lowercases. You subtract it from $62^6$ and similarly others. What about subtracting passwords which are made of only digits? $\endgroup$
    – Math Lover
    Commented Mar 7, 2021 at 17:39
  • $\begingroup$ See your math. Based on what you have written, in the final expression, you should have $+ 4 \cdot 26^4$ but you have only $+ 2 \cdot 26^4$. $\endgroup$
    – Math Lover
    Commented Mar 7, 2021 at 17:40
  • $\begingroup$ I want to count those which we dont need. $\endgroup$ Commented Mar 8, 2021 at 18:22

1 Answer 1

1
$\begingroup$

I just checked my final answer with that of the OP: are answers match. I simply had some trouble following the OP's logic, so I arrived at the same answer by a moderately different route:

Also, the alternative to Inclusion-Exclusion, which I will briefly describe, but do not advise using, would be a direct approach:

The number of digits used will either be $1,2,3,$ or $4$. In each of the 4 cases, you then have to enumerate how many of the remaining characters are uppercase vs lower case.

As an illustration:
In the case of 3 digits used, you will either have 1 uppercase or 2 uppercase. Exploring the specific case of 3 digits, 2 uppercase, and 1 lowercase, the enumeration would be:

There is $A = \binom{6}{1} \times \binom{5}{2}$ ways of positioning the digits, uppercase letters and lowercase letters.

Then, once the positions are set, there are $B = (10)^3 \times (26)^2 \times (26)^1$ different character assignments that can go in the corresponding positions in the password.

Therefore, the enumeration for this subcase is $A \times B.$

There may be a more elegant approach for the direct approach alternative to Inclusion Exclusion that is escaping me.

Anyway, in any event, Inclusion-Exclusion is much easier.


From Inclusion-Exclusion:

Let $T_k$ denote the number of ways that at least $k$ constraints are violated.

Then, you want $T_0 - T_1 + T_2 - T_3.$

$T_0 = (62)^6.$

To calculate $T_1$, there are 3 possibilities:
No uppercase, no lowercase, or no digits.

Therefore,
$T_1 = (36)^6 + (36)^6 + (52)^6.$

To calculate $T_2$, there are 3 possibilities:
No uppercase or lowercase, no uppercase or digits, no lowercase or digits.

Therefore
$T_2 = (10)^6 + (26)^6 + (26)^6.$

In considering $T_3$, it is impossible for all three constraints to be violated, because no characters are allowed except the 62 letters/numbers. The assumption that all 3 constraints are violated would mean that there were no characters available.

Therefore
$T_3 = 0.$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .