Skip to main content

Factorials, and the Gamma Function

What is the Gamma function? What does it have to do with the factorial of a number? And why does such a formula even work?

The Factorial

In our high school combinatorics course, we were introduced to the factorial of a natural number. We defined the factorial of a number $n$ to be the product of all the natural numbers till $n$.
Or symbolically:
$$n! = 1 . 2 . 3 ... (n-2)  (n-1)  n$$
This is a very useful function in Counting problems. This function also pops up in the exponential function:
$$e^x = 1+\frac{x}{1!}+\frac{x^2}{2!}+\frac{x^3}{3!}+...$$
Setting this aside, we think: can we 'extend' this function to all real number?

Surely, even if we were to come up with such a function, what would it mean to take this new 'factorial' of some real number?

Well, let's take a look at one important property of the factorial function:
$$n! = n(n-1)!$$ and this is true for all natural numbers $n$.

So, even if we came up with this homologous function, we'd have to make sure this property is not lost.

The extended Factorial

Let's call this new function $\phi(x)$. That is, $\phi(0)$ is still 1, and $\phi(3)$ is still 6, but this function is applicable to all positive real numbers.

Here comes the 'What the hell?' part. It turns out that:
$$\phi(x) = \int\limits_0^\infty {t^x e^{-t} dt}$$
Weird, right? And yet, it's true. If we try evaluating this function for any natural number, we still end up with the original result as the factorial.
Let us try to take our mind off what this means, or why it should even make sense, and actually try different values and see where we end up.

The Gamma Function

For many reasons, the gamma function is defined in almost the same way as the formula above, except that it gives the factorial of the preceding number. Or, we say:
$$\Gamma(x) = \int\limits_0^\infty {t^{x-1} e^{-t} dt}$$
So, we'd have $\Gamma(2) = 1$, $\Gamma(4) = 6$, and so on.

We'll attempt to evaluate the value of $\Gamma(1)$
$$\Gamma(1) = \int\limits_0^\infty {t^{1-1} e^{-t} dt}$$
$$= \int\limits_0^\infty {e^{-t}dt} = -e^{-t}\Big|_0^\infty$$
$$=1$$

Seems good. A little more interestingly:
$$\Gamma(2) = \int\limits_0^\infty {t^{2-1}e^{-t} dt} = \int\limits_0^\infty {te^{-t}dt}$$
$$= \int\limits_0^\infty {[(t+1)e^{-t}-e^{t}]dt} = -\int\limits_0^\infty {(t+1)(-e^{-t})dt + e^{-t}dt}$$
$$= -\int\limits_0^\infty {(t+1)d(e^{-t}) +e^{-t}d(t+1)}$$
$$= -\int\limits_0^\infty {d((t+1)e^{-t})} = (t+1)e^{-t}\Big|_\infty^0$$
$$=\frac{1+0}{e^0} - \lim_{t\to\infty} \frac{t+1}{e^t}$$
$$=1$$

Why the formula works

Remember that neat property of factorials? We had: $n! = n(n-1)!$

Somewhat similarly, if we prove that $\Gamma(n+1) = n\Gamma(n)$, then we are automatically done. 
Why though?

We have already shown that $\Gamma(1)=1$. If we were to prove the above expression, it would automatically mean that:

$\Gamma(2)=(1)\Gamma(1)=1$
$\Gamma(3)=(2)\Gamma(2)=2$
$\Gamma(4)=(3)\Gamma(3)=6$

and so on. This recurrence relation gives the factorial values for the integers.

Let's start the proof.

To prove that: $\Gamma(n+1)=n\Gamma(n)$

We have:
$\Gamma(n+1) = \int\limits_0^\infty {t^ne^{-t}dt}$
Consider:
$$d(t^ne^{-t}) = -t^ne^{-t}dt + (n) t^{n-1} e^{-t}dt$$
$$\implies \int\limits_0^\infty {t^ne^{-t}dt} = n \int\limits_0^\infty {t^{n-1}e^{-t}dt } - t^ne^{-t}\Big|_0^\infty$$
$$\int\limits_0^\infty {t^ne^{-t}dt} = n \int\limits_0^\infty {t^{n-1}e^{-t}dt } - (0-0)$$
$$\therefore \Gamma(n+1) = n\Gamma(n)$$
And we're done.

$\Gamma(\large\frac{1}{2})$, and other interesting properties

It turns out that this Gamma function $\Gamma$, is defined for all real numbers, except the negative integers (try to figure out why).

Let's try evaluating $\Gamma(\large\frac{1}{2})$

$\Gamma(\frac{1}{2}) = \int\limits_0^\infty {t^{\large\frac{-1}{2}}e^{-t}dt }$

$= \int\limits_0^\infty {\large\frac{e^{-t}}{\sqrt{t}}dt}$

It turns out that this function's integral cannot be expressed with elementary functions. Try all you want, but you won't get a neat answer to for integral.

However, we can use the erf function to evaluate the integral. I'll skip the actual calculation and present to you, the answer, in all it's glory:
$$\Gamma(\large\frac{1}{2})=\sqrt{\pi}$$
Thus, in a way, it makes sense to say that the factorial of $\large\frac{-1}{2}$ is $\sqrt{\pi}$.
Amazing, right?

Another awesome property of the Gamma function is that you can evaluate it's value for complex numbers too! But understanding of such properties requires knowledge of complex integrals.



Comments

Popular posts from this blog

The $\operatorname{erf}$ function

Can a function be 'defined' as the anti-derivative of another function? $\operatorname{erf}$ is one such function. Even though it has various proper infinite series expansions (as in Wolfram MathWorld - Erf ), it is defined by mathematicians as such: $$\operatorname{erf}(z) \equiv \frac{2}{\sqrt{\pi}}\int_0^ze^{-t^2}dt$$ This function has extensive implications in statistics, and can be used to express the integral of $e^{-x^2}$ and $e^{x^2}$. See the post that tries to find  integral of $e^{x^2}$  - we need not use integration by parts there, but rather can use the $\operatorname{erf}$ function. Source: Wolfram MathWorld

Problems that deceive you #1

Let us look at one of the most easiest problems in calculus $$\int_0^{\frac{\pi}{2}}\sqrt{4\sin^2\frac{x}{2}-4\sin\frac{x}{2}+1}\; dx$$ Seems pretty simple and straightforward, doesn't it? Inside the square root, the expression evaluates to $(2\sin\frac{x}{2}-1)^2$, and thus the integral will be $$\int_0^{\frac{\pi}{2}}\Bigl(2\sin\frac{x}{2}-1\Bigr)dx$$ This then can be evaluated by the following: $$\biggl[-4\cos\frac{x}{2} -x\biggr]_0^{\frac{\pi}{2}}$$ Hold on for the surprise... Its wrong! What seemed like a really straightforward and easy problem, is designed in such a way to appear easy so that we approach the wrong way. Why is the approach wrong? We did not consider the fact that a simple square root symbol represents its principal square root i.e., the positive square root. That means each and every value the expression inside the original integral evaluates to a positive quantity. But that is not the case when we simplified the integral to  $$\int...