<s>[INST] Find Derivative of $y=\tan^{-1}\left(\sqrt{\frac{x+1}{x-1}}\right)$ for $|x|>1$? 
Question. If $y=\tan^{-1}\left(\sqrt{\frac{x+1}{x-1}}\right)$ for $|x|>1$  then $\frac{d}{dx}=?$

Answer: $\displaystyle\frac{dy}{dx}=-\frac{1}{2|x|\sqrt{x^2-1}}$
My 1st attempt- I followed the simple method and started by taking darivative of  tan inverse and the following with chain rule and i got my answer as ($-\frac{1}{2x\sqrt{x^2-1}}$), which is not same as the above correct answer. 2nd method is that you can substitute $x=\sec\left(\theta\right)$ and while solving in last step we will get $\sec^{-1}\left(\theta\right)$ whose derivative contains $\left|x\right|$, but still i searched and don't know why its derivative has $\left|x\right|$
Here's my attempt stepwise
$\displaystyle\frac{dy}{dx}=\frac{1}{1+\left(\sqrt{\frac{x+1}{x-1}}\right)^2}\cdot\frac{1}{2\sqrt{\frac{x+1}{x-1}}}\cdot\frac{\left(x-1\right)-\left(x+1\right)}{\left(x-1\right)^2}$
$\displaystyle=\frac{\left(x-1\right)}{\left(x-1\right)+\left(x+1\right)}\cdot\frac{1\sqrt{x-1}}{2\sqrt{x+1}}\cdot-\frac{2}{\left(x-1\right)^2}$
$\displaystyle=-\frac{1}{2x}\cdot\frac{\left(x-1\right)\sqrt{x-1}}{\left(x-1\right)^2}\cdot\frac{1}{\sqrt{x+1}}$
$\displaystyle=-\frac{1}{2x\sqrt{x-1}\sqrt{x+1}}$
$\displaystyle=-\frac{1}{2x\sqrt{x^2-1}}$
Can you tell what i am doing wrong in my 1st attempt?
 [/INST] You start right:
\begin{align}
\frac{dy}{dx}
&=\frac{1}{1+\left(\sqrt{\dfrac{x+1}{x-1}}\right)^2}
  \frac{1}{2\sqrt{\dfrac{x+1}{x-1}}}
  \frac{(x-1)-(x+1)}{(x-1)^2}\\
&=\frac{1}{2}\frac{x-1}{(x-1)+(x+1)}
  \sqrt{\dfrac{x-1}{x+1}}
\frac{-2}{(x-1)^2}
\end{align}
but then make a decisive error in splitting the square root in the middle and then use the wrong fact that $t=\sqrt{t^2}$, which only holds for $t\ge0$.
You can go on with
$$
=-\frac{1}{2x}\sqrt{\dfrac{x-1}{x+1}}\frac{1}{x-1}
$$
and now you have to split into the cases $x>1$ and $x<-1$ or observe that $x(x-1)=|x|\,|x-1|$ (when $|x|>1$) so you can write
$$
=-\frac{1}{2|x|}\sqrt{\dfrac{x-1}{x+1}}\frac{1}{|x-1|}
=-\frac{1}{2|x|}\sqrt{\dfrac{x-1}{x+1}\frac{1}{(x-1)^2}}
$$
and finish up.

You might try simplifying the expression, before plunging in the computations.
You have, by definition,
$$
\sqrt{\frac{x+1}{x-1}}=\tan y
$$
so that
$$
x+1=x\tan^2y-\tan^2y
$$
that yields
$$
x=\frac{1+\tan^2y}{\tan^2y-1}=\frac{1}{\cos^2y}\frac{\cos^2y}{-\cos2y}=-\frac{1}{\cos2y}
$$
Hence $\cos2y=-1/x$ and $y=\frac{1}{2}\arccos(-1/x)$. Thus
$$
\frac{dy}{dx}=-\frac{1}{2}\frac{-1}{\sqrt{1-\dfrac{1}{x^2}}}\frac{-1}{x^2}=
=-\frac{1}{2}\frac{-\sqrt{x^2}}{\sqrt{x^2-1}}\frac{-1}{x^2}=
-\frac{1}{2|x|\sqrt{x^2-1}}
$$
because
$$
\frac{\sqrt{x^2}}{x^2}=\frac{|x|}{|x|^2}=\frac{1}{|x|}
$$
</s>