AP Calculus AB and BC

Integral of tan x sec^2 x: Two Right Answers

The integral of tan x times sec squared x is tan squared x over 2, plus C. Substituting u equals sec x instead gives sec squared x over 2, which looks different but differs only by the constant one half, so both are correct.

tanxsec2xdx=tan2x2+C\int \tan x\sec^{2}x\,dx = \frac{\tan^{2}x}{2} + C

Two substitutions, two answers

Taking u=tanxu = \tan x gives du=sec2xdxdu = \sec^{2}x\,dx and the integral udu\int u\,du.

tanxsec2xdx=tan2x2+C\int \tan x\sec^{2}x\,dx = \frac{\tan^{2}x}{2} + C

Taking u=secxu = \sec x gives du=secxtanxdxdu = \sec x\tan x\,dx and the integral udu\int u\,du again, but in a different variable.

tanxsec2xdx=sec2x2+C\int \tan x\sec^{2}x\,dx = \frac{\sec^{2}x}{2} + C

Why both are right

The Pythagorean identity says sec2x=tan2x+1\sec^{2}x = \tan^{2}x + 1, so the two answers differ by exactly 12\frac{1}{2}, which the constant of integration absorbs.

A useful thing to have seen once

Two antiderivatives of the same function always differ by a constant. That is the Mean Value Theorem corollary underneath every +C, and this integral is the cleanest place it shows up.

Common mistakes

  • Assuming one of the two forms must be wrong because it does not match the key.
  • Forgetting the 12\frac{1}{2} in either version.
  • Reading sec2x\sec^{2}x as sec(x2)\sec\left(x^{2}\right).

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

What is the integral of tan x sec^2 x?

Either tan2x2+C\frac{\tan^{2}x}{2} + C or sec2x2+C\frac{\sec^{2}x}{2} + C. The two differ by a constant, so both are correct.

How can two different answers both be right?

Because sec2x=tan2x+1\sec^{2}x = \tan^{2}x + 1, so the forms differ by 12\frac{1}{2}, which the +C+C absorbs.