Integral of tan² x: Formula, Derivation and Examples
The integral of tan² x is tan x - x + C. See how the identity tan² x = sec² x - 1 does all the work, plus tan²(ax), tan³ x and definite integral examples.
Trigonometric integrals Updated 2 min read
At a glance
- Antiderivative
- \tan x - x + C
- Identity used
- \tan^2 x = \sec^2 x - 1
- From 0 to π/4
- 1 - \dfrac{\pi}{4} \approx 0.215
- Linear form
- \int\tan^2(ax)\,dx = \dfrac{\tan(ax)}{a} - x + C
- Cotangent partner
- \int\cot^2 x\,dx = -\cot x - x + C
On this page
The integral of \tan^2 x is \tan x - x + C. One identity turns it into two integrals you already know.
Graph of tan² x and its antiderivative
Derivation, step by step
- Start from the Pythagorean identity \sin^2 x + \cos^2 x = 1. Divide by \cos^2 x to get \tan^2 x + 1 = \sec^2 x.
- Rearrange: \tan^2 x = \sec^2 x - 1.
- Substitute: \displaystyle\int\tan^2 x\,dx = \int\sec^2 x\,dx - \int 1\,dx.
- Use the integral of sec² x, \tan x, and the integral of a constant, x.
- Combine: \tan x - x + C.
Check by differentiating
Definite integrals
Since \tan^2 x is even, \int_{-\pi/4}^{\pi/4}\tan^2 x\,dx = 2 - \frac{\pi}{2}.
Substitution variants
Note that only the \tan term gets the factor \frac{1}{a}. The -x comes from integrating the constant 1, which has no inside function.
Example 1. \int\tan^2(3x)\,dx = \frac{1}{3}\tan(3x) - x + C.
Example 2. \int\tan^2\frac{x}{2}\,dx = 2\tan\frac{x}{2} - x + C.
Higher powers of tan
The identity \tan^2 x = \sec^2 x - 1 is the key to every power of \tan x.
Example 3: tan³ x.
The first piece is \frac{\tan^2 x}{2} with u = \tan x. The second is the integral of tan x. So
Example 4: tan² x sec² x. Here u = \tan x works directly: \int\tan^2 x\sec^2 x\,dx = \frac{\tan^3 x}{3} + C. This is the one case where \frac{\tan^3 x}{3} is the right answer, because the \sec^2 x factor is present.
Example 5: tan⁴ x. \tan^4 x = \tan^2 x(\sec^2 x - 1) = \tan^2 x\sec^2 x - \tan^2 x, so
Common mistakes
- Answering \frac{\tan^3 x}{3}. That needs a \sec^2 x factor. Check: its derivative is \tan^2 x\sec^2 x.
- Answering \sec^2 x or \ln^2\lvert\sec x\rvert. Neither differentiates back to \tan^2 x.
- Getting the identity backwards. It is \sec^2 x - 1, not 1 - \sec^2 x. Test at x = \frac{\pi}{4}: \tan^2 = 1 and \sec^2 - 1 = 2 - 1 = 1.
- Dividing -x by a in \int\tan^2(ax)\,dx.
Practise on trig integral problems.
Practice it now
Powers of sine and cosine
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