Why I am getting wrong answer to this definite integral? $$\int_0^{\sqrt3} \sin^{-1}\frac{2x}{1+x^2}dx $$
Obviously the substitution must be $x=tany$
$$2\int_0^{\frac{\pi}{3}}y\sec^2y \ dy $$
Taking $u=y $, $du=dy;dv=sec^2y \ dy, v=\tan y $
$$2\Big(y\tan y+\ln(\cos y)\Big)^{\frac{\pi}{3}}_{0} $$ 
Hence $$2\frac{\pi}{\sqrt 3}+2\ln\frac{1}{2} $$
But the answer given is $\frac{\pi}{\sqrt 3}$.
 A: If we substitute $x=\tan y$, we get:
$$ I = \int_{0}^{\pi/3}\frac{\arcsin(\sin(2y))}{\cos^2 y}\,dy = \int_{0}^{\pi/4}\frac{2t}{\cos^2 t}\,dt+\int_{\pi/4}^{\pi/3}\frac{\pi-2t}{\cos^2 t}\,dt $$
hence:
$$ I = \left(\frac{\pi}{2}-\log 2\right)+\left(\log 2+\frac{\pi}{\sqrt{3}}-\frac{\pi}{2}\right)=\color{red}{\frac{\pi}{\sqrt{3}}} $$
as wanted.
A: $$I=\int_{0}^{\sqrt{3}} \sin^{-1} \frac{2x}{1+x^2} dx$$
Notice that $$\frac{d}{dx} \sin^{1} \frac{2x}{1+x^2}= \frac{2}{1+x^2}~~ \frac{|1-x^2|}{(1-x^2)}= \frac{2}{1+x^2}, ~if~~ x^2<1,~~\frac{-2}{1+x^2}~if~ x^2>1.$$ 
So let us integrate by parts taking 1 as the second function. Then
$$I=\left ( x \sin^{-1} \frac{2x}{1+x^2}\right)
-\left(\int_{0}^{1} x\frac{d}{dx} \sin^{-1} \frac{2x}{1+x^2} dx+\int_{1}^{\sqrt{3}} x\frac{d}{dx} \sin^{-1} \frac{2x}{1+x^2} dx\right)$$
$$I=\left ( x \sin^{-1} \frac{2x}{1+x^2}\right)
-\left(\int_{0}^{1} \frac{2x}{1+x^2} dx+\int_{1}^{\sqrt{3}} \frac{-2x}{1+x^2} dx\right).$$
$$I=\left ( x \sin^{-1} \frac{2x}{1+x^2}\right)_{(0,\sqrt{3})}-(\ln 2-\ln 4 +\ln 2)=\frac{\pi}{\sqrt{3}}.$$
