# Express $\int \tan^n(x)dx$ in terms of $\int \tan^{n-2}(x)dx$. [duplicate]

Calculate $$\int \tan(x)dx$$, $$\int \tan^2(x)dx$$. Give a formula to $$\int \tan^n(x)dx$$ in terms of $$\int \tan^{n-2}(x)dx$$. Use this to calculate $$\int \tan^4(x)dx$$, $$\int \tan^5(x)dx$$

I have calculated the first two integrals:

$$\int \tan(x)dx = \log(|\cos(x)|) + C$$ $$\int \tan^2(x)dx = \tan(x) -x + C$$ where $$C\in \Bbb R$$. But I can't see the relationship between them to obtain the formula. Could you give any hint?

• There doesn't need to be a relationship between the first two integrals to find a recurrence relation between the $n$th and $(n-2)$nd integrals. – Peter Foreman Jan 18 at 20:37
$$\tan^n x = \tan^{n-2} x(\sec^2x-1) = \tan^{n-2} x(\tan x)’-\tan^{n-2}x$$
$$\int \tan^{n}x dx = \int \tan^{n-2}x \>d(\tan x) -\int \tan^{n-2}xdx = \frac {\tan^{n-1} x}{n-1} - \int \tan^{n-2}xdx$$