# Combinatorics and Probability Problem

The problem I am working on is:

An ATM personal identification number (PIN) consists of four digits, each a 0, 1, 2, . . . 8, or 9, in succession.

a.How many different possible PINs are there if there are no restrictions on the choice of digits?

b.According to a representative at the author’s local branch of Chase Bank, there are in fact restrictions on the choice of digits. The following choices are prohibited: (i) all four digits identical (ii) sequences of consecutive ascending or descending digits, such as 6543 (iii) any sequence start-ing with 19 (birth years are too easy to guess). So if one of the PINs in (a) is randomly selected, what is the prob-ability that it will be a legitimate PIN (that is, not be one of the prohibited sequences)?

c. Someone has stolen an ATM card and knows that the first and last digits of the PIN are 8 and 1, respectively. He has three tries before the card is retained by the ATM (but does not realize that). So he randomly selects the $2nd$ and $3^{rd}$ digits for the first try, then randomly selects a different pair of digits for the second try, and yet another randomly selected pair of digits for the third try (the individual knows about the restrictions described in (b) so selects only from the legitimate possibilities). What is the probability that the individual gains access to the account?

d.Recalculate the probability in (c) if the first and last digits are 1 and 1, respectively.

## ---------------------------------------------

For part a): The total number of pins without restrictions is $10,000$

For part b): The number of pins in either ascending or descending order is $10 \cdot 1 \cdot 1 \cdot 1$, because once the first digit is known, then the three other spots containing digits are already spoken for. The number of pins where each slot contains the same digit is $10 \cdot 1 \cdot 1 \cdot 1$, because once the first digit is known there is only one option left to the rest of the slots. The number of pins that have their first and second slot occupied by 1 and 9, respectively, is $1 \cdot 1 \cdot 10 \cdot 10 \cdot$. So, if R is the set that contains these restricted pins, then $|R| = 130$; and if N is the set that contains the non-restricted ones, meaning R and N are complementary sets, then $|N| = 10,000 - 130$. Hence, the probability is then $P(N) = 9780/10000 = 0.9870.$ However, the answer is $0.9876$. What did I do wrong?

For part c): The sample space, containing all of the outcomes of the experiment that will take place, is $|N|=9870$. When it says that the thief won't use the same pair of digits in each try, does that not allow him trying the pin 8 5 2 1 in one try and the pin 8 2 5 1 in another try?

• Ascending or descending is $14$, not $20$. That takes care of the disagreement. – André Nicolas Feb 3 '13 at 20:44
• @AndréNicolas I didn't get 14 or 20, I got 10. Your saying the answer is 14, how did you get that? – Mack Feb 3 '13 at 20:56
• @Eli: You got $2\cdot10=20$ for ascending and descending together, and André is saying that it should be $2\cdot7=14$ for both together. – joriki Feb 3 '13 at 21:04
• Oh, I see. The 2 corresponds to the two choices (ascending or descending); and the 7 corresponds to the fact that you can't start the 4-digit pin with 7,8, or 9 when ascending, and you can't start a 4-digit pin with 0,1, or 2 when descending. – Mack Feb 3 '13 at 21:14

## 4 Answers

For b): Which is the descending sequence starting with $1$ that you counted?

For c): Good question; the problem is badly worded in that regard. Taking it literally, I'd tend to interpret it as referring to unordered pairs, but since it makes little sense to couple two different PINs in this manner, I suspect that they actually mean ordered pairs. However, note that the answer doesn't depend on this.

I understand neither why the question says that the thief knows the restrictions, nor why you say that the sample space has size $9870$. The thief knows that the first and last digits are $8$ and $1$, respectively; that's not compatible with any of the sequences excluded by the restrictions, and it doesn't allow for $9870$ possibilities.

• I’d interpret is as referring to ordered pairs, partly from the language, and partly from the overall level of difficulty of the exercise. – Brian M. Scott Feb 3 '13 at 20:41
• @joriki I don't really understand what you are asking when you say, "Which is the descending sequence starting with 1 that you counted?" – Mack Feb 3 '13 at 21:00
• @Eli: Exactly. And $10-3=7$. – joriki Feb 3 '13 at 21:08
• @Eli: I found another version of the book online with the answers included. It has $.0337$ for d., which is also wrong, but can be interpreted as a rounded version of the correct result $3/89$ (see Metin's answer). So it seems they just round results without indicating it (which is rather bad style). So it seems likely that $0.0333$ is a rounded version of $3/90$. That leaves the question how they arrive at $90$ options. Perhaps they meant to say $1$ and $8$ instead of $8$ and $1$; then the birth year rule would lead to a count of $90$. – joriki Feb 4 '13 at 8:35
• @Eli: That would also explain why part c already mentions that the thief knows the restrictions, even though that's irrelevant for the question as posed. – joriki Feb 4 '13 at 8:37

For d): We have the case: $1$ * * $1$.

But the thief knows, by prohibition (i), it can not be $1111$. Thus he eleminates $1$ possibility.

Also he knows, by (iii), the second digit can not be $9$. There are exactly $10$ number of the form $19$ * $1$, namely, $1900$, $1910$, $1920$... So, at this stage he eleminates $10$ possibilities.

All in all, if he had no restrictions, there were $100$ choices for the form $1$ * * $1$. But he excluded $10 + 1 = 11$ of them and get 89 possible choices. Since he has 3 chances, the resulting possibility is $3/89$.

Just my two cents,

10^4 possibilities.

There are 14 ascending and descending groups of 4.

Keyspace 9,876

If the badguy knows two of the four spaces, he only has to guess through entropy 10^2. (None of the restrictions meet up with the range 8xx1)

3 Tries in 100

:)

• (0123)(1234)(2345)(3456)(4567)(5678)(6789) And then the reverse of those... – Ben Sep 9 '13 at 5:33

Regarding part [c], I do not think that there is something wrong with the book. As @Mack said in one of his comments, thief has to guess only two second numbers. Since the given restrictions actually do not apply on this order of numbers, he has to guess among 100 (10*10) possible combinations of the numbers.

Since he has 3 tries, the probability that he will gain desired access is 3/100.

According to Wolfram Alpha, 3/100 is exactly 0.03, which is the same as written solution from the book.

Correct me if I am wrong.