How to Calculate the Factorial of a Noninteger
At a glance
- 1. Extend the definition
Use the Gamma function: x! is defined as Γ(x + 1).
- 2. Use the integral
For positive x, evaluate Γ(x + 1) with its defining integral.
- 3. Apply recurrence
Reduce half-integer or other convenient values using Γ(z + 1) = zΓ(z).
- 4. Check special cases
Remember that nonpositive integers are poles, so their generalized factorials are undefined.
The usual factorial is defined for nonnegative integers by
That product does not directly make sense when is, for example, or . The standard extension is the Gamma function:
This definition agrees with ordinary factorials and supplies a smooth value for most noninteger inputs.
The Gamma function definition
For , the Gamma function can be defined by the improper integral
Therefore, for a positive real number ,
The Gamma function satisfies the recurrence relation
Since , this gives
for every nonnegative integer . Thus the Gamma function is not a different answer for integer factorials; it is the standard extension of the same operation.
Worked example: the factorial of one-half
Set . Then
Use the recurrence relation:
The identity follows from the Gaussian integral. Hence
Notice that this value is not obtained by trying to multiply all numbers from to . The Gamma function supplies the meaningful extension.
Worked example: the factorial of 3.5
For ,
Apply the recurrence repeatedly:
Therefore,
More generally, for a nonnegative integer ,
where is an odd double factorial.
Calculating an arbitrary decimal factorial
For a value such as , there is usually no simple expression involving elementary functions. Use a numerical implementation of the Gamma function:
Scientific calculators may have a Gamma function button, often written as Γ, gamma, or GAMMA. In a programming language, use its standard special-function library. For example, Python’s math.gamma gives the generalized factorial directly:
import math
x = 2.3
print(math.gamma(x + 1))
This prints approximately 2.6834373819.
For large arguments, computing the factorial itself can overflow ordinary numerical types. In that situation, use the logarithmic Gamma function instead:
In Python, this is available as math.lgamma(x + 1).
What happens for negative nonintegers?
The Gamma function extends the factorial beyond positive numbers as well. For example,
However, has poles at . Since , the generalized factorial is undefined when
that is, when . Thus , , and so on are undefined, while negative nonintegers such as can have finite values.
The value is not a problem: it is
Why use the Gamma function?
Many functions can be made to agree with the integer factorial values, so merely requiring a function to satisfy at integers does not uniquely determine an extension. The Gamma function is the conventional choice because it is smooth, satisfies the factorial recurrence, has the integral representation above, and is log-convex on the positive real numbers.
This convention is used in probability, statistics, calculus, and combinatorics. For example, continuous extensions of binomial coefficients use
whenever the Gamma terms are defined.
Common mistakes
- Writing for a noninteger. This finite product only naturally terminates when is a nonnegative integer. Use instead.
- Using instead of . The Gamma function shifts the factorial by one: , not .
- Assuming all negative inputs are allowed. Negative nonintegers may be valid, but negative integers are poles and have no finite factorial value.
- Expecting an elementary closed form for every decimal. Values such as generally require numerical evaluation of the Gamma function.
References
- NIST Digital Library of Mathematical Functions, Chapter 5: Gamma Function
- Abramowitz and Stegun, Handbook of Mathematical Functions, Chapter 6: Gamma and Related Functions
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.