# Evaluate $\int_{0}^{\frac{\pi}{4}}\ln(\cos(t))dt$

$$\int_{0}^{\frac{\pi}{4}}\ln(\cos(t))dt=\frac{-{\pi}\ln(2)}{4}+\frac{K}{2}$$

I ran across this integral while investigating the Catalan constant. I am wondering how it is evaluated. I know of this famous integral when the limits of integration are $0$ and $\frac{\pi}{2}$, but when the limits are changed to $0$ and $\frac{\pi}{4}$, it becomes more complicated.

I tried using $$\cos(t)=\frac{e^{it}+e^{-it}}{2},$$ then rewriting it as:
$$\int_{0}^{\frac{\pi}{4}}\ln\left(\frac{e^{it}+e^{-it}}{2}\right)=\int_{0}^{\frac{\pi}{4}}\ln(e^{it}+e^{-it})dt-\int_{0}^{\frac{\pi}{4}}\ln(2)dt.$$

But, this is where I get stuck.

Maybe factor out an $e^{it}$ and get $$\int_{0}^{\frac{\pi}{4}}\ln(e^{it}(1+e^{-2it}))dt=\int_{0}^{\frac{\pi}{4}}\ln(e^{it})dt+\int_{0}^{\frac{\pi}{4}}\ln(1+e^{-2it})dt$$

I thought maybe the Taylor series for ln(1+x) may come in

handy in some manner. It being $\ln(1+x)=\sum_{k=1}^{\infty}\frac{(-1)^{k+1}x^{k}}{k}$

Giving $\int_{0}^{\frac{\pi}{4}}\sum_{k=1}^{\infty}\frac{(-1)^{k+1}e^{-2kit}}{k}$

Just some thoughts. I doubt if I am on to anything. I used a technique similar to this when solving $\int_{0}^{\frac{\pi}{2}}x\ln(\sin(x))dx$.

But, how in the world would the Catalan constant come into the

solution?. $K=\sum_{k=0}^{\infty}\frac{(-1)^{k}}{(2k+1)^{2}}\approx .916$

-
Looks like you are on the right track. Maybe you should try to reverse the order of the sum and the integral... –  Fabian Mar 20 '11 at 21:49

I dont know what a Catalan number is but the real part of the integral gets you the expression you are seeking. You have $$\int_{0}^{\frac{\pi}{4}}\ln(e^{it}+e^{-it})dt= i(2n\frac{\pi^2}{4}+\frac{\pi^2}{16}) + \int_{0}^{\frac{\pi}{4}}\sum_{k=1}^{\infty}\frac{(-1)^{k+1}e^{-2kit}}{k}$$

Here $n$ just appears because of the multivalued $\ln (e^{it})$ term but you can ignore it as they are imganiary. The expression you got correctly was

$$\int_{0}^{\frac{\pi}{4}}\left(\sum_{k=1}^{\infty}\frac{(-1)^{k+1}e^{-2kit}}{k}\right)dt$$

$$=\sum_{k=1}^{\infty}\left(\int_{0}^{\frac{\pi}{4}}\frac{(-1)^{k+1}e^{-2kit}}{k}dt\right)$$

$$=\sum_{k=1}^{\infty}\frac{(-1)^{k+1}(e^{-i\frac{k\pi}{2}}-1)}{(-2ki)k}= \sum_{k=1}^{\infty}\frac{(-1)^{k+1}(e^{-i\frac{k\pi}{2}})}{(-2ki)k}-\sum_{k=1}^{\infty}\frac{(-1)^{k+1}}{(-2ki)k}$$

The second summation in this expression is gonna remain imaginary forever, so leave it out. In the first term observe that the summand is going to be real only if $k=2n+1$ as n goes from $0$ to $\infty$.

Substituting $k=2n+1$, and $e^{i(2n+1)\frac{\pi}{2}}=(-1)^n i$ you get the real part of the entire thing as

$$\sum_{n=0}^{\infty}\frac{(-1)^{n}}{2(2n+1)^{2}}$$

$$=\frac{K}{2}$$

-
A small comment about terminology: The Catalan numbers are $\frac{1}{n+1} \binom{2n}{n}$. Catalan's constant is $1/1^2-1/3^2+1/5^2-\dots$. –  Hans Lundmark Mar 21 '11 at 6:54
Wow, thank you very much. I was on the right track, but didn't have sense enough to finish. Thanks again. That makes sense. –  Cody Mar 21 '11 at 15:18


\begin{align} &\color{#c00000}{\int_{0}^{\pi/4}\ln\pars{\cos\pars{t}}\,\dd t} =-\,{\pi\ln\pars{2} \over 4} + \int_{0}^{\pi/4}\ln\pars{2\cos\pars{t}}\,\dd t \\[3mm]&=-\,{\pi\ln\pars{2} \over 4} + \half\int_{0}^{\pi/4}\ln\pars{\cot\pars{t}}\,\dd t +\int_{0}^{\pi/4}\ln\pars{2\cos\pars{t} \over \cot^{1/2}\pars{t}}\,\dd t \end{align} Since ( see this link ) $\ds{K = \int_{0}^{\pi/4}\ln\pars{\cot\pars{t}}\,\dd t}$: $$\color{#c00000}{\int_{0}^{\pi/4}\ln\pars{\cos\pars{t}}\,\dd t} =-\,{\pi\ln\pars{2} \over 4} + {K \over 2} + \half \color{#00f}{\int_{0}^{\pi/4}\ln\pars{4\cos^{2}\pars{t} \over \cot\pars{t}}\,\dd t} \tag{1}$$

The problem is reduced to show that the "$\color{#00f}{\mbox{blue integral}}$" vanishes out: \begin{align} &\color{#00f}{\int_{0}^{\pi/4}\ln\pars{4\cos^{2}\pars{t} \over \cot\pars{t}}\,\dd t} =\int_{0}^{\pi/4}\ln\pars{4\sin\pars{t}\cos\pars{t}}\,\dd t =\int_{0}^{\pi/4}\ln\pars{2\sin\pars{2t}}\,\dd t \\[3mm]&=\half\int_{0}^{\pi/2}\ln\pars{2\sin\pars{t}}\,\dd t ={1 \over 4}\,\pi\ln\pars{2} + \half\,\lim_{\mu \to 0}\partiald{}{\mu} \int_{0}^{1}t^{\mu}\pars{1 - t^{2}}^{-1/2}\,\dd t \\[3mm]&={1 \over 4}\,\pi\ln\pars{2} + {1 \over 4}\,\lim_{\mu \to 0}\partiald{}{\mu} \int_{0}^{1}t^{\pars{\mu - 1}/2}\pars{1 - t}^{-1/2}\,\dd t \\[3mm]&={1 \over 4}\,\pi\ln\pars{2} + {1 \over 4}\,\lim_{\mu \to 0}\partiald{}{\mu}\bracks{% \Gamma\pars{\mu/2 + 1/2}\Gamma\pars{1/2} \over \Gamma\pars{\mu/2 + 1}} \\[3mm]&={1 \over 4}\,\pi\ln\pars{2} + {1 \over 8}\,{\Gamma\pars{1/2} \over \Gamma\pars{1}}\ \bracks{\overbrace{\Psi\pars{\half} - \Psi\pars{1}} ^{\ds{-2\ln\pars{2}}}}\, \overbrace{\Gamma\pars{\half}}^{\ds{\root{\pi}}} = \color{#00f}{\large 0} \quad\mbox{since}\quad\Gamma\pars{1} = 1.\tag{2} \end{align} $\ds{\Gamma\pars{z}}$ and $\ds{\Psi\pars{z}}$ are the Gamma and Digamma Functions, respectively.

$\pars{1}$ and $\pars{2}$ lead to: $$\color{#00f}{\large\int_{0}^{\pi/4}\ln\pars{\cos\pars{t}}\,\dd t =-\,{\pi\ln\pars{2} \over 4} + {K \over 2}}$$

-