$\int_0^{\frac{\pi}{2}}\ln(\sin^2 x+k^2\cos^2 x)dx$ not by differentiation under the integral?

First of all, we can note that $ \int_{0}^{\frac{\pi}{2}}{\ln{\left(\sin{x}\right)}\,\mathrm{d}x}= \int_{0}^{\frac{\pi}{2}}{\ln{\left(\cos{x}\right)}\,\mathrm{d}x} $, $ \ \ \ \ \left(y=\frac{\pi}{2}-x\right)$

Substracting the RHS from the LHS, then multiplying by $ 2 $, gives $ \int_{0}^{\frac{\pi}{2}}{\ln{\left(\tan^{2}{x}\right)}\,\mathrm{d}x} = 0$.

\begin{aligned}\int_{0}^{\frac{\pi}{2}}{\ln{\left(\tan^{2}{x}+k^{2}\right)}\,\mathrm{d}x}&=k^{2}\int_{0}^{\frac{\pi}{2}}{\int_{0}^{1}{\frac{\mathrm{d}y\,\mathrm{d}x}{\tan^{2}{x}+k^{2}y}}}\\ &=k^{2}\int_{0}^{1}{\int_{0}^{\frac{\pi}{2}}{\frac{\mathrm{d}x\,\mathrm{d}y}{\tan^{2}{x}+k^{2}y}}}\\ &=k^{2}\int_{0}^{1}{\int_{0}^{\frac{\pi}{2}}{\frac{\mathrm{d}x}{\cos^{2}{x}\left(\tan^{2}{x}+k^{2}{y}\right)\left(1+\tan^{2}{x}\right)}}\,\mathrm{d}y}\\ &=k^{2}\int_{0}^{1}{\int_{0}^{+\infty}{\frac{\mathrm{d}x}{\left(x^{2}+k^{2}y\right)\left(1+x^{2}\right)}}\,\mathrm{d}y}\\ &=k^{2}\int_{0}^{1}{\int_{0}^{+\infty}{\left(\frac{1}{\left(1-k^{2}y\right)\left(x^{2}+k^{2}y\right)}-\frac{1}{\left(1-k^{2}y\right)\left(1+x^{2}\right)}\right)\mathrm{d}x}\,\mathrm{d}y}\\ &=k^{2}\int_{0}^{1}{\left(\frac{1}{1-k^{2}y}\int_{0}^{+\infty}{\frac{\mathrm{d}x}{x^{2}+k^2y}}-\frac{1}{1-k^{2}y}\int_{0}^{+\infty}{\frac{\mathrm{d}x}{1+x^{2}}}\right)\mathrm{d}y}\\ &=k^{2}\int_{0}^{1}{\left(\frac{\pi}{2\left(1-k^{2}y\right)}\left(\frac{1}{k\sqrt{y}}-1\right)\right)\mathrm{d}y}\\ &=k\pi\int_{0}^{1}{\frac{\mathrm{d}y}{2\sqrt{y}\left(1+k\sqrt{y}\right)}}\\ &=\pi\int_{0}^{1}{\frac{k}{1+ky}\,\mathrm{d}y}\\ \int_{0}^{\frac{\pi}{2}}{\ln{\left(\tan^{2}{x}+k^{2}\right)}\,\mathrm{d}x}&=\pi\ln{\left(1+k\right)}\end{aligned}


I doubt this was the approach Edwards had in mind, but if we make the substitution $u = \tan x$, the integral becomes $$ \begin{align}\int_{0}^{\pi /2}\ln(\sin^2 x+k^2\cos^2 x) \, \mathrm dx &=\int_{0}^{\infty} \frac{\ln \left(\frac{u^{2}+k^{2}}{u^{2}+1} \right)}{1+u^{2}} \, \mathrm du \\ & = \int_{0}^{\infty} \frac{\ln(u^{2}+k^{2})}{u^{2}+1} \, \mathrm du - \int_{0}^{\infty} \frac{\ln(u^{2}+1)}{u^{2}+1} \, \mathrm du. \end{align}$$

And by integrating the function $$f(z) = \frac{\ln(z+ik)}{z^{2}+1}, \quad k>0,$$ around a semicircular contour in the upper half of the complex plane, we find that $$ \int_{-\infty}^{\infty} \frac{\ln(x+ik)}{x^{2}+1} \, \mathrm dx = 2 \pi i \operatorname{Res}[f(z), i] = \pi \ln (i+ik). $$

(The branch cut is entirely in the lower half-plane if we use the principal branch of the logarithm.)

Equating the real parts on both side of the equation, we get $$\frac{1}{2} \int_{-\infty}^{\infty} \frac{\ln(x^{2}+k^{2})}{x^{2}+1} \, \mathrm dx = \pi \ln (1+k).$$

Therefore, $$\int_{0}^{\pi /2}\ln(\sin^2 x+k^2\cos^2 x) \, \mathrm dx = \pi \ln (1+k) - \pi \ln 2 = \pi \ln \left( \frac{1+k}{2} \right).$$


A generalization:

Assume that $k \ge 0$ and $ 0 < \theta < \pi$.

Let $$I(k, \theta) = \int_{-\pi/2}^{\pi/2} \ln \left(\sin^{2}(x)+k \sin(2x) \cos (\theta) +k^{2} \cos^{2}(x)\right) \, \mathrm dx .$$

Then again making substitution $u = \tan x$, we get

$$\begin{align} I(k, \theta) &= \int_{-\infty}^{\infty} \frac{\ln \left(\frac{u^{2}+2ku \cos (\theta) +k^{2}}{u^{2}+1} \right)}{u^{2}+1} \, \mathrm du \\ &= \int_{-\infty}^{\infty} \frac{\ln(u^{2}+2ku \cos (\theta) + k^{2})}{u^{2}+1} \, \mathrm du - 2 \pi \ln 2 \\ &= \pi \ln (1+2k \sin (\theta) +k^{2}) - 2 \pi \ln 2 \\ &= \pi \ln \left( \frac{1+2k \sin (\theta) +k^{2}}{4} \right). \end{align}$$

An evaluation of the integral on the second line using contour integration can be found here.