Deriving the derivative of $\tan^{2}x$ by quotient rule using (sinx/cosx) identity I am getting a different value (2secx(tanx+tan^2(x))

Deriving the derivative of $$\tan^{2}x$$ by quotient rule using $$\frac{\sin x}{\cos x}$$ identity, i am getting a different value $$2\sec x[\tan x+\tan^{2}x]$$ than by directly getting chain rule is $$2\sec^{2}x\tan x$$

Whats wrong?

Here is a correct derivation of the derivative of $$\tan^2 x$$ using the quotient rule:
$$\dfrac d {dx} \tan^2 x = \dfrac d {dx} \dfrac {\sin^2 x}{\cos^2x }=\dfrac{2\sin x \cos x \cos^2x + \sin^2 x 2 \cos x \sin x}{\cos^4x}$$
$$=2\dfrac{\sin x(\cos^2x+\sin^2x)}{\cos^3x}=2\dfrac{\sin x}{\cos^3 x}=2\tan x \sec^2x$$
• Yes, the chain rule yields $2 \tan x \sec^2x$ too – J. W. Tanner Oct 11 '19 at 6:58
• $\cos^2 x+\sin^2 x = 1$ is the Pythagorean identity – J. W. Tanner Oct 11 '19 at 7:08