# Evaluate $\int_{\frac{-\pi}4}^{\frac{\pi}4}\ln(\sin x+\cos x)\mathrm{d}x$

$$\int_{\frac{-\pi}4}^{\frac{\pi}4} \ln(\sin x+\cos x)\mathrm{d}x$$ I just can't think of any technique to solve this question.

Can anyone help me with at least how to begin?

$I=\int_{\frac{-\pi}{4}}^{\frac{\pi}{4}}\ln(\sin x+\cos x)dx.............(1)$
Replace $x$ by $\frac{-\pi}{4}+\frac{\pi}{4}-x=-x$
$I=\int_{\frac{-\pi}{4}}^{\frac{\pi}{4}}\ln(\sin (-x)+\cos (-x))dx=\int_{\frac{-\pi}{4}}^{\frac{\pi}{4}}\ln(-\sin x+\cos x)dx..............(2)$
Add $(1)$ and $(2)$
$2I=\int_{\frac{-\pi}{4}}^{\frac{\pi}{4}}\ln(\sin x+\cos x)+\ln(-\sin x+\cos x)dx$
$2I=\int_{\frac{-\pi}{4}}^{\frac{\pi}{4}}\ln(-\sin^2 x+\cos^2 x)dx$
$2I=\int_{\frac{-\pi}{4}}^{\frac{\pi}{4}}\ln(\cos2x)dx$
As $\ln(\cos 2x)$ is an even function.So
$2I=2\int_{0}^{\frac{\pi}{4}}\ln(\cos2x)dx$
$I=\int_{0}^{\frac{\pi}{4}}\ln(\cos2x)dx$
Let $2x=t\Rightarrow dx=\frac{dt}{2}$
$I=\int_{0}^{\frac{\pi}{2}}\ln(\cos t)\frac{dt}{2}$
$I=\frac{1}{2}\int_{0}^{\frac{\pi}{2}}\ln(\cos t)dt$
And use the standard result,$\int_{0}^{\frac{\pi}{2}}\ln(\cos t)dt=\frac{-\pi}{2}\ln 2$
$I=\frac{-\pi}{4}\ln 2$

• I cannot. Could you elaborate a liitle ? I am even not sure that the result is a real number. Thanks in advance. – Claude Leibovici Nov 18 '15 at 6:49

One may observe that $$\sin x+\cos x=\sqrt{2}\cos\left(\frac{\pi}4-x\right)$$ giving

\begin{align} \int_{\large\frac{-\pi}4}^{\large\frac{\pi}4} \ln(\sin x+\cos x)\:\mathrm{d}x &=\int_{0}^{\large\frac{\pi}2}\frac12{\ln 2}\:\mathrm{d}x+\int_{0}^{\large\frac{\pi}2} \ln(\cos x)\:\mathrm{d}x=-\frac{\pi}4\ln 2 \end{align}

where the latter integral may be evaluated as is done here.

Suppose one knows that,

1)$\displaystyle \int_0^1 \dfrac{\ln x}{1+x^2}dx=-G$

2) $\displaystyle \int_0^1 \dfrac{\ln(1+x^2)}{1+x^2}dx=\dfrac{\pi\ln 2}{2}-G$

Where $G$ is the Catalan constant.

$I=\displaystyle \int_{-\tfrac{\pi}{4}}^{\tfrac{\pi}{4}}\ln(\sin x+\cos x)dx$

$I=\displaystyle \int_{-\tfrac{\pi}{4}}^{\tfrac{\pi}{4}}\ln\left(\dfrac{\sin x+\cos x}{\cos x}\right)dx+\int_{-\tfrac{\pi}{4}}^{\tfrac{\pi}{4}}\ln(\cos x)dx$

Since $x\rightarrow \ln(\cos x)$ is an even function,

$\displaystyle I=\int_{-\tfrac{\pi}{4}}^{\tfrac{\pi}{4}}\ln(\tan x+1)dx+2\int_{0}^{\tfrac{\pi}{4}}\ln(\cos x)dx$

$\displaystyle I=\int_{-\tfrac{\pi}{4}}^{\tfrac{\pi}{4}}\ln(\tan x+1)dx-\int_{0}^{\tfrac{\pi}{4}}\ln((\sec x)^2)dx$

Perform the change of variable $y=\tan x$,

$\displaystyle I=\int_{-1}^1 \dfrac{\ln(1+x)}{1+x^2}dx-\int_{0}^1 \dfrac{\ln(1+x^2)}{1+x^2}dx$

$\displaystyle I=\int_{-1}^0 \dfrac{\ln(1+x)}{1+x^2}dx+\int_{0}^1 \dfrac{\ln(1+x)}{1+x^2}dx-\int_{0}^1 \dfrac{\ln(1+x^2)}{1+x^2}dx$

Perform the change of variable $y=-x$ in the first integral.

$\displaystyle I=\int_{0}^1 \dfrac{\ln(1-x)}{1+x^2}dx+\int_{0}^1 \dfrac{\ln(1+x)}{1+x^2}dx-\int_{0}^1 \dfrac{\ln(1+x^2)}{1+x^2}dx$

Perform the change of variable $y=\dfrac{1-x}{1+x}$ in the first integral:

$\displaystyle I=\int_{0}^1 \dfrac{\ln\left(\dfrac{2x}{1+x}\right)}{1+x^2}dx+\int_{0}^1 \dfrac{\ln(1+x)}{1+x^2}dx-\int_{0}^1 \dfrac{\ln(1+x^2)}{1+x^2}dx$

Therefore,

$\displaystyle I=\dfrac{\pi\ln 2}{4}+\int_0^1 \dfrac{\ln x}{1+x^2}dx-\int_{0}^1 \dfrac{\ln(1+x^2)}{1+x^2}dx=\dfrac{\pi\ln 2}{4}-G+G-\dfrac{\pi\ln 2}{2}=-\dfrac{\pi\ln 2}{4}$

Let $$I=\int_{-\pi/4}^{\pi/4}\log(\cos x+\sin x)\ dx$$ then multiply the function in the log term by $\frac{\cos x-\sin x}{\cos x-\sin x}$ \begin{align} I&=\int_{-\pi/4}^{\pi/4}\log\left((\cos x+\sin x)\cdot\frac{\cos x-\sin x}{\cos x-\sin x}\right)\ dx\\[10pt] &=\int_{-\pi/4}^{\pi/4}\log(\cos^2 x-\sin^2 x)\ dx-\int_{-\pi/4}^{\pi/4}\log(\cos x-\sin x)\ dx \end{align} For the first integral use the identity $\cos2x=\cos^2 x-\sin^2 x$ followed by substitution $2x\mapsto x$ and observe that the integrand is an even function so that we can use the symmetry argument. For the second integral use substitution $x\mapsto -x$ and observe that $\cos(-x)=\cos x$ and $\sin(-x)=-\sin x$. \begin{align} I&=\int_{0}^{\pi/2}\log\cos x\ dx-\int_{-\pi/4}^{\pi/4}\log(\cos x+\sin x)\ dx\\[10pt] &=-\frac{\pi}{2}\log 2-I\\[10pt] &=-\frac{\pi}{4}\log 2 \end{align} where it matches the other results.


\begin{align} &\color{#f00}{\int_{-\pi/4}^{\pi/4}\ln\pars{\sin\pars{x} + \cos\pars{x}}\,\dd x} = \int_{-\pi/4}^{\pi/4}\ln\pars{\root{2}\sin\pars{x + {\pi \over 4}}}\,\dd x \\[3mm] = &\ {\pi \over 4}\,\ln\pars{2}\ +\ \underbrace{% \int_{0}^{\pi/2}\ln\pars{\sin\pars{x}}\,\dd x} _{\ds{-\,{\pi \over 2}\,\ln\pars{2}}} = \color{#f00}{-\,{\pi \over 4}\,\ln\pars{2}} \end{align}