<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] $$\dfrac{d\arctan\sqrt{\dfrac{x+1}{x-1}}}{dx}=\dfrac1{1+\dfrac{x+1}{x-1}}\cdot\dfrac{d\sqrt{\dfrac{x+1}{x-1}}}{dx}$$
For $x-1\ne0,$
$\sqrt{\dfrac{x+1}{x-1}}=\sqrt{\dfrac{\sqrt{x^2-1}}{(x-1)^2}}=\dfrac{\sqrt{x^2-1}}{|x-1|}$
$F=\dfrac{d\sqrt{\dfrac{x+1}{x-1}}}{dx}=\dfrac{d\dfrac{\sqrt{x^2-1}}{|x-1|}}{dx}$
If $x-1>0,F=\dfrac x{(x-1)\sqrt{x^2-1}}-\dfrac{\sqrt{x^2-1}}{(x-1)^2}=\dfrac{x(x-1)-(x^2-1)}{(x-1)\sqrt{x^2-1}}=\dfrac1{\sqrt{x^2-1}}$
What if $x-1<0?$
</s>