## The Gamma and Digamma functions

2018 March 10

Before I get into the definitions and the properties of these two functions, I must first introduce a new mathematical constant: the Euler-Mascheroni constant This constant is defined as follows: where $H_n$ are the harmonic numbers.

I will now establish an integral representation of the Euler-Mascheroni constant which will prove to be useful later on. Recall that the harmonic numbers $H_n$ are given by and recall that Recall also the value of the limit which will come into play shortly.

By definition, we have

and so

This is the integral representation that I was looking for! Now I will get into the definitions and properties of the gamma and digamma functions, and the Euler-Mascheroni constant will show up eventually - just wait.

In my previous post about the Gamma and Lambert-W functions, I introduced the Gamma function, but did not explore its properties in much depth. Here is its definition:

For positive integer $z$, it holds that and, in general, the gamma function has the property which I demonstrated in my other post by integrating by parts. It also has the special value which is the famed "Gaussian integral."

Before moving on to the digamma function, I would like to prove the following property of the gamma function, relating it to the Beta function $\mathrm{B}(a,b)$: Here is the proof: and so and

This result can be used to prove Legendre's famous duplication formula for the Gamma Function, which expresses $\Gamma(2z)$ in terms of $\Gamma(z)$ and $\Gamma(z+1/2)$. Recall the definition of the Beta function: By substituting $x\to x^2$ in the definite integral, this is equivalent to Notice also that, by substituting $x\to \frac{1+x}{2}$ in the original integral, we have and, as a consequence, Thus, we have Now, by using the representation of the Beta function in terms of the Gamma function, we have which can be rearranged to obtain

which is the final form of the Gamma function's duplication formula.

Now I will introduce the Digamma function, defined as I will start by calculating a few values of the digamma function - this is where the Euler-Mascheroni constant starts to appear. Since the Gamma function is defined as we have and so Let us first endeavour to calculate the value of $\psi(1)$: Using integration by parts, we have

The last step in this equality is justified by the integral representation of $\gamma$ that we obtained earlier. Thus, we have

We could go back and calculate $\psi(2)$, $\psi(3)$, and so on, but there's a shortcut to do this. Remember this recurrence for the gamma function that I mentioned earlier? By taking the natural logarithm of both sides, we have and by differentiating both sides with respect to $z$, This tells us that, for any positive integer $n$, where $H_n$ are the harmonic numbers.

Observe the following. Since as previously proven, we have that Furthermore, we also have that By subtracting these two equations, we have Now we let $N\to\infty$. As $N$ grows large, the term on the RHS inside of the parentheses approaches zero, and so we are left with Thus, we are left with the series representation for the digamma function:

Believe it or not, a closed form for the digamma function can be found for rational arguments. Though its derivation is a bit of a slog, I shall power through it for you. Using the series representation that we just derived, we have Now recall my old blog post in which I devised a strategy for evaluating infinite series in the form for natural numbers $p$ and $q$. I will not explain the methods I use again in this post, so if you do not understand, I encourage you to go back to the old post. Using the complex roots of unity $\omega_n$, defined as and using the fact that one can derive the following formula, for natural numbers $q$ and $p$ with $p\lt q$: Thus, it follows from this that and so, continuing the chain of equalities that I began earlier,

Yuck, look at that nasty algebra. Just look away for a moment and take a little break. Here are a few more formulas that I am going to use in just a moment:

These formulas are all pretty easy to derive, so I won't derive them for you. Keep an eye out for them as I continue the derivation - I'm not going to point them out.

Because $\psi(p/q)$ is a real number for rational $p/q$, it follows that the right side of the equality is a real number, and so we may ignore the imaginary parts of each term of the summation, since they are guaranteed to cancel out to zero. Thus, we have

This is it! This is the result we've been working towards!

Of course, this only works for $p/q\in (0,1)$. However, if we want it to work for all rational numbers, we can simply use its recurrence to say that

or

Using these two formulas, it is easy to verify that, for any rational number $r$,

Since the digamma function is continuous except at nonpositive integers, this property must necessarily extend to all real numbers, meaning that

By integrating both sides of this with respect to $z$, we get By taking $z=1/2$, we can solve and obtain $C=\ln\pi$, giving us and, by exponentiating both sides, we get the famous Gamma function reflection formula:

I conclude this post with an exercise for the reader. Using this reflection formula, can you calculate the value of the following integral?

NOTE: This is called Raabe's Integral, and the more general form can also be evaluated.