# Integration of $\ln\sin x$ from 0 to $\frac{\pi}{2}$ by DUIS

How can we evaluate the integration $$\int_{0}^{\pi/2}\ln\left(\sin\left(x\right)\right) \,{\rm d}x$$ by using DUIS ( differentiation under the integral sign ) ?.

This question popped into my head when I read an article about DUIS as $$\ln\left(\left\vert\sin\left(x\right)\right\vert\right)$$ is the integral of $$\cot\left(x\right)$$.

Although I am in $$12$$th Standard, I am keen to learn new and exciting concepts and techniques, so please tell me if you have any questions related to this. Thanks !.

• Welcome to MSE. For some basic information about writing mathematics at this site see, e.g., basic help on mathjax notation, mathjax tutorial and quick reference, main meta site math tutorial and equation editing how-to. Commented Sep 26, 2018 at 9:46
• $\log\sin x$ has no elementary antiderivative, DUIS will not help.
– user65203
Commented Sep 26, 2018 at 9:58
• And by the way, this formula is not used as an integration technique.
– user65203
Commented Sep 26, 2018 at 10:04
• Ok thanks Yves Daoust... Can you tell me what should i learn about integration after duis? Commented Sep 26, 2018 at 10:05

There is another way to evaluate the integral.

Firstly, we have $$\int_0^{\frac{\pi}{2}}\ln \sin x\ dx\overset{t=\frac{\pi}{2}-x}{=}\int_0^{\frac{\pi}{2}}\ln \cos t\ dt,$$ and $$\int_{\frac{\pi}{2}}^{\pi}\ln \sin x\ dx\overset{t=x-\frac{\pi}{2}}{=}\int_0^{\frac{\pi}{2}}\ln \cos t\ dt.$$ Then \begin{align} 2\int_0^{\frac{\pi}{2}}\ln \sin x\,dx &=\int_0^{\frac{\pi}{2}}\ln \sin x\,dx+\int_0^{\frac{\pi}{2}}\ln \cos x\,dx \\ &=\int_0^{\frac{\pi}{2}}\ln \sin 2x\,dx-\frac{\pi}{2}\ln 2 \\ &=\frac{1}{2}\int_0^{\pi}\ln \sin x\ dx-\frac{\pi}{2}\ln 2\\ &=\frac{1}{2}\left(\int_0^{\frac{\pi}{2}}\ln \sin x\ dx+\int_{\frac{\pi}{2}}^{\pi}\ln \sin x\ dx\right)-\frac{\pi}{2}\ln 2\\ &=\int_0^{\frac{\pi}{2}}\ln \sin x\ dx-\frac{\pi}{2}\ln 2. \end{align}

That is $$\int_0^{\frac{\pi}{2}}\ln \sin x\ dx=-\frac{\pi}{2}\ln 2.$$

• Excellent answer, thank you. (+1) Commented May 21, 2021 at 16:57
• Note that $\int\limits_0^{\frac{\pi}{2}}\ln (\sin x)dx$ is an improper integral. Without proving or at least assuming its existence it makes no sense to apply integration by substitution. Commented Jan 6, 2022 at 20:22
• @Philipp Yes, you are right. We should first prove the existence of the integral, and it is clear by noting that $x^\varepsilon\ln \sin x\to 0$ as $x\to 0$.
– ling
Commented Jan 8, 2022 at 2:03
• Just to make sure that I understood your comment right, if $0<x\leq1$, then $\ln(\sin(x))\leq x^{\epsilon}\ln(\sin(x))<0$, where $\epsilon\in\mathbb{R}$. Therefore integral $\int\limits_0^{1}x^{\epsilon}\ln(\sin(x)) dx$ exists and of course $\int\limits_0^{\frac{\pi}{2}}x^{\epsilon}\ln(\sin(x)) dx$. So by comparison test $\int\limits_0^{\frac{\pi}{2}}\ln (\sin x)dx$ exists. Is this what you had in mind? Commented Jan 8, 2022 at 10:11
• @Philipp Not exactly. What I mean is that for any fixed $0<\varepsilon<1$, there is $|\ln\sin x|\leq\frac{C}{x^\varepsilon}$ for $x$ sufficiently close to $0$, then the integral exists by comparison test.
– ling
Commented Jan 9, 2022 at 2:28

You can start by defining $$I(a)=\int_0^{\pi/2} \sin^a x\,dx$$ Your desired integral is then just $$I'(0)$$. Now, in order to evaluate $$I(a)$$ in closed form, we will have to use the Beta function and its connection to the Gamma function:

\begin{align} I(a)&=\int_0^{\pi/2} \sin^a x\,dx \\ &=\frac{1}{2}B\left(a/2+1/2,1/2\right) \\ &=\frac{\Gamma\left(a/2+1/2\right)\Gamma\left(1/2\right)}{2\Gamma(a/2+1)} \\ &= \frac{\sqrt{\pi}}{2}\frac{\Gamma\left(a/2+1/2\right)}{\Gamma(a/2+1)} \end{align} Differentiating $$I(a)$$ and letting $$a\to 0$$ then yields

\begin{align} I'(a)\Big|_{a=0}&=\frac{\sqrt{\pi}}{2}\cdot\frac{\Gamma\left(a/2+1/2\right)\left(\psi^{(0)}\left(a/2+1/2\right) - \psi^{(0)}(a/2+1)\right)}{\Gamma(a/2)}\Biggr|_{a=0} \\ &=-\frac{\sqrt{\pi}}{2}\cdot \sqrt{\pi}\log 2 \\ &=-\frac{\pi}{2}\log 2 \end{align}

And we can conclude that

$$\int_0^{\pi/2} \log\sin x\,dx = -\frac{\pi}{2} \log 2$$

• I use hit and trial method for defining the function on which we have to apply DUIS. Is hit and trial the only way or do we use some method for defining that function? Commented Sep 26, 2018 at 17:22
• There is no general way to find an integrand on which to apply differentiation under the integral sign, but there are some tricks you can use--and with experience, you will have more tools at your disposal and be able to perhaps combine them in effective ways. I will also add that this can be a highly creative and imaginative process, and I find it incredibly fun and rewarding. An example of a technique I used in this answer: when you have an integral of the form $\int \log f(x) dx$, try to compute the integral $I(a)=\int f(x)^a dx$, differentiate it with respect to $a$, finding $I'(0)$. Commented Sep 26, 2018 at 18:22
• Thank you Zachary! Commented Sep 27, 2018 at 0:22

We can also derive by power series / Fourier series in $$\mathbb{C}$$.

$$\ln(1+z) = z - \frac{z^2}{2} + \frac{z^3}{3} \pm \cdots, \quad |z| \leq 1 \land z \neq -1.$$

Substitute $$z = e^{2i \theta}$$ and take the real part, we get

$$\ln 2 + \ln\cos\theta = \cos(2\theta) - \frac{\cos(4\theta)}{2} + \frac{\cos(6\theta)}{3} \pm\cdots.$$

(Hint: $$\ln z = \ln |z| + i \arg z$$, and $$|1+e^{2i\theta}| = 2 \cos \theta$$.)

Now integrate both sides from $$0$$ to $$\frac\pi2$$:

• RHS: They all vanish because $$\cos(2n \theta)$$ is anti-symmetric about $$\theta = \frac\pi4$$.
• LHS:
• $$\ln 2$$ integrates to $$\frac\pi2 \ln 2$$.
• $$\int_0^{\pi/2} \ln\cos \theta\ \mathrm{d}\theta = \int_0^{\pi/2} \ln\sin x\ \mathrm{d}x$$ by $$x = \frac\pi2 - \theta$$.

Therefore,

$$\int_0^{\pi/2} \ln\sin x\ \mathrm{d}x = -\frac\pi2 \ln 2.$$

• Tristan Needham, Visual Complex Analysis.

§2.3 of the book discusses power series, and §2.3.7 is Fourier series.

• Original source.

(The video is not in English, but math formulae are sufficient for understanding.)

First we begin with an equivalence: \begin{align}\int_{0}^{\pi\over 2}\ln(\sin x)\ dx=x\ln (\sin x)\ dx \biggr|_{0}^{\pi\over2}-\int_{0}^{\pi\over2}x\cot x\ dx\implies \int_{0}^{\pi\over 2}\ln(\sin x)\ dx=-\int_{0}^{\pi\over2}x\cot x\ dx \end{align} We integrate the second integral by Leibnitz rule \begin{align}\int_{0}^{\pi\over2}x\cot x\ dx=\int_{0}^{\pi\over2}\frac{\arctan{\tan x}}{\tan x}\ dx\end{align} \begin{align}I'(a)=\int_{0}^{\pi\over2}\frac{\partial}{\partial a}\frac{\arctan{(a\tan x)}}{\tan x}\ dx=\int_{0}^{\pi\over2}\frac{1}{a^2\tan^2x+1}\ dx\end{align} With the substitution $$\tan x = \xi$$ (and so $$dx=\frac{d\xi}{\xi^2+1}$$): \begin{align}\frac{a^2}{a^2-1}\int_{0}^{\infty}\frac{d\xi}{a^2\xi^2+1}-\frac{1}{a^2-1}\int_{0}^{\infty}\frac{d\xi}{\xi^2+1}=\frac{a}{a^2-1}\int_{0}^{\infty}\frac{d\xi}{\xi^2+1}-\frac{1}{a^2-1}\int_{0}^{\infty}\frac{d\xi}{\xi^2+1}\end{align} As the two integrals in the above expression would both equal $$\pi\over2$$, we would get: \begin{align}I'(a)=\frac{\pi}{2(a+1)}\implies I(1)=\frac{\pi}{2}\ln (2)\end{align} So,\begin{align}\int_{0}^{\pi\over 2}\ln(\sin x)\ dx=-\frac{\pi}{2}\ln (2)\end{align}

The evaluation of the integral (using the DUIS) has already been provided. Here, I present a different approach. It uses a beautiful product of sine functions, i.e., $$\displaystyle\prod_{k=1}^{n-1}\sin\left(\frac{k \pi}{n}\right) = \frac{n}{2^{n-1}}$$.

Note that $$f(x)=\ln(\sin(x))$$ is symmetric about $$x=\frac\pi2$$ since $$f\left(2.\frac\pi2-x\right)=f(\pi-x)=f(x)$$. So, $$\displaystyle\int_0^\pi\ln(\sin(x))\ \mathrm dx=2\int_0^\frac\pi2\ln(\sin(x))\ \mathrm dx=2\int_{\frac\pi2}^\pi\ln(\sin(x))\ \mathrm dx$$.

Now, the given integral can be evaluated as: \displaystyle\begin{align*}\int_0^\frac\pi2\ln(\sin(x))\ \mathrm dx &=\frac12\int_0^\pi\ln(\sin(x))\ \mathrm dx\\&=\frac12\displaystyle\lim_{n\rightarrow\infty}\bigg[\bigg(\frac{\pi-0}{n}\bigg)\sum_{k=1}^{n-1}\ln\bigg(\sin\bigg(0+\frac{(\pi-0)k}{n}\bigg)\bigg)\bigg]\\ &=\displaystyle\frac\pi2\lim_{n\rightarrow\infty}\bigg[\frac{1}{n}\ln\bigg(\prod_{k=1}^{n-1}\sin\bigg(\frac{k\pi}{n}\bigg)\bigg)\bigg]\\ &=\displaystyle\frac\pi2\lim_{n\rightarrow\infty}\bigg[\frac{1}{n}\ln\bigg(\frac{n}{2^{n-1}}\bigg)\bigg]\\ &=\displaystyle\frac\pi2\lim_{n\rightarrow\infty}\bigg[\frac{\ln n}{n}-\bigg(1-\frac{1}{n}\bigg)\ln2\bigg]\\ \color{red}{\int_0^\frac\pi2\ln(\sin(x))\ \mathrm dx}&\color{red}{=\displaystyle-\frac\pi2\ln2}\end{align*}

Alternatively, \begin{aligned}\mathcal I=\int_0^\frac\pi2\ln(\sin(x))\ \mathrm dx&=\frac12\left(\int_0^\frac\pi2\ln(\sin(x))\ \mathrm dx+\int_0^\frac\pi2\ln\left(\sin\left(\frac\pi2-x\right)\right)\ \mathrm dx\right)\\&=\frac12\left(\int_0^\frac\pi2\ln(\sin(x))\ \mathrm dx+\int_0^\frac\pi2\ln(\cos(x))\ \mathrm dx\right)\\&=\frac12\int_0^\frac\pi2\ln(\sin(x)\cos(x))\ \mathrm dx\\&=\frac12\int_0^\frac\pi2\ln(\sin(2x))\ \mathrm dx-\frac12\int_0^\frac\pi2\ln(2)\ \mathrm dx\\&=\frac{1}{2\cdot2}\int_0^\pi\ln(\sin(u))\ \mathrm du-\frac\pi4\ln2\qquad\text{substitute } u=2x\\\mathcal I&=\frac{\mathcal I}2-\frac\pi4\ln2\\\frac{\mathcal I}2&=-\frac\pi4\ln2\\\color{red}{\int_0^\frac\pi2\ln(\sin(x))\ \mathrm dx=\mathcal I}&\color{red}{=-\frac\pi2\ln2}& \end{aligned}

Hence, the required integral is $$\color{blue}{\boxed{\boxed{\int_0^\frac\pi2\ln(\sin(x))\ \mathrm dx=-\dfrac\pi2\ln2}}}$$

Hope this helps!