Integral of tan²x
Updated 6 November 2026 · Checked numerically by the ihateDesmos engine
The integral of tan²x
∫
tan(x)2
dx =tan(x)−x+C
The integral of tan²x is tan x − x + C. The identity tan²x = sec²x − 1 turns it into two easy integrals.
y=tan(x)2
in blue and its integral y=tan(x)−x
(with C = 0) in red. Defined for x ≠ π/2 + nπ.How to integrate tan²x
Method: pythagorean identity.
- 1Use the identity: tan²x = sec²x − 1.
- 2Split it: ∫sec²x dx − ∫1 dx.
- 3The first is tan x, and the second is x.
- 4So the result is tan x − x + C.
What it means
tan²x is close to x² near the origin, so the integral starts out looking like x³/3, and it blows up at the asymptotes of tan x.
The integral from 0 to π/4
Using the antiderivative: F(π/4) − F(0) = 1 − π/4, which is about 0.214602. A direct numerical integration of tan²x gives 0.214602, which agrees.
Check by differentiating
The derivative of the answer should give back the original function. The last column measures that slope directly from the answer, and it matches.
| x | tan²x | Slope of the answer |
|---|---|---|
| −1 | 2.42552 | 2.42552 |
| −π/4 | 1 | 1 |
| 0 | 0 | 0 |
| π/4 | 1 | 1 |
| 1 | 2.42552 | 2.42552 |
Common mistakes
- Using the power rule to get tan³x/3.
Frequently asked questions
What is the integral of tan²x?
The integral of tan²x is tan x − x + C, for x ≠ π/2 + nπ.
What is the integral of tan²x from 0 to π/4?
1 − π/4, which is about 0.214602.
Keep going
Integrate any function
Type your own function into the integral calculator for the steps, the answer and a graph.