Solution:
Key idea: An odd power of tanx is integrated by splitting off tan2x and using the identity tan2x=sec2x−1. One piece then has the form tanxsec2x, which a substitution handles, and the other piece is the standard integral of tanx. Here log means the natural logarithm.
Step 1 — Split the power using an identity.
We write tan3x as tanx⋅tan2x and replace tan2x by sec2x−1.
I=∫tanxtan2xdx
I=∫tanx(sec2x−1)dx
I=∫tanxsec2xdx−∫tanxdx
Step 2 — Integrate the first part by substitution.
Put t=tanx, so dt=sec2xdx. The first integral turns into the integral of a simple power of t.
∫tanxsec2xdx=∫tdt
∫tdt=2t2
Putting back t=tanx, the first part is 2tan2x.
Step 3 — Use the standard integral of tan x.
The standard result is ∫tanxdx=−log∣cosx∣. The second part carries a minus sign in front of it, so it contributes +log∣cosx∣.
Step 4 — Combine the two parts.
We add the two results and one constant of integration C.
I=2tan2x+log∣cosx∣+C
Watch out: Do not try ∫tan3xdx=4tan4x. The power rule works only when the derivative of tanx, namely sec2x, is also present.
Therefore, ∫tan3xdx=21tan2x+log∣cosx∣+C (or, in another form, 21tan2x−log∣secx∣+C).