# Hello, I need help, I cant remember my cell phone pin i set last night. It is a four digit number using numbers 0-9, the only thing i remember is it does contain 1 and 3. How many possible...

Hello, I need help, I cant remember my cell phone pin i set last night. It is a four digit number using numbers 0-9, the only thing i remember is it does contain 1 and 3. How many possible combinations could there possibly be? I don't want to reset it, I will lose all my information.

*print*Print*list*Cite

Hello!

There are `10^4` pins at all. Denote the set of pins that contain **no** 1's as `B_1` and that contain no 3's as `B_3.`

We'll use the formula `n(A uu B) = n(A)+n(B)-n(A nn B)` which is true for any finite sets, particularly for `B_1` andÂ `B_3` (`n(())` means the number of elements).

The set of pins that contain 1 AND contain 3 is the complement of those which don't contain 1 OR don't contain 3, i.e. `(B_1 uu B_3)^C.` The number of pins in this set is `10^4 - n(B_1 uu B_3).` By the above formula it is

`10^4 - (n(B_1)+n(B_3)-n(B_1 nn B_3)).`

It is clear that `n(B_1)=9^4` (any number except 1 at any of 4 positions), and `n(B_3)` is the same. `n(B_1 nn B_3)` is the number of pins that don't contain 1 AND don't contain 3, there are `8^4` of those (any number except 1 and 3 at any position).

So the answer is `10^4 - (9^4+9^4-8^4)=10^4+8^4-2*9^4 = 974.`

There are too many variants to try, it is necessary to recall the pin. Try the following trick: imagine that you want to set a new pin, what could it be?