proving counting problems?

68 Views Asked by At

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.

  1. How do I show that the number of passwords is equal to $36^n - 26^n$?

    1. 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?

2

There are 2 best solutions below

0
On
  1. 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.

  2. 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}$.

0
On

Each of the $n$ positions has $10+26=36$ theoretical options--one for each digit and each letter. Hence, there are $36^n$ total theoretical passwords. (Why?) But wait! That number includes some passwords that consist of letters only, and no digits. In fact, every $n$-letter password is included in that number. (Why?) There are $26^n$ such passwords (why?), so to exclude them, we simply subtract the undesirable passwords, giving $36^n-26^n$ acceptable passwords. (P.S.: The complement rule should read $$|U|=|A|+|U-A|.$$ Do you see why?)

Now, if we want a password with exactly $k$ digits, then how many ways can we choose which $k$ characters (of the total of $n$) are digits? How many ways can we then choose $k$ digits? How many letters will there be in the password? How many ways can we choose these?