<s>[INST] 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$$
 [/INST] 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)$$
</s>