Factorial
In mathematics, the factorial of a non-negative integer , denoted by , is the product of all positive integers less than or equal to . The factorial of also equals the product of with the next smaller factorial: For example, The value of 0! is 1, according to the convention for an empty product.[1]
For other uses, see Factorial (disambiguation).
Factorials have been discovered in several ancient cultures, notably in Indian mathematics in the canonical works of Jain literature, and by Jewish mystics in the Talmudic book Sefer Yetzirah. The factorial operation is encountered in many areas of mathematics, notably in combinatorics, where its most basic use counts the possible distinct sequences – the permutations – of distinct objects: there are . In mathematical analysis, factorials are used in power series for the exponential function and other functions, and they also have applications in algebra, number theory, probability theory, and computer science.
Much of the mathematics of the factorial function was developed beginning in the late 18th and early 19th centuries.
Stirling's approximation provides an accurate approximation to the factorial of large numbers, showing that it grows more quickly than exponential growth. Legendre's formula describes the exponents of the prime numbers in a prime factorization of the factorials, and can be used to count the trailing zeros of the factorials. Daniel Bernoulli and Leonhard Euler interpolated the factorial function to a continuous function of complex numbers, except at the negative integers, the (offset) gamma function.
Many other notable functions and number sequences are closely related to the factorials, including the binomial coefficients, double factorials, falling factorials, primorials, and subfactorials. Implementations of the factorial function are commonly used as an example of different computer programming styles, and are included in scientific calculators and scientific computing software libraries. Although directly computing large factorials using the product formula or recurrence is not efficient, faster algorithms are known, matching to within a constant factor the time for fast multiplication algorithms for numbers with the same number of digits.
The concept of factorials has arisen independently in many cultures:
From the late 15th century onward, factorials became the subject of study by Western mathematicians. In a 1494 treatise, Italian mathematician Luca Pacioli calculated factorials up to 11!, in connection with a problem of dining table arrangements.[12] Christopher Clavius discussed factorials in a 1603 commentary on the work of Johannes de Sacrobosco, and in the 1640s, French polymath Marin Mersenne published large (but not entirely correct) tables of factorials, up to 64!, based on the work of Clavius.[13] The power series for the exponential function, with the reciprocals of factorials for its coefficients, was first formulated in 1676 by Isaac Newton in a letter to Gottfried Wilhelm Leibniz.[14] Other important works of early European mathematics on factorials include extensive coverage in a 1685 treatise by John Wallis, a study of their approximate values for large values of by Abraham de Moivre in 1721, a 1729 letter from James Stirling to de Moivre stating what became known as Stirling's approximation, and work at the same time by Daniel Bernoulli and Leonhard Euler formulating the continuous extension of the factorial function to the gamma function.[15] Adrien-Marie Legendre included Legendre's formula, describing the exponents in the factorization of factorials into prime powers, in an 1808 text on number theory.[16]
The notation for factorials was introduced by the French mathematician Christian Kramp in 1808.[17] Many other notations have also been used. Another later notation , in which the argument of the factorial was half-enclosed by the left and bottom sides of a box, was popular for some time in Britain and America but fell out of use, perhaps because it is difficult to typeset.[17] The word "factorial" (originally French: factorielle) was first used in 1800 by Louis François Antoine Arbogast,[18] in the first work on Faà di Bruno's formula,[19] but referring to a more general concept of products of arithmetic progressions. The "factors" that this name refers to are the terms of the product formula for the factorial.[20]
Applications[edit]
The earliest uses of the factorial function involve counting permutations: there are different ways of arranging distinct objects into a sequence.[26] Factorials appear more broadly in many formulas in combinatorics, to account for different orderings of objects. For instance the binomial coefficients count the -element combinations (subsets of elements) from a set with elements, and can be computed from factorials using the formula[27] The Stirling numbers of the first kind sum to the factorials, and count the permutations of grouped into subsets with the same numbers of cycles.[28] Another combinatorial application is in counting derangements, permutations that do not leave any element in its original position; the number of derangements of items is the nearest integer to .[29]
In algebra, the factorials arise through the binomial theorem, which uses binomial coefficients to expand powers of sums.[30] They also occur in the coefficients used to relate certain families of polynomials to each other, for instance in Newton's identities for symmetric polynomials.[31] Their use in counting permutations can also be restated algebraically: the factorials are the orders of finite symmetric groups.[32] In calculus, factorials occur in Faà di Bruno's formula for chaining higher derivatives.[19] In mathematical analysis, factorials frequently appear in the denominators of power series, most notably in the series for the exponential function,[14]
and in the coefficients of other Taylor series (in particular those of the trigonometric and hyperbolic functions), where they cancel factors of coming from the th derivative of .[33] This usage of factorials in power series connects back to analytic combinatorics through the exponential generating function, which for a combinatorial class with elements of size is defined as the power series[34]
In number theory, the most salient property of factorials is the divisibility of by all positive integers up to , described more precisely for prime factors by Legendre's formula. It follows that arbitrarily large prime numbers can be found as the prime factors of the numbers
, leading to a proof of Euclid's theorem that the number of primes is infinite.[35] When is itself prime it is called a factorial prime;[36] relatedly, Brocard's problem, also posed by Srinivasa Ramanujan, concerns the existence of square numbers of the form .[37] In contrast, the numbers must all be composite, proving the existence of arbitrarily large prime gaps.[38] An elementary proof of Bertrand's postulate on the existence of a prime in any interval of the form , one of the first results of Paul Erdős, was based on the divisibility properties of factorials.[39][40] The factorial number system is a mixed radix notation for numbers in which the place values of each digit are factorials.[41]
Factorials are used extensively in probability theory, for instance in the Poisson distribution[42] and in the probabilities of random permutations.[43] In computer science, beyond appearing in the analysis of brute-force searches over permutations,[44] factorials arise in the lower bound of on the number of comparisons needed to comparison sort a set of items,[45] and in the analysis of chained hash tables, where the distribution of keys per cell can be accurately approximated by a Poisson distribution.[46] Moreover, factorials naturally appear in formulae from quantum and statistical physics, where one often considers all the possible permutations of a set of particles. In statistical mechanics, calculations of entropy such as Boltzmann's entropy formula or the Sackur–Tetrode equation must correct the count of microstates by dividing by the factorials of the numbers of each type of indistinguishable particle to avoid the Gibbs paradox. Quantum physics provides the underlying reason for why these corrections are necessary.[47]