# A $\log \Gamma$ identity: Where does it come from?

$$\log \Gamma (n)=n\log n -n +\frac{1}{2} \log \frac{2\pi}{n}+\int_0^\infty \frac{2\arctan (\frac{x}{n})}{e^{2\pi x}-1} \,\mathrm{d}x$$

Is an identity that is derived from using Sterling's approximation. I can't quite figure out how it was used, and was wondering for a proof.

• it is an application of the abel-plana formula – tired Jan 8 '16 at 20:59
• @tired what formula is that? – user266519 Jan 8 '16 at 21:05
• Differentiate both sides the right hand side w.r. t. $n$ , then apply the abel-plana formula to the function $1/(1+x/n)$ and use the series representation for the digamma function. Afterwards integrate back w.r.t to n – tired Jan 8 '16 at 21:05
• give google a shot... – tired Jan 8 '16 at 21:05
• @Dr.MV right, but i think the point is that their difference is well defined, also please have a look here: dlmf.nist.gov/5.9 it seems to work out – tired Jan 8 '16 at 21:45

Differentiate the integral $I(n)=2 \int_0^{\infty}\frac{\arctan(x/n)}{e^{2\pi t}-1}$ w.r.t. $n$:

$$I'(n)=\frac{2}{n} \int_{0}^{\infty}\frac{(x/n)}{(x/n)^2+1}\frac{1}{e^{2\pi x}-1}=\frac{-i}{n}\int_0^{\infty}\frac{f(i (x/n))-f(-i (x/n))}{e^{2\pi x}-1}$$

with $f(x/n)=\frac{1}{1+(x/n)}$

Let's apply Abel-Plana:

$$I'(n)=-\lim_{N\rightarrow \infty}\left(\sum_{m=0}^{N}\frac{1}{n+m}-\log(N)\right)+\frac{1}{2n}-\log(n)$$

The limit is given by the Digamma function and therefore

$$I'(n)=\psi(n)+\frac{1}{2n}-\log(n)$$

integrating back w.r.t $n$ gives

$$I(n)=\log(\Gamma(n))+\frac{\log(n)}{2}-n(\log(n)-1)+C$$

To fix the constant of integration we observe that $I(\infty)=0$. Together with the asymptotic expansion $\log(\Gamma(z))\approx \log(\sqrt{2\pi z}\left(\frac{z}{e}\right)^z)=(z-1/2)\log(z)-z+\frac{1}{2}\log(2\pi)$ this yields $C=-\frac{1}{2}\log(2\pi)$

We obtain:

$$I(n)=\log(\Gamma(n))+\frac{\log(n)}{2}-n(\log(n)-1)-\frac{1}{2}\log(2\pi)$$

this differs from the proposed answer by some signs in subleading terms, but is the same then as here

Appendix

Theorem:

The Digamma function is given by $\psi(x)=\lim_{N\rightarrow \infty}\left(-\sum_{m=0}^{N}\frac{1}{x+m}+\log(N)\right)$

(Informal) Proof:

Let's use the classical (Gauss-) product representation of the Gamma function:

$$\Gamma(x)=\lim_{N\rightarrow \infty}\frac{N! N^x}{\prod_{m=0}^N (x+m)}$$

taking logarithms

$$\log(\Gamma(x))=\lim_{N\rightarrow \infty}( \log(N!)+x\log(N)-\sum_{m=0}^N\log(x+m))$$

differentiate w.r.t. $x$

$$\psi(x)\equiv\partial_x\log(\Gamma(x))=\lim_{N\rightarrow \infty}(\log(N)-\sum_{m=0}^N\frac{1}{x+m})$$

QED

• I have a question to this proof. In first step you differentiated $I$ using this formula math.stackexchange.com/questions/1681848/… How do you know you can do this? Is this formula always true or you need some addtitional assumption? – Kulisty Mar 4 '16 at 8:44
• The function is differentiable for all $n$ integrable on $x\in[0,\infty]$ and the derivative is also integrable on this interval so i don't think there is a problem here – tired Mar 4 '16 at 10:01
• So you say that the formula I gave link to is always true? Do you know the proof? (You have to justify that you can interchange limit and integral) – Kulisty Mar 4 '16 at 13:30
• u can look up this stuff on wikipedia – tired Mar 4 '16 at 13:54

Proposition : $$\int_{0}^{\infty} \dfrac{\log(1-e^{-2a\pi x})}{1+x^2} \mathrm{d}x = \pi \left[\dfrac{1}{2} \log (2a\pi ) + a(\log a - 1) - \log(\Gamma(a+1)) \right]$$

Proof : Let $\displaystyle \text{I} (a) = \int_{0}^{\infty} \dfrac{\log(1-e^{-2a\pi x})}{1+x^2} \mathrm{d}x$

$\displaystyle = -\sum_{r=1}^{\infty} \dfrac{1}{r} \int_{0}^{\infty} \dfrac{e^{-2ar \pi x}}{1+x^2} \mathrm{d}x$

$\displaystyle = -\sum_{r=1}^{\infty} \dfrac{1}{r} \int_{0}^{\infty} \int_{0}^{\infty} e^{-x(2ar \pi + y)} \sin y \ \mathrm{d}y \ \mathrm{d}x$

$\displaystyle = -\sum_{r=1}^{\infty} \dfrac{1}{r} \int_{0}^{\infty} \dfrac{\sin y}{2ar\pi + y} \mathrm{d}y$

$\displaystyle = - \sum_{r=1}^{\infty} \dfrac{1}{r} \int_{0}^{\infty} \dfrac{\sin x}{2ar\pi + x} \mathrm{d}x$

Substitute $\displaystyle x \mapsto 2 r \pi x$

$\displaystyle \implies \text{I}(a) = - \sum_{r=1}^{\infty} \dfrac{1}{r} \int_{0}^{\infty} \dfrac{\sin 2 r \pi x}{x + a} \mathrm{d}x$

$\displaystyle = -\int_{0}^{\infty} \dfrac{1}{x+a} \sum_{r=1}^{\infty} \dfrac{\sin(2 r \pi x)}{r} \mathrm{d}x$

$\displaystyle = -\pi \int_{0}^{\infty} \dfrac{1}{x+a} \left(\dfrac{1}{2} - \{x\} \right) \mathrm{d}x \quad \left( \because \sum_{r=1}^{\infty} \dfrac{\sin (2 r \pi x)}{r} = \dfrac{\pi}{2} - \pi \{x\} \right)$

$\displaystyle = -\pi \left[ \int_{0}^{\infty} \dfrac{\mathrm{d}x}{2(x+a)} - \int_{0}^{\infty} \dfrac{\{x\}}{x+a} \mathrm{d}x \right]$

$\displaystyle = -\pi \lim_{n \to \infty} \left[ \dfrac{1}{2} \log \left(\dfrac{a+n}{a}\right) - \text{A}(n) \right]$

where $\displaystyle \text{A}(n) = \int_{0}^{n} \dfrac{\{x\} }{x+a} \mathrm{d}x$

Now,

$\displaystyle \text{A}(n) = \int_{0}^{n} \dfrac{\{x\} }{x+a} \mathrm{d}x$

$\displaystyle = \sum_{k=0}^{n} \int_{k}^{k+1} \dfrac{x-k}{x+a} \mathrm{d}x$

$\displaystyle = \sum_{k=0}^{n} \left[1 - (k+a)\log \left(\dfrac{k+a+1}{k+a}\right) \right]$

$\displaystyle = n - \sum_{k=0}^{n} \left[ (k+a+1) \log (k+a+1) - (k+a) \log (k+a) - \log (k+a+1) \right]$

$\displaystyle = n + a\log a - (a+n) \log (a+n) +\log(a \cdot (a+1) \cdot \ldots \cdot (a+n)) - \log a$

$\displaystyle \implies \text{I} (a) = -\pi \lim_{n \to \infty} \left[ \dfrac{1}{2} \log \left(\dfrac{a+n}{a}\right) - n - a\log a + (a+n) \log (a+n) - \log(a \cdot (a+1) \cdot \ldots \cdot (a+n)) + \log a \right]$

Note that $\displaystyle \lim_{n \to \infty} \dfrac{ n! n^t}{t \cdot (t+1) \cdot \ldots \cdot (t+n)} = \Gamma(t)$

$\displaystyle \implies \text{I} (a) = -\pi \lim_{n \to \infty} \left[ \dfrac{1}{2} \log \left(\dfrac{a+n}{a}\right) - n - a\log a + (a+n) \log (a+n) - a\log(n) - \log (n!) + \log(\Gamma(a)) + \log a \right]$

Simplifying using Stirling's Approximation and $\displaystyle \lim_{n \to \infty } n \log \left(1 + \dfrac{a}{n} \right) = a$, we have,

$\displaystyle \text{I} (a) = -\pi \left[\log(\Gamma(a+1)) - \dfrac{1}{2} \log(2a \pi) - a (\log(a) -1) \right]$

$\displaystyle = \pi \left[ \dfrac{1}{2} \log(2a \pi) + a (\log(a) -1) - \log(\Gamma(a+1)) \right] \quad \square$

Now,

Applying Integration By Parts on the proposition and simplifying, we get,

$\displaystyle \int_{0}^{\infty} \tan^{-1} \left(\dfrac{t}{a}\right)\dfrac{\mathrm{d}t}{e^{2\pi t} - 1} = \dfrac{1}{2} \left[ \log(\Gamma(a)) - \dfrac{\log(2a)}{2} - \left( a - \dfrac{1}{2} \right)\log (a) +a\right]$

$$\therefore \log(\Gamma(a)) = 2\int_{0}^{\infty} \tan^{-1} \left(\dfrac{t}{a}\right)\dfrac{\mathrm{d}t}{e^{2\pi t} - 1} + \dfrac{\log(2a)}{2} + \left( a - \dfrac{1}{2} \right)\log (a) -a \quad \square$$

• your answer is really nice! I tried to replicate it step by step, but I had some difficulty taking the limit $\lim_{n \rightarrow \infty}I(a)$. Could you kindly expand this step a little more? Thank you very much! – Ricardo770 Jul 20 '20 at 13:15
• @Ricardo770 Which part are you exactly stuck in? – MathGod Jul 29 '20 at 11:09
• thank you for your reply. I got stuck before taking the last limit, after using Stirling´s approximation. This is what I was able to get $I(a)=-\pi \lim_{n \rightarrow \infty}\left[\left(a+n+\frac{1}{2}\right)\log(1+\frac{a}{n})-\left(a+\frac{1}{2}\right)\log(a)-\frac{1}{2}\log(2\pi)+log(\Gamma(a+1))\right]$. I aprreciate if you can tell how to proceed from this point on. Thank you again! – Ricardo770 Jul 29 '20 at 14:35
• @Ricardo770 You're basically done, you just need to manage the terms with $n$, which is the first term. So you need to show that $$\lim_{n \to \infty} \left( a+n+\dfrac{1}{2} \right) \ln \left( 1 + \dfrac{a}{n} \right) = a$$ To show that, just separate the terms as $$\lim_{n \to \infty} \left( a+\dfrac{1}{2} \right) \ln \left( 1 + \dfrac{a}{n} \right) + \lim_{n \to \infty} n \ln \left( 1 + \dfrac{a}{n} \right)$$ The first limit goes to zero since $\ln (1) = 0$ and the second limit goes to $a$, which is a well known limit and can be proved using Taylor's Series, for instance. – MathGod Aug 12 '20 at 1:34
• thank you, I'll try it and let know. – Ricardo770 Aug 12 '20 at 12:02