Factorial

In mathematics, the factorial is the meromorphic function with fast growth along the real axis; for non-negative integer values of the argument, this function has integer values. Frequently, the postfix notation $$n!$$ is used for the factorial of number $$n$$. For integer $$n$$, the $$n!$$ gives the number of ways in which n labelled objects (for example the numbers from 1 to n) can be arranged in order. These are the permutations of the set of objects. In some programming languages, both n! and factorial(n), or Factorial(n), are recognized as the factorial of the number $$n$$.

Integer values of the argument
For integer values of the argument, the factorial can be defined by a recurrence relation. If n labelled objects have to be assigned to n places, then the n-th object can be placed in one of n places: the remaining n-1 objects then have to be placed in the remaining n-1 places, and this is the same problem for the smaller set. So we have


 * $$ n! = n \cdot (n-1)! \,$$

and it follows that


 * $$ n! = n \cdot (n-1) \cdots 2 \cdot 1, \,$$

which we could derive directly by noting that the first element can be placed in n ways, the second in n-1 ways, and so on until the last element can be placed in only one remaining way.

Since zero objects can be arranged in just one way ("do nothing") it is conventional to put 0! = 1.

The factorial function is found in many combinatorial counting problems. For example, the binomial coefficients, which count the number of subsets size r drawn from a set of n objects, can be expressed as


 * $$\binom{n}{r} = \frac{n!}{r! (n-r)!} .$$

The factorial function can be extended to arguments other than positive integers: this gives rise to the Gamma function.

Definitions
For complex values of the argument, the combinatoric definition above should be extended.

Implicit definition
The factorial can be defined as unique meromorphic function $$F$$, satisfying relations
 * $$ F(z+1)=(z+1) F(z) $$
 * $$ F(0)=1 $$

for all complex $$z$$ except negative integer values. The uniqueness of function $$F$$, satisfying these equations, follows from the Wielandt's theorem . Historically, the deduction refers to the Gamma function, but the application to the factorial is straightforward.

Definition through the integral
Usually, the integral representation is used as definition. For $$\Re(z)>-1$$, define
 * $$ z! = \int_0^\infty t^z \exp(-t) \mathrm{d}t $$

Such definition is similar to that of the Gamma function, and leads to the relation
 * $$z!=\Gamma(z+1)$$

for all complex $$z$$ except the negative integer values.

The definition above agrees with the combinatoric definition for integer values of the argument; at integer $$z$$, the integral can be expressed in terms of the elementary functions.

Extension of integral definition


The definition through the integral can be extended to the whole complex plane, using relation
 * $$z!=(z+1)!/(z+1)$$

for the cases $$\Re(z)<-1$$, assuming that $$z$$ is not negative integer. Also, the symmetry formula takes place for the non-integer values of $$z$$,
 * $$z! (-z)! =\frac{\pi z}{\sin(\pi z)}$$

The similar formula of symmetry holds however, for the Gamma function. From this expression, it follows that $$\frac{1}{z!(-z)!}$$ is entire function of $$z$$. Also, this symmetry gives the simple way to express $$(1/2)!=\sqrt{\pi}/2$$, and, therefore, factorial of half-integer numbers.

In the figure, lines of constant $$u=\Re(z!)$$ and lines of constant $$v=\Im(z!)$$ are shown. The levels \(u = − 24,\) \(− 20,\) \(− 16,\) \(− 12,\) \(− 8,\) \(− 7,\) \(− 6, \) \(− 5,\) \(− 4,\) \(− 3,\) \(− 2,\) \(− 1,\) \( 0,\) \(1,\) \(2,\) \(3,\) \(4,\) \(5,\) \(6,\) \(7,\) \(8,\) \(12,\) \(16,\) \(20,\) \(24\) are drown with thick black lines. Some of intermediate levels u = const are shown with thin blue lines for positive values and with thin red lines for negative values. Levels \(v = − 24,\) \(− 20,\) \(− 16,\) \(− 12,\) \(− 8,\) \( − 7,\) \( − 6,\) \( − 5,\) \( − 4,\) \( − 3,\) \( − 2,\) \( − 1\) are shown with thick red lines. Level \(v = 0\) is shown with thick pink lines. Levels \(v = 1,\) \( 2,\) \( 3,\) \( 4,\) \( 5,\) \( 6,\) \( 7,\) \( 8,\) \( 12,\) \( 16,\) \( 20,\) \( 24~\) are drown with thick blue lines. some of intermediate levels \(v = \mathrm{const}\) are shown with thin green lines. The dashed blue line shows the level $$u=\mu_0$$ and corresponds to the value $$\mu_0=(x_0)!\approx 0.85$$ of the principal local minimum $$x_0\approx 0.45$$ of the factorial of the real argument. The dashed red line shows the level and corresponds to the similar value of the negative local extremum of the factorial of the real argument. Due to the fast growth of the function, in the right hand side of the figure, the density of the levels exceeds the ability of the plotter to draw them; so, this part is left empty.

Factorial of the real argument
The definition above was elaborated for factorial of complex argument. In particular, it can be used to evlauate the factorial of the real argument. In the figure at right, the $$\mathrm{factorial}(x)=x!$$ is plotted versus real $$x$$ with red line. The function has simple poluses at negative integer $$x$$.

At $$x\rightarrow -1+o$$, the $$x! \rightarrow +\infty$$.

The local minimum
The factorial has local minimum at
 * $$x=\nu_0\approx 0.4616321450$$

marked in the picture with pink vertical line; at this point, the derivative of the factorial is zero:
 * $$\mathrm{factorial}^{\prime}(\nu_0)=0$$

The value of factorial in this point
 * $$\mu_0=\nu_0!=\mathrm{factorial(\nu_0)}\approx 0.8856031944$$

The Tailor expansion of $$z!$$ at the point $$z=\nu_0$$ can be writen ax follows:
 * $$z!=\mu_0+\sum_{n=2}^{N-1} c_n (z-\nu_0)^n + \mathcal{O}(z-\nu_0)^N~$$.

The coefficients of this expansion are copypasted in the table below: This expansion can be used for the precise evaluation of the inverse function of factorial (arcfactorial) in vicinity of the branchpoint.

Other local extremums are at negative values of the argument; one of them in shown in the figure above.

The Taylor expansion
The Taylor expansion of $$z!$$ at $$z=0$$, or the MacLaurin expansion, has the form $$z!=\sum_{n=0}^{N-1} g_n z^n+\mathcal{O}(z^N)~$$. The first coefficients of this expansion are copypasted in the table below: Here, $$\gamma$$ is the Euler constant and $$\zeta$$ is the Riemann function. The Computer algebra systems such as Maple and Mathematica can generate many terms of this expansion. The radius of convergence of the Taylor series is unity, and the coefficient $$g_n$$ does not decay as $$n$$ increases. However, due to the relation $$z!=z\cdot \mathrm{factorial}(z)$$, for any real value of argument of factorial, the expansion above can be used for the precize evaluation of factorial of the real argument, running the approximation above for an argument with modulus not larget than halh. Also, the expansion at the half-integer values can be used: $$z!=\sum_{n=0}^{N-1} h_n~\left(z-\frac{1}{2}\right)^n+\mathcal{O}\left(\left(z-\frac{1}{2}\right)^N\right)~$$. The first coefficients of this expansion are copypasted in the table below: The Taylor series of $$z!$$ developed at $$z=1/2$$, converges for all $$z$$ such that $$|z-1/2|<3/2$$.

In order to boost the approximation of factorial for real values of the argument, and, especially, for the evaluation for complex values, and the evaluation of the inverse function, the expansions for $$\log(z!)$$ and $$1/z!$$ are used instead of the direct Taylor expansions above.

Halphing of the imaginary part of the argument
While neither $$z$$ nor $$(z+1)/2$$ is negative integer, the argument of factorial can be dropped with the identity

\mathrm{Factorial}(z)~=~\frac{2^z}{\sqrt{\pi}}~ \mathrm{Factorial}\!\left(\frac{z}{2} \right)\cdot \mathrm{Factorial}\!\left(\frac{z\!-\!1}{2} \right) $$ This may be useful to drop with factor 1/2 the imaginary part of the argument (for example, to apply the Taylor expansion above for the evaluation), but the function has to be evaluated twice.

Related functions


In the plot of factorial of the real argument, the two other functions are plotted, $$\mathrm{ArcFactorial}(x)=\mathrm{factorial}^{-1}(x)$$ and $$\mathrm{factorial}(x)^{-1}$$. These functions are used for the generalization of the factorial and for its evaluation.

Inverse function
Inverse function of factorial can be defined with equation
 * $$(\mathrm{ArcFactorial}(z))!=z$$

and condition that ArcFactorial is holomorphic in the comlex plane with cut along the part of the real axis, that begins at the minimum value of the factorial of the positive argument, and extends to $$-\infty$$. This function is shown with lines of constant real part $$u=\Re(\mathrm{ArcFactorial}(z))$$ and lines of constant imaginary part $$v=\Im(\mathrm{ArcFactorial}(z))$$.

Levels \(u=1,2,3\) are shown with thick black curves. Levels \(u= 0.2,\) \(0.4,\) \(0.6,\) \(0.8,\) \( 1.2,\) \(1.4,\) \(1.6,\) \(1.8,\) \( 2.2,\) \(2.4,\) \(2.6,\) \(2.8, 3.2,\) \(3.4,\) \(3.6\) are shown with thin blue curves. Levels $$v=1,2,3$$ are shown with thick blue curves. Level $$v=0$$ is shown with thick pink line. Levels $$v=-1,-2,-3$$ are shown with thick red curves. The intermediate levels of constant $$v$$ are shown with thin dark green curves. The ArcFactorial has the branch point $$\mu_0 \approx 0.85 $$; the cut of the range of holomorphizm is shown with black dashed line.

ArcFactorial for some real values of the argument is approximated in the table at right.

In vicinity of the branchpoint $$z=\mu_0$$, the ArcFactorial can be expanded as follows:

\mathrm{ArcFactorial}(z)=\nu_0+\sum_{n=1}^{N-1} d_n\cdot \Big(\log(z/\mu_0) \Big)^{n/2} $$ The approximations for the first coefficients of this expansion are copypasted in the table at right. About of 30 terms in this expansion are sufficient to plot the distribution of the real and the imaginary parts of ArcFactorial in the figure.

Function $$f(z)=1/z!$$
The inverse function of factorial, id est, \(\mathrm{ArcFactorial}(z)=\mathrm{Factorial}^{-1}(z)~\) from the previous section, sohuld not be confused with

\(f(z)=\) \(\frac{1}{z!}\) \( =\mathrm{Factorial}(z)^{-1}\) \(=\frac{1}{\mathrm{Factorial}(z)}~\), which is also shown in the figure at right. The lines of constant $$u=\Re(f(z))$$ and the lines of constant $$v=\Im(f(z))$$ are drawn. The levels \(u=-24,\) \(-20,\) \(-16,\) \(-12,\) \(-8,\) \(-7\) \( .. 7,\) \(8,\) \(12,\) \(16,\) \(20,\) \(24\) are shown with thick black lines. The levels $$v=-24,-20,-16,-12,-8,-7 ... 7,-1$$ are shown with thick red lines. The level $$v=0$$ is shown with thick pink line. The levels $$v=1,2, ... 7,8,12,16,20,24$$ are shown with thick blue lines. Some of intermediate elvels $$u=$$const are shown with thin red lines for negative values and thin blue lines for the positive values. Some of intermediate elvels $$v=$$const are shown with thin green lines. The blue dashed curves represent the level $$u=1/\mu_0$$ and correspond to the positive local maximum of the inverse function of the real argument. The red dashed curves represent the level $$u=1/\mu_1$$, which corresponds to the first negative local maximum of the factorial of the real argument; $$\mathrm{factorial}^{\prime}(\nu_1)=0$$; $$\mathrm{factorial}(\nu_1)=\mu_1$$.

In the upper-left hand side of the figure, and at the lower-left hand side of the figure, the density of levels exceeds the ability of the ploter to draw them, and these parts are left empty.

$$f(z)=\frac{1}{z!}$$ is entire function, that grows in the left hand side of the compelx plane and quickly decays to zero along the real axis.

Logfactorial


For the approximation of factorial, it can be expressed as
 * $$ z!=\exp(\mathrm{LogFactorial}(z)) $$

At large values of the argument, the LogFactorial does not show the fast growth and is easier for the numerical implementation, than factorial.

Plof of LogFactorial
Function LogFactorial is shown in figure with lines of constant real part and lines of constant imaginary part. Levels of constant $$u=\Re(\mathrm{LogFactorial}(z))$$ and Levels of constant $$v=\Im(\mathrm{LogFactorial}(z))$$ are drawn with solid lines: Levels \(u=-24,\) \(-20,\) \(-16,\) \(-12,\) \(-8,\) \(-7,\) \(-6,\) \(-5,\) \(-4,\) \(-3,\) \(-2,\) \(-1,\) \(0,\) \(1,\) \(2,\) \(3,\) \(4,\) \(5,\) \(6,\) \(7,\) \(8,\) \(12\) \(,16,\) \(20,\) \(24\) are shown with thick black curves. Levels \(u=\) \( -3.8,\) \(-3.6,\) \(-3.4,\) \(-3.2\) \( -2.8,\) \(-2.6,\) \(-2.4,\) \(-2.2\) \( -1.8,\) \(-1.6,\) \(-1.4,\) \(-1.2\) \( -0.8,\) \(-0.6,\) \(-0.4,\) \(-0.2\) are shown with thin red curves. Levels \(u=\) \( 0.2,\) \(0.4,\) \(0.6,\) \(0.8\) \( 1.2,\) \(1.4,\) \(1.6,\) \(1.8\) \( 2.2,\) \(2.4,\) \(1.6,\) \(2.8\) \( 3.2,\) \(3.4,\) \(3.6,\) \(3.8\) are shown with thin blue curves. Levels \(v=-24,\) \(-20,\) \(-16,\) \(-12,\) \(-8,\) \(-7,\) \(-6,\) \(-5,\) \(-4,\) \(-3,\) \(-2,\) \(-1\) are shown with thick red curves. Level $$v=0$$ is shown with thick pink line. Levels $$v=1,2,3,4,5,6,7,8,12,16,20,24$$ are shown with thick blue lines. Levels \(v= -3.8,\) \(-3.6,\) \(-3.4,\) \(-3.2\) \( -2.8,\) \(-2.6,\) \(-2.4,\) \(-2.2\) \( -1.8,\) \(-1.6,\) \(-1.4,\) \(-1.2\) \( -0.8,\) \(-0.6,\) \(-0.4,\) \(-0.2\) \( 0.2,\) \(0.4,\) \(0.6,\) \(0.8\) \( 1.2,\) \(1.4,\) \(1.6,\) \(1.8\) \( 2.2,\) \(2.4,\) \(1.6,\) \(2.8\) \( 3.2,\) \(3.4,\) \(3.6,\) \(3.8\) are shown with thin green curves. The cut of range of holomorphism is shown with black dashed line.

Function LogFactorial has singularities at the same points, as the factorial, id est, at negative integer values of the argument.

Approximation of LogFactorial at large values of the argument
Far from the negative part of the real axis, the function LogFactorial can be approximated through the coninual fraction $$p$$:
 * $$\mathrm{LogFactorial}(z)= p(z) + \log(2\pi)/2 - z + (z+1/2)~\log(z)$$
 * $$p(z)= \frac{a_0}{z+\frac{a_1}{z+\frac{a_2}{z+\frac{a_3}{z+..}}}}$$

The coefficients $$a$$ and their approximate evaluations are copypasted in the table at right.

In vicinity of the real axis, while the modulus of the imaginary part of LogFactorial does not exceed $$\pi$$, the LogFactorial can be interpreted as lofarithm of factorial, id est,
 * $$\mathrm{LogFactorial}(z)=\log(z!)$$

In particular, this relation is valid for positive real values of $$z$$.

For all $$z$$ except negative integers, $$ z!=\exp\!\Big(\mathrm{LogFactorial}(z)\Big)$$

However, the LogFactorial has singularities at negative integer valies of the argument.

Stirling formula
Historically, one of the first approximations of the factorial with elementary functions was the Stirling formula below. For large n there is an approximation due to Scottish mathematician James Stirling
 * $$ n! \approx \sqrt{2\pi} n^{n+1/2} e^{-n} . \,$$

This formula can be obtained from the approximation for LogFactorial above, just replacing $$p(z)$$ to zero.

Iterated factorial and square root of factorial
Iterated factorial can be constructeed with the superfunction of factiorial and the inverse function, id est, the SuperFactorial \(F\) and the AbelFactorial \(G\). The \(n\)th iteration of factorial can be expressed as follows:

\(\mathrm{Factorial}^n(z)= \mathrm{SuperFactorial} \big(n+ \mathrm{AbelFactorial}(z)\big)\)

Where SuperFactorial is superfunction of factorial, id est, solution \(F\) of the transfer equation

\( F(z\!+\!1)= \mathrm{Factorial}(F(z))\)

and \(\mathrm{AbelFactorial}=\mathrm{SuperFactorial}^{-1}\), id est, the inverse function. AbelFactorial is also solution \(G\) of the Abel equation

\(G(z)+1= G(\mathrm{Factorial}(z))\)

The \(n\)th iteration can be calculated also for non-integer values of \(n\), number of iterations can be complex.

In particular, at \(n=1/2\), we have \({\rm factorial}^{1/2}(z)=\sqrt{\rm factorial}(z)\), where function \(\sqrt{\,!\,}=\sqrt{\rm factorial}\) can be interpreted as square root of factorial: \(\sqrt{\,!\,}\Big(\sqrt{\,!\,}(z)\Big)=z!\). Name of this function is used as logo of the Physics department of the Moscow State University and part of logo of TORI, shown in the top left corner.

Notation \(\sqrt{!} (z)\) happened to be not so convenient, some colleagues, who do not know about Logo of the Physics Department of the Moscow State University, confuse \(~\sqrt{!} (z)=\sqrt{\mathrm{Factorial}(z)}~\) with \(~\sqrt{\mathrm{Factorial}(z)}=\sqrt{z!}~\). For this reason, in future, at least in TORI, notation \(\mathrm{Factorial}^{1/2}(z)\) should be used instead.

Transfer equation
Factorial can be considered as holomorphic solution \(F\) of the transfer equation

\(F(z\!+\!1)= z \, F(z)\)

However, \(F=\mathrm{Factorial}\) is not only solution of this equation. Name Hadmard finction is suggested for one of other solutions .