# How do you find the integral of int tan^n(x) if n is an integer?

Sep 28, 2015

See the explanation section below.

#### Explanation:

For $n \ge 3$, use Integration by substitution to decrease the exponent on $\tan x$

$\int {\tan}^{n} x \mathrm{dx} = \int {\tan}^{n - 2} {\tan}^{2} x \mathrm{dx}$

$= \int {\tan}^{n - 2} \left({\sec}^{2} x - 1\right) \mathrm{dx}$

$= \int {\tan}^{n - 2} {\sec}^{2} x \mathrm{dx} - \int {\tan}^{n - 2} x \mathrm{dx}$

The first integral is $\int {u}^{n - 2} \mathrm{du}$, so we get

$\int {\tan}^{n} x \mathrm{dx} = \frac{1}{n + 1} {\tan}^{n - 1} x - \int {\tan}^{n - 2} x \mathrm{dx}$

The second integral is of the same form as the first. So, repaet the process until you arrive at

(for $n$ even): $\int {\tan}^{2} x \mathrm{dx} = \int \left({\sec}^{2} x - 1\right) \mathrm{dx} = \tan x - x + C$

or

(for $n$ odd): $\int \tan x \mathrm{dx} = \int \left(\sin \frac{x}{\cos} x\right) \mathrm{dx} = \ln \left\mid \sec x \right\mid + C$.

Sep 28, 2015

The general formula is too difficult for elementary calculus classes.

You have to determine these the hard way, sorry. I will do the first three.

$\int \tan x \mathrm{dx}$

Multiply by $\sec \frac{x}{\sec} x$:

$= \int \frac{\sec x \tan x}{\sec} x \mathrm{dx}$

Let:
$u = \sec x$
$\mathrm{du} = \sec x \tan x \mathrm{dx}$

$\implies \int \frac{1}{u} \mathrm{du}$

$= \ln | u |$

$= \textcolor{b l u e}{\ln | \sec x | + C}$

Ironically, the second degree $\tan$ is easier to differentiate.

$\int {\tan}^{2} x \mathrm{dx}$

Use trig identity and follow up:

$= \int {\sec}^{2} x - 1 \mathrm{dx}$

$= \textcolor{b l u e}{\tan x - x + C}$

And the third:

$\int {\tan}^{3} x \mathrm{dx}$

Split into familiar first and second-degree $\tan$ terms:

$= \int {\tan}^{2} x \tan x \mathrm{dx}$

Use trig identity:

$= \int \tan x \left({\sec}^{2} x - 1\right) \mathrm{dx}$

$= \int \tan x {\sec}^{2} x - \tan x \mathrm{dx}$

Split into familiar $u$ and $\mathrm{du}$ pairs:

$= \int \sec x \tan x \cdot \sec x - \tan x \mathrm{dx}$

Let:
$u = \sec x$
$\mathrm{du} = \sec x \tan x \mathrm{dx}$

$\implies \int u \mathrm{du} - \int \tan x \mathrm{dx}$

Recall the first-degree $\tan$ solution and re-use it.

$= \textcolor{b l u e}{{\sec}^{2} \frac{x}{2} - \ln | \sec x | + C}$

Hopefully that gave you the general techniques you can use to approach higher degree problems.

Sep 28, 2015

See the explanation.

#### Explanation:

Maybe this helps:

Let $n = 2 k + 1$, then:

$\int {\tan}^{n} x \mathrm{dx} = \int {\tan}^{2 k + 1} x \mathrm{dx} = \int {\left({\tan}^{2} x\right)}^{k} \tan x \mathrm{dx} = I$

${\tan}^{2} x = t \implies 2 \tan x {\sec}^{2} x \mathrm{dx} = \mathrm{dt} \implies \tan x \mathrm{dx} = \frac{\mathrm{dt}}{2 \left(t + 1\right)}$

since: ${\sec}^{2} x = {\tan}^{2} x + 1$

$I = \frac{1}{2} \int {t}^{k} / \left(t + 1\right) \mathrm{dt}$

Dividing polynomial ${t}^{k}$ with $t + 1$ gives us following result:

${t}^{k} : \left(t + 1\right) = {t}^{k - 1} - {t}^{k - 2} + {t}^{k - 3} - {t}^{k - 4} + \ldots$

and reminder

$\frac{1}{t + 1}$

which sign depends on $k$ (if $k$ is even it's positive and vice versa)

Hence,

${t}^{k} / \left(t + 1\right) = {\sum}_{i = 1}^{k} {\left(- 1\right)}^{i + 1} {t}^{k - i} + {\left(- 1\right)}^{k} \frac{1}{t + 1}$

$I = \frac{1}{2} \int \left({\sum}_{i = 1}^{k} {\left(- 1\right)}^{i + 1} {t}^{k - i} + {\left(- 1\right)}^{k} \frac{1}{t + 1}\right) \mathrm{dt}$

$I = \frac{1}{2} \left({\sum}_{i = 1}^{k} {\left(- 1\right)}^{i + 1} \int {t}^{k - i} \mathrm{dt} + {\left(- 1\right)}^{k} \int \frac{\mathrm{dt}}{t + 1}\right)$

$I = \frac{1}{2} \left({\sum}_{i = 1}^{k} {\left(- 1\right)}^{i + 1} {t}^{k - i + 1} / \left(k - i + 1\right) + {\left(- 1\right)}^{k} \ln \left(t + 1\right)\right)$

$I = \frac{1}{2} \left({\sum}_{i = 1}^{k} {\left(- 1\right)}^{i + 1} {\left({\tan}^{2} x\right)}^{k - i + 1} / \left(k - i + 1\right) + {\left(- 1\right)}^{k} \ln \left({\tan}^{2} x + 1\right)\right)$

$I = \frac{1}{2} \left({\sum}_{i = 1}^{k} {\left(- 1\right)}^{i + 1} {\left({\tan}^{2} x\right)}^{k - i + 1} / \left(k - i + 1\right) + {\left(- 1\right)}^{k} \ln {\sec}^{2} x\right)$

When $n = 2 k$:

$\int {\tan}^{n} x \mathrm{dx} = \int {\tan}^{2 k} x \mathrm{dx} = I$

$\tan x = t \implies {\sec}^{2} x \mathrm{dx} = \mathrm{dt} \implies \mathrm{dx} = \frac{\mathrm{dt}}{{t}^{2} + 1}$

And hence:

$I = \int {t}^{2 k} / \left({t}^{2} + 1\right) \mathrm{dt}$

${t}^{2 k} / \left({t}^{2} + 1\right) = {\sum}_{i = 1}^{k} {\left(- 1\right)}^{i + 1} {t}^{2 \left(k - i\right)} + {\left(- 1\right)}^{k} \frac{1}{{t}^{2} + 1}$

Hence,

$I = \int \left({\sum}_{i = 1}^{k} {\left(- 1\right)}^{i + 1} {t}^{2 \left(k - i\right)} + {\left(- 1\right)}^{k} \frac{1}{{t}^{2} + 1}\right) \mathrm{dt}$

$I = {\sum}_{i = 1}^{k} {\left(- 1\right)}^{i + 1} \int {t}^{2 \left(k - i\right)} \mathrm{dt} + {\left(- 1\right)}^{k} \int \frac{1}{{t}^{2} + 1} \mathrm{dt}$

$I = {\sum}_{i = 1}^{k} {\left(- 1\right)}^{i + 1} {t}^{2 \left(k - i\right) + 1} / \left(2 \left(k - i\right) + 1\right) + {\left(- 1\right)}^{k} \arctan t$

$I = {\sum}_{i = 1}^{k} {\left(- 1\right)}^{i + 1} {\left(\tan x\right)}^{2 \left(k - i\right) + 1} / \left(2 \left(k - i\right) + 1\right) + {\left(- 1\right)}^{k} \arctan \left(\tan x\right)$

$I = {\sum}_{i = 1}^{k} {\left(- 1\right)}^{i + 1} {\left(\tan x\right)}^{2 \left(k - i\right) + 1} / \left(2 \left(k - i\right) + 1\right) + {\left(- 1\right)}^{k} x$