1

I have seen a lot of videos in which people integrate functions like $\sqrt{\tan(x)}$, $\sqrt[3]{\tan^2(x)}$, etc. I was wondering if there was a closed-form expression for $$\int (\tan{x})^{\frac{p}{q}} dx$$

Where $p,q$ are integers, and $q \neq 0$. Eventually, I would like to generalize the result to an integrand ${\tan(x)}^r$, for $r \in \mathbb{R}$, but for now we can stay with the rationals.

My attempt at solving this:

Let $u = \tan(x) \implies x = \arctan(u), dx = \frac{du}{1+u^2}$. This yields $$\int \frac{u^{\frac{p}{q}}}{1+u^2}du$$

But I'm not sure where to go from here. My first thought was long division, but that can't work here. I also considered treating $\frac{1}{1+u^2}$ like a geometric series, but that has a finite radius of convergence.

Mailbox
  • 941
  • $v:=u^{1/q}$ (if $u>0$ or $q$ odd) – Anne Bauval Nov 30 '22 at 23:09
  • 1
    I'm working on a more general form $\int \tan\left(x\right)^{a}$ right now. What motivated you to find a closed form? (I'm asking because I looked through your questions and saw your interest in integrals. I hate to be a show-off, but you might be interested in some of my questions and answers.) – Accelerator Dec 01 '22 at 04:45

2 Answers2

3

Here is a more general result. Let $a \in \mathbb{R}\backslash\left\{-1,-3\right\}$ and let the integral in question be $I$. For this answer, we will suppose the following:

$$\cos^2(x) =\text{ } _2F_1\left(1, \frac{1+a}{2}; \frac{3+a}{2};-\tan^2(x)\right)-\frac{2\tan^2(x)}{3+a}\text{ }_2F_1\left(2, \frac{3+a}{2}; \frac{5+a}{2};-\tan^2(x)\right)$$

(which can be seen here (I have tried multiple real values of $a$)) where $\text{ } _2F_1 (a,b;c;z)$ is the Hypergeometric Function. Applying this, we get

$$ \eqalign{ I =& \int\tan^{a}\left(x\right)dx \cr =& \int\frac{\tan^{a}\left(x\right)}{\cos^{2}\left(x\right)}\cos^{2}\left(x\right)dx \cr =& \int\frac{\tan^{a}\left(x\right)}{\cos^{2}\left(x\right)}\text{ } _2F_1\left(1, \frac{1+a}{2}; \frac{3+a}{2};-\tan^2(x)\right)dx \cr &- \frac{2}{3+a}\int\frac{\tan^{2+a}\left(x\right)}{\cos^{2}\left(x\right)}\text{ }_2F_1\left(2, \frac{3+a}{2}; \frac{5+a}{2};-\tan^2(x)\right) \cr } $$

Next, we will suppose

$$\frac{d}{dz} \text{ } _2F_1 (a,b;c;f(z)) = \frac{ab}{c}\text{ } _2F_1 (a+1,b+1;c+1;f(z))f'(z).$$

Integrating by parts on the first integral, we let $u =\text{ }_2F_1\left(1, \frac{1+a}{2}; \frac{3+a}{2};-\tan^2(x)\right)$ and $dv = \dfrac{\tan^{a}\left(x\right)}{\cos^{2}\left(x\right)}dx$ so that $du = -\dfrac{2+2a}{3+a} \text{ } _2F_1\left(2, \frac{3+a}{2}; \frac{5+a}{2}; -\tan^2(x)\right)\tan(x)\sec^2(x)$ and $v = \dfrac{\tan^{1+a}(x)}{1+a}$. Then

$$ \eqalign{ I =& \frac{\tan^{1+a}\left(x\right)}{1+a} \text{ }_2F_1\left(1, \frac{1+a}{2}; \frac{3+a}{2};-\tan^2(x)\right) \cr &- \frac{1}{1+a}\int\tan^{1+a}\left(x\right)\left(-\frac{1+a}{3+a}\text{ } _2F_1\left(2, \frac{3+a}{2}; \frac{5+a}{2};-\tan^2(x)\right)\right)2\tan\left(x\right)\sec^{2}\left(x\right)dx \cr &- \frac{2}{3+a}\int\frac{\tan^{2+a}\left(x\right)}{\cos^{2}\left(x\right)} \text{ } _2F_1\left(2, \frac{3+a}{2}; \frac{5+a}{2};-\tan^2(x)\right). \cr } $$

Therefore,

$$\int\tan^{a}\left(x\right)dx = \frac{\tan^{1+a}\left(x\right)}{1+a} \text{ }_2F_1\left(1, \frac{1+a}{2}; \frac{3+a}{2};-\tan^2(x)\right) + C.$$

Accelerator
  • 6,203
1

The substitution $\tan(x) = t$ makes the integral into $$ \int \frac{t^a}{t^2 + 1}\; dt$$ Replacing $1/(t^2+1)$ by its power series we get (for $|t| < 1$) $$ \int \sum_{k=0}^\infty (-1)^k t^{a+2k}\; dt = \sum_{k=0}^\infty \frac{(-1)^k t^{1+a+2k}}{1+a+2k} = \frac{t^{1+a}}{1+a} {}_2F_1\left(1,\frac{1+a}{2}; \frac{3+a}{2}; -t^2\right)$$ and then substituting back $t=\tan(x)$ gets Accelerator's answer (for $-\pi/4 < x < \pi/4$).

EDIT: This requires $a$ to not be an odd negative integer.

For $|t|>1$, if $a$ is not an odd positive integer you can use a series in negative powers of $t$:

$$ \int \sum_{k=0}^\infty (-1)^k t^{a-2k-2} \; dt = \sum_{k=0}^\infty \frac{(-1)^k t^{a-2k-1}}{a-2k-1} = \frac{t^{a-1}}{a-1} {}_2F_1\left(1,\frac{1-a}{2}; \frac{3-a}{2}; -\frac{1}{t^2}\right)$$

Robert Israel
  • 470,583
  • A few questions:
    1. Why can't $a$ be an odd negative integer in the $|\tan(x)| > 1$ case?
    2. How does the hypergeometric function show up in that infinite sum?
    3. Why does changing $a + 2k$ to $a - 2k - 2$ give results for $|\tan(x)| >1$? Why can't we use odd positive integers for $a$ in this case?
    4. Do we need to consider the $|\tan(x)| = 1$ case?
    5. Is there any way to bypass these restrictions for $a$ using this method? Because clearly, using @Accelerator's method, we get results for all $a \in \mathbb{R}$.
    – Mailbox Dec 06 '22 at 01:21
  • @Mailbox I don't think there is a way to bypass the restrictions for that method because of convergence issues, and my method works if $a$ isn't $-1$ or $-3$. There are probably some tedious computations behind the scenes that make $a$ the way it is and that makes the Hypergeometric Function show up, but I don't know for sure because I didn't post this answer, of course. – Accelerator Dec 06 '22 at 06:28
  • If $a$ is an odd negative integer, the sum $\sum_{k=0}^\infty (-1)^k t^{a+2k}$ would contain a term $(-1)^k t^{-1}$, whose integral is $(-1)^k \log(t)$; it turns out there are closed form solutions in this case, but not given by a hypergeometric. – Robert Israel Dec 06 '22 at 06:40
  • The conditions $|t| > 1$ and $|t|< 1$ are needed to make the series converge. However, these solutions extend by analytic continuation (with appropriate branch cuts) and their difference is constant. – Robert Israel Dec 06 '22 at 16:51