# Problem with evaluating $\int_0^{\frac{\pi}{2}} \ln(\sin(\theta))d\theta$ using Beta Function

Recently I've been trying to tackle the integral $$\int_0^{\frac{\pi}{2}} \ln(\sin(\theta))d\theta$$ using the Beta function $$\frac{B(\frac{x}{2},\frac{1}{2})}{2}=\int_0^{\frac{\pi}{2}} \sin^{x-1}(\theta)d\theta=\frac{\sqrt{\pi}}{2}\left(\Gamma\left(\frac{x+1}{2}\right)\right)^{-1}$$ Differentiating both sides $$\int_0^{\frac{\pi}{2}} \ln(\sin(\theta))\sin^{x-1}(\theta)d\theta=-\frac{\sqrt{\pi}}{4}\frac{\psi(\frac{x+1}{2})}{\Gamma(\frac{x+1}{2})}$$ However, at $$x=1$$ $$\int_0^{\frac{\pi}{2}} \ln(\sin(\theta))d\theta\ne\frac{\gamma\sqrt{\pi}}{4}$$

Where did I go wrong?

• $\psi(x)=\frac{d}{dx}\log \Gamma(x)$, not $\frac{d}{dx}\Gamma(x)$. – Frpzzd Dec 19 '18 at 23:37
• Also, unless you are specifically asked to use the beta function to solve this integral, I would suggest a lot less messy solution. Note that it is equal to half the value of the integral $\int_0^\pi \ln(\sin(x))dx$, and make use of the sine double-angle formula. – Frpzzd Dec 19 '18 at 23:39
• If you're open to a different method, call the integral $I$, so replacing $\sin$ with $\cos$ still gives $I$; you can simplify $2I$ using $\sin 2x=2\sin x\cos x$, then prove $2I=I+\cdots$ – J.G. Dec 19 '18 at 23:41

## 3 Answers

You forgot the $$\Gamma(x/2)$$ factor.

Cleaner approach: for any $$\alpha\geq 0$$,

$$\int_{0}^{\pi/2}\left(\sin\theta\right)^{\alpha}\,d\theta = \int_{0}^{1}\frac{u^\alpha}{\sqrt{1-u^2}}\,du = \frac{1}{2}\int_{0}^{1}v^{\frac{\alpha-1}{2}}(1-v)^{-1/2}\,dv = \frac{\Gamma\left(\frac{\alpha+1}{2}\right)}{\Gamma\left(\frac{\alpha+2}{2}\right)}\cdot\frac{\sqrt{\pi}}{2}$$ Now we differentiate both sides with respect to $$\alpha$$. In order to differentiate the RHS, we multiply it by its logarithmic derivative. We get:

$$\int_{0}^{\pi/2}\left(\sin\theta\right)^{\alpha}\log\sin\theta\,d\theta = \frac{\sqrt{\pi}}{4}\cdot \frac{\Gamma\left(\frac{\alpha+1}{2}\right)}{\Gamma\left(\frac{\alpha+2}{2}\right)}\cdot\left[\psi\left(\tfrac{\alpha+1}{2}\right)-\psi\left(\tfrac{\alpha+2}{2}\right)\right].$$ Now we evaluate at $$\alpha=0$$, recalling that $$\Gamma(1)=1,\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}$$ and $$\sum_{n\geq 0}\frac{1}{(n+1)\left(n+\tfrac{1}{2}\right)}=\frac{\psi(1)-\psi(1/2)}{1-1/2}= 4\log 2.$$ The final outcome is: $$\int_{0}^{\pi/2}\log\sin\theta\,d\theta = -\frac{\pi}{2}\log 2.$$

Another way that only requires knowledge of the beta function (and expansion of the gamma function) is given as follows. Consider the integral

\begin{aligned}\int_{0}^{\pi/2}\sin^{\epsilon}x\,\mathrm{d}x &= \int_{0}^{\pi/2}e^{\epsilon\ln\sin x}\,\mathrm{d}x = \sum_{n=0}^{\infty}\frac{\epsilon^{n}}{n!}\int_{0}^{\infty}\ln^{n}\sin x\,\mathrm{d}x \\ &= \frac{\Gamma(1/2)\Gamma(1/2+\epsilon/2)}{2\,\Gamma(1+\epsilon/2)}. \end{aligned}

We have to match the appropriate coefficient of $$\epsilon$$ found by expanding the latter expression to the coefficient of the series in the first line. The integral we are interested in is the $$n=1$$ term. $$\epsilon^{2}$$ and higher order terms can then be neglected. Due to the trigonometric form of the beta function, integrals of this type often require the use of Legendre's duplication formula

$$\frac{\Gamma(1+\epsilon)}{\Gamma(1/2+\epsilon)} = \frac{2^{2\epsilon}}{\sqrt{\pi}}\frac{\Gamma^{2}(1+\epsilon)}{\Gamma(1+2\epsilon)},$$

derived also by using the beta function. The expansion of the gamma function around $$1$$ is given as

$$\ln\Gamma(1+\epsilon) = -\gamma\epsilon + \sum_{k=2}^{\infty}\frac{(-1)^{k}\zeta(k)}{k}\epsilon^{k}$$

which is highly useful. Here $$\gamma$$ is the Euler-Mascheroni constant and $$\zeta(k)$$ is the Riemann zeta function. Note that the form of the expansion of the gamma function and the ratio of gamma functions $$\Gamma(1+\epsilon)/\Gamma^{2}(1+\epsilon/2)$$ means that the first order term of this ratio cannot contribute (it is just $$1$$), so up to first order,

\begin{aligned} \frac{\Gamma(1/2)\Gamma(1/2+\epsilon/2)}{2\,\Gamma(1+\epsilon/2)} &= \frac{\sqrt{\pi}}{2}\frac{\sqrt{\pi}}{2^{\epsilon}}\frac{\Gamma(1+\epsilon)}{\Gamma^{2}(1+\epsilon/2)} \\ &\approx \frac{\pi}{2}\frac{1}{e^{(\ln 2)\epsilon}} \approx \frac{\pi}{2}(1 - (\ln 2)\epsilon). \end{aligned}

In general, if we look for the coefficient of the $$n$$th term, we have to multiply by $$n!$$ to account for the factorial in the original expansion. First order term is trivial: $$1! = 1$$, so the first order coefficient is the answer

$$\int_{0}^{\pi/2}\ln\sin x\,\mathrm{d}x = -\frac{\pi}{2}\ln 2.$$