How many different passwords start with a digit or end with a letter?

1k Views Asked by At

A password must be $6$ characters long and contain only digits and lower-case English letters. How many different passwords start with a digit or end with a letter?

I was only given the answer as $(10 \cdot 36^5) + (26 \cdot 36^5) - (10 \cdot 26 \cdot 36^4)$.

Please explain this to me as soon as possible.

2

There are 2 best solutions below

3
On
  • Start with a digit: $10\times 36^5$ passwords

  • End with a letter: $26\times 36^5$ passwords

  • Start with a digit AND end with a letter: $10\times 36^4\times 26$ passwords

The passwords in the third group are included twice in the first and second groups, so the correct answer is: $10\times 36^5+ 26\times 36^5-10 \times 36^4\times 26.$

The answer you provided is incorrect, so you may find it difficult to understand.

Venn AeqB

You might want to draw a Venn diagram that consists of two circles intersect each other, $A$ for "start with a digit", $B$ for "end with a letter", the shared part is for "start with a digit AND end with a letter" and ignore the "empty set" symbol.

0
On

Consider the following $6$ empty spaces: __ __ __ __ __ __

You want to 'fill them up' with letters or numbers. Notice there are $26$ letters in the alphabet and $10$ digits to choose from.

$(1)$ If you want to the password to start with a number, you can pick the first space to be 'filled' with any digit from $0$ to $9,$ so in $10$ possible ways. Since the rest doesn't matter for the condition to be fulfilled, any subsequent space can be filled with a number or a letter of which we have $26+10=36 $ total. So we have $10 \cdot 36^5$ total combinations that start with a number.

$(2)$ If you want the password to end with a letter, for the last space pick any of the $26$ letters available. For the other spaces pick any of the $36$ numbers or letters.So we have $26 \cdot 36^5$ total combinations that end with a letter.

However, notice that there are some combinations that start with a number and end with a letter. If we just sum up $(1)+(2)$ we would be counting these combinations twice (once every time we consider $(1)$ and another time when we consider $(2)$) so we have to subtract a set of these combinations, which is given by $10 \cdot 36^4 \cdot 26$ because of the same arguments as above. Hence the final result will be $$10 \cdot 36^5\ +\ 26 \cdot 36^5\ -\ 10 \cdot 36^4 \cdot 26.$$