Deriving the derivative formula for arcsecant correctly I have been trying to derive the derivative of the arcsecant function, but I can't quite get the right answer (the correct answer is the absolute value of what I get). I first get $\frac{d}{dy}\sec(y)=\frac{\cos^2(y)}{\sin(y)}=\frac{\cos^2(\sec^{-1}(x))}{\sin(\sec^{-1}(x))}$. Then, by examining the appropriate right triangle with angle $\theta$, hypotenuse $x$, adjacent side length $1$ and opposite side length $\sqrt{x^2-1}$, we see that $\sin(\sec^{-1}(x))=\sin(\theta)=\frac{\sqrt{x^2-1}}{x}$ and $\cos(\sec^{-1}(x))=\cos(\theta)=\frac{1}{x}$. Substituting these identities into the formula for the derivative, we get $$\frac{1}{x\sqrt{x^2-1}}$$. However, the actual answer is the absolute value of that.  I can't figure out where I am assuming $x$ is positive. It has been a while since I have mucked about with this kind of thing, so my apologies if this is a silly question. Wikipedia wasn't helpful on the matter.
 A: Carl is correct in his comment, it is based on the fact that a hypotenuse cannot be negative. However, we also see that if $y = \sec^{-1}(x)$, $\sec (y) = x$. We then apply the inverse function rule of derivatives to get
$$\frac{d}{dx}\sec^{-1}(x) = \frac{dy}{dx} = \frac{1}{\frac{dx}{dy}} = \frac{1}{\frac{d}{dy}\sec(y)} = \frac{1}{\sec(y)\tan(y)}$$
We then reference the rule explained on this page, that the product $\sec(x)\tan(x)$ is never negative. To see this, I will quote the page:
"For, if  y = arcsec x,  then the angle y falls either in the first or second quadrants.  When angle y falls in the first quadrant, then both sec y and tan y are positive. Therefore their product is positive.
When angle y falls in the second quadrant, sec y and tan y are both negative, so that again their product is positive.
If y = 0, then tan y= 0, hence the product sec y tan y is 0.
Therefore, that product is never negative."
Let us then further note that $\tan(u) = \sqrt{1-\sec^2(u)}$ from the well known Pythagorean identity for $\tan(u)$. Thus, we can rewrite our fraction as
$$\frac{1}{\sec(y)\sqrt{\sec^2(y)-1}}$$
We then back substitute $\sec(y) = x$ to get
$$\frac{1}{x\sqrt{x^2-1}}$$
We then note that the term inside the square root will always be positive due to the squaring of $x$, but we still need to make sure the $x$ term out front always stays positive, so we rewrite this as
$$\frac{1}{|x|\sqrt{x^2-1}}$$
(Note: the inside of the square root is the opposite sign that you got... that is the only mistake you made)
