# How to Integrate Tan^2(x) and Tan^3(x), Tangent Squared and Cubed

Tangent squared and tangent cubed -- written as either tan^2(x) & tan^3(x), or tan(x)^2 & tan(x)^3 -- are easy to integrate if you know a few basic trig identities, derivatives, and antiderivatives. With these fundamental relations, you can reduce the integrals of tan^2(x) and tan^3(x) to simpler forms.

The first key identity is

tan^2(x) + 1 = sec^2(x)

which is obtained by taking the relation sin^2(x) + cos^2(x) = 1 and dividing both sides by cos^2(x). (Recall, sec(x) is the reciprocal of cos(x).) The second key relation is

d/dx [ tan(x) ] = sec^2(x)

which can be derived by applying the quotient rule to the function f(x) = sin(x)/cos(x) = tan(x). And finally, the third important trig equation is

∫ tan(x) dx = -LN |cos(x)| + c

where LN | | is the natural log of the absolute value. This antiderivative is found by applying u-substitution to the function f(x) = sin(x)/cos(x) = tan(x), letting u = cos(x) and du = -sin(x) dx. Now that we have these equations at our disposal we can find the antiderivatives of tan^2(x) and tan^3(x).

## Antiderivative of Tan^2(x), aka Tan(x)^2

To integrate the function tan^2(x), we apply the first key identity. This transforms our integral into

∫ tan^2(x) dx

= ∫ [sec^2(x) - 1] dx

= [ ∫ sec^2(x) dx ] - [ ∫ 1 dx ]

= -x + ∫ sec^2(x) dx

Since the derivative of tan(x) is sec^2(x), it implies that the antiderivative of sec^2(x) is tan(x). Thus, we can obtain the final form

-x + ∫ sec^2(x) dx

= -x + tan(x) + c

## Example of Integrating Tan(x)^2

Find the area bounded by the functions y = 3 and y = tan(x)^2 between x = -π/3 and x = π/3. This region is shaded in purple in the graph above.

To solve this problem we find the area under the line y = 3 from between x = -π/3 and x = π/3, and subtract from it the area under the curve y = tan(x)^2 from between x = -π/3 and x = π/3. This gives us

2π - ∫ tan(x)^2 dx {-π/3 ≤ x π/3}

= 2π - [tan(π/3) - π/3 - tan(-π/3) + (-π/3)]

= 8π/3 - 2sqrt(3)

≈ 4.9135

## Antiderivative of Tan^3(x), aka Tan(x)^3

To find the integral of tan^3(x), let's first factor the trig function into

tan^3(x) = tan(x)*tan^2(x)

Using the first key relation, we can further transform it into

tan(x)*tan^2(x)

= tan(x)[sec^2(x) - 1]

= tan(x)sec^2(x) - tan(x)

Now our integral equation is

∫ tan^3(x) dx

= ∫ [tan(x)sec^2(x) - tan(x)] dx

= ∫ tan(x)sec^2(x) dx - ∫ tan(x) dx

The second piece of this integral equation is ∫ tan(x) dx = -LN |cos(x)|. To evaluate the first piece, we use the u-substitution

u = tan(x)

du = sec^2(x) dx

This gives us

∫ tan(x)sec^2(x) dx

= ∫ u du

= 0.5*u^2

= 0.5*tan^2(x)

Now putting everything together gives us

∫ tan^3(x) dx

= [ ∫ tan(x)sec^2(x) dx ] - [ ∫ tan(x) dx ]

0.5*tan^2(x) + LN |cos(x)| + c

## Going Further: How to Integrate Tan^n(x), aka Tan(x)^n

Now that we have seen how to integrate tangent squared and tangent cubed, we can apply the same techniques to integrate the tangent function raised to any power n. The integral formulas for tan(x)^n (tangent raised to the nth power) are iterative, meaning they require you to simplify the function many times to put it in its most reduced form. To integrate tan(x)^n, we first factor it as

tan(x)^n = tan(x)^2 * tan(x)^(n-2)

Then we use the relation tan(x)^2 = sec(x)^2 - 1 to transform the function into

tan(x)^2 * tan(x)^(n-2) = [sec(x)^2 - 1]tan(x)^(n-2)

= sec(x)^2 * tan(x)^(n-2) - tan(x)^(n-2)

The integral equivalence is

∫ tan(x)^n dx

= ∫ sec(x)^2 * tan(x)^(n-2) dx - ∫ tan(x)^(n-2) dx

We have seen how u-substitution can be applied to the first part of this integral expression, giving us

∫ sec(x)^2 * tan(x)^(n-2) dx

= (1/(n-1))*tan(x)^(n-1)

Therefore, the recursive expression for the antiderivative of tan(x)^n is

∫ tan(x)^n dx

= (1/(n-1))*tan(x)^(n-1) - ∫ tan(x)^(n-2) dx

Although this formula still contains another integral expression, the integrand's exponent is 2 less than the original function. Reapply this process to the integral tan(x)^(n-2) etc. until you obtain the most reduced form. Power reduction processes like this are also used to integrate functions of the form (x^n)d^x, sin(x)^n, and cos(x)^n.

## Comments

useful formulas, thanks. how do you integrate tan(x)^n if n is not an integer? e.g. sqrt(tan(x)) = tan(x)^(1/2)

How do you integrate tangent raised to the power -1 .... 1/tan(x) = tan(x)^-1 (not arctangent) ?