[Math] Derivative of tan(x) with product and chain rules instead of quotient rule

calculustrigonometry

So I usually just use the product and chain rules for quotient functions, because I can never remember which product to substract from which in the numerator. But somehow I'm doing it wrong for $\tan(x)$. Say $a$ and $b$ are functions of $x$, and $f$ is the quotient of those functions. I take $a$ and multiply it with the derivative of $b^{-1}$ and add the derivative of $a$ multiplied with $b^{-1}$. I am doing something wrong here but can't see what exactly yet.
\begin{gather}
f=ab^{-1},\quad f'=a'b^{-1}-b^{-2}ab'\\[2ex]
f(x)=\tan(x)=\frac{\sin(x)}{\cos(x)}=\sin(x)\cos^{-1}(x)\\[2ex]
f'(x)=\cos(x)\cos^{-1}(x)+\sin^2(x)\cos^{-2}(x)
\end{gather}
This is completely wrong, as I should get $f'(x)=\frac{1}{\cos^2(x)}$ instead of $f'(x)=1+\tan^2(x)$. I know I'm applying this wrong, but I'm not sure where. Thanks.

Best Answer

$$\frac{1}{\cos^2x}=\frac{\cos^2x+\sin^2x}{\cos^2x}=1+\tan^2 x.$$