Definition and basic examples
The factorial of a nonnegative integer n, written n!, is the product of all positive integers from 1 up to n. By convention 0! = 1. Thus 4! = 4 × 3 × 2 × 1 = 24 and 3! = 6. The factorial counts the number of distinct orderings (permutations) of n distinct items: for three letters A, B and C the six possible orderings are shown below:
- ABC
- ACB
- BAC
- BCA
- CAB
- CBA
Elementary properties and computation
The factorial satisfies the recursive relation n! = n × (n − 1)! for every integer n ≥ 1, and that identity together with 0! = 1 uniquely defines the sequence. This makes the factorial a simple example of recursion in mathematics and programming. Factorials grow very rapidly: 10! = 3,628,800, and values for even moderately large n quickly exceed typical computer number ranges.
Some basic properties and consequences:
- Permutation count: n! equals the number of ways to order n distinct objects.
- Binomial coefficients: combinations use factorials: C(n,k) = n!/(k!(n−k)!).
- Empty product: 0! = 1 follows from treating the product over an empty set as 1.
- Undefined for negative integers: factorial is not defined at negative integers because the product interpretation fails there.
History and analytic extension
The factorial has roots in basic counting and early combinatorics. Mathematicians later sought continuous analogues of the discrete factorial: the Gamma function Γ(z) is the classical extension satisfying Γ(n+1) = n! for positive integers n, allowing factorial-like values at many non-integer and complex arguments. This analytic continuation revealed deeper connections between factorials, complex analysis and special functions.
Approximation and growth
Because n! increases very quickly, exact values become large and unwieldy. Asymptotic formulas such as Stirling's approximation provide accurate estimates for large n and are widely used in probability, statistics and physics. Computationally, factorials present challenges: integer overflow in programming, the need for arbitrary-precision arithmetic, or using logarithms to handle huge values are common strategies.
Applications and notable uses
Factorials appear in many fields of mathematics and applied science: combinatorics (counting permutations and combinations), series expansions (Taylor and Maclaurin series involve n! in denominators), probability (arrangements and occupancy problems), and algebra (factorial polynomials). They also show up in physics (states counting) and computer science (algorithmic complexity analyses and recursion examples).