Probability password problem (6 characters) 4 digits 2 letters

combinatoricsprobability

A password is made from 6 characters , 4 of them are digits (0-9) and 2 are letters a-z (26 letters only lower case) each digit and letter can appear once at most.

  1. Someone choose a random password he remembers the letters and digits that make his password however he does not remember their order , what is the probability of getting it right in a single try?

  2. He remembers that the letters were used as the first 2 characters but does not remember the letters and digits what is the probability of getting it right in a single try?

  3. what is the probability of the password having the letter a and at least one of the digits 1,2?

I will start with "2" because I might have got it right ( not sure if it is right or just a coincidence ) if the first 2 characters are letters then we have $26*25*10*9*8*7$ and since we want him to get it right from a single try we will do $\frac 1 {26*25*10*9*8*7}$ $=$ $3.05*10^{-7}$ which is right according to the book but I am not sure if it is a coincidence.

for "1" since he knows the digits and letters he used we only need to sort them so my thought would be $6!$ and divide by $26*25*10*9*8*7$ but it is not right so I tried also sorting the digits first $4!$ and then the letters so we get $4!*2!$ and again divide by $26*25*10*9*8*7$ but again it is not right , then tried picking the digits first ${6 \choose 4}$ and multiply by the 2 characters left ${2 \choose 2}$ and divide by $26*25*10*9*8*7$ which is also not right.. the answer should be $1.4*10^{-3}$

And for "3" I thought about using Complement so my try was $1-$ $\frac {{6 \choose 4}8*2} {26*25*10*9*8*7}$ but I am not even close as the answer should be $0.051$

Thank you for any help , tips and hints all is appreciated!

Best Answer

Your answer and reasoning for problem 2 are both correct.

A password is composed of six characters. Four of them are digits (0 - 9) and two are letters (a - z). Each digit and letter can appear at most once. He remembers the letters and digits that make his password. However, he does not remember their order. What is the probability of getting the password right in a single try?

Since he knows the letters and digits used in the password, the only thing he needs to guess is the order in which they appear. There are $6!$ possible orders in which six distinct characters could appear, of which only one is correct. Hence, the probability that he guesses correctly the first time is $$\frac{1}{6!} = \frac{1}{720}$$

A password is composed of six characters. Four of them are digits (0 - 9) and two are letters (a - z). Each digit and letter can appear at most once.What is the probability of the password having the letter a and at least one of the digits 1, 2?

There are $\binom{26}{2}$ ways to select two distinct letters, $\binom{10}{4}$ ways to select four distinct digits, and $6!$ ways to arrange six distinct characters, so there are $$\binom{26}{2}\binom{10}{4}6!$$ possible passwords.

We will count the favorable cases using the Inclusion-Exclusion Principle.

The number of passwords which contain the letter a and the digit 1 is $$\binom{1}{1}\binom{25}{1}\binom{1}{1}\binom{9}{3}6! = \binom{25}{1}\binom{9}{3}6!$$ since we must choose the letter a, one of the other $25$ letters, the digit 1, and three of the other nine digits, then arrange the six distinct characters.

By symmetry, the number of passwords which contain the letter a and the digit 2 is also $$\binom{25}{1}\binom{9}{3}6!$$

However, if we add these two cases, we will have counted those cases in which the password contains the letter a and both the digits 1, 2 twice, once when we counted passwords containing the letter a and the digit 1 and once when we counted passwords containing the letter a and the digit 2. We only want to count them once, so we must subtract them from the total.

The number of passwords which contain the letter a and both the digits 1 and 2 is $$\binom{1}{1}\binom{25}{1}\binom{2}{2}\binom{8}{2}6! = \binom{25}{1}\binom{8}{2}6!$$ since we must select the letter a, one of the other $25$ letters, both the digits 1 and 2, and two of the other eight digits, then arrange the six distinct characters.

By the Inclusion-Exclusion Principle, the number of favorable passwords is $$\binom{25}{1}\binom{9}{3}6! + \binom{25}{1}\binom{9}{3}6! - \binom{25}{1}\binom{8}{2}6!$$ so the probability that an admissible password will contain the letter a and at least one of the digits 1, 2 is $$\frac{2\dbinom{25}{1}\dbinom{9}{3}6! - \dbinom{25}{1}\dbinom{8}{2}6!}{\dbinom{26}{2}\dbinom{10}{4}6!} = \frac{2\dbinom{25}{1}\dbinom{9}{3} - \dbinom{25}{1}\dbinom{8}{2}}{\dbinom{26}{2}\dbinom{10}{4}}$$ Note that the answer depends only on which characters appear in the password, not the order in which they appear.