# Factorial

The factorial of a positive integer, n, denoted n!, is the product of the positive integers less than or equal to n. E.g.,

5! = 5 * 4 * 3 * 2 * 1 = 120
10! = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1 = 3628800

0! is defined to be 1, by working the relationship n! = n (n-1)! backwards.

Sometimes, n! is read 'n shriek', in reference to the exclamation mark notation.

A good approximate formula for factorials is n! ~ (2 π n)1/2 (n/e)n, which is known as Stirling's Formula, after James Stirling, the mathematician who discovered it. It is quite accurate when n is large, however it has to be interpreted right: it means that the quotient of the two functions approaches 1 as n approaches infinity; it does not mean that their difference approaches zero.

The related gamma function Γ(z) can be defined for all complex numbers z except for z = 0, -1, -2, -3, ... It has the property

Γ(n+1) = n!

when n is a positive integer. By using this relation, we can extend the definition of factorials and define z! for all complex numbers z except the negative integers.

Factorials are important in combinatorics because there are n! different ways of arranging n distinct objects in a sequence (see permutations). They also turn up in formulas in calculus, for instance in Taylor's theorem because the n-th derivative of the function xn is n!.