Permutations of distinct objects · Mathematics Class 11–12 | StemPy Lab
Course 4.2·Lesson 1 of 3
Permutations of distinct objects
A permutation is an arrangement of objects in a definite order. Filling r places from n different objects gives n(n−1)⋯(n−r+1) ways, written nPr=(n−r)!n!
about 25 min1 simulation1 practice question1 Python program5 questions to check yourself
This lesson is free to read. Enroll free to keep your place and take the tests.
Lesson 1 of 3Show all lessonsHide
Try the code and the simulations beside the lesson.
Order matters
Three friends, Anu, Bilal and Chitra, finish a race. The results Anu first, Bilal second and Bilal first, Anu second are different results. The same people, in a different order, give a different outcome.
An arrangement of objects in a definite order is called a permutation. This course counts permutations without listing them all.
Filling places
Seven letter tiles, A to G, lie on a table. Gauri makes a code by placing four of them in a row. How many codes can she make?
Think of four empty places.
The 1st place can take any of the 7 tiles.
The 2nd place can take any of the 6 tiles left.
The 3rd place has 5 choices, and the 4th has 4.
By the multiplication principle, the number of codes is 7×6×5×4=840.
Four boxes in a row, labelled 1st place to 4th place, with the numbers 7, 6, 5 and 4 inside them and multiplication signs between them. Above each box it says how many letters are left: 7, 6, 5 and 4. After the last box it reads = 840. The title says: four letters in order from A, B, C, D, E, F, G, each place has one choice fewer.
The tree shows the same idea for three letters. Each level has one choice fewer than the level above.
A tree diagram that starts from one point at the top. It splits into three branches, A, B and C, marked 3 choices. Each of these splits into the two letters left, marked 2 choices, and each of those ends in the one letter left, marked 1 choice. The six paths spell ABC, ACB, BAC, BCA, CAB and CBA. The title reads 3 × 2 × 1 = 6 orders of A, B and C.
The formula for nPr
The number of permutations of n different objects taken r at a time is written nPr. Filling r places gives r factors, each one less than the last:
nPr=n(n−1)(n−2)⋯(n−r+1).
Multiply the top and the bottom by (n−r)!. The top becomes n!, so
nPr=(n−r)!n!,0≤r≤n.
For Gauri, 7P4=3!7!=65040=840.
Why 0! is 1
Arranging all n objects means r=n. Filling n places gives n! ways, so nPn=n!. The formula gives 0!n!. The two agree only if 0!=1. That is why we take 0!=1.
Also nP0=n!n!=1: there is exactly one way to fill no places at all.
When repeats are allowed
Suppose a tile can be used again, like the digits of a bicycle lock. Then every place has all n choices. Filling r places gives
n×n×⋯×n=nr.
A lock with 3 dials, each showing 0 to 9, has 103=1000 settings. If no digit may repeat, it has only 10P3=10×9×8=720.
Set r larger than n. With no repeats, you run out of objects, and there is no way to fill the places.
A useful relation
Take the first place on its own. It has n choices, and the other r−1 places are filled from the n−1 objects left. So
nPr=n×n−1Pr−1.
A worked example
Eight students reach a hall with 5 chairs in a row. In how many ways can 5 of them be seated?
Step 1. Does order matter? Yes. Swapping two seated students gives a new seating.
Step 2. Count. Fill the chairs from left to right: 8P5=8×7×6×5×4=6720.
Answer:6720 seatings.
Finding n
Sometimes n is the unknown. If nP2=56, then n(n−1)=56. Two whole numbers in a row multiply to 56, so n=8.
Practise with new numbers
Try it in Python
The program lists the codes of four tiles from seven with itertools.permutations, then counts them by the formula.
Common mistakes
Using nr when repeats are not allowed. Each object can fill only one place.
Writing r!n!. The bottom is (n−r)!, the orders of the objects left out.
Stopping the product one factor early.8P5 has five factors, ending at 4.
Thinking 0!=0. It is 1, so that nPn=n!.
Remember these
A permutation is an arrangement in a definite order.
nPr=n(n−1)⋯(n−r+1)=(n−r)!n!.
nPn=n! and 0!=1.
With repeats allowed, r places from n objects give nr arrangements.
nPr=n×n−1Pr−1.
Check yourself
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
Find 6P3.
A shelf has room for 3 of Farhan's 5 different books. In how many orders can he fill it?
How many 2 letter strings can be made from the 5 vowels if a vowel may repeat?
Explain in one line why nPr=(n−r)!n! needs 0!=1.
Solve nP2=30 for the whole number n.
Enroll free in Permutations
Every lesson is open to read. Enrolling also lets you:
Mark lessons done and carry on where you stopped.
Take the tests of this lesson and its course.
Count the course towards the certificate for its chapter.