In: Physics
Consider passwords of length 8 using symbols from the set of lower case letters: {a, b, c, ..., z}.
(a) How many such passwords use the letter p exactly two times and the letter q exactly two times? To illustrate, both akpqbqop and quaqpoop satisfy this condition. Include a brief indication of your strategy.
(b) How many such passwords use the letter p exactly once and the letter q exactly once and also have letters arranged so the p is not next to the q? To illustrate, we want to count passwords like amkquoop but not moopguzz or whaqpodo since these have the symbol p next to the q. Include a brief indication of your strategy.
a) For a password that contains 'p' exactly 2 times and q exactly 2 times, this means that the other 4 letters of the password are made of the 24 other letters (i.e the alphabet not including p and q).
How many 4 letter passwords can we make with 24 letters?
This is given by because there are 24 choices for each of the four places in the password.
Now, how can we add the p's and q's into each of these choices
Now, let us place the two letter 'p's into the password. There are 5 locations we can place the first 'p' in- before the first letter of our earlier 4 letter password, between the first and second, between second and third, b/w third and fourth and after the fourth letter. Now that we have a five-letter password, the second 'p' has 6 locations where it can be placed in. Does this mean that that for each of our earlier 4 letter passwords, there are 5*6=30 ways we can add the two p's? Remember that while doing so, we would be counting each password twice because the two p's are indistinguishable. Therefore, there are 30/2=15 unique six letter passwords that we can make from each 4 letter password.
Similarly, we can now add the q's. There are 7 places to add the first q into the six letter password and 8 places to add the second after adding the first.So. there are 7*8/2=28 unique 8 letter passwords we can make from the six letter password.
This means that the total number of 8 letter passwords containing 2 p's and 2 q's is:
b) We want a password with exactly one p and one q. So, there are six letters in the password that is not p or q.
The number of ways to get such a six letter password are because there are 24 choices for each of the six places in the password.
Now, there are seven locations in this six letter password where we can add additional letters - before the first letter, b/w the first and second and so on.
We are stipulated that the p and q must not be adjacent. So, if we choose one of these seven locations to place the p, we must place the q in one of the other six locations.
Hence, the number of ways we can add exactly one p and exactly one q to the six letter password to make an eight letter password where the p and q are not adjacent is given by 7*6=42.
Therefore, the total number of passwords satisfying the conditions is: