Derivative of tan x: Formula, Proof and Examples
The derivative of tan x is sec²x. See the quotient rule proof, the 1 + tan²x form, the chain rule for tan(u) and examples like tan(4x) and tan²x.
Trigonometric derivatives Updated 2 min read
At a glance
- Derivative
- \sec^2 x for x \ne \frac{\pi}{2} + k\pi
- Other forms
- \dfrac{1}{\cos^2 x} = 1 + \tan^2 x
- Chain rule form
- \dfrac{d}{dx}\tan u = \sec^2 u \cdot u'
- Slope at x = 0
- \sec^2 0 = 1
- Integral version
- \int \sec^2 x\,dx = \tan x + C
On this page
The derivative of \tan x is \sec^2 x. You will also see it written \frac{1}{\cos^2 x} or 1 + \tan^2 x. All three are the same function.
Graph of tan x and its derivative
Because \sec^2 x is never below 1, the tangent function is always increasing between asymptotes. It never has a horizontal tangent.
Proof with the quotient rule
Write \tan x = \frac{\sin x}{\cos x} and use the quotient rule:
The Pythagorean identity turns the top into 1:
If instead you split the fraction before simplifying, \frac{\cos^2 x}{\cos^2 x} + \frac{\sin^2 x}{\cos^2 x} = 1 + \tan^2 x. That form is handy when the answer should be written in terms of \tan x alone.
The chain rule version: derivative of tan(u)
| Function | Inside u | Derivative |
|---|---|---|
| \tan(4x) | 4x | 4\sec^2(4x) |
| \tan(x^2) | x^2 | 2x\sec^2(x^2) |
| \tan\sqrt{x} | \sqrt{x} | \frac{\sec^2\sqrt{x}}{2\sqrt{x}} |
| \tan(e^x) | e^x | e^x\sec^2(e^x) |
Worked examples
Example 1: a power of tan. \frac{d}{dx}\tan^2 x = 2\tan x\cdot\sec^2 x. Here tan is the inside and the square is the outside.
Example 2: a product. \frac{d}{dx}(x\tan x) = \tan x + x\sec^2 x, by the product rule.
Example 3: a tangent line. At x = \frac{\pi}{4}, \tan\frac{\pi}{4} = 1 and the slope is \sec^2\frac{\pi}{4} = (\sqrt{2})^2 = 2:
Example 4: second derivative. \frac{d}{dx}\sec^2 x = 2\sec^2 x\tan x, worked out on the derivative of sec²x page. It is negative for x < 0 and positive for x > 0, so \tan x has an inflection point at the origin.
How to remember it
Tangent is the slope of a line from the origin at angle x. As the angle approaches a right angle, that slope shoots up, and so does \sec^2 x. At x = 0 the tangent graph passes through the origin at a 45 degree angle, matching a derivative of 1.
Common mistakes
- Writing \sec x instead of \sec^2 x. The square matters. \frac{d}{dx}\sec x = \sec x\tan x, a different result.
- Writing \sec^2 x\tan x. That is the derivative of \frac{1}{2}\sec^2 x, not of \tan x.
- Applying the formula at an asymptote. \tan x and its derivative do not exist at x = \frac{\pi}{2} + k\pi.
Reading the formula backward gives \int\sec^2 x\,dx = \tan x + C, see the integral of sec²x. For \int\tan x\,dx, see the integral of tan x.
Practice it now
Sine, cosine and tangent
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson