Finding $\int_{0}^{\pi/2} \frac{\tan x}{1+m^2\tan^2{x}} \mathrm{d}x$ How do we prove that $$I(m)=\int_{0}^{\pi/2} \frac{\tan x}{1+m^2\tan^2{x}} \mathrm{d}x=\frac{\log{m}}{m^2-1}$$
I see that $$I(m)=\frac{\partial}{\partial m} \int_{0}^{\pi/2} \arctan({m\tan x}) \ \mathrm{d}x$$
But I don't see how to use this fact. Can we? Please help me out, and if possible please post a solution using differentiation under the integral sign.
 A: Using my hint from the comment above ($x=\arctan(y)$) and assuming that $m$ is real and finite gives us 
\begin{align}
I(m)=\int_0^{b}\frac{dy}{1+y^2}\frac{y}{1+y^2m^2}\
\end{align}
Where $b=\lim_{y\to\pi/2}\tan(y)$ this limit has to be taken with some care because it diverges. Calculating the above Integral by standard methods (partial fractions works)gives us
\begin{align}
I(m)=\frac{1}{2}\dfrac{\log\left(\dfrac{1}{1+b^2}+\dfrac{m^2 b^2}{1+b^2}\right)}{m^2-1}
\end{align}
Choosing the correct branch of $\tan(y)$ (so that our range of integration is continous) we get $b=+\infty$. This leads to 
\begin{align}
I(m)=\frac{1}{2}\frac{\log(m^2)}{m^2-1}=\frac{\log(m)}{m^2-1}
\end{align}
Maybe one should add that $\lim_{m\to 1}I(m)=1/2$ and therefore is well defined.This can be seen by for example by Taylor expansion of $\log$ around $1$.
A: $\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
$\ds{{\rm I}\pars{m}\equiv\int_{0}^{\pi/2}
     {\tan\pars{x} \over 1 + m^{2}\tan^{2}\pars{x}}\,\dd x
     = {\ln\pars{\verts{m}} \over m^{2} - 1}:\ {\large ?}}$.

\begin{align}
{\rm I}\pars{m}&
=\color{#66f}{\large\int_{0}^{\pi/2}{\sin\pars{x}\cos\pars{x}\over
\cos^{2}\pars{x} + m^{2}\sin^{2}\pars{x}}\,\dd x}
\\[5mm]&=\half\int_{0}^{\pi/2}{\sin\pars{2x}\over
\bracks{1 + \cos\pars{2x}}/2 + m^{2}\bracks{1 - \cos\pars{2x}}/2}\,\dd x
\\[5mm]&=\int_{0}^{\pi/2}{\sin\pars{2x}\over
1 + m^{2} + \pars{1 - m^{2}}\cos\pars{2x}}\,\dd x
\\[5mm]&=\left.{\ln\pars{1 + m^{2} + \bracks{1 - m^{2}}\cos\pars{2x}}\over
-2\pars{1 - m^{2}}}
\right\vert_{\, x\ =\ 0}^{\, x\ =\ \pi/2}
\\[5mm]&={\ln\pars{2m^{2}} - \ln\pars{2}\over 2\pars{m^{2} - 1}}
=\color{#66f}{\large{\ln\pars{\verts{m}} \over m^{2} - 1}}
\end{align}

A: $\def\artanh{{\rm{artanh}}\;}$Denote the evaluated integral as $I$ and rewrite it as follows
\begin{align}
I&=\frac{1}{2}\int_0^{\Large\frac{\pi}{2}}\frac{\sin2x}{\cos^2x+m^2\sin^2x}\,dx\\
&=\int_0^{\Large\frac{\pi}{2}}\frac{\sin2x}{m^2+1-(m^2-1)\cos2x}\,dx\\
&=\frac{1}{2}\int_0^{\large\pi}\frac{\sin x}{m^2+1-(m^2-1)\cos x}\,dx\\
\end{align}
where we use trigonometric identity $\sin^2\theta=\dfrac{1-\cos2\theta}{2}$ and $\cos^2\theta=\dfrac{1+\cos2\theta}{2}$ and map $2x\mapsto x$. Now, using identity (proof can be seen here)
\begin{equation}
1+2\sum_{n=1}^\infty \left(\frac{b}{a}\right)^n\cos(n x)=\frac{a^2-b^2}{a^2+b^2-2ab\cos x}\qquad,\qquad\mbox{for}\, |b|<a
\end{equation}
and the correspondence values $a=\dfrac{m+1}{\sqrt{2}}$ and $b=\dfrac{m-1}{\sqrt{2}}$, one may find
\begin{align}
I&=\frac{1}{4m}\int_0^{\large\pi}\left[\sin x+2\sum_{n=1}^\infty \left(\frac{m-1}{m+1}\right)^n\cos(nx)\sin x\right]\,dx\\
&=\frac{1}{2m}+\frac{1}{2m}\sum_{n=2}^\infty \left(\frac{m-1}{m+1}\right)^n\int_0^{\large\pi}\cos(nx)\sin x\,dx\\
&=\frac{1}{2m}-\frac{1}{2m}\sum_{n=2}^\infty \left(\frac{m-1}{m+1}\right)^n\frac{\cos(n\pi)+1}{n^2-1}\\
&=\frac{1}{2m}-\frac{1}{m}\sum_{n=1}^\infty \left(\frac{m-1}{m+1}\right)^{2n}\frac{1}{4n^2-1}\\
&=\frac{1}{2m}-\frac{1}{2m}\left[1+\left(\frac{m-1}{m+1}\right)\artanh\left(\frac{m-1}{m+1}\right)-\left(\frac{m+1}{m-1}\right)\artanh\left(\frac{m-1}{m+1}\right)\right]\\
&=\frac{2}{m^2-1}\artanh\left(\frac{m-1}{m+1}\right)\\
&=\frac{\ln m}{m^2-1}\qquad\qquad\square
\end{align}
For the last step evaluation, we use Taylor series for $\artanh$function
\begin{equation}
\artanh x=\sum_{n=0}\frac{x^{2n+1}}{2n+1}\qquad,\qquad\mbox{for}\,\, |x|<1
\end{equation}
and identity
\begin{equation}
\artanh x=\frac{1}{2}\ln\left(\frac{1+x}{1-x}\right)\qquad,\qquad\mbox{for}\,\, |x|<1
\end{equation}
A: Assume $m\gt0$ (since the integral is even in $m$) and substitute $t=\tan(x)$ and $u=t^2$:
$$
\begin{align}
\int_0^{\pi/2}\frac{\tan(x)}{1+m^2\tan^2(x)}\mathrm{d}x
&=\int_0^\infty\frac{t}{1+m^2t^2}\frac{\mathrm{d}t}{1+t^2}\\
&=\frac12\int_0^\infty\frac{\mathrm{d}u}{(1+m^2u)(1+u)}\\
&=\frac1{2(m^2-1)}\lim_{L\to\infty}\int_0^L\left(\frac{m^2}{1+m^2u}-\frac1{1+u}\right)\mathrm{d}u\\
&=\frac1{2(m^2-1)}\lim_{L\to\infty}\left[\int_0^{m^2L}\frac{\mathrm{d}u}{1+u}-\int_0^L\frac{\mathrm{d}u}{1+u}\right]\\
&=\frac1{2(m^2-1)}\lim_{L\to\infty}\int_L^{m^2L}\frac{\mathrm{d}u}{1+u}\\
&=\frac1{2(m^2-1)}\lim_{L\to\infty}\log\left(\frac{1+m^2L}{1+L}\right)\\
&=\frac{\log(m)}{m^2-1}
\end{align}
$$
