<s>[INST] Evaluate integral: $\int_0^{\frac{\pi}{2}}\ln(a^2\cos^2 x +b^2\sin^2x)dx$? For $a,b>0$, show that

$$\int_0^{\frac{\pi}{2}}\ln(a^2\cos^2 x+b^2\sin^2 x) dx=\pi\ln\left(\frac{a+b}{2}\right)$$
I came across to this problem in the book Table of integrals, series and product. So here is my try to prove the closed form.

For $a>b$ then, we can write the    $$ a^2\cos^2x +b^2\sin^2x =b^2\cos^2x+b^2\sin^2x + k\cos^2x = b^2 +k\cos^2x $$ where $ k= a^2-b^2$ and similarly, for $ b>a$  we can write $a^2\cos^2x +b^2\sin^2x = a^2+l\sin^2x$ where $l= b^2-a^2$. Hence we have $$ \int_0^{\frac{\pi}{2}}\ln(b^2+k\cos^2x )dx=\\
\int_0^{\frac{\pi}{2}}\left(\ln(b^2) + \ln\left(1+\frac{k}{b^2}\cos^2x\right)\right)dx\cdots(1)$$ and $$\int_0^{\frac{\pi}{2}}\ln(a^2+l\sin^2x )dx \\= \int_0^{\frac{\pi}{2}}\left(\ln(a^2) + \ln\left(1+\frac{l}{a^2}\sin^2x\right)\right)dx, \; \; b>a$$ Since $\left| \frac{k}{b^2}\cos^2 x\right|\leq 1$ so we use the Machlaurin series of $\ln(1+x)$ for $|x|<1$ giving us $$ \pi \ln(b)+\sum_{m\geq 1} \frac{(-1)^{m-1}}{m}\left(\frac{k}{4b^2}\right)^m\int_0^{\frac{\pi}{2}}\cos^{2m}xdx$$ The latter integral is well know result know as Wallis integral thus gives us $$ \frac{\pi}{2}\sum_{m\geq 1} \frac{(-1)^{m+1}}{m}\left(\frac{k}{4b^2}\right)^m{2m\choose m}\cdots(2)$$ Recalling the generating function of Central  binomial coefficients for $|y| <\frac{1}{4}$, ie $$\sum_{m\geq 1} {2m\choose m} y^{m}=\frac{1}{\sqrt{1-4y}}-1.$$ Dividing by $y$ and an integrating  from $0$ to $z$ we have $$ \sum_{m\geq 1}\frac{1}{m}{2m\choose m} z^{m} =-2\ln\left(\frac{\sqrt{1-4z}+1}{2}\right) $$ multiplying thoroughly by $-1$ and set $z=-\frac{k}{4b^2}=-\frac{a^2-b^2}{4b^2}$ gives us $$\sum_{m\geq 1} \frac{(-1)^{m+1}}{m}\left(\frac{k}{4b^2}\right)^m{2m\choose m}\\ = 2\ln\left(\frac{{a+b}}{2}\right)-2\ln b $$ From $(1)$ and $(2)$ we have $$\pi\ln(b)+\pi\ln\left(\frac{a+b}{2}\right)-\pi\ln b \\= \pi\ln\left(\frac{a+b}{2}\right)$$ Similarly, for the case of $b>a$ we replace $ \cos^2x$ by $\sin^2x$, $k$ by $ l$. We obtained the same desired result.  Moreover,   we can also have the following  result.

$$\int_0^{\frac{\pi}{2}}\ln(a^2\cos^2 x+b^2\sin^2 x) dx=\frac{1}{2}\int_0^{\pi}\ln(a^2\cos^2x+b^2\sin^2x)dx=\pi\ln\left(\frac{a+b}{2}\right)$$

Now I'm wishing to know other different approaches/proofs for the aforementioned integral.
Thank you.
 [/INST] Let
$$ I(a)=\int_{0}^{\frac{\pi}{2}} \ln(a^2 \cos^2 x+b^2 \sin^2 x) dx $$
Thus
$$ I(b)=\int_{0}^{\frac{\pi}{2}} \ln(b^2 \cos^2 x+b^2 \sin^2 x) dx=\pi \ln b $$
\begin{align}
I'(a)&=\int_{0}^{\frac{\pi}{2}} \frac{2a\cos^2 x}{a^2 \cos^2 x+b^2 \sin^2 x}dx \\
&=2a \int_{0}^{\frac{\pi}{2}} \frac{d(\tan x)}{(a^2+b^2 \tan^2 x)(1+\tan^2 x)} \\
&=\frac{\pi}{a+b} \\
\end{align}
Thus
$$ \int_b^a I'(a) da=\int_b^a \frac{\pi}{a+b} da $$
$$ I(a)-I(b)=\pi (\ln(a+b)-\ln(2b)) $$
$$ I(a)=\pi \ln \frac{a+b}{2} $$
</s>