Definite integral $\int_{\frac{-\pi}{4}}^{\frac{\pi}{4}}\ln(\cos x + \sin x) dx$ Evaluate the following integral:
$$\int_{\frac{-\pi}{4}}^{\frac{\pi}{4}}\ln(\cos x + \sin x) dx$$
 A: Observe $\sin x+\cos x=\sqrt{2}(\frac{1}{\sqrt{2}}\sin x+\frac{1}{\sqrt{2}}\cos x)=\sqrt{2}(\cos\frac{\pi}{4}\sin x+\sin\frac{\pi}{4}\cos x)=\sqrt{2}\sin(x+\frac{\pi}{4})$. Now perform a u-sub $x+\frac{\pi}{4}=u$ to arrive at $\sqrt{2}\sin u$ integrating from $0$ to $\frac{\pi}{2}$ which is a well known integral discussed elsewhere on this site
A: We have
$$\ln\left(\cos(x)+\sin(x)\right) = \ln(\sqrt{2}) + \ln\left(\dfrac1{\sqrt2}\left(\cos(x)+\sin(x)\right)\right) = \dfrac{\ln(2)}2 + \ln\left(\sin\left(x+\dfrac{\pi}4\right)\right)$$
Hence,
$$I = \int_{-\pi/4}^{\pi/4} \left(\dfrac{\ln(2)}2 +  \ln\left(\sin\left(x+\dfrac{\pi}4\right)\right)\right)dx = \dfrac{\pi}4 \ln(2) + \int_0^{\pi/2} \ln(\sin(x))dx$$
where the second integral is $-\dfrac{\pi\ln(2)}2$ from here. Hence, the integral is $I = -\dfrac{\pi}4\ln(2)$.
A: $$I=\frac{1}{2} \int_{\frac{-\pi}{4}}^{\frac{\pi}{4}} log(sinx+cosx)^2dx=\frac{1}{2} \int_{\frac{-\pi}{4}}^{\frac{\pi}{4}}log(1+sin2x)dx \tag{1}$$ using $\int_{a}^{b}f(x)dx=\int_{a}^{b}f(a+b-x)dx$ we have
$$I=\frac{1}{2} \int_{\frac{-\pi}{4}}^{\frac{\pi}{4}}log(1-sin2x)dx \tag{2}$$
Adding $(1)$ and $(2)$ we get
$$2I=\frac{1}{2} \int_{\frac{-\pi}{4}}^{\frac{\pi}{4}}log(cos^22x)dx= \int_{\frac{-\pi}{4}}^{\frac{\pi}{4}}log(cos2x)dx=2\int_{0}^{\frac{\pi}{4}}log(cos2x)dx=\int_{0}^{\frac{\pi}{2}}log(cosx)dx=\frac{-\pi}{2log2}$$
$$I=\frac{-\pi}{4log2}$$
