Associated Topics || Dr. Math Home || Search Dr. Math

### Trying to Unlock a Cell Phone

```Date: 11/16/2003 at 12:45:46
From: Savannah
Subject: four number combination to a locked cellular phone

I put in the local newspaper that I found a cellular phone on the side
of the road.  No one answered the ad so now I thought I would use it
but it's locked by a four digit number.  I've tried a lot of
combinations and can't seem to get the right one.  Can you help?

Savannah

```

```

Date: 01/05/2005 at 14:52:55
From: Doctor Douglas
Subject: Re: four number combination to a locked cellular phone

Hi Savannah.

Although we can't tell you what the code is to unlock the phone, we
can compute the number of possible combinations (thus giving you some
information about how long the task might take).

The number of possibilities for the initial digit is 10, because the
initial digit could be any of {0,1,2,3,4,5,6,7,8,9}.  For exactly the
same reason, the number of possibilities for the second digit is 10.
This means that the number of possible combinations for *just the
first two* digits is

10 x 10 = 100.

In fact, it's not too hard to list the possible sets of two
consecutive digits.  Here's the list, where I use dots (...) to
save me from writing out every element of this somewhat boring
list: {00,01,02,03,...,08,09,10,11,...,18,19,20,21,22,...,97,98,99}.
You can see that these are just the numbers from zero to 99, where
we include leading zeroes.

Now let's add the third digit.  There are ten possibilities here,
and these combine with each of the hundred possibilities for the
first two digits:  {000,001,002,...,997,998,999}.  There are
10 x 10 x 10 = 1000 combinations in this list.  You can probably
see the pattern now:  for a sequence of N symbols, each of which
has K possibilities, the number of possible combinations is

K x K x ...x K    =    K^N
\__________/
there are N           "K to the power N"
factors of K
in this product

You can apply this formula to calculate the number of four-digit
PIN combinations.

This formula is a direct result of the "Fundamental Principle of
Counting", which can be paraphrased as "If there are P ways of doing
one thing and Q ways of doing another, then there are P x Q ways of
doing both".

I should mention that although I have used the word "combinations"
here (in keeping with its usage with respect to locks and locking),
the word "combination", as used by most mathematicians, has a
different meaning:  a way of choosing a subset of some elements from
a larger set, without regard to ordering or sequence.  For example,
choosing a set of three representatives from a group of fifteen.
For more information about these sorts of possibilities, you can
check out the following web page:

Ask Dr. Math FAQ:  Permutations and Combinations
http://mathforum.org/dr.math/faq/faq.comb.perm.html

In your problem above, each of the four elements IS distinct from
each other (i.e. knowing the first digit of the code is completely
independent from knowing the last digit of the code).  Your problem
can be thought of in these terms as a "permutation with replacement",
as illustrated by the following answer in our archives:

Combinations and Permutations with Replacement
http://mathforum.org/library/drmath/view/64626.html

Our archives also have many problems that illustrate the use of the
Fundamental Principle of Counting (counting-by-multiplication):

Combinations of Three Words
http://mathforum.org/library/drmath/view/56148.html

Path Possibilities
http://mathforum.org/library/drmath/view/56208.html

Maximum Possible Combinations
http://mathforum.org/library/drmath/view/56130.html

Combinations of Images on a TV Screen
http://mathforum.org/library/drmath/view/56108.html

http://mathforum.org/library/drmath/view/56112.html

Examples of the Fundamental Counting Principle
http://mathforum.org/library/drmath/view/54298.html

I hope that this helps you with your cell phone.  If you decide that
there are too many combinations to try each one individually, I
suggest that you take the phone to one of the service providers that
use that phone.  They usually have special equipment that can find
out to whom the phone is registered, or if it is your own phone, to
"reset" it so that it is usable.

- Doctor Douglas, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
High School Permutations and Combinations

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search