Trigonometric derivatives

Derivative of tan(x): Formula, Proof, and Examples

The tangent derivative is easiest to verify by writing tan(x)=sin(x)/cos(x). The same points excluded from tangent remain excluded from its derivative formula.

Direct answer

ddx[tan⁡x]=sec⁡2x\frac{\mathrm{d}}{\mathrm{d}x}\left[\tan x\right] = \sec^{2} x

Requires cos(x) ≠ 0; angles are measured in radians.

Proof with the quotient rule

Rewrite tangent as sin(x)/cos(x), then differentiate the quotient.

The numerator becomes cos²(x)+sin²(x), which equals 1. The denominator is cos²(x).

Thus the derivative is 1/cos²(x)=sec²(x), at points where cos(x) is nonzero.

1
(sin x / cos x)' = (cos²x + sin²x)/cos²x
2
= 1/cos²(x)
3
= sec²(x)

Derivative of tan(2x)

The derivative is 2 sec²(2x). The outer tangent gives sec²(2x), and the inner angle 2x contributes a factor of 2 by the chain rule. At x=0 the slope is 2. The derivative exists where cos(2x) is nonzero.

Derivative of tan(u)

With respect to u, the derivative is sec²(u). If u=u(x) is differentiable and you are differentiating with respect to x, multiply by du/dx. For example, if u=x²+1, the derivative with respect to x is 2x sec²(x²+1), where cos(x²+1) is nonzero.

Derivative of inverse tangent, arctan(x)

The derivative of arctan(x) is 1/(1+x²) for every real x. If y=arctan(x), then tan(y)=x. Implicit differentiation gives sec²(y)·dy/dx=1, and sec²(y)=1+tan²(y)=1+x². In trigonometry, tan⁻¹(x) denotes arctan(x). The reciprocal 1/tan(x) equals cot(x) on the domain of 1/tan(x), where its derivative is −csc²(x).

Worked example with a negative inner derivative

For f(x)=tan(π/4−2x), keep the entire angle inside sec². Its inner derivative is −2, so the tangent slope at x=0 is −4. The formula applies only where cos(π/4−2x) is nonzero.

  1. Differentiate the angle.

    u=π/4−2x,u′=−2u=\pi/4-2x,\quad u'= -2
  2. Multiply secant squared by the inner derivative.

    f′(x)=−2sec⁡2(π/4−2x)f'(x)=-2\sec^2(\pi/4-2x)
  3. Use cos(π/4)=√2/2.

    f′(0)=−2⋅2=−4f'(0)=-2\cdot 2=-4

Worked examples

ddx[tan⁡(3 x)]\frac{\mathrm{d}}{\mathrm{d}x}\left[\tan\left(3\,x\right)\right]
3 sec2 3 x3\,\mathrm{sec}^{2}\,3\,x

Multiply by the inner derivative 3.

ddx[tan⁡(x2)]\frac{\mathrm{d}}{\mathrm{d}x}\left[\tan\left(x^{2}\right)\right]
2 x sec⁡2(x2)2\,x\,\sec^{2}\left(x^{2}\right)

Keep the whole inner input inside sec².

ddx[tan⁡2x]\frac{\mathrm{d}}{\mathrm{d}x}\left[\tan^{2} x\right]
2 tan⁡x sec⁡2x2\,\tan x\,\sec^{2} x

Use the power rule followed by the tangent rule.

Common mistakes

  • • Writing sec(x) instead of sec²(x).
  • • Omitting the restriction cos(x) ≠ 0.
  • • Forgetting the inner derivative in tan(g(x)).

Try the worked examples in the calculator

Each link opens the matching calculator with the expression, variable and required conditions already filled in.

Open the calculator without a preset: Derivatives

References