Integral with a parameter Hello I try solve a problem on integration 
$\int_0^\frac{\pi}{2}\frac{\arctan(y\tan(x))}{\tan(x)}dx$ 
My stuck is that I use differentiation under integral sign and producing $ I'(y) = \int_0^ \frac{\pi}{2}\frac{dx}{1+(y\tan(x))^2}$ what can I do?
Thanks
The solution is $\frac{\pi}{2}\text{sgn}(y \ln(1+|y|))$
 A: Assuming $y>0$,
$$I(y)=\int_{0}^{\pi/2}\frac{\arctan(y\tan x)}{\tan x}\,dx = \int_{0}^{+\infty}\frac{\arctan(yt)}{t(1+t^2)}\,dt$$
hence:
$$ I'(y) = \int_{0}^{+\infty}\frac{dt}{(1+t^2)(1+y^2 t^2)}=\frac{\pi}{2+2y} $$
by partial fraction decomposition, then
$$ \forall y>0,\qquad I(y) = \int_{0}^{y}\frac{\pi\,du}{2+2u} = \frac{\pi}{2}\log(1+y) $$
and since $I(y)$ is an odd function, your claim follows.
A: First, note that the integral given by 
$$I(y)=\int_0^{\pi/2}\frac{\arctan(y\tan(x))}{\tan(x)}\,dx$$
is an odd function with $I(y)=-I(-y)$.  Therefore, we examine the case for $y\ge 0$.
Next, the integral given by 
$$I'(y)=\int_0^{\pi/2} \frac{1}{1+y^2\tan^2(x)}\,dx \tag 1$$
can be evaluated a host of ways.
In doing so, we find that 
$$I'(y)=\frac{\pi}{2(y+1)} \tag 2$$
Integrating $(1)$ and using $I(0)=0$ reveals
$$I(y)=\frac{\pi}{2}\log(1+y)$$
If $y<0$, then we use the fact that $I(y)$ is odd to write
$$I(y)=-\frac{\pi}{2}\log(1-y)$$
Putting both cases together yields
$$I(y)=\text{sgn}(y)\frac{\pi}{2}\log(1+|y|)$$
as expected!

EVALUATION OF THE INTEGRAL IN $(1)$
We assume that $y>0$ for the proceeding analysis.  
Note that we can write 
$$\frac{1}{1+y^2\tan^2(x)}=\frac{1}{1-y^2}-\frac{2y^2}{1-y^2}\frac{1}{(1+y^2)+(1-y^2)\cos(2x)}$$
Then, we have 
$$\begin{align}
\int_0^{\pi/2}\frac{1}{1+y^2\tan^2(x)}\,dx&=\frac{\pi}{2(1-y^2)}-\frac{2y^2}{1-y^2}\int_0^{\pi/2}\frac{1}{(1+y^2)+(1-y^2)\cos(2x)}\,dx\\\\
&=\frac{\pi}{2(1-y^2)}-\frac{y^2}{1-y^2}\int_0^{\pi}\frac{1}{(1+y^2)+(1-y^2)\cos(x)}\,dx\\\\
&=\frac{\pi}{2(1-y^2)}-\frac{y^2}{2(1-y^2)}\int_{-\pi}^{\pi}\frac{1}{(1+y^2)+(1-y^2)\cos(x)}\,dx\tag 3
\end{align}$$
The integral in $(3)$ can be evaluated using the classical Tangent Half-Angle Substitution or contour integration.  Here, we take the latter approach to write
$$\begin{align}
\int_{-\pi}^{\pi}\frac{1}{(1+y^2)+(1-y^2)\cos(x)}\,dx&=\frac2i\oint_{|z|=1}\frac{1}{(1-y^2)z^2+2(1+y^2)z+(1-y^2)}\,dz\\\\
&=\frac{2}{i(1-y^2)}\oint_{|z|=1}\frac{1}{\left(z-\frac{y+1}{y-1}\right)\left(z-\frac{y-1}{y+1}\right)}\,dz\\\\
&=(2\pi i )\left(\frac{2}{i(1-y^2)}\right)\text{Res}\left(\frac{1}{\left(z-\frac{y+1}{y-1}\right)\left(z-\frac{y-1}{y+1}\right)}, z=\frac{y-1}{y+1}\right)\\\\
&=\frac{\pi}{y}
\end{align}$$
Putting it all together we find that 
$$I'(y)=\frac{\pi}{2(1+y)}$$
