46
$\begingroup$

How to compute the following integral? $$\int\log(\sin x)\,dx$$


Motivation: Since $\log(\sin x)'=\cot x$, the antiderivative $\int\log(\sin x)\,dx$ has the nice property $F''(x)=\cot x$. Can we find $F$ explicitly? Failing that, can we find the definite integral over one of intervals where $\log (\sin x)$ is defined?

$\endgroup$
7
  • 1
    $\begingroup$ 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. $\endgroup$ May 8, 2011 at 13:00
  • $\begingroup$ Yes, the dilogarithm seems to be required here... $\endgroup$ May 8, 2011 at 13:03
  • $\begingroup$ @Kolya: Do you actually want to compute $\int_a^b {\log (\sin (x))\,{\rm d}x}$ for certain $a$ and $b$? $\endgroup$
    – Shai Covo
    May 8, 2011 at 13:32
  • 2
    $\begingroup$ For $a=0$ and $b=\pi/2$ or $b=\pi$, for example... $\endgroup$
    – Did
    May 8, 2011 at 13:59
  • 1
    $\begingroup$ 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. $\endgroup$
    – JSCB
    Jul 12, 2012 at 8:21

11 Answers 11

40
$\begingroup$

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.

$\endgroup$
6
  • $\begingroup$ 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. $\endgroup$ May 8, 2011 at 17:41
  • 1
    $\begingroup$ 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. $\endgroup$ May 8, 2011 at 17:45
  • $\begingroup$ Yes, and in Abramowitz and Stegun, too. $\endgroup$ May 8, 2011 at 17:46
  • 3
    $\begingroup$ I was wondering just last night whether $$ \int_{0}^{\pi/2}\ln^{k}(\sin{x})\;{dx}$$ where $k\in\mathbb{N}$, can be calculated! $\endgroup$
    – Lyrebird
    May 8, 2011 at 18:52
  • 1
    $\begingroup$ @Lyrebird: The integrals you mentioned in your comment can be calculated by considering the parametric integral $\int_{0}^{\pi/2}\sin^t(x)\,\mathrm dx$, $t\ge 0$. Differentiating this integral $k$-times w.r.t. $t$ and letting $t\to 0^+$ generates integrals involving powers of logarithms. On the other hand, the parametric sine-integral with $t$ can be evaluated as a specific value of the Beta function. Expanding it around $t=0$ and considering its coefficients gives the required evaluation. Further generalizations are possible. Also, there is a connection to multiple-zeta-like values. $\endgroup$
    – Marian G.
    Sep 23, 2021 at 17:39
17
$\begingroup$

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}$)

$\endgroup$
2
  • $\begingroup$ I discovered the identity you used above as $\sin^2(x)=\dfrac{1-\cos(2x)}{2}=\dfrac{(1-e^{2ix})(1-e^{-2ix})}{4}$ while answering this question. I was lead here via a series of links. Nice answer (+1). $\endgroup$
    – robjohn
    Mar 11, 2014 at 14:43
  • 1
    $\begingroup$ @hunminpark, How did you derive that identitiy in the beginning of this answer? $\endgroup$
    – Amad27
    Dec 15, 2014 at 7:57
11
$\begingroup$

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} $$

Directly from this definition we have

$$ 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). $$

$\endgroup$
0
10
$\begingroup$

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.

$\endgroup$
9
$\begingroup$

$$ \begin{align} &I=\int_0^{\pi/2}\log(\sin x)dx=\int_0^{\pi/2}\log(\cos x)dx\\ \implies 2I&=\int_0^{\pi/2}\log(\sin x\cos x)dx=\int_0^{\pi/2}\log(\frac{1}{2}.2\sin x\cos x)dx\\ &=\int_0^{\pi/2}\log(1/2)dx+\int_0^{\pi/2}\log(\sin 2x)dx\\ &\text{Put }t=2x\implies dt=2dx\\ 2I&=\frac{\pi}{2}\log(\frac{1}{2})+\frac{1}{2}\int_0^{\pi}\log(\sin t)dt=\frac{-\pi}{2}\log 2+\frac{1}{2}\int_0^{\pi}\log(\sin x)dx\\ &=-\frac{\pi}{2}\log 2+\frac{1}{2}\int_0^{\pi/2}\log(\sin x)dx+\frac{1}{2}\int_0^{\pi/2}\log(\cos x)dx=-\frac{\pi}{2}\log 2+I\\ &\boxed{I=-\frac{\pi}{2}\log 2} \end{align} $$

$\endgroup$
1
  • $\begingroup$ You obtain the equation $2I=-\frac\pi2\cdot\ln 2+I$ and deduce that $I=-\frac\pi2\cdot\ln 2$. However, this equation is also satisfied for $I=\pm\infty$. Of course, $I=+\infty$ is absurd. But what about $I=-\infty$. I think that it is necessary to discuss the convergence of the original improper integral. Anyway, nice manipulations. (+1) $\endgroup$
    – Marian G.
    Sep 22, 2021 at 20:24
7
$\begingroup$

There was a duplicate posted a while ago. Since I think my answer might be of some interest, here it goes:

By substituting $\sin{x}=t$, we can write it as: \begin{align*} \int_{0}^{\pi/2} \, \log\sin{x}\, dx &= \int_{0}^{1} \, \frac{\log{t}}{\sqrt{1-t^2}}\, dt \tag{1} \end{align*}

Now, consider:

\begin{align*} I(a) &= \int_{0}^{1} \, \frac{t^a}{(1-t^2)^{1/2}}\, dt \\ &= \mathrm{B}\left(\frac{a+1}{2},\; \frac{1}{2}\right) \\ \frac{\partial }{\partial a}I(a) &= \frac{1}{4}\left(\psi\left(\frac{a+1}{2}\right)-\psi\left(\frac{a+2}{2}\right)\right)\mathrm{B}\left(\frac{a+1}{2},\; \frac{1}{2}\right) \\ \implies I'(0) &= \frac{1}{4}\left(\psi\left(\frac{1}{2}\right)-\psi\left(1\right)\right)\mathrm{B}\left(\frac{1}{2},\; \frac{1}{2}\right) \tag{2} \end{align*} Putting the values of digamma and beta functions. \begin{align*} \psi\left(\frac{1}{2}\right) &= -2\log{2}-\gamma \\ \psi\left(1\right) &= -\gamma \\ \mathrm{B}\left(\frac{1}{2}, \frac{1}{2}\right) &= \pi \end{align*}

Hence, from $(1)$ and $(2)$, \begin{align*} \boxed{\displaystyle \int_{0}^{\pi/2} \, \log\sin{x}\, dx = -\frac{\pi}{2}\log{2}} \end{align*}

Using a CAS, we can derive for higher powers of $\ln\sin{x}$, e.g. \begin{align*} \int_{0}^{\pi/2} \, \left(\log\sin{x}\right)^2\, dx &= \frac{1}{24} \, \pi^{3} + \frac{1}{2} \, \pi \log\left(2\right)^{2} \\ \int_{0}^{\pi/2} \, \left(\log\sin{x}\right)^3\, dx &= -\frac{1}{8} \, \pi^{3} \log\left(2\right) - \frac{1}{2} \, \pi \log\left(2\right)^{3} - \frac{3}{4} \, \pi \zeta(3)\\ \int_{0}^{\pi/2} \, \left(\log\sin{x}\right)^4\, dx &= \frac{19}{480} \, \pi^{5} + \frac{1}{4} \, \pi^{3} \log\left(2\right)^{2} + \frac{1}{2} \, \pi \log\left(2\right)^{4} + 3 \, \pi \log\left(2\right) \zeta(3) \end{align*}

We can also observe another interesting thing, for small values of $n$
\begin{align*} \displaystyle \int_{0}^{\pi/2} \, \left(\log\sin{x}\right)^n\, dx \approx \displaystyle (-1)^n\, n! \end{align*}

$\endgroup$
5
$\begingroup$

(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$.

$\endgroup$
2
  • $\begingroup$ 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$... $\endgroup$ Jul 12, 2012 at 8:11
  • $\begingroup$ @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. $\endgroup$
    – user17762
    Jul 12, 2012 at 8:13
2
$\begingroup$

Probably this question indeed aims on a definite integral from $0$ to $\pi/2$ (or $\pi$). But it can be of interest to give a rather simple form of the antiderivative in the range $0<x<\pi$ as well.

Lemma: $$ \int_0^x\log(2\sin t) dt=-\frac12\sum_{k=1}^\infty\frac{\sin(2kx)}{k^2} =-\frac12\Im[\operatorname{Li}_2(e^{2ix})],\tag1 $$ Proof:

Observe that $\log(2\sin t)$ in the range $0< t<\pi$ is a real number. Therefore: $$\begin{align} \log(2\sin t)&=\log(e^{it}-e^{-it})-\log i\\ &=i\left(t-\frac\pi2\right)+\log(1-e^{-2it})\\ &=i\left(t-\frac\pi2\right)-\sum_{k=1}^\infty\frac{e^{-2ikt}}k\\ &=i\underbrace{\left(t-\frac\pi2+\sum_{k=1}^\infty\frac{\sin(2kt)}k\right)}_{=0}-\sum_{k=1}^\infty\frac{\cos(2kt)}k\\ &=-\sum_{k=1}^\infty\frac{\cos(2kt)}k.\tag2 \end{align} $$ Substituting $(2)$ into the left hand side of $(1)$ one obtains its right hand side. $\blacksquare$

Thus for the integral in question we have: $$ \int_0^x\log(\sin t) dt=\int_0^x\left[\log(2\sin t)-\log2\right] dt =-\frac12\Im[\operatorname{Li}_2(e^{2ix})] -x\log2. $$

$\endgroup$
2
$\begingroup$

$$\int\ln(\sin x)dx=\int\ln\left(\frac{(1-e^{-2ix})e^{ix}}{2i}\right)dx=\int\left(ix-\ln2-\frac{\pi i}{2}\right)dx+\int\ln(1-e^{-2ix})dx$$ The first integral on the RHS is easy to handle $$\int\left(ix-\ln2-\frac{\pi i}{2}\right)dx=\frac{ix^2}{2}-\left(\ln2+\frac{\pi i}{2}\right)x+C$$ We will use substitution to handle the second integral $$u=e^{-2ix}$$ $$dx=-\frac{du}{2iu}$$ $$\int\ln(1-e^{-2ix})dx=\frac{-1}{2i}\int\frac{\ln(1-u)}{u}du=\frac{\operatorname{Li}_2(u)}{2i}+C=\frac{\operatorname{Li}_2(e^{-2ix})}{2i}+C$$ We get $$\int\ln(\sin x)dx=\frac{ix^2}{2}-\left(\ln2+\frac{\pi i}{2}\right)x+\frac{\operatorname{Li}_2(e^{-2ix})}{2i}+C$$

$\endgroup$
2
  • $\begingroup$ This does not look so real tough... $\endgroup$
    – Bob Dobbs
    Dec 26, 2022 at 16:38
  • 1
    $\begingroup$ @BobDobbs what do you mean? i do use imaginary numbers i guess $\endgroup$
    – phi-rate
    Jan 21, 2023 at 0:01
0
$\begingroup$

It seems that the integral can not be evaluated by elemantary functions, but one have to write the solution by using a special function which we have not seen in Calculus $1$. Instead of starting with the product expansion of $\frac{\sin x}{x}$, I saw the following Calculus $1$ trick: $$\ln\sin x=\ln\sin x+x\cot x-1+2\frac{1-x\cot x}{2}$$ Hence, $$\int\ln\sin x dx=x\ln\sin x-x+2\pi M\left(\frac{x}{\pi}\right)+c$$ where $$M(t)=\int_0^t\frac{1-\pi t\cot(\pi t)}{2}dt=\sum_{n=1}^{\infty}\frac{\zeta(2n)}{2n+1}t^{2n+1},\hspace{1cm} |t|<1.$$ Then, we have $M(\frac{1}{2})=\frac14-\frac14\ln2$. You may see WA output.

Hence, $\int_0^{\pi/2}\ln\sin x dx=-\frac\pi 2+2\pi(\frac14-\frac14\ln2)=-\frac\pi 2\ln 2$.

You may argue that for the computation of $M(\frac{1}{2})$, you will need $\int_0^{\pi/2}\ln\sin x dx$, so this is a chicken and egg situation. But, I think there are other methods to compute the values of $M(x)$ involving Gamma, Beta etc. functions.

$\endgroup$
-3
$\begingroup$

For the indefinite integral, you have this closed form:

$$ \frac{i{x}^{2}}{2}+x\ln \left( \cos \left( x \right) \right) -x\ln \left( 1+{{\rm e}^{2\,ix}} \right) +\frac{i}{2} Li_2 ( -{ {\rm e}^{2\,ix}} ), $$

where $Li_2$ is a polylogarithm.

$\endgroup$
4
  • 10
    $\begingroup$ Simply stating a closed form without a derivation seems mostly useless. $\endgroup$ Aug 18, 2014 at 23:40
  • $\begingroup$ @Downvoter: What's the down vote for? $\endgroup$ Aug 18, 2014 at 23:41
  • 3
    $\begingroup$ @CarlMummert: It tells people there exists a closed form and whoever is interested in proving it can put some effort to find it. Giving detailed answers all the time is not useful. $\endgroup$ Aug 18, 2014 at 23:43
  • 6
    $\begingroup$ @MhenniBenghorbal Using polylogarithms is really not useful here... I think it is even debatable if this can be called a closed form solution. You can always come up with new special functions, name them, and say you have a closed form solution. In this case we could just define $\mathrm{MickeyMouse} (x) = \int_0^x \log(\sin x) \, dx$... $\endgroup$ Apr 12, 2019 at 19:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .