The factorial of a positive integer n equals the product of all positive integers less than or equal to n. This is denoted as n!
Mathematically, the formal expression for factorial is:
In the case of 0, sometimes a special definition declares that
even though one would expect that to be zero. This special definition is justified by saying that the product of no numbers is equal to 1. Another way to justify it is to observe that in general,
Factorials frequently make an appearance in the mathematics of combinatorics and statistics. The most direct application concerns the number of permutations of a set of distinguishable objects—that is, the number of ways n different things can be arranged.
In general, n different things can be arranged in n! ways. For example, three objects can be arranged in 3! = 6 different ways:
- A B C
- A C B
- B A C
- B C A
- C A B
- C B A
It is easy to see that this is always true. We have seen that three objects can be arranged in six ways. If we now add a fourth object, D, we can see that for each arrangement there are four different places where we can insert the D. For example, starting with A B C, we can get
- D A B C
- A D B C
- A B D C
- A B C D
Corresponding to each permutation of three objects, there are four permutations of four objects, so there are 4 * 6 = 24 permutations of four objects. Similarly, there are 5 * 24 = 120 permutations of five, 6 * 120 = 720 permutations of six, and so forth.
Change-ringing has been a popular hobby or pastime in England since the 1600s. It consists of ringing a set of bells, such as the bells in a church steeple, with the goal of ringing them in every possible permutation. This is called a "full peal."
The number 7! in Plato's Laws
A curious use of factorials occurs in Plato's Laws. In Book V he says the citizens of his ideal state should be exhorted:
- "Good friends, honor order and equality, and above all the number 5040.
5040 is 7! or seven factorial,
The ideal state is to contain exactly 5040 citizens. His reason is that this number can be divided exactly by every number from 1 to 10, as well as 12, 20, 21, and 144, which he seems to think is important:
- We will fix the number of citizens at 5040, to which the number of houses and portions of land shall correspond. Let the number be divided into two parts and then into three; for it is very convenient for the purposes of distribution, and is capable of fifty-nine divisions, ten of which proceed without interval from one to ten. Here are numbers enough for war and peace, and for all contracts and dealings. These properties of numbers are true, and should be ascertained with a view to use.
- Plato, Laws, Book VI, tr. Benjamin Jowett