1
$\begingroup$

A password consists of 4 characters, each of which is either a digit or a letter of the alphabet. Each password must contain at least ONE digit and AT LEAST ONE letter. How many different such passwords are there?

I am not sure how to go about this one. At first I did 4 blank digits: XXXX. I did lowercase and uppercase separately since it doesn't specify above. 36^4=1,569,616 for just digits and lowercase. 14,776,336 for lowercase, uppercase, and digits (62^4).

There are two different ways I can go about this and i'm not sure which one.

Originally I did 26*36*36*10 (reserved a spot for the digit, and one for the lowercase) and got 336,60 which seems a bit low.

Then I took the total and subtracted it from the things it could not be (10^4 for digits, and 26^4 for letters only) and got 1,212,640.

I essentially did the same with uppercase, but wasn't sure if I should use 26^4 twice (for lowercase and uppercase) or use 52^4.

Which method should I be using, and if possible please explain why?

Thank you!!!

$\endgroup$
1
$\begingroup$

We might as well assume case doesn't matter - if it does, you just need to adjust the numbers slightly. The total number of strings of characters is, as you pointed out, $36^4$. However, not all of these are passwords. If all characters are letters ($26^4$ possibilities) or all characters are numbers ($10^4$ possibilities, none of which doubles up with a case where all characters are letters) then our string is not a password. In all other cases the string IS a password. Hence there are $$36^4-(26^4+10^4)=1\ 212\ 640$$ possible passwords. If the password is case sensitive, the answer becomes $$62^4-(52^4+10^4)=7\ 454\ 720.$$

$\endgroup$
1
$\begingroup$

Passwords are almost always case sensitive, for a given letter there are $26 \times 2=52$ possibilities, and for the digits we have $10$ possibilities.

Given the restrictions, there are three scenarios;

  1. 3 letters, 1 digit
  2. 2 letters, 2 digits
  3. 1 letter, 3 digits

Consider the first scenario. There are 4 ways to arrange where the digit goes, or equivalently where the letters go. Let L denote a letter, and D denote a digit. The 4 "choices" are LLLD, LLDL, LDLL, DLLL. 4 ways of choosing where one thing belongs (in this case, we are choosing where the letter goes, but it it is equal to choosing where 3 letters go) is $\binom{4}{1}$. Thus, if we want to count the total possibilities for creating a password with 3 letters and 1 digit we compute $$\binom{4}{1}52^310^1$$

So now we can extend this to the other scenarios and sum it all up. We find: $$ \binom{4}{1}52^310^1+\binom{4}{2}52^2 10^2+\binom{4}{3}52^1 10^3 = 7,454,720$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.