Range of inverse trigonometric function Find the range of $y$.
$$y=\tan^{-1}\left(\frac{2x}{1+x^2}\right)$$
I used the following approach:
Let $$x=\tan\theta$$
$$\therefore \theta=\tan^{-1}x$$
Since the principal solution of $\tan^{-1}$ function is from $\left(\frac{-\pi}{2},\frac{\pi}{2}\right)$, so 
$$\theta \in \left(\frac{-\pi}{2},\frac{\pi}{2}\right)$$
On solving, we get $$y=\tan^{-1}(\tan(2\theta))=2\theta$$
$$\therefore y \in (-\pi,\pi)$$
Where am I going wrong? Because Wolfram says something else.
 A: You have to be careful: the range of $f(g(x))$ over $\mathbb{R}$ is the range of $f$ over the range of $g$. Since $g:\mathbb{R}\to\mathbb{R}$ defined by $g(x)=\frac{2x}{1+x^2}$ is surjective on $I=[-1,1]$, the range of $f(x)$ is given by $f(I)$, i.e. $\left[-\frac{\pi}{4},\frac{\pi}{4}\right]$.
A: Solve for $x$ first:
$$y=\tan^{-1}\left(\frac{2x}{1+x^2}\right)$$
$$\tan y = \frac{2x}{1+x^2}\quad \text{(note that $1+ x^2 \geq 1\quad \forall x$)}$$
$$(1 + x^2) \tan y = 2x \iff (\tan y)\, x^2 - 2x + \tan y = 0$$
This is a quadratic in $x$, so you can use the quadratic formula to solve for $x_1, x_2$.
$$x_1, x_2 = \frac{2 \pm \sqrt{4 - 4\tan^2 y}}{2} = 1\pm \sqrt{1-\tan^2y}$$  
Interchange $x_i$ and $y_i$ for each valid solution, and find the domain of the resulting inverse function(s) $y_i$.
A: Now sure as $\tan2\theta$ as   $\tan2\theta=\dfrac{2\tan\theta}{1-\tan^2\theta}$
Let $\dfrac{2x}{1+x^2}=u\iff ux^2-2x+u=0$
As $x$ is real, the discriminant $(-2)^2-4\cdot u\cdot u\ge0$
$$\iff u^2\le1\iff-1\le u\le1$$
$$\implies-\frac\pi4\le\arctan u\le\frac\pi4$$
A: $\frac{2x}{1+x^2}$ has a maximum at $x=1$ and a minimum at $x=-1$.  $\arctan x$ is continuous and increasing so the range of $\arctan \frac{2x}{1+x^2}$ will be $(-\pi/4 , \pi/4)$.
