kuniga.me > NP-Incompleteness > The Gamma Function
19 Jul 2025
There’s evidence that the factorial function has been used in some form since at least 1150 by the Indian mathematician Bhāskara II [3]. In the 18th century, European mathematicians attempted to generalize this function beyond the natural numbers. Daniel Bernoulli, Christian Goldbach and Leonhard Euler were involved in the early attempts and came up with different definitions.
In the 19th century Carl Friedrich Gauss, Karl Weierstrass and Adrien-Marie Legendre further contributed to it, the latter naming the function and its equivalent definitions as the gamma function.
Weierstrass in particular provided an alternative definition as an infinite product. He later generalized this result to the Weierstrass Factorization Theorem. It’s within this context that we’ll study the gamma function in this post.
In the post Weierstrass Factorization Theorem we used the theorem to derive a power series for $\sin(\pi z)$, based on the fact that its zeros are the natural numbers. It turns out $\sin (\pi z)$ is the simplest function that has all integers as zeros.
We now aim to decompose it a bit. Suppose we have a function that only has the negative numbers as zeros. Using Weierstrass theorem we can show that one such a function is:
\[G(z) = \prod_{n = 1}^\infty \left(1 + \frac{z}{n}\right) e^{-z/n}\]via a similar reasoning as done for $\sin (\pi z)$. Conversely, the function $G(-z)$ has the positive numbers as zeros, so their product has all integers except zero as zeros:
\[G(z) G(-z) = \prod_{n = 1}^\infty \left(1 - \frac{z^2}{n^2}\right)\]Noting the terms $e^{-z/n}$ cancel out. In [2] we had shown that:
\[\sin (\pi z) = z \pi \prod_{n \ge 1} \left(1 - \frac{z^2}{n^2}\right)\]So we can write
\[\sin (\pi z) = z \pi G(z) G(-z)\]Now consider $G(z - 1)$. If $w + 1$ is a zero for $G(z)$, then $w$ is a zero for $G(z - 1)$, hence we conclude that its zeros are all the non-positive numbers (i.e. the zeros of $G(z)$ plus $0$).
Using Weierstrass, we can conclude that:
\[G(z - 1) = z e^{\gamma(z)} \prod_{n = 1}^\infty \left(1 + \frac{z}{n}\right) e^{-z/n}\]Replacing $G(z)$ we have:
\[(1) \quad G(z - 1) = z e^{\gamma(z)} G(z)\]It’s possible to show that $\gamma(z)$ is a constant, which we’ll denote by $\gamma$ and known as Euler’s constant, defined as:
\[\gamma = \lim_{n \rightarrow \infty} \left(\left(\sum_{k = 1}^n \frac{1}{k}\right) - \log n \right)\]and it’s approximately 0.57722. Let’s define $H(z) = G(z) e^{\gamma z}$. We have that
\[(2) \quad H(z - 1) = z H(z)\]If we define $\Gamma(z) = 1 / (z H(z))$ we obtain
\[(3) \quad \Gamma(z + 1) = z \Gamma(z)\]Which is a more useful form than $G(z)$, and is the famous Gamma function. By substituting back the definitions of $H(z)$ and then $G(z)$, we get the explicit formula:
\[(4) \quad \Gamma(z) = \frac{e^{-\gamma z}}{z} \prod_{n = 1}^\infty \left( 1 + \frac{z}{n}\right)^{-1} e^{z / n}\]We can express our early example in terms of $\Gamma(z)$:
\[(5) \quad \frac{\pi}{\Gamma(z)\Gamma(1 - z)} = \sin \pi z\]This identity is known as Euler’s reflection formula.
The gamma function is a meromorphic function, with the non-positive integers as poles.
We can see the gamma function as a generalization of the factorial. If we plug 1 in $\Gamma(z)$ we get $\Gamma(1) = 1$.
Thus, if $z \in \mathbb{N}$, the recurrence $\Gamma(z + 1) = z \Gamma(z)$ tells us that $\Gamma(z) = (z - 1)!$. The gamma function is more general than the factorial because we can plug in real numbers. For example, $\Gamma(1/2) = \sqrt{\pi}$.
There’s also a formula connecting $\Gamma(2z)$ and $\Gamma(z)$, known as Legendre’s duplication formula, which we’ll not prove here:
\[\Gamma(2z) = \frac{\Gamma(z) \Gamma(z + 1/2) 2^{2z - 1}}{\sqrt{\pi}}\]Like with Weierstrass Factorization Theorem, this chapter was also one of the most enjoyable to read from Ahlfors [1]. The connection betweem seemingly unrelated things in math always makes me appreciate its beauty.
Lemma 1.
\[\log (n + 1) = \sum_{k = 1}^{n} \log \left(1 + \frac{1}{k} \right)\]Lemma 2.
\[\lim_{n \rightarrow \infty} \log (n + 1) = \log(n)\]