# Puzzle / Permutation question?

1. Jun 1, 2006

### thx1138

Puzzle question...

I am developing an interactive combination lock that involves utilizing a total of 9 buttons to open a door. I am wondering how many combinations there are if the answer requires a certain three to be pushed on?

I am not sure how to calculate this, but I am trying to decide if I need to use more than nine or less to make this challenging?

I have never taken a stat class so I am basically starting from scratch but I have looked on the internet for permutations, etc...with no real progress...

Thanks

THX1138

2. Jun 1, 2006

### Tide

Will the three buttons need to be pressed in a particular order?

3. Jun 1, 2006

### thx1138

No;

They will just have to have the correct three turned on when they try to open the door. Order of pressing does not matter.

Thanks

THX1138

4. Jun 1, 2006

### mattmns

If order does not matter, then I believe the number of combinations will be: (9 choose 3) = 84

5. Jun 1, 2006

### thx1138

Thats it?
I thought it would be more than 84...?

Now I am depressed because I need it to be more than 84 combinations

THX1138

6. Jun 1, 2006

### Tide

If you push it up to 4 buttons the number becomes 126, FWIW.

7. Jun 1, 2006

### thx1138

Both 84 and 126 seem low to me. However I am not a math person. Can someone explain or show how these numbers are calculated....?

My thought process is:

At first you have nine choices, then eight, then seven....
so 9 X 8 X 7 = 504....?:uhh:

THX1138

8. Jun 1, 2006

### Hurkyl

Staff Emeritus
The trick to counting is to figure out just what you counted.

You've counted the number of ways to choose a sequence of three (different) numbers.

Is that the same as a combination1? No! 123 and 321 are different sequences of three numbers, but they denote the same combination, right?

So you've counted the number of ways to punch in three digits. (504)
How many different ways is there to punch in each individual combination?

Once you know that, you can divide to find the number of combinations! (Because the answer to that second question is the same for any combination)

9. Jun 1, 2006

### thx1138

Correct... 123 would be the same as 321.

The order does not matter, just having them actually pushed.

So I guess I am still confused...
How many ways are there to punch in given combination?
I am not sure:
123, 213, 321, 231, 132, 312, others...?hmmm....

Then divide by 504?

THX1138

10. Jun 1, 2006

### mattmns

504/6 = 84

Note how "Choose" works (I am going to assume you are familiar with factorials!)

By definition (N Choose R) = $$\frac{N!}{(N-R)!R!}$$

So (9 Choose 3) = $$\frac{9!}{(9-3)!3!} = \frac{9x8x7x6x5x4x3x2x1}{(6x5x4x3x2x1)x(3x2x1)}$$

And if we cancel the 6, 5, 4, 3, 2, 1, from the bottom and top we are left with: $$\frac{9x8x7}{3x2} = \frac{504}{6} = 84$$

Note that on the bottom we have your 6 combination of pushed buttons (the exact 6 you posted), and on the top we have your 9x8x7 = 504

edit...

If you are not happy with 124, then you will have no choice but to make more possible buttons. For example, if you increase the number of buttons to 12, and still require 3 for the combination, then there will be (12 Choose 3) = 220 combination. Or if you increase the number from 3 to 4, you will have (12 choose 4) = 495 combinations, or you can increase even more, to say 5 required to open the lock, and get (12 choose 5) = 792. Whatever you decide to do, you will need more than 9 possible buttons to get more than 126 combinations.

Last edited: Jun 1, 2006
11. Jun 2, 2006

### thx1138

Thank you "Mattmns" as well as others who helped here.

I now have an understanding of the logic with this idea.

Not sure what I am going to do yet, but I think I might settle for
10 choose 4 .

Another note, what happens if the participants do not know how many buttons are needed for the combination ....?
Then that opens the door for every possible arrangement. Any Idea how I fiqure all possible combinations for 9 or 10 buttons?

Thanks again

THX1138

EDIT: BTW if you type "10 choose 4" in google it calculates automatically for you; most of you most likely already know that.

Last edited: Jun 2, 2006
12. Jun 2, 2006

### mattmns

Making the number required to open the lock unknown would definitely increase the combinations, and difficulty. To figure out the number of combinations you would just need to add up the number of combinations for each number from 1-9 if there are 9 total, or 1-10 if there are 10 total. For example, if we wanted to find this out for 9 total buttons we would do the following:

(9 choose 1) + (9 choose 2) + (9 choose 3) + (9 choose 4) + (9 choose 5) + (9 choose 6) + (9 choose 7) + (9 choose 8) + (9 choose 9) = 511 total combinations.

13. Jun 2, 2006

### rhj23

wouldn't it be easier to consider that in any set arrangement any individual button is either on or off, and each independently. so the total number of possibles is 2^9 = 512. it is clear that all of these are distinct

(i have one more than you because my method includes 'all off' as a possible arrangement, which it is not in this case)

14. Jun 3, 2006

### mattmns

Yep that is much easier

15. Jun 9, 2006

### rcgldr

Here's an answer that doesn't require knowledge of the choose function:

In order to get 3 good buttons, on the first pick, you have 3 good buttons out of 9 total buttons that are good, then on the second pick you have 2 good buttons out of 8 that are good, and on the third pick you have 1 out of 7 buttons that are good.

3/9 x 2/8 x 1/7 = 6/504 = 1/84

Success happens when there are no bad picks:

There are 8 possible outcomes when pushing the buttons:

Code (Text):

(all good, 0 bad)   = 3/9 x 2/8 x 1/7 =   6/504 =  1/84
1st bad             = 6/9 x 3/8 x 2/7 =  36/504 =  6/84
2nd bad             = 3/9 x 6/8 x 2/7 =  36/504 =  6/84
3rd bad             = 3/9 x 2/8 x 6/7 =  36/504 =  6/84
1st + 2nd bad       = 6/9 x 5/8 x 3/7 =  90/504 = 15/84
1st + 3rd bad       = 6/9 x 3/8 x 5/7 =  90/504 = 15/84
2nd + 3rd bad       = 3/9 x 6/8 x 5/7 =  90/504 = 15/84
1st + 2nd + 3rd bad = 6/9 x 5/8 x 4/7 = 120/504 = 20/84
-------------------------------------------------------
sum of all cases                      = 504/504 = 84/84

16. Jun 9, 2006

### rcgldr

I've seen some 5 button locks on doors, but these allow 1 or 2 buttons to be pushed at a time, and three patterns are used to unlock the door. I haven't seen a case where the same button is pressed twice in a row, but it appears the mechanism allows this.

If double buttons were used for all three patteerns, then you'd have (5 choose 2)^3 or 1/1000 chance of guessing the pattern.

If only single buttons were used, then it would be 1/125 chance.

The fact that it could be either on any of the 3 tries makes it even more unlikely to guess the combination.