Interesting integral: $I=\int_0^1 \int_0^1 \log\left( \cos(\pi x)^2 + \cos(\pi y)^2 \right)dxdy$ I've stumbles across the following integral when doing some combinatorial work:
$$ I=\int_0^1 \int_0^1 \log\left( \cos(\pi x)^2 + \cos(\pi y)^2 \right)dxdy$$
After plugging this into Mathematica, it outputs:
$$ I=\frac{4C}{\pi}-\log(4)$$
where $C$ is Catalan's constant $\left( C= \frac{1}{1^2}-\frac{1}{3^2}+\frac{1}{5^2}-\ldots \right)$. I have messed around with this integral yet I cannot figure out how it got that result. Anyone have any ideas?
 A: The calculations will be simplified if we know that $\cos(\pi x) \ge 0$ and $\cos(\pi y) \ge 0$.  To achieve that we observe that
$$
\int_{0}^{1}\int_{0}^{1}\log(\cos^{2}(\pi x)+\cos^{2}(\pi y))\, dxdy = 
4\int_{0}^{1/2}\int_{0}^{1/2}\log(\cos^{2}(\pi x)+\cos^{2}(\pi y))\, dxdy .
$$
We study 
$$
f(s) = \int_{0}^{1/2}\int_{0}^{1/2}\log(\cos^{2}(\pi x)+s\cos^{2}(\pi y))\, dxdy
$$
and are interested in $4f(1)$. Since
$$
f(1)-f(0) = \int_{0}^{1}f'(s)\, ds
$$
we are ready if we can determine the integral and $f(0)$.
We get that
\begin{gather*}
f(0) = \int_{0}^{1/2}\int_{0}^{1/2}\log(\cos^{2}(\pi x))\, dxdy = \int_{0}^{1/2}\log(\cos(\pi x))\, dx \\[2ex]= \int_{0}^{1/2}\log(\sin(\pi x))\, dx
 = \dfrac{1}{2}\int_{0}^{1}\log(\sin(\pi x))\, dx  = \dfrac{1}{2}\int_{0}^{1/2}\log(\sin(\pi 2z))2\, dz\\[2ex] = \int_{0}^{1/2}\log 2\, dz + \int_{0}^{1/2}\log(\sin(\pi z))\, dz +\int_{0}^{1/2}\log(\cos(\pi z))\, dz\\[2ex]
 = \dfrac{1}{2}\log 2 + f(0)+f(0).
\end{gather*}
Consequently$f(0) = -\dfrac{1}{2}\log 2$.
We proceed to
$$
f'(s) = \int_{0}^{1/2}\int_{0}^{1/2}\dfrac{\cos^{2}(\pi y)}{\cos^{2}(\pi x) +s\cos^{2}(\pi y)}\, dxdy.
$$
The integral with respect to $x$ can be evaluated via a standard substitution $t= \tan\dfrac{z}{2}$.
\begin{gather*}
\int_{0}^{1/2}\dfrac{\cos^{2}(\pi y)}{\cos^{2}(\pi x) +s\cos^{2}(\pi y)}\, dx = \int_{0}^{1/2}\dfrac{2\cos^{2}(\pi y)}{1+\cos(2\pi x) + 2s\cos^{2}(\pi y)}\, dx\\[2ex]= \dfrac{1}{\pi}\int_{0}^{\pi}\dfrac{\cos^{2}(\pi y)}{1+\cos(z) + 2s\cos^{2}(\pi y)}\, dz 
= \dfrac{1}{\pi}\int_{0}^{\infty}\dfrac{\cos^{2}(\pi y)}{1+t^{2} +1-t^{2} + 2(1+t^{2})s\cos^{2}(\pi y)}2\, dt \\[2ex] = \dfrac{1}{\pi}\int_{0}^{\infty}\dfrac{\cos^{2}(\pi y)}{1 + s\cos^{2}(\pi y)+ st^{2}\cos^{2}(\pi y)}\, dt\\[2ex]
 = \dfrac{1}{\pi}\left[\dfrac{\cos(\pi y)}{\sqrt{s}\sqrt{1+s\cos^{2}(\pi y)}}\arctan\left(\sqrt{\dfrac{s}{1+s\cos^{2}(\pi y)}}\cos(\pi y)t\right)\right]_{0}^{\infty} \\[2ex]= \dfrac{\cos(\pi y)}{2\sqrt{s}\sqrt{1+s\cos^{2}(\pi y)}}.
\end{gather*}
It remains to integrate with respect to $y$.
\begin{gather*}
\int_{0}^{1/2}\dfrac{\cos(\pi y)}{2\sqrt{s}\sqrt{1+s\cos^{2}(\pi y)}}\, dy = \int_{0}^{1/2}\dfrac{\cos(\pi y)}{2\sqrt{s}\sqrt{1+s -s\sin^{2}(\pi y)}}\, dy\\[2ex] = \left[\dfrac{1}{2\pi s}\arcsin\left(\sqrt{\dfrac{s}{1+s}}\sin(\pi y)\right)\right]_{0}^{1/2}
= \dfrac{1}{2\pi s}\arcsin\sqrt{\dfrac{s}{1+s}} = \dfrac{1}{2\pi s}\arctan\sqrt{s}.
\end{gather*}
Finally we return to
\begin{gather*}
f(1)-f(0) = \int_{0}^{1}f'(s)\, ds = \int_{0}^{1}\dfrac{1}{2\pi s}\arctan\sqrt{s}\, ds\\[2ex] = \int_{0}^{1}\dfrac{1}{2\pi u^{2}}\arctan(u)2u\, du = \int_{0}^{1}\dfrac{1}{\pi u}\arctan(u)\, du = \dfrac{C}{\pi}.
\end{gather*}
Since we already know $f(0)$ we conclude that
$$
\int_{0}^{1}\int_{0}^{1}\log(\cos^{2}(\pi x)+\cos^{2}(\pi y))\, dxdy =  \dfrac{4C}{\pi} -2\log 2 = \dfrac{4C}{\pi} - \log 4.
$$
