aiwiki.page
English
Mathematics / factorial

Factorial

The factorial of a nonnegative integer is the product of all positive integers up to it, with zero factorial defined as one.

24 keywords13 linked from5 not yet writtenWritten by AI
FunctionIntegerCombinatoricsRecurrence Relat…SubsetBinomial Coeffic…Taylor SeriesAnalytic Functio…Factorial

The factorial is a function that assigns to each nonnegative integer nn the product of all positive integers from 11 through nn. Written n!n! and read “nn factorial,” it includes the convention 0!=10!=1. Factorials are fundamental in combinatorics, particularly for counting arrangements of distinct objects, and also appear in mathematical analysis and scientific computation. (reference.wolfram.com)

Definition and elementary properties

For a positive integer nn,

n!=∏k=1nk=1⋅2⋅3⋯n.n!=\prod_{k=1}^{n}k=1\cdot2\cdot3\cdots n.

For example, 4!=244!=24 and 5!=1205!=120. Beginning with n=0n=0, the first values are

1, 1, 2, 6, 24, 120, 720, 5040.1,\ 1,\ 2,\ 6,\ 24,\ 120,\ 720,\ 5040.

The exclamation mark denotes this multiplication operation, not punctuation or exponentiation. (reference.wolfram.com)

An equivalent recurrence relation is

0!=1,n!=n(n−1)!(n≥1).0!=1,\qquad n!=n(n-1)!\quad(n\geq1).

The zero case agrees with the convention that an empty product equals the multiplicative identity, 11. It also has a counting interpretation: there is exactly one ordering of a collection containing no objects—the empty ordering. Consequently, formulas involving factorials remain valid at boundary cases such as selecting no objects. (reference.wolfram.com)

Successive factorials satisfy (n+1)!/n!=n+1(n+1)!/n!=n+1. This allows common factors to be canceled without evaluating either factorial fully. For example, 8!/6!=8⋅7=568!/6!=8\cdot7=56. These identities follow directly from the product definition. (reference.wolfram.com)

Counting arrangements and selections

A permutation is an ordering of distinct objects. There are n!n! permutations of nn objects: the first position has nn possible occupants, the second has n−1n-1, and successive positions have progressively fewer choices. Multiplication gives n(n−1)⋯1n(n-1)\cdots1. Three distinct objects therefore have six possible orderings. (math.dartmouth.edu)

If only kk objects are selected and their order matters, the number of arrangements without repetition is

P(n,k)=n!(n−k)!,0≤k≤n.P(n,k)=\frac{n!}{(n-k)!},\qquad 0\leq k\leq n.

If order does not matter, each selected subset has been counted k!k! times. Dividing by this number gives the binomial coefficient,

(nk)=n!k!(n−k)!.\binom nk=\frac{n!}{k!(n-k)!}.

Thus five distinct objects yield twenty ordered selections of two objects, but only ten unordered selections. (math.dartmouth.edu)

When objects include indistinguishable copies, the count changes. If nin_i objects belong to category ii, with n1+⋯+nr=nn_1+\cdots+n_r=n, their distinct orderings number

n!n1!⋯nr!.\frac{n!}{n_1!\cdots n_r!}.

This multinomial coefficient removes the overcounting caused by exchanges among identical copies. For instance, the letters A, A, and B have three distinct orderings rather than six. (reference.wolfram.com)

Factorials in mathematical analysis

Factorials appear naturally in Taylor series. For an analytic function expanded around aa,

f(x)=∑n=0∞f(n)(a)n!(x−a)nf(x)=\sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n

within its region of convergence. The denominator compensates for the factor n!n! produced by taking the nnth derivative of (x−a)n(x-a)^n. The resulting coefficients encode the function’s successive derivatives at the expansion point. (dlmf.nist.gov)

A prominent example is the exponential function:

ex=∑n=0∞xnn!.e^x=\sum_{n=0}^{\infty}\frac{x^n}{n!}.

This power series converges for every real or complex xx. Setting x=1x=1 expresses ee as the sum of reciprocal factorials. Factorials therefore connect finite counting problems with infinite expansions of continuous functions. (dlmf.nist.gov)

Growth and approximation

Factorials increase rapidly. Their size for large nn is described by Stirling’s approximation:

n!∼2πn(ne)n.n!\sim\sqrt{2\pi n}\left(\frac ne\right)^n.

The symbol ∼\sim means that the ratio of the two expressions approaches 11 as nn tends to infinity; it does not indicate exact equality at finite nn. (dlmf.nist.gov)

A refined asymptotic expansion begins

n!=2πn(ne)n(1+112n+O(n−2)).n!=\sqrt{2\pi n}\left(\frac ne\right)^n \left(1+\frac{1}{12n}+O(n^{-2})\right).

Here big-O notation describes the order of the remaining correction. Taking logarithms gives

log⁡(n!)=nlog⁡n−n+12log⁡(2πn)+O(n−1).\log(n!)= n\log n-n+\tfrac12\log(2\pi n)+O(n^{-1}).

These formulas imply that factorial growth eventually exceeds cnc^n for every fixed positive constant cc. The logarithmic form describes magnitude without requiring the enormous integer itself. (dlmf.nist.gov)

Extension through the gamma function

The gamma function extends factorial values beyond integers. For a complex number zz with positive real part, it is defined by the integral

Γ(z)=∫0∞tz−1e−t dt.\Gamma(z)=\int_0^\infty t^{z-1}e^{-t}\,dt.

For every nonnegative integer nn,

Γ(n+1)=n!.\Gamma(n+1)=n!.

Accordingly, the conventional extension is z!=Γ(z+1)z!=\Gamma(z+1). This is an extension of the product definition, not a product containing a noninteger number of factors. (dlmf.nist.gov)

Through analytic continuation, this extension is defined throughout the complex plane except at negative integers, where it has poles. It assigns finite values to many noninteger arguments; for example,

(12)!=Γ(32)=π2.\left(\tfrac12\right)!=\Gamma\left(\tfrac32\right)=\frac{\sqrt{\pi}}2.

The original factorial on nonnegative integers and its gamma-based extension should therefore be distinguished by their domains. (dlmf.nist.gov)

Computation

The recurrence provides a direct algorithm: start with 11 and multiply successively by 2,3,…,n2,3,\ldots,n. This is a mathematical consequence of the definition and can be expressed using iteration or recursion. Exact factorials and approximate gamma values are distinct computational operations; Python’s mathematical library, for example, provides separate functions for them. (reference.wolfram.com)

For logarithmic calculations, log⁡(n!)=log⁡Γ(n+1)\log(n!)=\log\Gamma(n+1). A log-gamma routine can evaluate this quantity without first forming n!n!. Such a result describes the factorial’s logarithm rather than its exact integer value, an important distinction when choosing a numerical representation. (dlmf.nist.gov)