Reduction formula for $\int \tan^n x dx$

Reduction formula for $$I_n = \int \tan^n x dx$$


Let $u(x) = \tan^{n-2} x \qquad \qquad v^{'}(x) = \tan^2 x$

Integrating by parts

$$I_n = (\tan x - x)(\tan^{n-2} x) - \int (\tan(x) - x)(n-2)(\tan^{n - 3} x + \tan^{n- 1} x) dx \tag{0}$$

Let the second integral be $J$,

After expanding and simplifying I get,

$$J = (n-2)I_{n-2} + (n-2)I_n - (n-2)\int x\tan^{n-3} x + x\tan^{n-1} dx \tag{1}$$

Let $w(x) = \tan^n x \qquad \qquad z^{'}(x) = 1$

Integrating $I_n$ again by parts,

$$I_n = x\tan^n x - n\int x\tan^{n+1} x + x\tan^{n-1} x dx$$

For $I_{n-2}$,

$$(n-2)\int x\tan^{n-3} x + x\tan^{n-1} dx = x\tan^{n-2} x - I_{n-2}$$

Substituting this in $(1)$

$$J = I_{n-2}(n-1) + I_n(n-2) - x\tan^{n-2} x $$

Substituting this in $(0)$,

we get,

$$I_{n} = {\tan^{n-1} x \over n-1} - I_{n-2}$$.

Is this correct ? I know the final answer is correct but is the method correct ? looks a bit circular to me.


You don't need integration by parts at all. Just write $$\tan^nx=\tan^{n-2}x(\sec^2x-1)$$ Multiply out and integrate and get the answer immediately