# Factorial

product of all integers between 1 and the integral input of the function

In mathematics, the factorial of a whole number ${\displaystyle n}$, written as ${\displaystyle n!}$,[1] is equal to the product of ${\displaystyle n}$ and all the whole numbers less than it. In symbols, ${\displaystyle n!=n(n-1)(n-2)...(3)(2)(1)}$.

For example, the factorial of 4, written as 4!, equals 24. This is because ${\displaystyle 4\times 3\times 2\times 1=24}$. In symbols, we can write ${\displaystyle 4!=4(3)(2)(1)=24}$. For some technical reasons, ${\displaystyle 0!}$ is equal to ${\displaystyle 1}$.[2][3]

## Arranging Objects

Factorials can tell us how many possible ways there are to arrange ${\displaystyle n}$  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: ${\displaystyle 3!=(3)(2)(1)=6}$ . So A, B, and C can be arranged in six different ways.

The factorial function grows very fast. There are ${\displaystyle 10!=3,628,800}$  ways to arrange 10 items.[4]

## Permutations and Combinations

Factorials are also used to find permutations and combinations. In a permutation, we begin with ${\displaystyle n}$  objects and want to know how many different ways we can order a subset ${\displaystyle r}$  of them. For example, suppose there are ${\displaystyle n=8}$  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 ${\displaystyle r=3}$ ?[2]

The way to find the answer is to calculate the following: ${\displaystyle P(n,r)=n!/(n-r)!}$ . The answer is ${\displaystyle 336}$ .

Combinations are the same, except that for a combination, the order of the ${\displaystyle r=3}$  objects does not matter. Therefore, the way to calculate a combination is ${\displaystyle C(n,r)=n!/((n-r)!r!)}$ .

## Notes

Factorials are not defined for negative integers. However, the related gamma function (${\displaystyle \Gamma (x)}$ ) is defined over the real and complex numbers (except for negative integers).[3]

## References

1. "Compendium of Mathematical Symbols". Math Vault. 2020-03-01. Retrieved 2020-09-09.
2. Willers, Michael (2021). Mathematics: From Algebra to Algorithms, Adventures in Numbers. London, UK: New Burlington Books. pp. 126–7. ISBN 978-1-80242-020-3.
3. Weisstein, Eric W. "Factorial". mathworld.wolfram.com. Retrieved 2020-09-09.
4. "Factorial Function !". www.mathsisfun.com. Retrieved 2020-09-09.