Compute integral: $\int_{0}^{\pi/2}\log(a^2\sin^2 x+b^2\cos^2 x )dx$ This is a integral for a calculus exam, and I have no idea how to solve it.
$$\int_0^{\frac{\pi}{2}} \log \big( a^2 \sin^{2}(x)+b^2 \cos^{2}(x) \big) \, \mathrm{d}x$$
 A: Consider 
$$I(b)=\int_0^{\pi/2} \ln\left(a^2\sin^2x+b^2\cos^2x\right)\,dx $$  
$\displaystyle 
\begin{aligned}
\Rightarrow \frac{\partial I}{\partial b} &=2b\int_0^{\pi/2} \frac{\cos^2x}{a^2\sin^2x+b^2\cos^2x}\,dx\\
&=2b\int_0^{\pi/2} \frac{dx}{a^2\tan^2x+b^2}\\
&=2b\int_0^{\infty} \frac{dt}{(a^2t^2+b^2)(1+t^2)}\,\,\,\,\,\,\,(\tan x=t)\\
&=\frac{2b}{b^2-a^2}\left(\int_0^{\infty}\frac{dt}{1+t^2}-a^2\int_0^{\infty} \frac{dt}{a^2t^2+b^2}\right)\,\,\,\,\,\,(\text{partial fractions})
\\&=\frac{2b}{b^2-a^2}\left(\frac{\pi}{2}-\frac{\pi}{2}\frac{a}{b}\right)\\
&=\pi\frac{b-a}{b^2-a^2}=\frac{\pi}{a+b}
\end{aligned}$
Hence,
$$\Rightarrow I(b)=\pi \ln(a+b)+C$$
To evaluate $C$, I compute $I(0)$ i.e
$$I(0)=\int_0^{\pi/2} \ln(a^2\sin^2x)\,dx=\pi\ln\frac{a}{2}$$
$$\Rightarrow I(0)=\pi\ln a+C=\pi\ln\frac{a}{2} \Rightarrow C=-\pi\ln 2$$
Hence,
$$I(b)=\pi\ln\left(\frac{a+b}{2}\right)$$
A: Without loss of generality, let $b>a>0$. Noting
$$ \sin^2x=\frac{1-\cos(2x)}{2}, \cos^2x=\frac{1+\cos(2x)}{2} $$
we have
\begin{eqnarray*}
I&=&\int_0^{\frac{\pi}{2}} \log \big(\frac{a^2+b^2}{2}+\frac{b^2-a^2}{2}\cos(2x)\big) \mathrm{d}x\\
&=&\frac{1}{2}\int_0^{\pi} \log \big(\frac{a^2+b^2}{2}+\frac{b^2-a^2}{2}\cos x\big) \mathrm{d}x\\
&=&\frac{1}{2}\int_0^{\pi} \log \left(\frac{a^2+b^2}{b^2-a^2}+\cos x\right) \mathrm{d}x+\frac{\pi}{2}\log\frac{b^2-a^2}{2}.
\end{eqnarray*}
Note, for $a>1$
$$\int_0^{\pi} \log \left(\alpha+\cos x\right) \mathrm{d}x=\pi\log\frac{a(a+\sqrt{a^2-1})}{2a} $$
and hence we have
\begin{eqnarray*}
I&=&\pi\log\frac{a+b}{2}
\end{eqnarray*}
