- Foundation
- About 14 min
- 5 practice questions
Integrals of tan x, cot x, sec x and cosec x
Integrate the four remaining trigonometric functions, see where the formulas for sec x and cosec x come from, and use them with a linear inside and in definite integrals.
If something looks wrong, please tell us.
The standard table gave you the integrals of sin x, cos x, sec²x, cosec²x, sec x tan x and cosec x cot x. Four natural functions are missing from it: tan x, cot x, sec x and cosec x. Their integrals are logarithms, and two of them (sec x and cosec x) use a clever trick. These results are used so often that they are worth learning as standard formulas.
tan x and cot x
Write tan x = sin x / cos x. The numerator is minus the derivative of the denominator, so by the shortcut ∫ f′/f dx = ln|f| we get ∫ tan x dx = −ln|cos x| + C = ln|sec x| + C, since −ln|cos x| = ln|1/cos x|. In the same way cot x = cos x / sin x has a numerator that is the derivative of the denominator, so ∫ cot x dx = ln|sin x| + C.
sec x and cosec x
These cannot be done by the same quick shortcut. The trick is to multiply and divide sec x by (sec x + tan x): sec x = [sec x (sec x + tan x)]/(sec x + tan x) = (sec²x + sec x tan x)/(sec x + tan x). The numerator is exactly the derivative of the denominator, since d/dx (sec x + tan x) = sec x tan x + sec²x. So the integral is a logarithm: ∫ sec x dx = ln|sec x + tan x| + C. A similar step for cosec x, multiplying by (cosec x − cot x), gives ∫ cosec x dx = ln|cosec x − cot x| + C.
| Function | Integral |
|---|---|
| tan x | ln|sec x| + C, or −ln|cos x| + C |
| cot x | ln|sin x| + C |
| sec x | ln|sec x + tan x| + C |
| cosec x | ln|cosec x − cot x| + C |
∫ tan x dx = ln|sec x|, ∫ cot x dx = ln|sin x|, ∫ sec x dx = ln|sec x + tan x|, ∫ cosec x dx = ln|cosec x − cot x|. Check any of them by differentiating.
Worked example 1: a linear inside
Find ∫ tan 3x dx. With a linear expression inside, divide by the coefficient: ∫ tan 3x dx = (1/3) ln|sec 3x| + C. Check: d/dx[(1/3) ln|sec 3x|] = (1/3) × (sec 3x tan 3x × 3)/(sec 3x) = tan 3x. In the same way ∫ sec 2x dx = (1/2) ln|sec 2x + tan 2x| + C.
Worked example 2: a sum that simplifies
Find ∫ sec x (sec x + tan x) dx. Multiply out: sec x (sec x + tan x) = sec²x + sec x tan x. Both are in the standard table, so the integral is tan x + sec x + C. There was no need for the logarithm formula here. Look at the expression first and see which formula it needs.
Worked example 3: definite integrals
Evaluate ∫ from 0 to π/4 of tan x dx. The antiderivative is ln|sec x|. At π/4, sec x = √2, and at 0, sec x = 1. So the value is ln √2 − ln 1 = ln √2 = (1/2) ln 2, about 0.347. Next, ∫ from 0 to π/4 of sec x dx = ln(sec π/4 + tan π/4) − ln(sec 0 + tan 0) = ln(√2 + 1) − ln 1 = ln(√2 + 1), about 0.881. The second is larger, which makes sense because sec x is bigger than tan x on this interval.
Worked example 4: using an identity first
Find ∫ (tan x + cot x) dx. The two integrals are ln|sec x| and ln|sin x|, so the answer is ln|sec x| + ln|sin x| + C = ln|sec x sin x| + C = ln|tan x| + C. This agrees with another route: tan x + cot x = (sin²x + cos²x)/(sin x cos x) = 1/(sin x cos x), whose antiderivative is ln|tan x|.
Common mistakes
- Confusing the minus sign: ∫ tan x dx = −ln|cos x|, not +ln|cos x|.
- Writing ∫ sec x dx = ln|sec x| + C. The correct answer needs sec x + tan x inside the logarithm.
- Forgetting the absolute value signs. The argument of a logarithm integral can be negative.
- Forgetting to divide by the coefficient when the angle is 3x or 2x.
Key takeaways: tan x gives ln|sec x|, cot x gives ln|sin x|, sec x gives ln|sec x + tan x| and cosec x gives ln|cosec x − cot x|. Divide by the coefficient of x for a linear angle. Check by differentiating, and use the standard table first if the expression expands into sec²x and sec x tan x.
Check your understanding
-
1. What is ∫ tan x dx?
- −ln|sec x| + C
- ln|sec x| + C
- ln|sin x| + C
- sec²x + C
Show answer
Answer: B. tan x = sin x / cos x, and the numerator is minus the derivative of the denominator. So ∫ tan x dx = −ln|cos x| + C = ln|sec x| + C.
-
2. What is ∫ tan 3x dx?
- 3 ln|sec 3x| + C
- (1/3) ln|cos 3x| + C
- ln|sec 3x| + C
- (1/3) ln|sec 3x| + C
Show answer
Answer: D. For a linear angle 3x we divide by 3. So ∫ tan 3x dx = (1/3) ln|sec 3x| + C.
-
3. What is the exact value of ∫ from 0 to π/4 of tan x dx?
- (1/2) ln 2
- 2 ln 2
- ln 2 + 1
- (1/4) ln 2
Show answer
Answer: A. [ln|sec x|] from 0 to π/4 = ln √2 − ln 1 = (1/2) ln 2.
-
4. What is ∫ sec x (sec x + tan x) dx?
- tan x − sec x + C
- sec x tan x + C
- tan x + sec x + C
- ln|sec x + tan x| + C
Show answer
Answer: C. Expanding gives sec²x + sec x tan x. The integral of sec²x is tan x and the integral of sec x tan x is sec x.
-
5. What is ∫ cosec x dx?
- ln|cosec x + cot x| + C
- ln|sec x + tan x| + C
- −cosec x cot x + C
- ln|cosec x − cot x| + C
Show answer
Answer: D. Multiplying and dividing by (cosec x − cot x) makes the numerator the derivative of the denominator. The integral is ln|cosec x − cot x| + C.
Sign in to keep track of the lessons you finish.