AP Calculus AB and BC

Integral of sec x: Proof, Formula, and Mistakes

The integral of sec x is ln|sec x + tan x| + C. The proof multiplies sec x by (sec x + tan x)/(sec x + tan x), so the numerator becomes exactly the derivative of the denominator, and the substitution u = sec x + tan x turns the problem into the integral of du/u.

secxdx=lnsecx+tanx+C\int \sec x\,dx = \ln\left|\sec x + \tan x\right| + C

How to integrate sec x

There is no rule in Unit 6 that hands you secxdx\int \sec x\,dx directly. The standard route is a multiplication by 1, chosen so that a substitution appears. Multiply the integrand by secx+tanxsecx+tanx\frac{\sec x + \tan x}{\sec x + \tan x}.

secxdx=secxsecx+tanxsecx+tanxdx=sec2x+secxtanxsecx+tanxdx\int \sec x\,dx = \int \sec x \cdot \frac{\sec x + \tan x}{\sec x + \tan x}\,dx = \int \frac{\sec^2 x + \sec x \tan x}{\sec x + \tan x}\,dx

Now set u=secx+tanxu = \sec x + \tan x. Differentiating gives secxtanx+sec2x\sec x \tan x + \sec^2 x, which is exactly the numerator you just built.

u=secx+tanx,du=(secxtanx+sec2x)dxu = \sec x + \tan x, \qquad du = \left(\sec x \tan x + \sec^2 x\right)\,dx

The whole integral collapses to the logarithm pattern.

duu=lnu+C=lnsecx+tanx+C\int \frac{du}{u} = \ln|u| + C = \ln\left|\sec x + \tan x\right| + C

Why the conjugate works

Nothing mystical is happening: multiplying by 1 is always legal, and this particular 1 is picked so the numerator becomes the derivative of the denominator. That is the pattern uudx=lnu+C\int \frac{u'}{u}\,dx = \ln|u| + C, and recognizing it is the real skill Topic 6.9 is testing.

Checking the answer by differentiating

Every antiderivative is verifiable in one line, and on a free-response question that check costs almost nothing. Differentiate lnsecx+tanx\ln\left|\sec x + \tan x\right| with the chain rule, using ddx[secx]=secxtanx\frac{d}{dx}[\sec x] = \sec x \tan x and ddx[tanx]=sec2x\frac{d}{dx}[\tan x] = \sec^2 x.

ddx[lnsecx+tanx]=secxtanx+sec2xsecx+tanx\frac{d}{dx}\left[\ln\left|\sec x + \tan x\right|\right] = \frac{\sec x \tan x + \sec^2 x}{\sec x + \tan x}

Factor secx\sec x out of the numerator and the bracket cancels the denominator.

secx(tanx+secx)secx+tanx=secx\frac{\sec x\left(\tan x + \sec x\right)}{\sec x + \tan x} = \sec x

On any interval where secx\sec x is defined, such as (π2,π2)\left(-\frac{\pi}{2}, \frac{\pi}{2}\right), the formula holds. It is also valid on the next branch (π2,3π2)\left(\frac{\pi}{2}, \frac{3\pi}{2}\right), where secx+tanx\sec x + \tan x is negative and the absolute value does the work.

Where the integral of sec x fits in AP Calculus

This belongs to Unit 6, Integration and Accumulation of Change, which carries a weighting of 15 to 20 percent on both AB and BC. The move that solves it is Topic 6.9 (Integrating Using Substitution), and recognizing that substitution is the right tool here is Topic 6.14 (Selecting Techniques for Antidifferentiation).

The two derivative facts the proof rests on come from Unit 2, Topic 2.10 (Finding the Derivatives of Tangent, Cotangent, Secant, and/or Cosecant Functions), a unit weighted 10 to 15 percent on AB and 5 to 10 percent on BC.

Not the same as the sec rules you already memorized

sec2xdx=tanx+C\int \sec^2 x\,dx = \tan x + C and secxtanxdx=secx+C\int \sec x \tan x\,dx = \sec x + C are just Unit 2 derivative rules read backwards. secxdx\int \sec x\,dx is not one of those; it needs the conjugate trick, which is exactly why it gets memorized as a result in its own right.

Common mistakes with the integral of sec x

  • Answering tanx+C\tan x + C. That is sec2xdx\int \sec^2 x\,dx. One power of sec\sec makes the whole problem different.
  • Answering secx+C\sec x + C. That is secxtanxdx\int \sec x \tan x\,dx, the product, not the bare secant.
  • Writing lnsecx+C\ln\left|\sec x\right| + C. Differentiating that gives tanx\tan x, not secx\sec x, so the +tanx+\tan x inside the logarithm is not optional.
  • Forgetting the inside factor on a composite. sec(3x)dx=13lnsec3x+tan3x+C\int \sec(3x)\,dx = \frac{1}{3}\ln\left|\sec 3x + \tan 3x\right| + C, with the 13\frac{1}{3} out front.
  • Integrating straight across x=π2x = \frac{\pi}{2}. There is an infinite discontinuity there, so something like 0πsecxdx\int_0^{\pi} \sec x\,dx is improper and diverges; evaluating the antiderivative at the endpoints anyway produces a number that means nothing.
  • Dropping the absolute value. Write lnsecx+tanx\ln\left|\sec x + \tan x\right|; on branches where secx+tanx\sec x + \tan x is negative, ln(secx+tanx)\ln(\sec x + \tan x) is undefined.

Worked examples

Example 1. Evaluate 0π/4secxdx\int_0^{\pi/4} \sec x\,dx. Use the antiderivative and the endpoint values secπ4=2\sec\frac{\pi}{4} = \sqrt{2}, tanπ4=1\tan\frac{\pi}{4} = 1, sec0=1\sec 0 = 1, tan0=0\tan 0 = 0.

0π/4secxdx=[lnsecx+tanx]0π/4=ln(2+1)ln(1)=ln(1+2)0.8814\int_0^{\pi/4} \sec x\,dx = \Big[\ln\left|\sec x + \tan x\right|\Big]_0^{\pi/4} = \ln\left(\sqrt{2} + 1\right) - \ln(1) = \ln\left(1 + \sqrt{2}\right) \approx 0.8814

Example 2. Find sec(3x)dx\int \sec(3x)\,dx. Substitute w=3xw = 3x, so dw=3dxdw = 3\,dx and dx=13dwdx = \frac{1}{3}\,dw.

sec(3x)dx=13secwdw=13lnsec3x+tan3x+C\int \sec(3x)\,dx = \frac{1}{3}\int \sec w\,dw = \frac{1}{3}\ln\left|\sec 3x + \tan 3x\right| + C

Example 3. Evaluate 0π/3secxdx\int_0^{\pi/3} \sec x\,dx, where secπ3=2\sec\frac{\pi}{3} = 2 and tanπ3=3\tan\frac{\pi}{3} = \sqrt{3}.

0π/3secxdx=ln(2+3)ln(1)=ln(2+3)1.3170\int_0^{\pi/3} \sec x\,dx = \ln\left(2 + \sqrt{3}\right) - \ln(1) = \ln\left(2 + \sqrt{3}\right) \approx 1.3170

Both endpoints stayed on one branch

In each definite integral above, the interval sits inside (π2,π2)\left(-\frac{\pi}{2}, \frac{\pi}{2}\right), so secx\sec x is continuous and the Fundamental Theorem applies. Always check that before substituting endpoints into the antiderivative.

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 sec x?

secxdx=lnsecx+tanx+C\int \sec x\,dx = \ln\left|\sec x + \tan x\right| + C. You can confirm it by differentiating: the chain rule gives secxtanx+sec2xsecx+tanx\frac{\sec x \tan x + \sec^2 x}{\sec x + \tan x}, and factoring secx\sec x out of the numerator cancels the denominator, leaving secx\sec x.

Why do you multiply by sec x + tan x?

Because it manufactures a substitution. Multiplying by secx+tanxsecx+tanx\frac{\sec x + \tan x}{\sec x + \tan x} leaves the integrand unchanged in value, but the new numerator sec2x+secxtanx\sec^2 x + \sec x \tan x is precisely the derivative of the new denominator. That is the uudx=lnu+C\int \frac{u'}{u}\,dx = \ln|u| + C pattern.

Is -ln|sec x - tan x| + C also a correct answer?

Yes, and it is the same function, not merely a shifted one. Since sec2xtan2x=1\sec^2 x - \tan^2 x = 1, we get secxtanx=1secx+tanx\left|\sec x - \tan x\right| = \frac{1}{\left|\sec x + \tan x\right|}, so its negative logarithm equals lnsecx+tanx\ln\left|\sec x + \tan x\right| exactly. The form lntan(x2+π4)+C\ln\left|\tan\left(\frac{x}{2} + \frac{\pi}{4}\right)\right| + C is equivalent too.

How is the integral of sec x different from the integral of sec squared x?

They share no method. sec2xdx=tanx+C\int \sec^2 x\,dx = \tan x + C is a memorized derivative rule reversed, since ddx[tanx]=sec2x\frac{d}{dx}[\tan x] = \sec^2 x. The single power, secxdx=lnsecx+tanx+C\int \sec x\,dx = \ln\left|\sec x + \tan x\right| + C, requires the conjugate multiplication and a substitution.

What is the domain of the antiderivative?

Wherever secx\sec x itself is defined, which excludes x=π2+kπx = \frac{\pi}{2} + k\pi. The formula is valid on each interval between consecutive vertical asymptotes, and the constant CC can differ from one interval to the next. A definite integral whose limits straddle an asymptote is improper.