Integrate $f(y)=\int_{0}^{\frac{\pi}{2}} \ln(y^2 \cos^2x+ \sin^2x) .dx$ This Integral came up while attempting another question: 

$$f(y)=\int_{0}^{\frac{\pi}{2}} \ln(y^2 \cos^2x+ \sin^2x) .dx$$

The suggested solution was as follows:
$$f'(y) = 2y \int_{0}^{\pi/2}\frac{cos^{2}x}{sin^{2}x + y^{2}cos^{2}x}dx$$
$$= 2y \int_{0}^{\pi/2}\frac{dx}{tan^{2}x + y^{2}}$$
$$= 2y \int_{0}^{\pi/2}\frac{sec^{2}x - tan^{2}x }{tan^{2}x + y^{2}}dx$$
$$= 2y . \frac{1}{y} tan^{-1}( \frac{1}{y}) |_{0}^{\infty} -2y\frac{\pi}{2} + y^{2}f'(y)$$
$$f'(y) = \frac{\pi}{1 + y}$$
Unfortunately, I was unable to understand the how to get the last 3 steps. As per my understanding, 
$$f'(y)= 2y \int_{0}^{\pi/2}\frac{sec^{2}x - tan^{2}x }{tan^{2}x + y^{2}}dx$$
Splitting into 2 integrals, 
$$= 2y\int_0^{\pi/2}\dfrac{\sec^2 x}{\tan^2 x + y^2}dx-2y \int_{0}^{\pi/2}\frac{tan^{2}x }{tan^{2}x + y^{2}}dx$$
Substituting $\tan(x)=u$ in the first integral,
$$ 2y\int_0^{\pi/2}\dfrac{\sec^2 x}{\tan^2 x + y^2}dx$$
$$= 2y\int_0^{\infty}\dfrac{du}{u^2 + y^2}$$
$$=2y\times \dfrac{1}{y}\tan^{-1}(\dfrac{u}{y})|_0^\infty$$
However, this does not seem to agree with the given solution. Also, I have no idea as to how to integrate $-2y \int_{0}^{\pi/2}\frac{tan^{2}x }{tan^{2}x + y^{2}}dx$ 
ould somebody please be so kind as to point out my error in computing the first integral and also help me integrate the second integral? Many, many thanks in advance!

Your calculation of $2y\int_0^{\pi/2}\sec^2 x/(\tan^2 x + y^2)\, dx$ is correct so far, and the value is $\pi$. Now
\begin{align}2y\int_0^{\pi/2} \frac{\tan^2 x}{\tan^2 x + y^2}\, dx &= 2y\int_0^{\pi/2} \left(1 - \frac{y^2}{\tan^2 x + y^2}\right)\, dx \\
&= 2y\cdot\frac{\pi}{2}  - y^2\cdot 2y\int_0^{\pi/2} \frac{1}{\tan^2 x + y^2}\, dx\\
&= \pi y - y^2 f'(y),
\end{align}
and therefore
$$2y\int_0^{\pi/2} \frac{\sec^2 x - \tan^2 x}{\tan^2x + y^2}\, dx = \pi - \pi y + y^2f'(y),$$
that is, 
$$f'(y) = \pi - \pi y + y^2 f'(y).$$
Solving for $f'(y)$,
$$f'(y) = \frac{\pi - \pi y}{1 - y^2} =  \frac{\pi(1 - y)}{(1 - y)(1 + y)} = \frac{\pi}{1 + y}.$$
