Search for probability and statistics terms on Statlect

Gamma function

by , PhD

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.

Table of Contents

Introduction and motivation

Recall that, if $nin U{2115} $, its factorial $n!$ is[eq1]so that $n!$ satisfies the following recursion:[eq2]

The Gamma function [eq3] satisfies a similar recursion:[eq4]but it is defined also when $z$ is not an integer.


The following is a possible definition of the Gamma function.

Definition The Gamma function $Gamma $ is a function [eq5] satisfying the following equation:[eq6]

The domain of definition of the Gamma function can be extended beyond the set $U{211d} _{++}$ 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.

How to compute the values of the 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 [eq7] in terms of elementary functions for every $z$.

As a consequence, one often needs to resort to numerical algorithms to compute [eq8].

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 [eq9].

Plot of the gamma function with interactive calculator

Argument z
Gamma(z) - Overflows for large z
Log-scale plot (1 yes; 0 no)

Properties and caveats

If you play with the calculator, you will notice several properties of the Gamma function:

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.

Recursive formula

Given the above definition, it is straightforward to prove that the Gamma function satisfies the following recursion: [eq13]


The recursion can be derived by using integration by parts:[eq14]

Relation to the factorial function

When the argument of the Gamma function is a natural number $nin U{2115} $ then its value is equal to the factorial of $n-1$:[eq15]


First of all, we have that[eq16]

Using the recursion [eq17], we obtain[eq18]

Some known values

A well-known formula, which is often used in probability theory and statistics, is the following:[eq19]


By using the definition and performing a change of variable, we obtain[eq20]

By using this fact and the recursion formula previously shown, it is immediate to prove that[eq21]for $nin U{2115} $.


The result is obtained by iterating the recursion formula:[eq22]

Lower and upper incomplete Gamma functions

The definition of the Gamma function[eq23]can be generalized in two ways:

  1. by substituting the upper bound of integration ($x=infty $) with a variable ($x=y$):[eq24]

  2. by substituting the lower bound of integration with a variable:[eq25]

The functions [eq26] and [eq27] thus obtained are called lower and upper incomplete Gamma functions.

Clearly, they have the property that[eq28]for any $y$, which is equivalent to[eq29]

The two ratios[eq30]and[eq31]are often called standardized incomplete Gamma functions.

They are numerically more stable and easier to deal with because they take values between 0 and 1, while the values taken by the two functions [eq32] and [eq33] 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.

Interactive calculator for lower and upper incomplete Gamma functions

Argument z
Bound of integration x
Standardized lower incomplete
Standardized upper incomplete
Value of lower incomplete
Value of upper incomplete
Logarithm of lower incomplete
Logarithm of upper incomplete

Solved exercises

Below you can find some exercises with explained solutions.

Exercise 1

Compute the following ratio:[eq34]


We need to repeatedly apply the recursive formula[eq35]to the numerator of the ratio:[eq36]

Exercise 2



We need to use the relation of the Gamma function to the factorial function: [eq38]which, for $n=5$, becomes[eq39]

Exercise 3

Express the following integral in terms of the Gamma function:[eq40]


This is accomplished as follows:[eq41]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.

How to cite

Please cite as:

Taboga, Marco (2021). "Gamma function", Lectures on probability theory and mathematical statistics. Kindle Direct Publishing. Online appendix.

The books

Most of the learning materials found on this website are now available in a traditional textbook format.