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

$Γ:Cs →C↦0∫∞ x_{s−1}e_{−x}dx. $An interesting result about this function is that $Γ(n)=(n−1)!$ for positive integers $n∈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?

First, consider the integral

$I(x) =∫lnxdx. $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 =uv−∫vdu. $Write $u=lnx$ and $dv=dx$. Then $du=x1 dx$ and $v=x$. So

$I(x) =∫lnxdx=xlnx−∫xx1 dx=xlnx−x+C. $What happens if we have higher powers of $lnx$?

$I_{2}(x) =∫ln_{2}xdx $Substitute $u=ln_{2}x$ and $dv=dx$. Then $du=x2lnx dx$ and $v=x$.

Using integration by parts;

$I_{2}(x) =∫ln_{2}xdx=xln_{2}x−∫xx2lnx dx=xln_{2}x−2∫lnxdx $Interestingly, we get $I(x)$ as part of the integration result of $I_{2}(x)$. If we fully integrate the result, we get:

$I_{2}(x) =xln_{2}x−2∫lnxdx=xln_{2}x−2(xlnx−x)+C=xln_{2}x−2xlnx+2x+C. $What happens with the third power? Take a guess, you're probably right.

$I_{3}(x) =∫ln_{3}xdx $Take $u=ln_{3}x$ and $dv=dx$. Then $du=x3ln_{2}x dx$ and $v=x$.

$I_{3}(x) =∫ln_{3}xdx=xln_{3}x−∫x⋅3ln_{2}x⋅x1 dx=xln_{3}x−3∫ln_{2}xdx $Again, we have $I_{2}(x)$ as part of the integration result of $I_{3}(x)$. Evaluating the integral fully gives:

$I_{3}(x) =xln_{3}x−3∫ln_{2}xdx=xln_{3}x−3(xln_{2}x−2xlnx+2x)+C=xln_{3}x−3xln_{2}x+6xlnx−6x+C. $Indeed, it always occurs that $I_{n}(x)=xln_{n}x−nI_{n−1}(x)$. But why is this a useful result?

Take a look at the coefficients of the last term, $x$.

$I(x)I_{2}(x)I_{3}(x)I_{4}(x)I_{5}(x) =xlnx−x+C=xln_{2}x−2xlnx+2x+C=xln_{3}x−3xln_{2}x+6xlnx−6x+C=xln_{4}x−4xln_{3}x+12xln_{2}x−24xlnx+24x+C=xln_{5}x−5xln_{4}x+20xln_{3}x−60xln_{2}x+120xlnx−120x+C⋮ $Those *are* factorials, with alternating signs (positive, negative).

Our goal is two-fold:

- To get rid of the leading terms involving $lnx$.
- 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 $x$ and a power of $lnx$. Thus, they all tend to zero at both $x=1$ (since $ln1=0$) and at $x=0$. We need to retain the last term with just $x$, which we can do by evaluating the integral over the interval $(0,1)$.

$[I_{n}]_{0}=0∫1 ln_{n}xdx =[(−1)_{n}⋅n!⋅x]_{0} =(−1)_{n}⋅n! $### Removing the Sign Alternation

To do this, we need to negate the result for odd $n$. This is easily achieved by dividing the result by $(−1)_{n}$, giving the integral

$n! =(−1)_{n}1 0∫1 ln_{n}xdx=0∫1 (−1)_{n}ln_{n}x dx=0∫1 (−1lnx )_{n}dx=0∫1 (−lnx)_{n}dx=0∫1 ln_{n}x1 dx. $But the integral now looks complicated. Can we simplify it?

Substitute $u=lnx1 $, so that:

$u−uxdx =lnx1 =lnx=e_{−u}=−e_{−u}du $Note that as $x→0_{+}$, $x1 →∞_{+}$, therefore $u→∞_{+}$, and when $x→1$, $x1 →1$, so $u→0$.

Thus;

$0∫1 ln_{n}x1 dx =∞∫0 u_{n}⋅(−e_{−u})du=−∞∫0 u_{n}⋅e_{−u}du=0∫∞ u_{n}⋅e_{−u}du $This is the exact form of the gamma function, evaluated at $s=n+1$.

Why is the gamma function shifted by $1$?

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 $1$ to make it easier to work with
by giving it a pole^{1} at the origin instead of at $s=−1$.

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, $Γ$ appears in multiple areas of mathematics, including:

- Complex analysis (definition of the Riemann zeta function):

- Probability theory (definition of the beta distribution):

- Number theory (the functional equation of the Riemann zeta function):

- And many more, left as an exercise to the reader.

- A pole of a function $f$ is a point in the domain of $f$ where the value of $f$ is undefined. ↩