Gamma Derivation

January 14, 2024
530 words
3 min read
views

There are few creatures in mathematics as interesting yet, somehow, useful as the Gamma function,

Γ ⁣:CCs0xs1exdx.\begin{aligned} \Gamma \colon \C &\to \C \\ \\ s &\mapsto \int\limits_0^\infty x^{s-1} e^{-x} \, \d x. \end{aligned}

An interesting result about this function is that Γ(n) = (n1)!\Gamma(n)~=~(n-1)! for positive integers nNn \in \N. But why is that so? Better yet, why is the gamma function defined so, how is it related to factorials, and what does its values at non-integers mean?

An interesting integral

First, consider the integral

I(x)=lnxdx.\begin{aligned} I(x) &= \int \ln x \, \d x. \end{aligned}

It is not a polynomial function, so we cannot use the power rule. However, if you remember your calculus well, you may recall integration by parts:

udv=uvvdu.\begin{aligned} \int u \, \d v &= uv - \int v \, \d u. \end{aligned}

Write u = lnxu~=~\ln x and dv = dx\d v~=~\d x. Then du = 1xdx\displaystyle \d u~=~\frac{1}{x} \, \d x and v = xv~=~x. So

I(x)=lnxdx=xlnxx1xdx=xlnxx+C.\begin{aligned} I(x) &= \int \ln x \, \d x \\ &= x \ln x - \int x \frac{1}{x} \, \d x \\ &= x \ln x - x + C. \end{aligned}

Power TWO

What happens if we have higher powers of lnx\ln x?

I2(x)=ln2xdx\begin{aligned} I_2(x) &= \int \ln^2 x \, \d x \end{aligned}

Substitute u = ln2xu~=~\ln^2 x and dv = dx\d v~=~\d x. Then du = 2lnxxdx\displaystyle \d u~=~\frac{2 \ln x}{x} \, \d x and v = xv~=~x.

Using integration by parts;

I2(x)=ln2xdx=xln2xx2lnxxdx=xln2x2lnxdx\begin{aligned} I_2(x) &= \int \ln^2 x \, \d x \\ &= x \ln^2 x - \int x \frac{2 \ln x}{x} \, \d x \\ &= x \ln^2 x - 2 \int \ln x \, \d x \end{aligned}

Interestingly, we get I(x)I(x) as part of the integration result of I2(x)I_2(x). If we fully integrate the result, we get:

I2(x)=xln2x2lnxdx=xln2x2(xlnxx)+C=xln2x2xlnx+2x+C.\begin{aligned} I_2(x) &= x \ln^2 x - 2 \int \ln x \, \d x \\ &= x \ln^2 x - 2 \left( x \ln x - x \right) + C \\ &= x \ln^2 x - 2 x \ln x + 2 x + C. \end{aligned}

Power THREE

What happens with the third power? Take a guess, you're probably right.

I3(x)=ln3xdx\begin{aligned} I_3(x) &= \int \ln^3 x \, \d x \\ \end{aligned}

Take u = ln3xu~=~\ln^3 x and dv = dx\d v~=~\d x. Then du = 3ln2xxdx\displaystyle \d u~=~\frac{3 \ln^2 x}{x} \, \d x and v = xv~=~x.

I3(x)=ln3xdx=xln3xx3ln2x1xdx=xln3x3ln2xdx\begin{aligned} I_3(x) &= \int \ln^3 x \, \d x \\ &= x \ln^3 x - \int x \cdot 3 \ln^2 x \cdot \frac{1}{x} \, \d x \\ &= x \ln^3 x - 3 \int \ln^2 x \, \d x \\ \end{aligned}

Again, we have I2(x)I_2(x) as part of the integration result of I3(x)I_3(x). Evaluating the integral fully gives:

I3(x)=xln3x3ln2xdx=xln3x3(xln2x2xlnx+2x)+C=xln3x3xln2x+6xlnx6x+C.\begin{aligned} I_3(x) &= x \ln^3 x - 3 \int \ln^2 x \, \d x \\ &= x \ln^3 x - 3 \left( x \ln^2 x - 2 x \ln x + 2 x \right) + C \\ &= x \ln^3 x - 3 x \ln^2 x + 6 x \ln x - 6 x + C. \end{aligned}

A pattern in the chaos?

Indeed, it always occurs that In(x) = xlnnxnIn1(x)\displaystyle I_n(x)~=~x \ln^n x - n I_{n-1}(x). But why is this a useful result?

Take a look at the coefficients of the last term, xx.

I(x)=xlnxx+CI2(x)=xln2x2xlnx+2x+CI3(x)=xln3x3xln2x+6xlnx6x+CI4(x)=xln4x4xln3x+12xln2x24xlnx+24x+CI5(x)=xln5x5xln4x+20xln3x60xln2x+120xlnx120x+C\begin{aligned} I(x) &= x \ln x - x + C \\ I_2(x) &= x \ln^2 x - 2 x \ln x + 2 x + C \\ I_3(x) &= x \ln^3 x - 3 x \ln^2 x + 6 x \ln x - 6 x + C \\ I_4(x) &= x \ln^4 x - 4 x \ln^3 x + 12 x \ln^2 x - 24 x \ln x + 24 x + C \\ I_5(x) &= x \ln^5 x - 5 x \ln^4 x + 20 x \ln^3 x - 60 x \ln^2 x + 120 x \ln x - 120 x + C \\ &\vdots \end{aligned}

Those are factorials, with alternating signs (positive, negative).

Recovering the factorial

Our goal is two-fold:

  • To get rid of the leading terms involving lnx\ln x.
  • To get rid of the alternation in signs.

Removing the Leading Terms

The leading terms have one thing in common: they are all a product of xx and a power of lnx\ln x. Thus, they all tend to zero at both x = 1x~=~1 (since ln1 = 0\ln 1~=~0) and at x = 0x~=~0. We need to retain the last term with just xx, which we can do by evaluating the integral over the interval (0,1)(0, 1).

[In]01 = 01lnnxdx=[(1)nn!x]01=(1)nn!\begin{aligned} \brackets{I_n}_0^1~=~\int \limits_0^1 \ln^n x \, \d x &= \brackets{(-1)^n \cdot n! \cdot x}_0^1 &= (-1)^n \cdot n! \\ \end{aligned}

Removing the Sign Alternation

To do this, we need to negate the result for odd nn. This is easily achieved by dividing the result by (1)n(-1)^n, giving the integral

n!=1(1)n01lnnxdx=01lnnx(1)ndx=01(lnx1)ndx=01(lnx)ndx=01lnn1xdx.\begin{aligned} n! &= \frac{1}{(-1)^n} \int\limits_0^1 \ln^n x \, \d x \\ &= \int\limits_0^1 \frac{\ln^n x}{(-1)^n} \, \d x\\ &= \int\limits_0^1 \parens{\frac{\ln x}{-1}}^n \, \d x \\ &= \int\limits_0^1 \parens{-\ln x}^n \, \d x \\ &= \int\limits_0^1 \ln^n \frac{1}{x} \, \d x. \end{aligned}

The Gamma Function

But the integral now looks complicated. Can we simplify it?

Substitute u = ln1x\displaystyle u~=~\ln \frac{1}{x}, so that:

u=ln1xu=lnxx=eudx=eudu\begin{aligned} u &= \ln \frac{1}{x} \\ -u &= \ln x \\ x &= e^{-u} \\ \d x &= -e^{-u} \, \d u \end{aligned}

Note that as x0+x \rightarrow 0^+, 1x+\displaystyle \frac{1}{x} \rightarrow \infty^+, therefore u+u \rightarrow \infty^+, and when x1x \rightarrow 1, 1x1\displaystyle \frac{1}{x} \rightarrow 1, so u0u \rightarrow 0.

Thus;

01lnn1xdx=0un(eu)du=0uneudu=0uneudu\begin{aligned} \int\limits_0^1 \ln^n \frac{1}{x} \, \d x &= \int\limits_\infty^0 u^n \cdot (- e^{-u}) \, \d u \\ &= -\int\limits_\infty^0 u^n \cdot e^{-u} \, \d u \\ &= \int\limits_0^\infty u^n \cdot e^{-u} \, \d u \\ \end{aligned}

This is the exact form of the gamma function, evaluated at s = n+1s~=~n + 1.

info

Why is the gamma function shifted by 11?

The ideas behind the function started being developed by Bernoulli and Goldbach in the early 1700s, and Euler defined the eventual function in 1729 (Euler was Bernoulli's student).

However, the function, in its current form and name, was defined by Legendre in 1811. He most likely shifted the function by 11 to make it easier to work with by giving it a pole1 at the origin instead of at s = 1s~=~-1.

The Gamma Extensions

The gamma function has various useful properties. For example, although it collapses to the factorial function at positive integers, it is well-defined for all complex numbers except zero and the non-negative integers. It is sometimes used as an analytic continuation of the factorial function to fractional and complex values. Over non-integers, the logarithmic terms are consequential in the value giving rise to the gamma extensions.

As an ode to its relevance, Γ\Gamma appears in multiple areas of mathematics, including:

ζ(s)=n=11ns=1Γ(s)0xs1ex1dx.\begin{aligned} \zeta(s) &= \sum\limits_{n=1}^\infty \frac{1}{n^s} \\ &= \frac{1}{\Gamma(s)} \int\limits_0^\infty \frac{x^{s-1}}{e^x - 1} \, \d x. \end{aligned}β(a,b)=01xa1(1x)b1dx=Γ(a)Γ(b)Γ(a+b).\begin{aligned} \beta(a, b) &= \int\limits_0^1 x^{a-1} (1-x)^{b-1} \, \d x \\ &= \frac{\Gamma(a) \Gamma(b)}{\Gamma(a+b)}. \end{aligned}πs/2Γ(s2)ζ(s)=π(1s)/2Γ(1s2)ζ(1s).\begin{aligned} \pi^{-s/2} \Gamma\parens{\frac{s}{2}} \zeta(s) &= \pi^{-(1-s)/2} \Gamma\parens{\frac{1-s}{2}} \zeta(1-s). \end{aligned}

Footnotes

  1. A pole of a function ff is a point in the domain of ff where the value of ff is undefined.