Question: Each user on a computer system has a password, which is six to eight characters long, where each character is an upper-case letter or a digit. Each password must contain at least one digit. How many possible passwords are there?

I'm in the Basic of Counting section of my Discrete Mathematics book, and I have a problem with my reasoning with this. I will give you my reasoning and the books reasoning. Both give different answers, but I don't see a difference in the train of thought, so I need someone to point out the difference.

My Attempt: Immediately I noticed 3 kinds of character length which allows me to break it down to three cases, respectively $P_6, P_7, P_8$, then add all of them. For $P_6$, $5$ will be made up of alpha numeric characters, and $1$ is made up of just digits due to the requirement of "at least one digit", thus

$$P_6 = (36)^5*10$$

Should be enough to show my train of thought, now the books solution.

Books Solution: The book did the same thing in dividing in 3 cases and adding them later so I'll go ahead and show you their train of thought for $P_6$.

$$P_6 = 36^6 - 26^6$$

Basically its the number of possible 6 alphanumeric minus just alpha numeric.

I know that both give different answers, but I still can't tell why.


Your calculation for $P_6$ gives the number of words in which the first five characters can be letters or digits, and the last must be a digit. But there is nothing in the rules to say that the last must be a digit.

Alternatively, you could interpret your answer to say that, for example, symbols $1,2,4,5,6$ can be anything, and the $3$rd must be a digit. Same problem - there is no requirement that any specific symbol must be a digit.

The simplest solution to the problem is the one given in the book.

  • $\begingroup$ But isn't it like $36*36*36*36*36*10 = 36*10*36*36*36*36$, otherwise, it shouldn't matter since multiplication is commutative. I believe I'm missing something fundamental here. $\endgroup$ – JoeyAndres Jul 18 '14 at 6:31
  • 1
    $\begingroup$ yes those are the same but you don't account for both of them, You only account for one $\endgroup$ – Kamster Jul 18 '14 at 6:32
  • $\begingroup$ @user159813 Right!!!! Thanks. $\endgroup$ – JoeyAndres Jul 18 '14 at 6:33
  • $\begingroup$ You could add up all possibilities to get $6\times36^5\times10$. Unfortunately this introduces a different kind of error. The best way is the solution from the book. $\endgroup$ – David Jul 18 '14 at 6:33
  • 1
    $\begingroup$ Yea, this way David suggest counts some combos more than once $\endgroup$ – Kamster Jul 18 '14 at 6:33

$36^6$ gives you the number of passwords $6$ characters long, including passwords which are alphanumeric. But it also includes password which contains only alphabet, therefore subtract subtract $26^6$.

Similarly for passwords of length $7$ and $8$.


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.