AP Calculus AB and BC

Integral of tan^2 x: Answer, Steps, and Domain

The integral of tan^2 x is tan x - x + C. Rewrite tan^2 x as sec^2 x - 1 using the Pythagorean identity, then integrate term by term: the antiderivative of sec^2 x is tan x and the antiderivative of 1 is x. It holds on any interval where tan x is defined.

∫tan⁡2x dx=tan⁡x−x+C\int \tan^2 x\,dx = \tan x - x + C

The rewrite that makes it work

There is no antiderivative rule for a squared tangent, so the first move is always to trade tan⁡2x\tan^2 x for something you already know how to integrate. Divide the Pythagorean identity sin⁡2x+cos⁡2x=1\sin^2 x + \cos^2 x = 1 by cos⁡2x\cos^2 x to get tan⁡2x+1=sec⁡2x\tan^2 x + 1 = \sec^2 x, then solve for tan⁡2x\tan^2 x.

tan⁡2x=sec⁡2x−1\tan^2 x = \sec^2 x - 1

Now the integrand splits into two standard pieces. The antiderivative of sec⁡2x\sec^2 x is tan⁡x\tan x, because ddx[tan⁡x]=sec⁡2x\frac{d}{dx}[\tan x] = \sec^2 x, and the antiderivative of the constant 11 is xx.

∫tan⁡2x dx=∫(sec⁡2x−1)dx=tan⁡x−x+C\int \tan^2 x\,dx = \int \left(\sec^2 x - 1\right)dx = \tan x - x + C

Why no substitution is needed

Students often reach for uu-substitution here, but there is no inner function to peel off. The identity does all the work, which is why ∫tan⁡2x dx\int \tan^2 x\,dx is classified as a trig-identity problem rather than a substitution problem.

Checking the answer by differentiating

Every antiderivative claim is checkable in one line. Differentiate tan⁡x−x\tan x - x and you should land back on the integrand.

ddx[tan⁡x−x]=sec⁡2x−1=tan⁡2x\frac{d}{dx}\left[\tan x - x\right] = \sec^2 x - 1 = \tan^2 x

The last equality is the same Pythagorean identity read backwards, so the check closes cleanly. If your answer differentiates to sec⁡2x\sec^2 x with no −1-1, you dropped the constant term during integration.

Domain, and what that means for definite integrals

Both tan⁡2x\tan^2 x and tan⁡x−x\tan x - x blow up at the odd multiples of π2\frac{\pi}{2}, where cos⁡x=0\cos x = 0. The formula is valid only on an interval that avoids those asymptotes, such as (−π2,π2)\left(-\frac{\pi}{2}, \frac{\pi}{2}\right).

  • A definite integral such as ∫0π/4tan⁡2x dx\int_0^{\pi/4} \tan^2 x\,dx is fine, because the whole interval sits inside one branch. It evaluates to tan⁡π4−π4=1−π4\tan\frac{\pi}{4} - \frac{\pi}{4} = 1 - \frac{\pi}{4}.
  • An integral whose limits straddle π2\frac{\pi}{2} is improper. Applying the Fundamental Theorem across the asymptote produces a number, but it is meaningless, and on the AP exam it is scored as wrong.
  • Since tan⁡2x≥0\tan^2 x \geq 0 everywhere it is defined, any correct definite integral on a single branch must come out nonnegative. A negative answer is a signal that you crossed an asymptote.

State the interval

Free-response rubrics reward writing the antiderivative with its interval of validity. Answering tan⁡x−x+C\tan x - x + C on (−π2,π2)\left(-\frac{\pi}{2}, \frac{\pi}{2}\right) costs one extra clause and shows you know where the result lives.

Related integrals that use the same identity

Once the identity is in hand, several neighboring integrals follow the same pattern of converting a squared trig function into something with a known antiderivative.

∫cot⁡2x dx=∫(csc⁡2x−1)dx=−cot⁡x−x+C\int \cot^2 x\,dx = \int \left(\csc^2 x - 1\right)dx = -\cot x - x + C

For tan⁡2\tan^2 of a linear inside function, the identity still applies and the chain rule contributes a reciprocal factor: ∫tan⁡2(3x) dx=13tan⁡(3x)−x+C\int \tan^2(3x)\,dx = \frac{1}{3}\tan(3x) - x + C.

Higher powers such as ∫tan⁡3x dx\int \tan^3 x\,dx peel off one factor of tan⁡2x\tan^2 x, apply the same identity, and then finish with a substitution. That is BC-style trig integration rather than the single-step AB problem above.

Every answer on this page is machine checked

An automated test differentiates the antiderivative above and confirms it returns the integrand. A wrong sign or a missing factor fails the build, so it cannot reach you.

Frequently asked questions

Why is the answer tan⁡x−x\tan x - x and not tan⁡3x3\frac{\tan^3 x}{3}?

The power rule for antiderivatives applies to powers of the variable, not to powers of a function. Since the derivative of tan⁡x\tan x is sec⁡2x\sec^2 x rather than 11, you cannot raise the exponent and divide. The identity tan⁡2x=sec⁡2x−1\tan^2 x = \sec^2 x - 1 is the legitimate route.

Where does the identity tan⁡2x=sec⁡2x−1\tan^2 x = \sec^2 x - 1 come from?

Start from sin⁡2x+cos⁡2x=1\sin^2 x + \cos^2 x = 1 and divide every term by cos⁡2x\cos^2 x. That gives tan⁡2x+1=sec⁡2x\tan^2 x + 1 = \sec^2 x, and subtracting 11 from both sides isolates tan⁡2x\tan^2 x.

What is ∫0π/4tan⁡2x dx\int_0^{\pi/4} \tan^2 x\,dx?

Evaluate tan⁡x−x\tan x - x at the endpoints: (tan⁡π4−π4)−(0−0)=1−π4\left(\tan\frac{\pi}{4} - \frac{\pi}{4}\right) - (0 - 0) = 1 - \frac{\pi}{4}, about 0.21460.2146. The interval lies inside a single branch of the tangent, so the Fundamental Theorem applies.

Is this integral on the AP Calculus AB exam?

Yes. It belongs to Unit 6, Integration and Accumulation of Change, and it is fair game on both AB and BC. AB questions keep it to the one-step identity rewrite, while BC extends the technique to higher powers of tangent and secant.