Sub topic 2
Factorials and Arranging n Distinct Objects
This chapter assumes you can simplify fractions, work with exponents and products, and use the multiplication principle from the previous chapter: if one task can be done in a ways and a second task in b ways, the two together can be done in a × b ways. Here we turn that principle into the factorial, the basic tool for counting arrangements.
What a factorial is
The factorial of a positive integer n, written n!, is the product of all whole numbers from 1 up to n.
n! = n × (n − 1) × (n − 2) × ... × 2 × 1
| n | n! |
|---|---|
| 0 | 1 |
| 1 | 1 |
| 2 | 2 |
| 3 | 6 |
| 4 | 24 |
| 5 | 120 |
| 6 | 720 |
| 7 | 5040 |
| 8 | 40320 |
Memorize the values up to 7! or 8!. Under exam time pressure, you do not want to multiply them out each time.
Factorials grow very fast. 10! is already 3,628,800. This matters for estimation. If an arrangement count for 10 distinct objects comes out as a few hundred, something has gone wrong.
The recursive property
Each factorial is built from the one before it:
n! = n × (n − 1)!
This lets you cancel factorials in a fraction. For example:
- 8! / 6! = 8 × 7 × 6! / 6! = 56
- 10! / (7! × 3!) = (10 × 9 × 8) / 6 = 120
The method is to expand the larger factorial only until the smaller factorial appears, then cancel. Never compute both in full.
Why 0! equals 1
Defining 0! = 1 can look arbitrary, but it is forced by the recursive property. Put n = 1 into n! = n × (n − 1)!:
1! = 1 × 0!, so 0! = 1.
It also fits the counting meaning. There is exactly one way to arrange zero objects: do nothing. Later formulas such as nCn = n! / (n! × 0!) = 1 depend on this.
Common mistakes with factorial arithmetic
- Factorials do not add or multiply across the symbol. (3 + 2)! is 120, but 3! + 2! is 8.
- (2n)! is not 2 × n!. For n = 3, (2n)! = 720, while 2 × 3! = 12.
- Negative integers and fractions have no factorial at this level.
Arranging n distinct objects in a row
Suppose you have n different objects and want to place all of them in a row. Fill the positions one at a time from left to right:
- Position 1 can take any of the n objects.
- Position 2 can take any of the remaining n − 1.
- Position 3 can take any of the remaining n − 2.
- This continues until the last position, which has only 1 object left.
By the multiplication principle, the total number of arrangements is n × (n − 1) × ... × 1 = n!.
The word "distinct" matters. This formula counts arrangements in which every object is different, so swapping any two objects gives a new arrangement. If some objects are identical, n! overcounts. A later chapter handles that case.
Worked example 1: a shelf of books
In how many ways can 6 different books be arranged on a shelf?
Each arrangement uses all 6 books, so the answer is 6! = 720.
Worked example 2: a word with distinct letters
How many arrangements of the letters of the word CAT exist, with or without meaning?
All three letters differ, so the count is 3! = 6. They are ACT, ATC, CAT, CTA, TAC and TCA.
Worked example 3: arranging the letters of LOGARITHM
LOGARITHM has 9 letters, and all of them are different. The number of arrangements is 9! = 362,880.
Read the word carefully before you apply n!. Check each letter against the others. A single repeated letter means this formula no longer applies.
Checking factorial results in code
The following code confirms the values above and shows the cancellation idea numerically.
import math
print(math.factorial(0)) # 1
print(math.factorial(6)) # 720
print(math.factorial(9)) # 362880
# Cancellation: 8! / 6! = 8 * 7
print(math.factorial(8) // math.factorial(6)) # 56
# Brute-force check that CAT has 3! arrangements
from itertools import permutations
arrangements = ["".join(p) for p in permutations("CAT")]
print(sorted(arrangements)) # ['ACT', 'ATC', 'CAT', 'CTA', 'TAC', 'TCA']
print(len(arrangements) == math.factorial(3)) # TrueBrute force with itertools.permutations is a useful way to test a formula on a small case. You cannot do this in the exam, but you can use the same habit: test your method on a smaller version of the problem, such as 3 objects instead of 7, and count by hand.
Arranging only some of the objects
Sometimes you do not use every object. If you have 5 distinct objects and fill only 3 positions, the first position has 5 choices, the second 4, and the third 3. The count is 5 × 4 × 3 = 60. In factorial form, this is 5! / 2!, because dividing by 2! cancels the last two factors of 5!. The next chapter develops this idea as the permutation formula nPr. For now, notice that the same one-position-at-a-time reasoning produces it.
Treating a group as one object
A useful extension of n! is to glue some objects together and treat the glued group as one object. Suppose 5 distinct people must be arranged in a row, with A and B always side by side.
- Treat A and B as one block. Now there are 4 units to arrange (the block and the other 3 people): 4! = 24 ways.
- Inside the block, A and B can be in two orders (AB or BA): 2! = 2 ways.
- By the multiplication principle, the total is 4! × 2! = 48.
Forgetting step 2 is one of the most common errors. The restrictions chapter covers this method more fully. Here the point is that n! is the engine behind it.
Common errors with n!
- Using n! when objects repeat. The letters of BANANA are not all distinct, so 6! overcounts.
- Using n! when only some objects are placed. Filling 3 of 5 positions needs 5 × 4 × 3, not 5!.
- Confusing arrangement with selection. If the problem asks only which objects are chosen and order does not matter, factorials alone are not enough. The combinations chapter covers this.
- Mishandling cancellation. Write the larger factorial down only to the point where the smaller one appears.
A short CAT-style practice problem
Simplify 12! / (10! × 2!).
Expand 12! only until 10! appears: 12 × 11 × 10!. Cancel 10!, which leaves (12 × 11) / 2 = 66.
This value is also 12C2, which previews the next chapters.
Exercise
Seven different books are placed on a shelf. Two of them, a physics book and a chemistry book, must always stand next to each other. How many arrangements are possible?
Show answer
Treat the two books as one block. That gives 6 units to arrange: 6! = 720 ways. The two books can be in 2 orders inside the block. Total = 720 × 2 = 1440.
Exercise
Simplify 9! / (7! × 2!) and state what the answer represents if you are choosing 2 objects from 9.
Show answer
9! = 9 × 8 × 7!, so the expression is (9 × 8) / 2 = 36. This equals 9C2, the number of ways to select 2 objects from 9 when order does not matter.
Exercise
In how many ways can the letters of the word ORANGE be arranged so that the arrangement uses all six letters?
Show answer
All six letters are different, so the number of arrangements is 6! = 720.