What the formula says
(tan x)′ = 1/cos²x = 1 + tan²x
The rule is a theorem, and it holds only when x is in radians, like the rules for sine and cosine it is built from. It is defined everywhere tan x is — every x except π/2 + nπ, where cos x = 0.
Example. f(x) = tan x. Then f′(π/4) = 1/cos²(π/4) = 1/(1/2) = 2. The other form agrees: 1 + tan²(π/4) = 1 + 1 = 2.
Two forms, one function
The formula sheet prints both forms, and a reader who has learned one often thinks the other is a different rule. It is not. Both come out of the quotient rule applied to tan x = sin x / cos x:
(sin x / cos x)′ = (cos x · cos x − sin x · (−sin x)) / cos²x = (cos²x + sin²x) / cos²x
Now there are two ways to finish. Use the Pythagorean identity, cos²x + sin²x = 1, and the top becomes 1: 1/cos²x. Or split the fraction in two: cos²x/cos²x + sin²x/cos²x = 1 + tan²x.
Which one to use depends on what you already have. If the question gives cos x, the first is quicker. If it gives tan x, the second needs no cosine at all.
A second example: something inside
f(x) = tan(3x). The inside comes out as a factor, as it does for sine and cosine: f′(x) = 3/cos²(3x) = 3(1 + tan²(3x)). At x = 0, f′(0) = 3/1 = 3.
The values worth knowing
| x | tan x | 1/cos²x | 1 + tan²x |
|---|---|---|---|
| 0 | 0 | 1 | 1 |
| π/6 | 1/√3 | 4/3 | 4/3 |
| π/4 | 1 | 2 | 2 |
| π/3 | √3 | 4 | 4 |
The slope is 1 at the origin and grows without bound towards π/2, where the curve shoots up towards its asymptote. It is never below 1, which is why tan x rises on every piece of its graph.
Common mistakes
- Working in degrees. The rule needs radians. In degrees every answer is off by the factor π/180.
- A minus sign from the cosine rule. cos x differentiates to −sin x, but the two minus signs in the quotient rule cancel. The derivative of tan x is positive wherever it is defined.
- Mixing it up with the cotangent. (cot x)′ = −1/sin²x. Sine in the denominator and a minus sign belong to cot, not tan.
- cos²x read as cos(x²). cos²x means (cos x)², the square of the cosine.
Common questions
What is sec²x?
sec x is 1/cos x, the secant. Many textbooks write the derivative of tan x as sec²x, which is exactly
1/cos²x. This page writes 1/cos²x or 1 + tan²x.
Why is the derivative never negative?
1/cos²x is one divided by a square, and 1 + tan²x is one plus a square. Neither can be below 1. tan x
therefore rises on every interval where it is defined, from −∞ to +∞ between each pair of asymptotes.
What happens at x = π/2?
Nothing — tan x is not defined there, so neither is its derivative. cos(π/2) = 0, and both forms
divide by zero or square something infinite.

