product of all integers between 1 and the integral input of the function From Wikipedia, the free encyclopedia
In mathematics, the factorial of a whole number , written as ,[1] is equal to the product of and all the whole numbers less than it. In symbols, .
For example, the factorial of 4, written as 4!, equals 24. This is because . In symbols, we can write . For some technical reasons, is equal to .[2][3]
Factorials can tell us how many possible ways there are to arrange objects.[2][3] For example, if we have three letters (A, B, and C), we can list them as follows: ABC, ACB, BAC, BCA, CAB, and CBA. This is the manual way of solving the problem. It shows that there are six ways to arrange three different objects--in this case, letters.
The mathematical way to solve this problem involves factorials. At first, we have a choice of three different letters (A, B, or C). Then, after we choose one letter, there are two letters left. Finally, there is only one letter left. If we multiply these numbers together, we will get the total number of ways to arrange our letters: . So A, B, and C can be arranged in six different ways.
The factorial function grows very fast. There are ways to arrange 10 items.[4]
Factorials are also used to find permutations and combinations. In a permutation, we begin with objects and want to know how many different ways we can order a subset of them. For example, suppose there are runners in a race. After the race is over, how many different ways can these eight runners stand on the winners' podium (first, second, and third), so that ?[2]
The way to find the answer is to calculate the following: . The answer is .
Combinations are the same, except that for a combination, the order of the objects does not matter. Therefore, the way to calculate a combination is .
Factorials are not defined for negative integers. However, the related gamma function () is defined over the real and complex numbers (except for negative integers).[3]