Home›Study Resources›Maths›
What is the derivative of tan x?
Maths
A-Level

What is the derivative of tan x?

The derivative of tan x is sec² x. You can prove this by writing tan x as sin x ÷ cos x and using the quotient rule: (cos x × cos x − sin x × (−sin x)) ÷ cos² x = 1 ÷ cos² x = sec² x. Cambridge International 9709 (2026-27 syllabus) lists tan x in the derivatives you must use in Pure Mathematics 2 and 3. Example: Differentiate y = tan 3x. Use the chain rule: dy/dx = 3 × sec² 3x Answer: dy/dx = 3 sec² 3x

Quick answer: The derivative of tan x is sec2 x. Write tan x = sin x ÷ cos x and use the quotient rule to prove it. With the chain rule, the derivative of tan(ax) is a sec2(ax).

What the specification expects

This page follows the Cambridge International AS & A Level Mathematics 9709 syllabus for 2026 and 2027. Topic 2.4 (Pure Mathematics 2) and topic 3.4 (Pure Mathematics 3) both say candidates should be able to:

  • use the derivatives of ex, ln x, sin x, cos x, tan x, together with constant multiples, sums, differences and composites
  • differentiate products and quotients
  • find and use the first derivative of a function defined parametrically or implicitly, including problems involving tangents and normals

The list of formulae (MF19) gives f(x) = tan x, f′(x) = sec2 x.

Method

  1. Recall d/dx(tan x) = sec2 x, where sec x = 1 ÷ cos x.
  2. For tan(ax + b), multiply by the derivative of the inside: a sec2(ax + b).
  3. Use the product or quotient rule when tan x is multiplied or divided by another function.
  4. Work in radians.

Worked example 1: proving the result

Show that d/dx(tan x) = sec2 x.

  1. tan x = sin x ÷ cos x, so u = sin x and v = cos x.
  2. du/dx = cos x and dv/dx = −sin x.
  3. Quotient rule: (cos x × cos x − sin x × (−sin x)) ÷ cos2 x = (cos2 x + sin2 x) ÷ cos2 x.
  4. cos2 x + sin2 x = 1, so the result is 1 ÷ cos2 x.

Answer: d/dx(tan x) = sec2 x

Worked example 2: chain rule

Differentiate y = tan 3x.

  1. The inside function is 3x, with derivative 3.
  2. dy/dx = 3 × sec2 3x.

Answer: dy/dx = 3 sec2 3x

Worked example 3: product rule

Differentiate y = x tan x.

  1. u = x, v = tan x, so du/dx = 1 and dv/dx = sec2 x.
  2. dy/dx = v du/dx + u dv/dx = tan x + x sec2 x.

Answer: dy/dx = tan x + x sec2 x

Worked example 4: equation of a tangent

Find the equation of the tangent to y = tan x at x = π/4.

  1. At x = π/4, y = tan(π/4) = 1.
  2. Gradient = sec2(π/4) = 1 ÷ cos2(π/4) = 1 ÷ ½ = 2.
  3. y − 1 = 2(x − π/4).

Answer: y = 2x + 1 − π/2

Common mistakes

  • Writing the derivative as sec x or −sec2 x.
  • Forgetting the chain rule factor, for example writing sec2 3x for tan 3x.
  • Using degrees. The result only holds with x in radians.
  • Squaring incorrectly: sec2(π/4) is 2, not √2.

FAQs

Is sec2 x the same as 1 + tan2 x?

Yes. The identity sec2 x ≡ 1 + tan2 x is in the 9709 syllabus, so you can write the derivative either way.

What is the integral of sec2 x?

Reversing the result, ∫ sec2 x dx = tan x + c. Topic 3.5 includes integrating sec2(ax + b).

Want one-to-one help? Find an online Maths tutor with ExpertTutor.

Reviewed by

Want one-to-one support?

One-to-one online tuition can help you build confidence in your subject. Find a tutor who teaches your course.

Find a Tutor

Learn face to face in Glasgow

Prefer in-person lessons? Visit the ExpertTutor Glasgow Southside centre.

See the centre