First of all, only the first approach is correct ($1/n$)
the thought behind the second approach is not correct
So if we want to find the probability of guessing the correct password from the first try, using the above formula we'd say it is $1/3$. However, as long as the hacker found the correct password from the first try, the first 2 permutations are actually equivalent (we are not interested in the order in which the hacker was supposed to try the next passwords - as long as she found the correct one, she stops - or at least this is how I interpret the problem), so the correct probability would actually be $1/5$.
If we are only considering up to the first try, actually row 1 and row 2 are the same, row3 and row 4 are the same, and row5 and row6 are the same. So the probability of getting the password correct in the first try is still 1/3, but not 1/5
- The logic in your third approach is not correct neither, because not all tries have the same weight. (kind of similar mistake on your thoughts behind the 2nd approach)
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.
Best Answer
The total number of passwords should be the number of 4-6 digit passwords using the characters 2, 3, 5, and 7 minus the number of passwords using just 3, 5, and 7. For this you compute
$$(4^4 + 4^5 + 4^6) - (3^4 + 3^5 + 3^6) = 5376 - 1053 = 4323.$$
The probability that your friend guesses on the first attempt is $\frac{1}{4323}$, as you said.
The probability that your friend guesses your password on the second attempt is the probability that she guesses wrong on the first attempt and right on the second attempt. That's $\frac{4322}{4323}\cdot\frac{1}{4322} = \frac{1}{4323}$.
Similarly, let's say you look at the third attempt: you want the probability that your friend guesses wrong on the first and second tries, and then guesses your password on the third try. That happens with probability $\frac{4322}{4323}\cdot\frac{4321}{4322}\cdot\frac{1}{4321} = \frac{1}{4323}$.
The same pattern continues: assuming your friend guesses a different password every time, the probability that she guesses on the $n^\text{th}$ attempt is $\frac{1}{4323}$.
Now, as you suggested, you can add the probabilities corresponding to the first try + second try + ... + tenth try, since you want to know the odds that she guesses right on the first try or the second try or the third try, and so on.
This gives you a probability of
$$10 \cdot \frac{1}{4323} = \frac{10}{4323}.$$