First, did use wolfram alpha and it does give me the answer in terms of a hypergeometric sequence.

I am a grade 12 student, and I am trying to investigate into this integral for my assessment. Could someone please explain how I can go from the LHS to the RHS:

$$\int \tan^n(x)\, dx = \frac {\tan^{n + 1}(x)\; _2F_1(1, \frac {n + 1}2, \frac {n + 3}2, -\tan^2(x))}{n + 1}\, + \,\text {constant}$$

Where, as usual, $_2F_1$ denotes the HyperGeometric Function

  • 1
    $\begingroup$ The image is unreadable $\endgroup$ – Don Thousand Jan 10 '19 at 14:34
  • $\begingroup$ I'm not sure in the image if they are meant to be $()$ brackets or if there is a reason for the different shape $\endgroup$ – Henry Lee Jan 10 '19 at 14:36
  • 2
    $\begingroup$ Note: I added what I believe to be the correct integral to your post, the link you included could not be read. Please advise if what I wrote was not what you intended. I left your link in place though, if what I wrote is what you wanted, then you might want to delete the broken link. $\endgroup$ – lulu Jan 10 '19 at 14:40
  • $\begingroup$ This seems like quite a high level integral compared to what you will have learnt. If you can avoid it that would probably be better $\endgroup$ – Henry Lee Jan 10 '19 at 14:41
  • $\begingroup$ Worth remarking; if $n\in \mathbb N$ then, generally, one just uses a simple reduction to integrate this. $\endgroup$ – lulu Jan 10 '19 at 14:44

Let's consider the case when $n=2k+1$ is odd: we can write $$ \int\tan^nx\,dx=\int\tan^{2k+1}x\,dx= \int\frac{(\sin^2x)^k}{\cos^{2k+1}x}\sin x\,dx= -\int\frac{(1-\cos^2x)^k}{\cos^{2k+1}x}\,d(\cos x) $$ which is elementary. Example with $k=2$: we reduce to \begin{align} -\int\frac{(1-\cos^2x)^2}{\cos^5x}\,d(\cos x) &=-\int\left(\frac{1}{\cos^5x}-\frac{2}{\cos^3x}+\frac{1}{\cos x}\right)\,d(\cos x)\\ &=\frac{1}{4\cos^4x}-\frac{1}{\cos^2x}-\log\lvert\cos x\rvert+c \end{align}

For $n=2k$ even, it's a bit different: $$ \int\tan^nx\,dx=\int\frac{\sin^{2k}x}{\cos^{2k}x}\,dx= \int\frac{(1-\cos^2x)^k}{\cos^{2k}x}\,dx $$ and the problem is reduced to computing $$ \int\frac{1}{\cos^{2m}x}\,dx $$ which can be dealt with the substitution $t=\tan x$. Example with $m=2$; since $$ \cos^2x=\frac{1}{1+\tan^2x} $$ we have $$ \int\frac{1}{\cos^4x}=\Bigl[t=\tan x,dt=\frac{1}{\cos^2x}\,dx\Bigr]= \int(1+t^2)\,dt=t+\frac{t^3}{3}+c=\tan x+\frac{1}{3}\tan^3x\,dx $$ In general, for $m\ge1$, with the same substitution, $$ \int\frac{1}{\cos^{2m}x}=\int(1+t^2)^{m-1}\,dt $$

| cite | improve this answer | |
  • $\begingroup$ Could you show how to integrate 1/(cos(x))^(2m)? And is it possible to further breakdown the first case where you split tan(x)^n in terms of odd powers of sin and cos? sorry if it an obvious question, I just find it slightly hard to understand this. $\endgroup$ – Redlion11 Jan 10 '19 at 15:55
  • $\begingroup$ @Redlion11 I added a couple of examples $\endgroup$ – egreg Jan 10 '19 at 16:08
  • $\begingroup$ Thank you, I get it now. $\endgroup$ – Redlion11 Jan 10 '19 at 16:13

Notice that $$(\tan x)'=\tan^2x+1$$ so that

$$\tan^n x=\tan^{n-2} x\,(\tan x)'-\tan^{n-2}x.$$

This gives you a recurrence relation that ends with the integrand $\tan x$ or $1$ depending on the parity of $n$.


This leads to better expressions than those given by Alpha, even with a numerical exponent.




$$\frac{\tan^7 x}7-\frac{\tan^5 x}5+\frac{\tan^3 x}3-\tan x+x.$$

| cite | improve this answer | |
  • $\begingroup$ Thanks for the response, but could you elaborate a bit more on how you arrived at \tan^n x=\tan^{n-2} x\,(\tan x)'-\tan^{n-2}x $\endgroup$ – Redlion11 Jan 10 '19 at 16:18
  • $\begingroup$ @Redlion11: no, this is immediate. Expand. $\endgroup$ – Yves Daoust Jan 10 '19 at 17:23

Depending on the limits, the Beta function can be used: $$B(m+1,n+1)=2\int_0^{\pi/2}\cos^{2m+1}(x)\sin^{2n+1}(x)dx=\frac{m!n!}{(m+n+1)!}$$ For outside of this range you can use that: $$B(z;a,b)=\int_0^zx^{a-1}(1-x)^{b-1}dx=z^a\sum_{n=0}^\infty\frac{(1-b)_n}{n!(a+n)}z^n$$ All this can be found here: http://mathworld.wolfram.com/BetaFunction.html


| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.