# Calculate integrals involving gamma function

What are the usual ways to follow in order to solve the integrals given below? \begin{align*} I&=\int_0^1 \ln\Gamma(x)\,dx\\ J&=\int_0^1 x\ln\Gamma(x)\,dx \end{align*}

-
A quick google search reveals the following paper: google.com/…. These appear to be very serious and tedious integrals to compute. –  nullUser Jul 5 '12 at 20:41
@nullUser: i hope they are not that serious and tedious. Andrew's solution for the first integral is very easy and short. –  Chris's sis Jul 5 '12 at 21:02
It looks very easy because he hid all of the difficulty. Computing $\int_0^{\pi}\log \sin x$ is now the serious and tedious integral to compute. –  nullUser Jul 5 '12 at 21:05
@nullUser: i know to compute that integral very easily. Yes, Andrew did the hard part. –  Chris's sis Jul 5 '12 at 21:16
Here is a method of that integral without reflection formula math.stackexchange.com/questions/130621/… –  Norbert Jul 5 '12 at 21:50

As an addendum of sorts to the previous answers, there is the identity

$$\mathrm{logG}(z+1)=\frac{z}{2}\log(2\pi)-\frac{z(z+1)}{2}+z\log\Gamma(z+1)-z(\log\,z-1)-\int_0^z \log\Gamma(t)\,\mathrm dt$$

where $\mathrm{logG}(z)$ is the logarithm of the Barnes function (double gamma function) $G(z)$, the function that satisfies the functional equation $G(z+1)=\Gamma(z)G(z)$. (Barnes proved this identity in his paper, where he introduced the function now named after him.) For $n$ an integer, $G(n)$ can be expressed as

$$G(n)=\prod_{k=1}^{n-2} k!$$

Thus, to evaluate $\int_0^1 \log\Gamma(t)\,\mathrm dt$, we have

\begin{align*} \mathrm{logG}(2)&=\frac{1}{2}\log(2\pi)-1+\log\Gamma(2)-(\log\,1-1)-\int_0^1 \log\Gamma(t)\,\mathrm dt\\ 0&=\frac{1}{2}\log(2\pi)-\int_0^1 \log\Gamma(t)\,\mathrm dt \end{align*}

and you obtain the same solution as Andrew.

For the integral $\int_0^1 t\log\Gamma(t)\,\mathrm dt$, integration by parts and taking appropriate limits yields the identity

$$\int_0^1 t\log\Gamma(t)\,\mathrm dt=-\frac12\int_0^1 t^2\,\psi(t)\,\mathrm dt$$

Now, Victor Adamchik, in a paper on negative-order polygamma functions (the same sort of functions that appear in Argon's answer), gives the identity

$$\begin{split}&\int_0^z x^n \psi(x) \,\mathrm dx=\\&(-1)^n\left(\frac{B_{n+1} H_n}{n+1}-\zeta^\prime(-n)\right)+\sum_{k=0}^n (-1)^k \binom{n}{k} z^{n-k} \left(\zeta^\prime(-k,z)-\frac{B_{k+1}(z) H_k}{k+1}\right)\end{split}$$

where $B_n$ and $B_n(z)$ are the Bernoulli numbers and polynomials, $H_n=\sum_{j=1}^n\frac1{j}$ is a harmonic number, and $\zeta^\prime(s,a)=\left.\frac{\mathrm d}{\mathrm dt}\zeta(t,a)\right|_{t=s}$ is the derivative of the Hurwitz zeta function.

For $z=1$, the identity simplifies nicely:

$$\int_0^1 x^n \psi(x) \,\mathrm dx=\sum_{k=0}^{n-1}(-1)^k\binom{n}{k}\left(\zeta^\prime(-k)-\frac{B_{k+1} H_k}{k+1}\right)$$

Taking $n=2$, and using the special values $\zeta^\prime(0)=-\frac12\log(2\pi)$ and $\zeta^\prime(-1)=\frac1{12}-\log\,A$, where $A$ is the Glaisher-Kinkelin constant, we finally obtain

$$\int_0^1 x^2 \psi(x) \,\mathrm dx=2\log\,A-\frac12\log(2\pi)$$

and thus

$$\int_0^1 t\log\Gamma(t)\,\mathrm dt=\frac14\log(2\pi)-\log\,A$$

-
nice identity! (+1) –  Chris's sis Jul 8 '12 at 6:48
Just in case you haven't seen it, I added something for the second integral. –  Ｊ. Ｍ. Jul 11 '12 at 11:07
thanks for your answer! –  Chris's sis Jul 11 '12 at 11:11

As for the first integral, one can use the Euler's reflection formula $\Gamma(1-z) \; \Gamma(z) = {\pi \over \sin{\pi z}}\;$: $$I=\frac12\int_0^1 ( \log \Gamma(x)+\log \Gamma(1-x))\; dx= \frac12\int_0^1 \log \frac{\pi} {\sin{\pi x}} dx=$$ $$\frac12\int_0^1 (\log {\pi}-\log {\sin{\pi x}})\; dx= \frac12\log {\pi}-\frac1{2\pi}\int_0^\pi \log {\sin{x}}\; dx=$$ $$\frac12\log {\pi}-\frac1{2\pi}(-\pi \log 2)=\frac{1}{2} \log 2 \pi.$$ The last integral is well known Gauss integral.

-

As for $J$, another way is to try to use the Fourier series for $\ln\Gamma(x)$ discovered by E.E. Kummer in 1847:

$$\ln\Gamma(x)=\frac{\ln 2\pi}{2}+\sum_{n=1}^{\infty}\frac{\cos 2\pi nx}{2n}+\sum_{n=1}^{\infty}\frac{(\gamma+\ln 2\pi n)\sin 2\pi nx}{n\pi}\,(0<x<1)$$

where $\gamma=0.577\dots$ is Euler's constant

Let's multiply this equality by $x$ and integrate from $0\text{ to }1$.

Integrals on the right side:

\begin{align*} &\int_{0}^{1}x\,dx=\frac{1}{2}\\ &\int_{0}^{1}x\cos 2\pi nx\,dx=0\\ &\int_{0}^{1}x\sin 2\pi nx\,dx=-\frac{1}{2\pi n} \end{align*} Thus, \begin{align*}\int_{0}^{1}x\ln\Gamma(x)&=\frac{\ln 2\pi}{4}-\frac{\gamma}{2\pi^2}\sum_{n=1}^{\infty}\frac{1}{n^2}-\frac{1}{2\pi^2}\sum_{n=1}^{\infty}\frac{\ln 2\pi n}{n^2}\\&=\frac{\ln 2\pi}{4}-\frac{\gamma}{12}-\frac{1}{2\pi^2}\sum_{n=1}^{\infty}\frac{\ln 2\pi n}{n^2}\end{align*} if I am not mistaken. I don't know can this be simplified further.

-
it leads to the answer written above by Argon since $\sum_{n=1}^\infty\frac{\log n}{n^2}$ can be expressed through the Glaisher's constant en.wikipedia.org/wiki/Glaisher–Kinkelin_constant –  Andrew Jul 6 '12 at 15:42

The integral $I$ was mentioned on chat recently, and my solution is different than those given before.

Since $x\Gamma(x)=\Gamma(x+1)$, we have $$\int_0^n\log(\Gamma(x))\,\mathrm{d}x+\int_0^n\log(x)\,\mathrm{d}x =\int_1^{n+1}\log(\Gamma(x))\,\mathrm{d}x\tag{1}$$ Subtracting $\int_1^n\log(\Gamma(x))\,\mathrm{d}x$ from $(1)$ gives $$\int_0^1\log(\Gamma(x))\,\mathrm{d}x+\int_0^n\log(x)\,\mathrm{d}x =\int_n^{n+1}\log(\Gamma(x))\,\mathrm{d}x\tag{2}$$ Stirling's approximation says $$\log(\Gamma(x))=x\log(x)-x-\frac12\log(x)+\frac12\log(2\pi)+o(1)\tag{3}$$ Integrating $(3)$ between $n$ and $n+1$ yields \begin{align} &\int_n^{n+1}\log(\Gamma(x))\,\mathrm{d}x\\ &=\left[\frac12x^2\log(x)-\frac14x^2-\frac12x^2-\frac12x\log(x)+\frac12x\right]_n^{n+1}+\frac12\log(2\pi)+o(1)\\ &=n\log(n)-n+\frac12\log(2\pi)+o(1)\tag{4} \end{align} Furthermore, $$\int_0^n\log(x)\,\mathrm{d}x=n\log(n)-n\tag{5}$$ In light of $(2)$, subtracting $(5)$ from $(4)$ gives \begin{align} \int_0^1\log(\Gamma(x))\,\mathrm{d}x &=\frac12\log(2\pi)+o(1)\\ &=\frac12\log(2\pi)\tag{6} \end{align}

-
Really nice! (+1). I like to see many solutions to each problem. –  Chris's sis Jul 15 '13 at 7:49

By parts, we have $$J=\int_0^1 x\log \Gamma(x) \, dx=\left[x\psi^{(-2)}(x)\right]_0^1-\int_0^1 \psi^{(-2)}(x)\, dx=\psi^{(-2)}(1)-\psi^{(-3)}(1)=I-\psi^{(-3)}(1)=\frac{1}{4}\log (\frac{2\pi}{A^4})$$

where $A \approx 1.28$ is Glaisher's constant.

-
This is not a solution, for my taste. You just referenced to the values of $\psi$ function which known to the narrow circle of specialists. In order to get I usual solution (which uses only basic facts obout gamma function) one need to repeat some part of Glaisher's work. –  Norbert Jul 5 '12 at 22:55