The Gamma function is a generalization of the factorial function to non-integer numbers.
It is often used in probability and statistics, as it shows up in the normalizing constants of important probability distributions such as the Chi-square and the Gamma.
In this lecture we define the Gamma function, we present and prove some of its properties, and we discuss how to calculate its values.
Recall that, if
,
its factorial
is
so
that
satisfies the following
recursion:
The Gamma function
satisfies a similar
recursion:
but
it is defined also when
is not an integer.
The following is a possible definition of the Gamma function.
Definition
The Gamma function
is a function
satisfying the following
equation:
The domain of definition of the Gamma function can be extended beyond the set
of strictly positive real numbers (for example to complex numbers).
However, the somewhat restrictive definition given above is sufficient to address the great majority of statistics problems that involve the Gamma function.
We will show below some special cases in which the value of the Gamma function can be derived analytically.
However, in general, it is not possible to express
in terms of elementary functions for every
.
As a consequence, one often needs to resort to numerical algorithms to compute
.
We include here a calculator that implements one of these algorithms and we
refer the reader to Abramowitz and Stegun
(1965) for a thorough discussion of the main methods to compute numerical
approximations of
.
If you play with the calculator, you will notice several properties of the Gamma function:
it tends to infinity as
approaches
;
it quickly tends to infinity as
increases;
for large values of
,
is so large that an overflow occurs: the true value of
is replaced by infinity; however, we are still able to correctly store the
natural logarithm of
in the computer memory.
The last point has great practical relevance. When we manipulate quantities that depend on a value taken by the Gamma function, we should always work with logarithms.
Given the above definition, it is straightforward to prove that the Gamma
function satisfies the following recursion:
The recursion can be derived by using
integration by
parts:
When the argument of the Gamma function is a natural number
then its value is equal to the factorial of
:
First of all, we have
that
Using the recursion
,
we
obtain
A well-known formula, which is often used in probability theory and
statistics, is the
following:
By using the definition and performing a
change of variable, we
obtain
By using this fact and the recursion formula previously shown, it is immediate
to prove
thatfor
.
The result is obtained by iterating the
recursion
formula:
The definition of the Gamma
functioncan
be generalized in two ways:
by substituting the upper bound of integration
()
with a variable
(
):
by substituting the lower bound of integration with a
variable:
The functions
and
thus obtained are called lower and upper incomplete Gamma functions.
Clearly, they have the property
thatfor
any
,
which is equivalent
to
The two
ratiosand
are
often called standardized incomplete Gamma functions.
They are numerically more stable and easier to deal with because they take
values between
and
,
while the values taken by the two functions
and
can easily overflow.
The lower incomplete function is particularly important in statistics, as it appears in the distribution function of the Chi-square and Gamma distributions.
Below you can find some exercises with explained solutions.
Compute the following
ratio:
We need to repeatedly apply the recursive
formulato
the numerator of the
ratio:
Compute
We need to use the relation of the Gamma
function to the factorial function:
which,
for
,
becomes
Express the following integral in terms of the Gamma
function:
This is accomplished as
follows:where
in the last step we have just used the definition of Gamma function.
Abramowitz, M. and I. A. Stegun (1965) Handbook of mathematical functions: with formulas, graphs, and mathematical tables, Courier Dover Publications.
Please cite as:
Taboga, Marco (2021). "Gamma function", Lectures on probability theory and mathematical statistics. Kindle Direct Publishing. Online appendix. https://www.statlect.com/mathematical-tools/gamma-function.
Most of the learning materials found on this website are now available in a traditional textbook format.