Skip to content
Helper

Integration of sec x: Formula, Proof and the Integral of sec²x

Why the integral of sec x is ln|sec x + tan x| + C, with sec²x too

Class 12Proof and examples Checked 23 Nov

The integration of sec x gives ln|sec x + tan x| + C, where C is any constant. You cannot reach it with a basic rule, so the proof uses a clever step: multiply the top and bottom by (sec x + tan x), and the integral turns into the form f'(x)/f(x).

Its partner sec2x is far easier. Because the derivative of tan x is sec2x, the integral of sec2x is simply tan x + C. Below you will find both proofs written the way a board examiner wants to see them, the case of sec 2x and sec 3x, a short note on sec3x, and practice sums with answers.

Drawing tools on a desk for practising the integration of sec x
Practise the sec x proof until the multiplying step feels natural.

At a glance

  • ∫ sec x dx

    ln|sec x + tan x| + C
  • Other form

    ln|tan(π/4 + x/2)| + C
  • ∫ sec<sup>2</sup>x dx

    tan x + C
  • ∫ sec x tan x dx

    sec x + C
  • ∫ sec(ax) dx

    (1/a) ln|sec ax + tan ax| + C
  • Key trick

    Multiply by (sec x + tan x)

Integration of sec x: the formula to remember

∫ sec x dx = ln|sec x + tan x| + C

The bars mean modulus. Log is only defined for positive values, and sec x + tan x can be negative for some angles, so the modulus keeps the answer valid everywhere the function exists. In class 12 answers, writing log in place of ln is fine, since both mean the natural log to base e.

Some answer keys print the same result as ln|tan(π/4 + x/2)| + C. This is not a different answer. Using the half angle formulas, sec x + tan x equals tan(π/4 + x/2), so the two expressions are equal for every x. If your answer and the key look different, test both at one angle before you panic.

Proof of the sec x integral, step by step

Write the proof in four lines. Examiners give marks for the multiplying step, so show it clearly.

  1. Multiply and divide sec x by (sec x + tan x): ∫ sec x (sec x + tan x)/(sec x + tan x) dx.
  2. Open the top: ∫ (sec2x + sec x tan x)/(sec x + tan x) dx.
  3. Put t = sec x + tan x. Then dt = (sec x tan x + sec2x) dx, which is exactly the top.
  4. The integral becomes ∫ dt/t = ln|t| + C = ln|sec x + tan x| + C.

Why multiply by that factor in particular? Because the derivative of sec x + tan x is sec x tan x + sec2x, which is sec x times the same bracket. Once you see this, the trick stops feeling like magic. The same idea with (cosec x - cot x) gives the cosec x result, listed on our page for log x and trig integrals.

Integration of sec²x and why it is tan x

∫ sec2x dx = tan x + C

There is no trick here. Differentiation tells us d/dx (tan x) = sec2x. Integration reverses differentiation, so the sec^2x integration answer is tan x plus a constant. Read sec2x as (sec x)2, the square of sec x.

Do not mix this up with sec 2x, which means sec of the angle 2x. Many students search for the integration of sec2x and mean one or the other, so read the question carefully. In print, sec2x has a small raised 2 after sec, while sec 2x has a full size 2 before x.

Sec x integration with a number in front of x

When the angle is ax or ax + b, integrate as normal and divide by a, the coefficient of x. This is the linear substitution rule.

∫ sec(ax + b) dx = (1/a) ln|sec(ax + b) + tan(ax + b)| + C
∫ sec2(ax + b) dx = (1/a) tan(ax + b) + C
Secx integration results for common angles
IntegralResult
∫ sec 2x dx(1/2) ln|sec 2x + tan 2x| + C
∫ sec 3x dx(1/3) ln|sec 3x + tan 3x| + C
∫ sec2(5x) dx(1/5) tan 5x + C
∫ sec2(4x + 1) dx(1/4) tan(4x + 1) + C
∫ sec x tan x dxsec x + C

Worked examples

Example 1. Evaluate ∫ (3 sec2x + 2 sec x) dx.

  1. Split the sum: 3 ∫ sec2x dx + 2 ∫ sec x dx.
  2. First part: 3 tan x.
  3. Second part: 2 ln|sec x + tan x|.
  4. Answer: 3 tan x + 2 ln|sec x + tan x| + C.

Example 2. Find ∫ sec2x/(1 + tan x) dx.

  1. Put t = 1 + tan x, so dt = sec2x dx.
  2. The integral is ∫ dt/t = ln|t| + C.
  3. Answer: ln|1 + tan x| + C.

Example 3. Find ∫ tan2x dx using sec2x.

  1. Use the identity tan2x = sec2x - 1.
  2. ∫ (sec2x - 1) dx = tan x - x + C.

This step appears again and again; see more on our page for the integration of sin²x, cos²x and tan²x.

Example 4. Evaluate the definite integral of sec x from 0 to π/4.

  1. At x = π/4: sec = √2, tan = 1, so ln(√2 + 1).
  2. At x = 0: sec = 1, tan = 0, so ln 1 = 0.
  3. Answer: ln(√2 + 1), about 0.8814 to 4 decimal places.

Example 5. Evaluate the integral of sec2x from 0 to π/4.

  1. Antiderivative is tan x.
  2. tan(π/4) - tan 0 = 1 - 0.
  3. Answer: 1.

A note on sec³x and higher powers

The cube of sec x needs integration by parts. Take sec x as one part and sec2x as the other, then use tan2x = sec2x - 1 and bring the repeated integral to the left side. The result is:

∫ sec3x dx = (1/2)(sec x tan x + ln|sec x + tan x|) + C

For even powers, keep one sec2x aside and put t = tan x. For example, sec4x = (1 + tan2x) sec2x, which integrates to tan x + tan3x/3 + C. The parts method is explained in full on our integration by parts page.

Where students lose marks

  • Writing tan x as the answer for sec x. That is the integral of sec2x, not sec x.
  • Dropping the modulus. Many markers cut half a mark for ln(sec x + tan x) without bars.
  • Forgetting to divide by a. The integral of sec 3x carries a factor 1/3 in front.
  • Missing + C in an indefinite integral. Write it every time.
  • Using sec x = 1/sin x. sec x is 1/cos x; cosec x is 1/sin x.

A quick self check: differentiate your answer. If you get back the function under the integral sign, you are right.

Practice questions on sec integrals

1. ∫ sec 4x dx

Show answer

(1/4) ln|sec 4x + tan 4x| + C.

2. ∫ (sec2x - 2) dx

Show answer

tan x - 2x + C.

3. ∫ sec2x tan x dx

Show answer

Put t = tan x, dt = sec2x dx. ∫ t dt = t2/2, so the answer is tan2x/2 + C.

4. ∫ 1/cos2x dx

Show answer

1/cos2x is sec2x, so the answer is tan x + C.

5. ∫ sec x (sec x + tan x) dx

Show answer

Open it: ∫ (sec2x + sec x tan x) dx = tan x + sec x + C.

For a mixed set covering every chapter type, try our integration questions, or return to our integration hub, which lists every calculus topic.

Frequently asked questions

What is the integration of secx?

It is ln|sec x + tan x| + C. An equal form is ln|tan(π/4 + x/2)| + C. Both are accepted in exams if the working is shown.

What is the integration of sec^2x, that is sec squared x?

The integral of sec2x is tan x + C, because the derivative of tan x is sec2x. No substitution is needed.

What is the integration of sec 2x?

For sec of the angle 2x, the answer is (1/2) ln|sec 2x + tan 2x| + C. The 1/2 comes from dividing by the coefficient of x.

Why do we multiply by sec x + tan x?

Because the derivative of sec x + tan x equals sec x times (sec x + tan x). After multiplying, the top becomes the exact derivative of the bottom, so the integral is a log.

Is the integral of sec x equal to log of sec x + tan x without the modulus?

Only where sec x + tan x is positive. The general answer needs the modulus, so always write it to be safe.

What is the integral of sec x tan x?

It is sec x + C, since the derivative of sec x is sec x tan x. Keep this one in your quick recall list.