Skip to content
ihateDesmos

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.

−1.0−0.50.51.0−550
Open in calculator
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.

  1. 1
    Use the identity: tan²x = sec²x − 1.
  2. 2
    Split it: ∫sec²x dx − ∫1 dx.
  3. 3
    The first is tan x, and the second is x.
  4. 4
    So 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.

−1−0.50.51−6−4−22468

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.

Checking the integral
xtan²xSlope of the answer
−12.425522.42552
−π/411
000
π/411
12.425522.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.

Open the integral calculator