Everyone is asked to create a new 8 character password with at least one number and exactly one special character with the remaining characters being lowercase letters. How many possible passwords are available?

I don't get how to find with restrictions.

26 letters 10 numbers 9 special characters.

• How many "special characters" are there? – Eric M. Schmidt Apr 19 '16 at 6:28
• Is it with/without repetition – Archis Welankar Apr 19 '16 at 6:30
• It is with repetition and there are 9 special characters and 10 numbers. – Sohee Apr 19 '16 at 6:32

We first count the number of 8-character passwords with no numbers at all, but exactly one special character. We

• Choose the special character: $9$ ways
• Place it: $8$ ways
• Choose a letter for each of the remaining positions: $26^7$ ways

So we can do it in $9 \cdot 8 \cdot 26^7$ ways. Now, we count the number of 8-character passwords with exactly one special character and no restrictions on the number of numbers. We

• Choose the special character: $9$ ways
• Place it: $8$ ways
• Choose a letter or a number for each of the remaining positions: $(26 + 10)^7$ ways

The number of such passwords is thus $9 \cdot 8 \cdot (26+10)^7$. If we want to count the number of passwords with at least one number, we subtract the number of passwords with no number from the total number of passwords. Hence the answer is $$9 \cdot 8 \cdot (26+10)^7 - 9 \cdot 8 \cdot 26^7 = 5063929482240$$

• You seem to be assuming that the first symbol is a number and the second symbol is a special character. – Gerry Myerson Apr 19 '16 at 7:38
• @GerryMyerson Sorry, overlooked it in a hurry. Edited. – shardulc Apr 19 '16 at 7:48
• Good, but still not right. Consider a much simpler problem: 2 characters, one of which must be a number. Your reasoning gives $(10)(2)(36)=720$, but this counts the two-number passwords twice. It should be $(10)(26)+(10)(10)+(26)(10)$. – Gerry Myerson Apr 19 '16 at 8:05
• @GerryMyerson Used a different approach. – shardulc Apr 19 '16 at 8:19
• @trueblueanil Fixed. I'm being very careless today :) – shardulc Apr 19 '16 at 9:11

I am not sure whether this is the best or easiest way but here is one way to attack the problem. I will use L to represent an arbitrary letter, 9 for an arbitrary digit, and * for a special character.

Case 1 – Exactly one number

Case 1a – The letter is in position 7 and the special character is in 8 i.e. LLLLLL9* so, there are 26^6 x 10 x 9 possibilities.

Back to the general case 1, how many other arrangements are there? The digit can be in any of 8 positions and the special character in any of the other 7. So 8 x 7 x the number of 1a cases.

Case 2 – Exactly two numbers

Case 2a – the pattern LLLLL99* has 26 ^ 5 x 10 ^ 2 x 9 possibilities.

Back to general case 2, how many other arrangements? The two digits can be in 8 x 7 / 2 places and the special character in one of the remaining 6.

Case 3 etc. Continue in the same way. You will need some simple combinatorics e.g. how many arrangements of three digits, four digits, etc.

The rule appears to allow case 7: 0 letters, 7 digits and 1 special character so don’t forget that.

• Shardluc's answer is simpler. – badjohn Apr 19 '16 at 10:30