Why doesn't my derivation of the arcsec derivative formula not work? We would like to find the derivative of $\operatorname{arcsec}(x) = y$. Rearranging this, we get $x = \sec(y)$. Taking the derivative of both sides, we get $1 = \sec(y)\tan(y)y^\prime$. Thus, $$y^\prime = \frac{1}{\sec(y)\tan(y)}.$$ Now, draw a right triangle with an acute angle $y$, hypotenuse $x$, and a side adjacent to angle $y$ with length $1$. By the Pythagorean theorem, the side opposite angle $y$ is equal to $\sqrt{x^2-1}$. Thus, we have $x = \sec(y)$, which we already knew and got from the triangle, and $$\tan(y) = \frac{1}{\sqrt{x^2-1}}$$ from the triangle we drew. We substitute these values in to our derivative expression to get $$y' = \frac{1}{x\sqrt{x^2-1}}.$$
However, $y^\prime$ should equal $$\frac1{|x|\sqrt{x^2-1}}$$ (note the absolute value). Since the difference occurred in the $|x|$ part, that means I must've done something wrong when I said $\sec(y) = x$, but I do not know why this assumption is wrong. Please correct my proof.
 A: The sloppy reasoning occurs with the right triangle you wrote. You must be careful about the range (values) of the arcsec function. $y=\text{arcsec}(x)$ can lie either in $[0,\pi/2)$ or in $(\pi/2,\pi]$. (These correspond, respectively, to $x>0$ and $x<0$.)
$\tan(y)<0$ when $y\in (\pi/2,\pi]$, and so $\tan(y)=-\sqrt{x^2-1}$ in that event. Working with your formula for $y'$, we note that when $x<0$,
$$\sec(y)\tan(y)= x(-\sqrt{x^2-1})= (-x)\sqrt{x^2-1} =|x|\sqrt{x^2-1},$$
and this explains the formula. To be honest, it's a bit sneaky to move the negative to the other term, but it allows us to write a single formula, rather than writing down cases. (There's no problem, of course, when $x>0$.)
A: Ted Shifrin has already explained the problem with your derivation, but if you're looking for a 'safer' way of finding the derivative then consider this: if $\DeclareMathOperator{\arcsec}{arcsec} y = \arcsec x$, then using the identity $\arcsec x = \arccos 1/x$, we see that
\begin{align}
\frac{dy}{dx}=\frac{d}{dx}\left(\arccos 1/x\right) &= -\frac{1}{\sqrt{1-\left(\frac{1}{x}\right)^2}} \cdot -\frac{1}{x^2} \\[4pt]
&= \frac{1}{x^2\sqrt{1-\frac{1}{x^2}}} \, .
\end{align}
