It's my first post here and I was wondering if someone could help me with evaluating the definite integral $$ \int_0^{\Large\frac{\pi}{4}} \log\left( \cos x\right) \, \mathrm{d}x $$ Thanks in advance, any help would be appreciated.

  • $\begingroup$ What did you try ? maybe putting $t=\cos(x)$ would help $\endgroup$ – Belgi Sep 19 '12 at 12:12
  • $\begingroup$ There is an answer, but I cannot say how it is found: wolframalpha.com/input/?i=Integrate[Log[Cos[x]]%2C{x%2C0%2CPi%2F4}] $\endgroup$ – Siminore Sep 19 '12 at 12:16
  • $\begingroup$ @Siminore: That link is broken; here's one that works. $\endgroup$ – joriki Sep 19 '12 at 12:20
  • $\begingroup$ @Souvik : You mean 'evaluating'. $\endgroup$ – mick Sep 19 '12 at 13:12

Write $$\log(\cos(x))=\log\left(\frac12 e^{ix}(1+e^{-2ix})\right)\\ =-\log 2 + ix +\sum_{k=1}^\infty\frac{(-1)^{k+1}}{k}e^{-2ikx}.$$ Then integrate term by term to obtain $$\int_0^{\pi/4}\log(\cos(x))dx=-\frac{\pi}{4}\log 2 +i\frac{\pi^2}{32}+\frac{i}{2}\sum_{k=1}^\infty\frac{(-1)^{k+1}}{k^2}\left[e^{-ik\pi/2}-1\right].$$ The odd terms of the series with $e^{-ik\pi/2}$ give rise to the Catalan constant, and the even terms combine with the other infinite series to cancel the $i\pi^2/32$ term.


Let $$ I=\int_0^{\Large\frac\pi4}\ln(\sin x)\ dx\qquad\text{and}\qquad J=\int_0^{\Large\frac\pi4}\ln(\cos x)\ dx $$ then \begin{align} I+J&=\int_0^{\Large\frac\pi4}\ln(\sin x\cos x)\ dx\\ &=\int_0^{\Large\frac\pi4}\ln\left(\frac12\sin 2x\right)\ dx\\ &=\int_0^{\Large\frac\pi4}\ln(\sin 2x)\ dx-\int_0^{\Large\frac\pi4}\ln2\ dx\\ &=\frac12\int_0^{\Large\frac\pi2}\ln(\sin y)\ dy-\frac\pi4\ln2\qquad\color{red}{\Rightarrow}\qquad \text{set}\ y=2x\\ &=-\frac\pi2\ln2 \end{align} and \begin{align} I-J&=\int_0^{\Large\frac\pi4}\ln\left(\frac{\sin x}{\cos x}\right)\ dx\\ &=\int_0^{\Large\frac\pi4}\ln\left(\tan x\right)\ dx\\ &=\int_0^{1}\frac{\ln t}{1+t^2}\ dt\qquad\color{red}{\Rightarrow}\qquad \text{set}\ t=\tan x\\ &=\int_0^{1}\sum_{n=1}^\infty(-1)^n t^{2n}\ln t\ dt\\ &=\sum_{n=1}^\infty(-1)^n\int_0^{1} t^{2n}\ln t\ dt\\ &=-\sum_{n=1}^\infty\frac{(-1)^n}{(2n+1)^2}\\ &=-G, \end{align} where $G$ is Catalan's constant. Therefore $$ I=\int_0^{\Large\frac\pi4}\ln(\sin x)\ dx=-\frac12\left(G+\frac\pi2\ln2\right) $$ and $$ J=\int_0^{\Large\frac\pi4}\ln(\cos x)\ dx=\frac12\left(G-\frac\pi2\ln2\right). $$

References :

$[1]\ \ \displaystyle\int_0^{\Large\frac\pi2}\ln(\sin y)\ dy=\int_0^{\Large\frac\pi2}\ln(\cos y)\ dy=-\frac\pi2\ln2$

$[2]\ \ \displaystyle\int_0^1 x^\alpha \ln^k x\ dx=\frac{(-1)^k k!}{(\alpha+1)^{k+1}}, \qquad\text{for }\ k=0,1,2,\ldots$

  • $\begingroup$ The $n$-index in the Catalan constant must start at $\ \color{#c00000}{0}\ $ instead of 1. You can check it at this link. $\endgroup$ – Felix Marin Dec 28 '14 at 6:03
  • $\begingroup$ very very very nice! (+1) $\endgroup$ – clathratus Nov 11 '18 at 20:38

$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\Li}[1]{\,{\rm Li}_{#1}} \newcommand{\norm}[1]{\left\vert\left\vert\, #1\,\right\vert\right\vert} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$

\begin{align}&\color{#66f}{\large\int_{0}^{\pi/4}\ln\pars{\cos\pars{x}}\,\dd x} = \int_{-\pi/2}^{-\pi/4}\ln\pars{-\sin\pars{x}}\,\dd x = \int_{\pi/4}^{\pi/2}\ln\pars{\sin\pars{x}}\,\dd x \\[5mm]&=\int_{\pi/4}^{\pi/2}\overbrace{\bracks{% -\ln\pars{2} - \sum_{k\ =\ 1}^{\infty}{\cos\pars{2kx} \over k}}}^{\dsc{\ln\pars{\sin\pars{x}}}}\,\dd x =-\,{1 \over 4}\,\pi\ln\pars{2} -\sum_{k\ =\ 1}^{\infty}{1 \over k}\int_{\pi/4}^{\pi/2}\cos\pars{2kx}\,\dd x \\[5mm]&=-\,{1 \over 4}\,\pi\ln\pars{2} -\sum_{k\ =\ 1}^{\infty}{1 \over k}{\sin\pars{k\pi} - \sin\pars{k\pi/2} \over 2k} =-\,{1 \over 4}\,\pi\ln\pars{2} +\half\sum_{k\ =\ 1}^{\infty}{\sin\pars{k\pi/2} \over k^{2}} \\[5mm]&=-\,{1 \over 4}\,\pi\ln\pars{2} +\half\sum_{k\ =\ 0}^{\infty}{\sin\pars{k\pi + \pi/2} \over \pars{2k + 1}^{2}} =-\,{1 \over 4}\,\pi\ln\pars{2} +\half\ \underbrace{\sum_{k\ =\ 0}^{\infty}{\pars{-1}^{k} \over \pars{2k + 1}^{2}}} _{\ds{\mbox{Catalan Constant}\ \dsc{G}}} \\[5mm]&=\color{#66f}{\large-\,{1 \over 4}\,\pi\ln\pars{2} + \half\,G} \end{align}

  • $\begingroup$ Could you explain $$-\sum_{k\geq1}\frac{\sin(\pi k)-\sin(\pi k/2)}{k^2}=\sum_{k\geq1}\frac{\sin(\pi k/2)}{k^2}$$ $\endgroup$ – clathratus Nov 11 '18 at 20:42
  • $\begingroup$ Wait never-mind I feel like an idiot. $$\forall k\in\Bbb Z, \sin(\pi k)=0$$ $\endgroup$ – clathratus Nov 11 '18 at 20:45

The integral: $$S=\int_0^\frac{\pi}{4}\log(\cos(x))dx=\frac{1}{4}(2C-\pi \log 2)$$ where $C$ is the Catalan constant.

  • 5
    $\begingroup$ So Wolfram|Alpha tells us. Can you offer any insight into how this result is obtained? $\endgroup$ – joriki Sep 19 '12 at 12:22
  • $\begingroup$ Hmhm, I saw that answer with Catalan constant,can there be a more elementary solution without infinite series? $\endgroup$ – Souvik Sep 19 '12 at 12:26
  • $\begingroup$ Use $\cos(x)=\frac{\exp(i\theta)+\exp(-i\theta)}{2}$ and then integrate it. $\endgroup$ – Riccardo.Alestra Sep 19 '12 at 12:33
  • 3
    $\begingroup$ The reason the Catalan constant has a special name is that it cannot (as far as we know) be written in terms of more familiar things. $\endgroup$ – GEdgar Sep 19 '12 at 13:07
  • $\begingroup$ @ Riccardo: This helps us to find the part with $\pi log(2)$ but how do you find the Catalan constant with that ? $\endgroup$ – mick Sep 19 '12 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.