Integrating $\tan^2 x$ and $\sec^2 x$
You already know $\dfrac{d}{dx}\tan x = \sec^2 x$, so $\displaystyle\int \sec^2 x\,dx = \tan x + C$ is instant. But what about $\tan^2 x$? There's no direct antiderivative rule — the trick is a single Pythagorean identity that converts $\tan^2 x$ into $\sec^2 x - 1$, both of which integrate cleanly. Nail this conversion and you unlock a whole family of harder integrals too.
You know that $\dfrac{d}{dx}\tan x = \sec^2 x$. What does that immediately tell you about $\displaystyle\int \sec^2 x\,dx$? And can you think of any reason why $\displaystyle\int \tan^2 x\,dx$ might need a different approach? Write your instinct before reading on.
The entire lesson rests on a single Pythagorean identity for tangent and secant:
Dividing $\sin^2 x + \cos^2 x = 1$ through by $\cos^2 x$ gives:
Rearranged: $\tan^2 x = \sec^2 x - 1$. This allows us to replace $\tan^2 x$ in any integral with $\sec^2 x - 1$, both of which integrate cleanly.
Key facts
- $\tan^2 x = \sec^2 x - 1$ (Pythagorean identity for tan/sec)
- $\int \sec^2 x\,dx = \tan x + C$
- $\int \tan^2 x\,dx = \tan x - x + C$
Concepts
- Why $\tan^2 x$ has no "direct" antiderivative without an identity
- How the Pythagorean identity $\tan^2 x + 1 = \sec^2 x$ is derived from $\sin^2 x + \cos^2 x = 1$
- How to extend the $\sec^2$ integral using the chain rule
Skills
- Evaluate $\int \tan^2 x\,dx$, $\int \tan^2(2x)\,dx$, and related definite integrals
- Integrate expressions involving linear combinations of $\sec^2 x$ and $\tan^2 x$
- Recognise when to apply the $\tan^2 = \sec^2 - 1$ substitution in mixed integrals
Because $\dfrac{d}{dx}\tan x = \sec^2 x$, we can reverse the process immediately:
For the chain-rule version with a linear argument, divide by the coefficient of $x$:
Example: $\displaystyle\int \sec^2(3x)\,dx = \dfrac{\tan 3x}{3} + C$.
Check: $\dfrac{d}{dx}\!\left(\dfrac{\tan 3x}{3}\right) = \dfrac{1}{3} \cdot \sec^2(3x) \cdot 3 = \sec^2(3x)$ ✓
$\int\sec^2 x\,dx=\tan x+C$; chain rule: $\int\sec^2(ax+b)\,dx=\frac{1}{a}\tan(ax+b)+C$; $\int\tan^2 x\,dx=\tan x-x+C$ (use $\tan^2=\sec^2-1$).
Pause — copy $\int\sec^2 x\,dx=\tan x+C$ and the chain-rule extension $\int\sec^2(ax+b)\,dx=\frac{1}{a}\tan(ax+b)+C$ into your book.
Quick check: Which of the following is the correct antiderivative of $\sec^2(2x)$?
We just saw that $\int\sec^2 x\,dx=\tan x+C$ and chain-rule extensions give $\int\sec^2(ax+b)\,dx=\frac{1}{a}\tan(ax+b)+C$. That raises a question: there is no direct formula for $\int\tan^2 x\,dx$ — which Pythagorean identity converts $\tan^2 x$ into an integrable form? This card answers it → use $\tan^2 x=\sec^2 x-1$, so $\int\tan^2 x\,dx=\tan x-x+C$.
There is no direct rule for $\int \tan^2 x\,dx$. The key is to use the Pythagorean identity to rewrite $\tan^2 x$:
Now both terms integrate directly:
Check: $\dfrac{d}{dx}(\tan x - x) = \sec^2 x - 1 = \tan^2 x$ ✓
For $\tan^2(ax+b)$, apply the same identity, then use the chain rule:
There is no direct rule for $\int \tan^2 x\,dx$. The key is to use the Pythagorean identity to rewrite $\tan^2 x$:
Pause — copy the $\tan^2 x$ integral: use identity $\tan^2 x=\sec^2 x-1$ to get $\int\tan^2 x\,dx=\tan x-x+C$ into your book.
Did you get this? True or false: $\displaystyle\int \tan^2 x\,dx = \tan x - x + C$.
Worked examples · 3 in a row, reveal as you go
Evaluate $\displaystyle\int_0^{\pi/4} \tan^2 x\,dx$ exactly.
Find $\displaystyle\int \tan^2(3x)\,dx$.
Find $\displaystyle\int (1 + \tan^2 x)\,dx$. Comment on the result.
Fill the gap: $\displaystyle\int \tan^2(2x)\,dx = \dfrac{\tan(2x)}{2} - $ $+ C$.
Misconceptions to fix · the 3 traps that cost marks
Did you get this? True or false: $\displaystyle\int_0^{\pi/4} \sec^2 x\,dx = 1$.
Activities · practice with the ideas
Find $\displaystyle\int \sec^2(4x)\,dx$.
Find $\displaystyle\int \tan^2(2x)\,dx$.
Evaluate $\displaystyle\int_0^{\pi/3} \tan^2 x\,dx$ exactly. (Use $\tan\tfrac{\pi}{3}=\sqrt{3}$.)
Show that $\displaystyle\int 3\sec^2 x - 2\tan^2 x\,dx = \sec^2 x\,dx$ in disguise. (Hint: replace $\tan^2 x$ and simplify before integrating.)
Verify by differentiation that $\int \tan^2 x\,dx = \tan x - x + C$.
Odd one out: Three of these results are correct. Which one is NOT correct?
At the start you guessed whether integrating $\tan^2 x$ involves $\sec^2 x$. The answer is yes — the identity $\tan^2 x = \sec^2 x - 1$ is the only tool you need. Once you apply it, everything reduces to two standard integrals: $\int \sec^2 x\,dx = \tan x$ and $\int 1\,dx = x$.
The lesson is that many "impossible" integrals become easy the moment you apply the right identity. In future, whenever you see $\tan^2$, your first thought should be: replace with $\sec^2 - 1$.
Pick your answer, then rate your confidence — that tells the system what to drill next. Each retry pulls a fresh mix from the bank.
Q1. Find $\displaystyle\int \tan^2 x\,dx$, showing the identity you use. (2 marks)
Q2. Evaluate $\displaystyle\int_0^{\pi/4} \tan^2 x\,dx$ exactly. (3 marks)
Q3. Find $\displaystyle\int (2\tan^2 x + 3\sec^2 x)\,dx$. Show all simplification steps. (3 marks)
Comprehensive answers (click to reveal)
Activity answers: 1. $\tfrac{\tan(4x)}{4}+C$ · 2. $\tfrac{\tan(2x)}{2}-x+C$ · 3. $\sqrt{3}-\tfrac{\pi}{3}$ · 4. $3\sec^2 x-2(\sec^2 x-1)=\sec^2 x+2$, so $\int(\sec^2 x+2)\,dx=\tan x+2x+C$ · 5. $\tfrac{d}{dx}(\tan x-x)=\sec^2 x-1=\tan^2 x$ ✓
Q1 (2 marks): $\tan^2 x = \sec^2 x-1$ [1]. $\int(\sec^2 x-1)\,dx=\tan x-x+C$ [1].
Q2 (3 marks): Identity: $\tan^2 x = \sec^2 x-1$ [1]. $\int_0^{\pi/4}(\sec^2 x-1)\,dx=\left[\tan x-x\right]_0^{\pi/4}$ [1]. $=(1-\tfrac{\pi}{4})-(0-0)=1-\dfrac{\pi}{4}$ [1].
Q3 (3 marks): $2\tan^2 x+3\sec^2 x = 2(\sec^2 x-1)+3\sec^2 x = 5\sec^2 x-2$ [1]. $\int(5\sec^2 x-2)\,dx$ [1]. $= 5\tan x-2x+C$ [1].
Five timed questions on integrating $\tan^2 x$, $\sec^2 x$, and related expressions. Beat the boss to bank a tier — gold (90% + speed), silver (75%), or bronze (50%). Replays welcome.
⚔ Enter the arenaClimb platforms by answering trig integration questions. Lighter alternative to the boss.
Mark lesson as complete
Tick when you've finished the practice and review.