Derivative of tangent

Let $y = f(x) = \tan x$.

Since $ \tan x= {{\sin x} \over {\cos x}}$, we use the quotient rule and get

${{dy} \over {dx}} = {{({d \over {dx}}(\sin x))\cos x - \sin x({d \over {dx}}(\cos x))} \over {(\cos x)^2 }}$

$ = {{(\cos x)(\cos x) - (\sin x)( - \sin x)} \over {(\cos x)^2 }}$

$ = {{\cos ^2 x + \sin ^2 x} \over {\cos ^2 x}}$

$ = {1 \over {\cos ^2 x}}$

$ = \sec ^2 x$