gives the factorial of n.
- Mathematical function, suitable for both symbolic and numerical manipulation.
- For non‐integer n, the numerical value of n! is given by Gamma[1+n].
- For integers and half integers, Factorial automatically evaluates to exact values.
- Factorial can be evaluated to arbitrary numerical precision.
- Factorial automatically threads over lists.
- Factorial can be used with Interval and CenteredInterval objects. »
Background & Context
- Factorial represents the factorial function. In particular, Factorial[n] returns the factorial of a given number , which, for positive integers, is defined as . For n1,2,…, the first few values are therefore 1,2,6,24,120,720,…. The special case is defined as 1, consistent with the combinatorial interpretation of there being exactly one way to arrange zero objects. For a general complex number , , where the Gamma function is defined by for all complex values of except when is a negative integer (in which case is complex infinity). Factorials of half integers are given by rational multiples of .
- Factorials are best known for counting fixed orderings of the elements of a list, known as permutations, which can be generated using Permutations. There are permutations of a list of (distinct) elements, a fact that follows from there being spots to place the first element, spots to place the second element once the first is placed, spots to place the third element once the first two elements are placed and so on until a single spot remains in which to place the last element. There are therefore permutations of , namely , , , , and .
- More generally, for an -element multiset having distinct elements with copies of the distinct element (so ), the number of permutations equals the multinomial coefficient , given by Multinomial. The multinomial coefficient also counts the ways to partition an -element set into labeled subsets of sizes n1,…,nk. Hence the binomial coefficient , given by Binomial and defined to count the -element subsets of an -element set, satisfies .
- The factorial function satisfies the recurrences and . It grows faster than any exponential function, as shown by Stirling's approximation . Factorials also appear in fundamental results in number theory and analysis. Wilson's theorem states that if and only if is prime. If is an infinitely differentiable scalar function, then its Taylor series representation about a point (computable using Series) is given by . Setting and in the Taylor series of the exponential function yields the beautiful identity for E (the base of the natural logarithm) .
- Other functions associated with or generalizing Factorial include Factorial2, FactorialPower, , QFactorial, BarnesG and Pochhammer.
Examplesopen allclose all
Basic Examples (7)
Series expansion at Infinity:
Numerical Evaluation (5)
Specific Values (5)
Plot the Factorial function:
Function Properties (10)
Factorial threads elementwise over lists:
Factorial is not an analytic function:
Factorial is neither non-decreasing nor non-increasing:
Factorial is not injective:
Factorial is not surjective:
Factorial is neither non-negative nor non-positive:
Factorial has both singularity and discontinuity for negative integers:
Factorial is neither convex nor concave:
Series Expansions (5)
Function Representations (2)
Generalizations & Extensions (4)
Infinite arguments give symbolic results:
Factorial allows derivatives:
Number of permutations of 6 elements:
Plot of the absolute value of Factorial in the complex plane:
Find the asymptotic expansion of ratios of factorials:
Volume of an n‐dimensional unit hypersphere:
Plot the volume of the unit hypersphere as a function of dimension:
Properties & Relations (9)
Compute a generating function sum involving Factorial:
Compute numerical sums involving Factorial:
The exponential generating function for Factorial:
Possible Issues (2)
Neat Examples (3)
Nested factorials over the complex plane:
Plot Factorial at infinity:
Wolfram Research (1988), Factorial, Wolfram Language function, https://reference.wolfram.com/language/ref/Factorial.html (updated 2022).
Wolfram Language. 1988. "Factorial." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/Factorial.html.
Wolfram Language. (1988). Factorial. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Factorial.html