A pin can be composed of 4 or 5 characters short and each character can be a capital letter, lower case letter or a number. If each pin must be composed of one capital, a lower case letter and a number, how many possible pins are valid ?
My thinking is that:
First count the 4-character pin, which is 26*26*10*62, 26 for Cap and lower case, then 10 for (0-9), 62 for all Cap, lower case and 10 digit.
Then count the 5- character pin, which is 26*26*10*62*62
Which gives me 26,404,560 as total. However I was told is not correct. Any hints are appreciated.
This is more complicated than you might think. Here is how you do it for the 4-character case:
Count the number of total PINs, valid or not: $62^4$.
Subtract:
But now you have subtracted some PINs twice, namely those PINs missing two compulsory categories. So you have to add these back on:
So the number of valid 4-character PINs is $62^4-36^4-36^4-52^4+10^4+26^4+26^4$. The 5-character case is similar.
Actually, looking back, it wasn't all that complicated!
This procedure (subtracting then adding, then (if necessary) subtracting and adding...) is called the Inclusion-exclusion principle, and is often useful in combinatorics.