Let n >= 1 be an integer. We consider passwords consisting of n characters, each character being a digit or a lowercase letter. A password must contain at least one digit.
How do I show that the number of passwords is equal to $36^n - 26^n$?
- let k be an integer with 1 <= k <= n. Prove that the number of passwords with exactly k digits is equal to $${n \choose k} 10^k 26^{n-k} $$ ?
This what my solution to the text book question:
for question one i used the complement rule whic states |U| = |A| - |U-A|, would that be enough to show $36^n - 26^n$?
how do I solve number 2?
Yes: there are 36 available characters, so the number of strings of length $n$ is $36^n$. The ones we remove are those without at least one digit, which just means those with no digits. These strings only have 26 available characters (only the letters), so there are $26^n$ of them.
There are $k$ "digit slots" and $n-k$ "letter slots", giving $10^k26^{n-k}$. It only remains to account for shuffling these slots around. Do this by choosing $k$ slots out of the $n$ slots to be for digits --- there are ${n \choose k}$ ways of doing so --- the rest of them will be for letters. Of course, we could have chosen which slots are for letters instead, but it's the same because ${n \choose k} = {n \choose n-k}$.