# Permutations Formula

In the previous node, you ordered an entire group. But sometimes you just need to select some elements in a certain order.
For example, if 10 students enter a poetry contest and you again need to pick 1st, 2nd and 3rd place. How many ways could you pick them? 10! would give you the number of ways to order all 10 contestants, but you just need to pick 3.

(Scroll down for the solution.)

You multiply for each possibility like before, but stop once you've chosen the 3 winners. In this case the solution would be:
10 x 9 x 8,
since then all 3 winners have been chosen. Notice that this is equivalent to:

10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1
7 * 6 * 5 * 4 * 3 * 2 * 1

or, in more concise form:
10!
7!   =  720

General Rule
Whenever you need to permute r from n elements, you can just multiply n*(n-1)*(n-2)... until you've selected r elements. Notationally, this is equivalent to:

nPr =
n!

(n-r)!

The shortcut for this formula is "permute" or "P". So instead of typing it all out by hand, you can just type
(n permute r) in a calculating device.
In the poetry contest example, you could just do (10 permute 3) = 720. However, you sometimes need to know how permutations work, since the formula cannot be applied in all cases.

### Challenge

On many house locks, each button can be used only once in the code. Given a lock with 12 buttons, how many possible codes are there that are either 4 or 5 'buttons' long?

Alternatively, you can try out Learneroo before signing up.

• #### Joshua Berlin

I like where you are going with these challenges, but would like to see more examples. Some of the working can be tricky to understand. One way of doing this would be to show 1 or two examples with failure to show how not do calculate some of the challenges.

• #### Learneroo

@Joshua Thank for your feedback. I think that's a good idea, and I will look into doing it. However, I'll want to balance it with making it easy for people to look up how to do a specific topic without being distracted by the incorrect approach.

• #### Bryan

Great explanation, but isn't 7! = 5040? Do you mean 6! = 720?

• #### Learneroo

It's 10! / 7! = 720

Sorry the division line wasn't showing clearly.