Derivating with respect the parameter calcule $\int_0^{\frac{\pi}{2}}\frac{\arctan(a\tan x)}{\tan x}dx$ Derivating with respect the parameter calcule $$\int_0^{\frac{\pi}{2}}\frac{\arctan(a\tan x)}{\tan x}dx$$
 A: Let $f(a)$ be given by the integral
$$f(a)=\int_0^{\pi/2}\frac{\arctan(a\tan(x))}{\tan(x)}\,dx$$
Then, differentiating reveals
$$f'(a)=\int_0^{\pi/2}\frac{1}{1+a^2\tan^2(x)}\,dx=\frac{\pi/2 }{a+1}$$
Integrating and using $f(0)=0$ yields
$$f(a)=\frac\pi2\log(a+1)$$
Therefore, we find that 
$$\int_0^{\pi/2}\frac{x}{\tan(x)}\,dx=\frac\pi 2 \log(2)$$
A: To complement the post by @MarkViola, let us show
\begin{align}
\int^{\pi/2}_0 \frac{dx}{1+a^2\tan^2x}= \frac{\pi}{2(a+1)}
\end{align}
assuming $a>0$. 
Observe
\begin{align}
\int^{\pi/2}_0 \frac{dx}{1+a^2\tan^2x} = \int^{\pi/2}_0 \frac{\sec^2 x- \tan^2x}{1+a^2\tan^2x}\ dx
\end{align}
which means
\begin{align}
\int^{\pi/2}_0 \frac{dx}{1+a^2\tan^2x}+ \frac{1}{a^2}\int^{\pi/2}_0 \frac{a^2\tan^2 x}{1+a^2\tan^2x}\ dx = \int^{\pi/2}_0 \frac{\sec^2 x}{1+a^2\tan^2x}\ dx.
\end{align}
Next, notice the left hand side of the above identity is equal to
\begin{align}
\int^{\pi/2}_0 \frac{dx}{1+a^2\tan^2x}+ \frac{1}{a^2}\int^{\pi/2}_0 1- \frac{1}{1+a^2\tan^2 x}\ dx = \left(1-\frac{1}{a^2} \right)\int^{\pi/2}_0 \frac{dx}{1+a^2\tan^2 x}+ \frac{\pi}{2a^2}.
\end{align}
and the right hand side by $u$-sub equals
\begin{align}
\int^{\pi/2}_0 \frac{\sec^2 x}{1+a^2\tan^2 x}\ dx = \frac{\pi}{2a}.
\end{align}
Hence it follows
\begin{align}
\left(1-\frac{1}{a^2} \right)\int^{\pi/2}_0 \frac{dx}{1+a^2\tan^2 x} = \frac{\pi(a-1)}{2 a^2} \ \ \ \implies \ \ \ \int^{\pi/2}_0 \frac{dx}{1+a^2\tan^2 x} = \frac{\pi}{2(a+1)}.
\end{align}
Remark: If we drop the condition $a>0$, then we see that
\begin{align}
\int^{\pi/2}_0 \frac{\sec^2 x}{1+a^2\tan^2 x}\ dx = \frac{\pi}{2|a|}
\end{align}
which leads to the conclusion
\begin{align}
\int^{\pi/2}_0 \frac{dx}{1+a^2\tan^2 x} = \frac{\pi}{2(|a|+1)}.
\end{align}
