How can you evaluate $$\int\limits_0^{\pi/2}\log\cos(x)\,\mathrm{d}x\;?$$
-
What is the context for this question? The anti-derivative is not elementary (I ran it on WA and thought "Oh cool, dilogarithms!"). – colormegone Feb 26 '14 at 03:05
-
@RecklessReckoner The anti-derivative needn't be found for this particular problem. The answer ought to be $-\pi \log(2)/2$, but I suspect it has been asked here (or elsewhere) before... – Benjamin Dickman Feb 26 '14 at 03:27
-
After seeing the result, I figured this was one that had to be evaluated over a specific interval, like many "complete" integral functions. This is a new one to me. Thanks, I'll add this to the collection. – colormegone Feb 26 '14 at 06:41
-
The following recent question in progress is related: A closed form for $\int_0^{π/2} x^3\ln^3(2\cos x)dx$. (As a small plug, the method in my answer there includes this one as a special case.) – Semiclassical Jul 15 '14 at 13:54
10 Answers
For the sake of simplicity, all the integral variables I use are $x$ even there are a lot of substitutions. Because lots of variables could make one confused.
Let $I$ denote the integral value. By substitute $x$ for $\pi/2-x$, we have: \begin{equation} I=\int_0^{\frac{\pi}{2}}\log\cos(x)dx=\int_0^{\frac{\pi}{2}}\log\sin(x)dx \end{equation} And then, we have: \begin{equation} I=\int_0^{\frac{\pi}{2}}\log(2\cos(\frac{x}{2})\sin(\frac{x}{2}))dx\\ =\frac{\pi}{2}\log2+\int_0^{\frac{\pi}{2}}\log\cos(\frac{x}{2})dx+\int_0^{\frac{\pi}{2}}\log\sin(\frac{x}{2})dx\\ =\frac{\pi}{2}\log2+2\int_0^{\frac{\pi}{4}}\log\cos(x)dx+2\int_0^{\frac{\pi}{4}}\log\sin(x)dx\\ =\frac{\pi}{2}\log2+I_1+I_2 \end{equation} In the second step from bottom, I use the substitution that $x=x/2$.
For $I_1$, use the substitution that $x=\pi/2-x$ we obtain \begin{equation} I_1=2\int_{\frac{\pi}{4}}^{\frac{\pi}{2}}\log\sin(x)dx \end{equation} It gives that $I_1+I_2=2I$. So we have \begin{equation} I=\frac{\pi}{2}\log2+2I\\ I=-\frac{\pi}{2}\log2 \end{equation}

- 2,148
-
I have learnt something I probably should of thought of (seen) before. So thank you :). +1 – Chinny84 Jul 15 '14 at 13:42
$$ \int_0^{\pi/2} \ln \cos xdx =I=\int_0^{\pi/2} \ln \sin x dx. $$ By symmetry we have $\ln \cos x=\ln \sin x$ on the interval $[0,\pi/2]$. This is true for any even/odd function on this interval, as is an exercise in Demidovich-Problems in Analysis. Thus we have $$ 2I=\int_0^{\pi/2}\ln \cos x dx+ \int_0^{\pi/2} \ln \sin x dx= \int_0^{\pi/2} \ln(\sin x \cos x)dx=\int_0^{\pi/2} \ln\big(\frac{1}{2}\cdot\sin(2x)\big) dx. $$ All I used was $\ln(a\cdot b)=\ln(a)+\ln(b)$ and $2\sin x \cos x=\sin(2x)$. Now we split the integral back up to obtain $$ -\int_0^{\pi/2}\ln(2)dx+\int_0^{\pi/2}\ln(\sin(2x))dx=2I. $$ Thus we can now substitute $u=2x$ to obtain $$ -\frac{\pi\ln(2)}{2}+\frac{1}{2}\int_0^\pi \ln \sin (u) du=2I $$ But the integral of $\ln \sin u$ is 2I, thus we have $$ -\frac{\pi\ln(2)}{2}+I=2I, \ \to {\boxed{I=-\frac{\pi \ln(2)}{2}.}} $$

- 14,882

- 9,878
-
1
-
1
-
@Integrals Hello. I am having difficulty seeing why $\int_0^\pi \ln \sin(u) du$ is $2I$. Would you mind showing me why? – user193319 Mar 12 '17 at 16:33
-
3@user193319 Good question, $$ \int_0^{\pi} \ln \sin (u) du =\int_0^{\pi/2}\ln \sin (u) du + \int_{\pi/2}^{\pi}\ln \sin (u) du $$ Now the first integral is obviously just our integral $I$, for the second integral let $u=x+\pi/2$ to obtain $$ I+\int_0^{\pi/2}\ln (\sin (x+\pi/2))dx= I+\int_0^{\pi/2}\ln \cos (x) dx $$ but we know this second integral is indeed $I$ also, so we have just $$ I+\int_0^{\pi/2}\ln \cos (x) dx=I+\int_0^{\pi/2}\ln \sin( x) dx=I+I=2I. $$ Alternatively, you can plot the integrand and visually see the area for $x \in [0,\pi]$ but thats not a proof obviously. – Jeff Faraci Mar 12 '17 at 19:00
How comes I forgot to write my favorite proof?
We have a well-known identity:
$$\prod_{k=1}^{n-1}\sin\left(\frac{\pi k}{n}\right)=\frac{2n}{2^n}\tag{1}$$ and since $\log\sin x$ is an improperly Riemann-integrable function over $(0,\pi)$, it follows that:
$$ \int_{0}^{\pi}\log\sin\theta\,d\theta = \lim_{n\to +\infty}\frac{\pi}{n}\sum_{k=1}^{n-1}\log\sin\left(\frac{\pi k}{n}\right)=-\pi\log 2,\tag{2}$$ so: $$ \int_{0}^{\pi/2}\log\cos\theta\,d\theta = \int_{0}^{\pi/2}\log\sin\theta\,d\theta = \color{red}{-\frac{\pi}{2}\log 2}.\tag{3}$$

- 353,855
-
11Stop asking "What's the downvote for?" and replace that with "What's the lack of upvotes for?" because you always surprise me with your awesome answers. – Simply Beautiful Art Mar 29 '17 at 21:34
Here is an approach. Making the changes of variables $u=\cos x$ and $u^2=t$ in a row gives
$$ I = \frac{1}{4}\int _{0}^{1}\!\,{\frac {\ln \left( t \right) }{\sqrt {1-t} \sqrt {t}}}{dt} .$$
To evaluate the above integral, let's consider the following beta function
$$ F = \int_{0}^{1} t^a (1-t)^b dt = \beta(a+1,b+1)=\frac{\Gamma(a+1)\Gamma(b+1)}{\Gamma(a+b+2)} .$$
Now, our integral follows from $F$ as
$$ I = \lim_{b\to -1/2}\lim_{a\to -1/2}F_a(a,b)=-\frac{\pi\ln 2}{2},\quad F_a =\frac{dF}{da}. $$

- 47,431
Here is another solution: As we have $\cos(x)=\frac{e^{ix}+e^{-ix}}{2}=\frac{e^{2ix}+1}{2e^{ix}}$ we get: $$I=\int_0^{\frac{\pi}{2}} \ln(\cos(x))dx=\int_0^{\frac{\pi}{2}} \ln(e^{2ix}+1)dx-\int_0^{\frac{\pi}{2}} \ln(2)dx-\int_0^{\frac{\pi}{2}} ixdx$$ By using the series expansion of $\ln(x)$ and by calculating the two simple integrals we obtain: $$I=\int_0^{\frac{\pi}{2}} \sum_{k=0}^\infty \frac{(-1)^k}{k+1}\cdot e^{2ix(k+1)}dx-\frac{\pi}{2}\cdot \ln(2)-i\frac{\pi^2}{8}$$ By swapping the integral and the sum, the integral of the infinite sum can be calculated as follows: $$\int_0^{\frac{\pi}{2}} \sum_{k=0}^\infty \frac{(-1)^k}{k+1}\cdot e^{2ix(k+1)}dx=\sum_{k=0}^\infty \frac{(-1)^k}{k+1}\cdot \int_0^{\frac{\pi}{2}}e^{2ix(k+1)}dx=\sum_{k=0}^\infty \frac{(-1)^k}{k+1}\cdot \left(\frac{e^{i\pi(k+1)}-1}{2i(k+1)}\right)=\frac{i}{2}\cdot\sum_{k=0}^\infty \frac{(-1)^k}{k+1}\cdot \left(\frac{1-(-1)^{k+1}}{(k+1)}\right)$$ Here I used, that $\frac{1}{i}=-i$. Now, when $k$ is uneven, the expression after the sigma is equal to $0$, this yields: $$\frac{i}{2}\cdot\sum_{k=0}^\infty \frac{(-1)^k}{k+1}\cdot \left(\frac{1-(-1)^{k+1}}{(k+1)}\right)=\frac{i}{2}\cdot\sum_{k=0}^\infty \frac{2\cdot(-1)^{2k}}{(2k+1)^2}=i\cdot\sum_{k=0}^\infty \frac{1}{(2k+1)^2}=i\cdot\left(\sum_{k=1}^\infty \frac{1}{k^2}-\sum_{k=1}^\infty \frac{1}{(2k)^2}\right)=i\cdot\frac{3}{4}\cdot\zeta(2)=i\frac{\pi^2}{8}$$ Therefore, $I$ can be expressed as follows: $$I=i\frac{\pi^2}{8}-\frac{\pi}{2}\cdot \ln(2)-i\frac{\pi^2}{8}=-\frac{\pi}{2}\cdot \ln(2)$$

- 12,030
- 2
- 22
- 66
-
1it's a brilliant method , but how can you manipulate a complex value i.e $i$ inside a real integral ? can we do that ? – user440024 Jun 07 '17 at 17:18
Here is a hint:
- Let $\displaystyle I = \int_{x=0}^{\pi/2} \log \cos x \, dx$.
- By choosing a suitable substitution, show we also have $\displaystyle I = \int_{x=0}^{\pi/2} \log \sin x \, dx$.
- Using a symmetry argument, also show that $\displaystyle I = \int_{x=\pi/2}^\pi \log \sin x \, dx$.
- Add the results of (1) and (2) together to get an expression for $2I$.
- Transform the integrand using properties of logarithms and a double-angle identity.
- Use (3) to rewrite the result of (5) in terms of $I$ in a second way.
- Solve for $I$.

- 135,869
\begin{align}\int_0^{\pi/2}\ln\cos x\ dx\overset{ibp}=&-\int_0^{\pi/2}\frac x{\tan x}dx =-\int_0^{\pi/2}\int_0^1 \frac1{1+y^2\tan^2 x}dy \ dx\\ =&-\frac\pi2\int_0^1\frac1{1+y}dy=-\frac\pi2\ln2 \end{align}

- 97,352
-
I am trying to follow the solution but am not sure how to handle the first integration by parts step. If I attempt to integrate and evaluate $\ln \cos x$, then the value is unbounded. If I integrate and evaluate $dx$, the same result. I'm not sure how to proceed. Could you please elaborate this step slightly? Thank you. – Simplex_ Jan 08 '23 at 10:05
$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ \begin{align} &\bbox[#ffd,5px]{\int_{0}^{\pi/2}\ln\pars{\cos\pars{x}}\,\dd x} = -\,{1 \over 2}\int_{0}^{\pi/2}\ln\pars{1 + \tan^{2}\pars{x}}\,\dd x \\[5mm] \stackrel{\tan^{2}\pars{x}\ \mapsto\ x}{=}\,\,\,& -\,{1 \over 4}\int_{0}^{\infty}x^{-1/2} \,{\ln\pars{1 + x} \over 1 + x}\,\dd x \end{align} Note that $\ds{{\ln\pars{1 + x} \over 1 + x} = -\sum_{k = 0}^{\infty}H_{k}\pars{-x}^{k} = \sum_{k = 0}^{\infty}\bracks{-H_{k}\,\Gamma\pars{1 + k}} {\pars{-x}^{k} \over k!}}$. $\ds{H\ \mbox{and}\ \Gamma}$ are the Harmonic Number and the Gamma Function, respectively.
With the Ramanujan's Master Theorem: \begin{align} &\bbox[#ffd,5px]{\int_{0}^{\pi/2}\ln\pars{\cos\pars{x}}\,\dd x} = -\,{1 \over 4}\int_{0}^{\infty}x^{\color{red}{1/2} - 1} \,{\ln\pars{1 + x} \over 1 + x}\,\dd x \\[5mm] = &\ -\,{1 \over 4}\ \overbrace{\Gamma\pars{1 \over 2}}^{\ds{\root{\pi}}}\ \braces{-H_{-\color{red}{1/2}} \,\Gamma\pars{1 - \bracks{\color{red}{1 \over 2}}}} \\[2mm] = &\ {1 \over 4}\,\pi\ \overbrace{\int_{0}^{1}{1 - t^{-1/2} \over 1 - t} \,\dd t}^{\ds{H_{-1/2}}} \,\,\,\stackrel{\large t\ \mapsto\ t^{2}}{=}\,\,\, {1 \over 4}\,\pi \int_{0}^{1}{1 - t^{-1} \over 1 - t^{2}}\,2t\,\dd t \\[5mm] = &\ -\,{1 \over 2}\,\pi \int_{0}^{1}{\dd t \over 1 + t} = \bbx{-\,{1 \over 2}\,\pi\ln\pars{2}} \\ & \end{align}

- 89,464
I first treat the integral as a derivative of a beta function
$$ I(a)=\int_0^{\frac{\pi}{2}} \cos ^a x d x=\frac{1}{2} B\left(\frac{a+1}{2}, \frac{1}{2}\right) $$
$$ \begin{aligned} I&\left.=\frac{\partial}{\partial a} I(a)\right|_{a=0} \left.=\left.\frac{1}{4} B\left(\frac{a+1}{2}, \frac{1}{2}\right)\left(\psi\left(\frac{a+1}{2}\right)-\psi\left(\frac{a}{2}+1\right)\right)\right) \right|_{a=0}\\ &=\frac{1}{4} B\left(\frac{1}{2}, \frac{1}{2}\right)\left[\psi\left(\frac{1}{2}\right)-\psi(1)\right]=\frac{1}{4} \pi(-\ln 4) =-\frac{\pi}{2} \ln 2 \end{aligned} $$

- 20,421
\begin{eqnarray} 2\sin 2\phi \sin\phi &=& -(\cos 3\phi - \cos \phi)\\ 2\sin 4\phi \sin\phi &=& -(\cos 5\phi - \cos 3\phi)\\ 2\sin 6\phi \sin\phi &=& -(\cos 7\phi - \cos 5\phi)\\ ... \end{eqnarray} thus \begin{eqnarray} \cos \phi = 2 \sin 2 \phi \sin\phi + 2 \sin 4\phi \sin \phi + 2 \sin 6 \phi \sin \phi + .. \end{eqnarray} thus \begin{eqnarray} \frac{\cos \phi}{\sin \phi} = 2 \sin 2 \phi + 2 \sin 4\phi + 2 \sin 6 \phi + .. \end{eqnarray} integrate from $\pi/2$ to $\phi$ \begin{eqnarray} \ln \sin \phi &=& \left( -\cos 2 \phi - \frac{\cos 4\phi}{2} - \frac{\cos 6 \phi}{3} - ..\right) - \left(1 - \frac{1}{2} + \frac{1}{3} - ..\right) \\ &=& \left( -\cos 2 \phi - \frac{\cos 4\phi}{2} - \frac{\cos 6 \phi}{3} - ..\right) - \ln 2 \end{eqnarray} integrate again \begin{eqnarray} \int \ln \sin \phi d\phi&=& \left( -\frac{\sin 2 \phi}{2} - \frac{\sin 4\phi}{2 \cdot 4} - \frac{\sin 6 \phi}{3 \cdot 6} - ..\right) - \phi \ln 2 \end{eqnarray} thus \begin{eqnarray} \int_{0}^{\pi/2} \ln \sin \phi d\phi&= - \frac{\pi \ln 2}{2} \end{eqnarray}
You can find this derivation in the last page of Euler's this paper : De summis serierum numeros Bernoullianos involventium

- 177
-
For which values of $\phi$ is the series $\frac{\cos \phi}{\sin \phi} = 2 \sin 2 \phi + 2 \sin 4\phi + 2 \sin 6 \phi +\dots$ convergent? – Jean-Claude Arbaut Jan 15 '24 at 01:49
-
It doens't converge in the usuall sense. RHS contains a noise that oscillates with infinitely small wavelength. LHS actually is $\frac{\cos \phi - \cos (\infty \phi)}{\sin \phi}$. I want to know the mathematically rigorous way to use this equation in the reasoning. – Hayashi Yoshiaki Jan 15 '24 at 03:44