TITLE: $\int_0^{\frac{\pi}{2}}\ln(\sin^2 x+k^2\cos^2 x)dx$ not by differentiation under the integral?
QUESTION [5 upvotes]: Show that
$$\int_0^{\frac{\pi}{2}}\ln(\sin^2 x+k^2\cos^2 x)dx=\pi\ln \frac{1+k}{2}$$
This is an exercise from Edwards Treatise on Integral Calculus II pg.188.
What solution to this problem can be given ?
In the chapter in Edwards he introduces the technique of substitution $x\mapsto \frac{\pi}{2}-x$. And proves Euler's formulas
$$\int_0^{\frac{\pi}{2}}\ln \sin x dx =\int_0^{\frac{\pi}{2}}\ln \cos x dx=-\frac{\pi}{2}\ln 2$$
The problem can be written as
$$\int_0^{\frac{\pi}{2}}\ln(\tan^2 x+k^2 )dx+2\int_0^{\frac{\pi}{2}}\ln(\cos x)dx=\pi\ln(1+k)-\pi\ln 2$$
Which reduces the question to
$$\int_0^{\frac{\pi}{2}}\ln(\tan^2 x+k^2 )dx=\pi\ln(1+k)$$
What proof can people give of this equation ?
The only success I have had is to differentiate with respect to $k$, and the result is easy to evaluate.
However, it seems that Edwards has at this stage not discussed that method, (although he lists it as a technique, and there is a chapter on it in part I) so is there another solution ? Of course, these old books may be playing by different rules. And the Tripos type questions dont follow any pedagogical pattern. But I guess I really want to know if someone has another solution.

REPLY [3 votes]: There is a quite low-level elementary solution. Using some trigonometric identities and change of variable, we obtain
\begin{multline*}
\int\limits_0^{\frac \pi 2} \ln(\sin^2 x + k^2\cos^2x)\,dx = \int\limits_0^{\frac \pi 2} \ln\Big(\frac{1-\cos 2x}2+ k^2\frac{1+\cos 2x}2\Big)\,dx = \\
\frac 12 \int\limits_0^\pi \ln\Big(\frac{1-\cos t}2+ k^2\frac{1+\cos t}2\Big)\,dt = \frac 14 \int\limits_0^{2\pi} \ln\Big(\frac{1+k^2}2-\frac{1-k^2 }2\cos t\Big)\,dt.
\end{multline*}
Suppose that $0 < k < 1$. Then we have an integral of a continuous function, which equals to the limit of its Riemann sums:
\begin{multline*}
\frac 14 \int\limits_0^{2\pi} \ln\Big(\frac{1+k^2}2-\frac{1-k^2 }2\cos t\Big)\,dt = \frac \pi{2n} \lim\limits_{n\to\infty} \sum\limits_{j=0}^{n-1}\ln\Big(\frac{1+k^2}2-\frac{1-k^2 }2\cos \frac{2\pi j}n\Big) =\\ \frac \pi{2n} \lim\limits_{n\to\infty} \ln \prod\limits_{j=0}^{n-1}\Big(\frac{1+k^2}2-\frac{1-k^2 }2\cos \frac{2\pi j}n\Big) = \frac \pi{2n} \lim\limits_{n\to\infty} \ln \prod\limits_{j=0}^{n-1}\Big(a^2 - 2ab\cos \frac{2\pi j}n + b^2\Big),
\end{multline*}
where $a = \frac{1+k}{2}$, $b = \frac{1-k}{2}$. Applying the algebraic identity
$$
\prod\limits_{j=0}^{n-1}\Big(a^2 - 2ab\cos \frac{2\pi j}n + b^2\Big) = (a^n - b^n)^2,
$$
we finally get
$$
\frac \pi{2n} \lim\limits_{n\to\infty} \ln (a^n - b^n)^2 = \frac \pi{n} \lim\limits_{n\to\infty} \ln \Big(\Big(\frac{1+k}2\Big)^n - \Big(\frac{1-k}2\Big)^n\Big) = \pi \ln \frac{1+k}2.
$$