# Computing the integral of $\log(\sin x)$

How to compute the following integral

$$\int\log(\sin x)~dx~?$$

-
I'm pretty sure this is an integral that can't be expressed in terms of elementary functions (that is, the functions of 1st-year calculus). See, for example, reference.wolfram.com/legacy/v5/TheMathematicaBook/… about halfway down the page. –  Gerry Myerson May 8 '11 at 13:00
Yes, the dilogarithm seems to be required here... –  Ｊ. Ｍ. May 8 '11 at 13:03
@Kolya: Do you actually want to compute $\int_a^b {\log (\sin (x))\,{\rm d}x}$ for certain $a$ and $b$? –  Shai Covo May 8 '11 at 13:32
For $a=0$ and $b=\pi/2$ or $b=\pi$, for example... –  Did May 8 '11 at 13:59
Although this integral may cannot be expressed in elementary function, but it may can be expressed in series form. For example, ∫sin(sin x)dx and ∫cos(cos x)dx can both be evaluated in series form. –  ᴊ ᴀ s ᴏ ɴ Jul 12 '12 at 8:21

You can calculate $$\int_0^\pi\log(\sin x)\,dx = -\pi\log2$$ and integrating up to $\pi/2$ would give half of this.

Note that integrating $\log(\sin x)$ from 0 to $\pi/2$ is the same as integrating $\log(\cos x)$ so that \begin{align} \int_0^{\pi/2}\log(\sin x)\,dx &= \frac12\int_0^{\pi/2}\log(\sin x\cos x)\,dx\\ &= \frac12\int_0^{\pi/2}\log(\sin 2x)\,dx - \frac{\pi}{4}\log 2. \end{align} After a change of variables, this can be rearranged to get the result.

-
Actually, as the OP hasn't come back to say if it was the definite or indefinite integral that he was after, I'm not sure if this fully answers the question. –  George Lowther May 8 '11 at 17:41
Also, I'm not sure what the appropriate amount of detail is for a homework question. The value of the integral is no secret anyway, as Wolfram alpha knows it. –  George Lowther May 8 '11 at 17:45
Yes, and in Abramowitz and Stegun, too. –  Ｊ. Ｍ. May 8 '11 at 17:46
(should have said he/she above. The ability to edit comments runs out too quickly.) –  George Lowther May 8 '11 at 17:50
I was wondering just last night whether $$\int_{0}^{\pi/2}\ln^{k}(\sin{x})\;{dx}$$ where $k\in\mathbb{N}$, can be calculated! –  Lyrebird May 8 '11 at 18:52

I think it worth mentioning the history of (essentially) this function, tracing back to work of Lobachevsky in the beginnings of non-Euclidean geometry. See the pdf here for Milnor's survey, the function is discussed from page 9 onward.

-

(I am assuming that the OP is interested in the definite integral).

The following argument is not completely rigorous $\displaystyle \int_0^{\pi/2} \log(\sin(x)) dx = - \dfrac{\pi}2 \log 2$ but I think it can be made rigorous.

From integration by parts/ other techniques, we have that $$\int_0^{\pi/2} \sin^{2k}(x) dx = \frac{2k-1}{2k}\frac{2k-3}{2k-2} \cdots \frac{1}{2} \frac{\pi}{2} = \dfrac{(2k)!}{4^k (k!)^2} \dfrac{\pi}2 = \dfrac{\Gamma(2k+1)}{4^k \Gamma^2(k+1)} \dfrac{\pi}2$$

Hence, a possible analytic extension to $\displaystyle \int_0^{\pi/2} \sin^{2z}(x) dx$ is $\dfrac{\Gamma(2z+1)}{4^z \Gamma^2(z+1)} \dfrac{\pi}2$.

Now differentiate both sides with respect to $z$, and set $z=0$, to get $$2 \int_0^{\pi/2} \log(\sin(x)) = -\dfrac{\pi}2 \log(4)$$ Hence, we get that $$\int_0^{\pi/2} \log(\sin(x)) dx = -\dfrac{\pi}2 \log(2)$$ This also provides you a way to evaluate $\displaystyle \int_0^{\pi/2} \sin^{n}(x) \log(\sin(x)) dx$.

-
The differentiation under the integral sign is fine, I think, so it seems to me that the only gap is to justify the expression for $\int_0^{\pi/2} \sin^{2\alpha}(x)\mathrm dx$ for noninteger $\alpha$... –  Ｊ. Ｍ. Jul 12 '12 at 8:11
@J.M. Actually thinking about it since the domain is only from $0$ to $\pi/2$, $\sin^{2 \alpha}(x)$ is well defined even for non-integer $\alpha$. So I think this does it. Hence, the analytic extension is the analytic extension. –  user17762 Jul 12 '12 at 8:13

Series expansion can be used for this integral too.
We use the following identity; $$\log(\sin x)=-\log 2-\sum_{k\geq 1}\frac{\cos(2kx)}{k} \phantom{a} (0<x<\pi)$$ This identity gives $$\int_{a}^{b} \log(\sin x)dx=-(b-a)\log 2-\sum_{k\ge 1}\frac{\sin(2kb)-\sin(2ka)}{2k^2}$$ ($a, b<\pi$)
For example, $$\int_{0}^{\pi/4}\log(\sin x)dx=-\frac{\pi}{4}\log 2-\sum_{k\ge 1}\frac{\sin(\pi k/2)}{2k^2}=-\frac{\pi}{4}\log 2-\frac{1}{2}K$$ $$\int_{0}^{\pi/2} \log(\sin x)dx=-\frac{\pi}{2}\log 2$$ $$\int_{0}^{\pi}\log(\sin x)dx=-\pi \log 2$$ ($K$; Catalan's constant ... $\displaystyle K=\sum_{k\ge 1}\frac{(-1)^{k-1}}{(2k-1)^2}$)

-
An excellent discussion of this topic can be found in the book The Gamma Function by James Bonnar. Consider just two of the provably equivalent definitions of the Beta function: $$\begin{eqnarray} B(x,y)&=& 2\int_0^{\pi/2}\sin(t)^{2x-1}\cos(t)^{2y-1}\,dt\\ &=& \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}. \end{eqnarray}$$
$$B(n+\frac{1}{2},\frac{1}{2}): \int_0^{\pi/2}\sin^{2n}(x)\,dx=\frac{\sqrt{\pi} \cdot\Gamma(n+1/2)}{2(n!)}$$ $$B(n+1,\frac{1}{2}): \int_0^{\pi/2}\sin^{2n+1}(x)\,dx=\frac{\sqrt{\pi} \cdot n!}{2 \Gamma(n+3/2)}$$ Hence the quotient of these two integrals is $$\begin{eqnarray} \frac{ \int_0^{\pi/2}\sin^{2n}(x)\,dx}{\int_0^{\pi/2}\sin^{2n+1}(x)\,dx}&=& \frac{\Gamma(n+1/2)}{n!}\frac{\Gamma(n+3/2)}{n!}\\ &=& \frac{2n+1}{2n}\frac{2n-1}{2n}\frac{2n-1}{2n-2}\cdots\frac{3}{4}\frac{3}{2}\frac{1}{2}\frac{\pi}{2} \end{eqnarray}$$ where the quantitiy $\pi/2$ results from the fact that $$\frac{\int_0^{\pi/2}\sin^{2\cdot 0}(x)\,dx}{\int_0^{\pi/2}\sin^{2\cdot 0+1}x\,dx}=\frac{\pi/2}{1}=\frac{\pi}{2}.$$ So we have that $$\int_0^{\pi/2}\sin^{2n}(x)\,dx=\frac{2n-1}{2n}\frac{2n-3}{2n-2}\cdots\frac{1}{2}\frac{\pi}{2}=\frac{(2n)!}{4^n (n!)^2}\frac{\pi}{2}.$$ Hence an analytic continuation of $\int_0^{\pi/2}\sin^{2n}(x)\,dx$ is $$\int_0^{\pi/2}\sin^{2z}(x)\,dx=\frac{\pi}{2}\frac{\Gamma(2z+1)}{4^z \Gamma^2(z+1)}=\frac{\pi}{2}\Gamma(2z+1)4^{-z}\Gamma^{-2}(z+1).$$ Now differentiate both sides with respect to $z$ which yields
$$\begin{eqnarray} 2\int_0^{\pi/2}\sin^{2z}(x)\log(\sin(x))\,dx =\frac{\pi}{2} \{2\Gamma'(2z+1)4^{-z}\Gamma^{-2}(z+1)\\ +2\Gamma(2z+1)4^{-z}\Gamma^{-3}(z+1)\Gamma'(z+1)\\ -\log(4)\Gamma(2z+1)4^{-z}\Gamma^{-2}(z+1)\}. \end{eqnarray}$$
Finally set $z=0$ and note that $\Gamma'(1)=-\gamma$ to complete the integration: $$\begin{eqnarray} 2\int_0^{\pi/2}\log(\sin(x))\,dx&=&\frac{\pi}{2}(-2\gamma+2\gamma-\log(4))\\ &=& -\frac{\pi}{2}\log(4)=-\pi\log(2). \end{eqnarray}$$ We conclude that $$\int_0^{\pi/2}\log(\sin(x))\,dx=-\frac{\pi}{2}\log(2).$$