# Evaluate $\int\frac1{1+x^n}dx$ for $n\in\mathbb R$

I was wondering on how to evaluate the following indefinite integral for all $n\in\mathbb R$.

$$\int\frac1{1+x^n}dx$$

It seems to be peculiar in that we have

\begin{align} \int\frac1{1+x^{-1}}dx&=x-\ln(x+1)+c\\ \int\frac1{1+x^0}dx&=\frac12x+c\\ \int\frac1{1+x^{1/2}}dx&=2\sqrt x-2\ln(1+\sqrt x)+c\\ \int\frac1{1+x^1}dx&=\ln(x+1)+c\\ \int\frac1{1+x^2}dx&=\arctan(x)+c\\ \int\frac1{1+x^3}dx&=\frac13\ln(1+x)-\frac2{3\sqrt3}\arctan\left(\sqrt{\frac43}\left(x-\frac12\right)\right)+c \end{align}

Naturally, there appears to be some combination of $\ln$ and $\arctan$, though no simple formula arises to solve the general case.

It is, however, easy to see that

$$\int\frac1{1+x^{-n}}dx=\int1-\frac1{1+x^n}dx$$

So there is an easy enough connection between positive and negative $n$.

Also, it is easy enough to find the series expansion, taking advantage of the above connection we just made to circumvent problems concerning convergence.

$$\frac1{1+x^n}=1-x^n+x^{2n}-x^{3n}+\dots\forall\ |x|<1$$

$$\int\frac1{1+x^n}dx=c+x-\frac1{n+1}x^{n+1}+\frac1{2n+1}x^{2n+1}-\dots$$

$$=c+\sum_{k=0}^\infty\frac{(-1)^k}{kn+1}x^{kn+1}\ \forall\ |x|<1$$

Though this isn't very much along the lines of closed form.

For $n=\frac ab$, where $a$ and $b$ are whole numbers, we can use the substitution $x=u^b$ to get

$$\int\frac1{1+x^n}dx=\int\frac{bu^{b-1}}{1+u^a}du$$

though I'm unsure where that could lead. This reduces the integral down to

$$\int\frac1{1+x^n}dx=b\int P(u)+\frac{u^{b-1-ak}}{1+u^a}du,\quad k\in\mathbb N$$

for some polynomial $P(u)$. Though I'm still clueless as to how this can be advanced.

How can I evaluate $\int\frac1{1+x^n}dx\ \forall\ n\in\mathbb R$ in closed form? Can someone prove there at least exists some closed form solution for all $n\in\mathbb Q$ if the above is not possible? If possible, use real numbers.

• I'm curious about whether anything can be done with $\frac 1{1+x^{-n}}+\frac 1{1+x^n}=1$, this seems to be a relatively powerful identity that I hadn't considered before... – abiessu Nov 5 '16 at 0:05
• One way to connect all of these integrals is with the hypergeometric function. In particular, one may compute that $$\int \frac{1}{1 + x^n}\,dx = x \cdot {}_2F_1(1,1/n;1 + 1/n; -x^n) + C$$ However, since the hypergeometric function is defined in terms of its power series, this is not a terribly satisfying epiphany. – Ben Grossmann Nov 5 '16 at 0:06
• I have a 150 page table of mathematical formulas in my bookshelf where 20 of those are devoted to indeterminate integrals. It lists this integral for $n = 1, 2, 3$ and $4$ separately, and that's it for your integrals (although the integrals for $1/(1-x^n)$ are also listed for the same $n$). I think that would suggest that no nice closed form was known at the time of printing, which was 2003. – Arthur Nov 5 '16 at 0:10
• I was looking at the same problem a while ago and posted a solution. See math.stackexchange.com/questions/1837784/… – 926reals Nov 5 '16 at 1:08
• These two questions are also related (by not the same, since they do not request solution as combination of arctan and log): Solving this integral $\int\frac{1}{1+x^n} dx$? and How to find the indefinite integral $\int \frac{dx}{1+x^{n}}$? – Martin Sleziak Jan 14 '17 at 9:16

In THIS ANSWER, I showed that that the indefinite integral of interest is given by

$$\bbox[5px,border:2px solid #C0A000]{\int\frac{1}{x^n+1}dx=-\frac1n\sum_{k=1}^n\left(\frac12 x_{kr}\log(x^2-2x_{kr}x+1)-x_{ki}\arctan\left(\frac{x-x_{kr}}{x_{ki}}\right)\right)+C}$$

for $n\ge 1$, where $x_{kr}$ and $x_{ki}$ can be written, respectively, as

$$x_{kr}=\cos \left(\frac{(2k-1)\pi}{n}\right)$$

$$x_{ki}=\sin \left(\frac{(2k-1)\pi}{n}\right)$$

For $n<0$, we simply write

$$\int \frac{1}{1+x^{-|n|}}\,dx=x-\int \frac{1}{1+x^{|n|}}\,dx$$

and use the aforementioned result with $n$ replaced with $|n|$.

• Wow, that is quite beautiful. Mind me asking if you can do anything for $n\in\mathbb Q$ or $\mathbb R$? – Simply Beautiful Art Nov 5 '16 at 13:03
• @SimpleArt Thank you for the nice comment! Much appreciated. Now, unfortunately, I don't know how to generalize this result to the case for non-integer values of $n$ without appealing to the hypergeometric function. But that is unlikely the goal here. -Mark – Mark Viola Nov 5 '16 at 15:05
• @marcocantarini Thanks Marco. Much appreciative. – Mark Viola Nov 15 '16 at 14:19
• Would you be so kind as to look at $\displaystyle\int\frac{x^b}{1+x^a}dx$ for $a,b\in\mathbb N$? – Simply Beautiful Art Nov 19 '16 at 0:23
• Very nice! How in the world could I have missed this precious answer to this question? +1 – DonAntonio Jan 13 '17 at 21:25

For positive integers $n$ you can write $$\dfrac{1}{1+x^n} = \sum_{\omega} \dfrac{r(\omega)}{x - \omega}$$ where the sum is over the $n$'th roots of $-1$ and $r(\omega)$ is the residue of $1/(1+x^n)$ at $x = \omega$, so that your integral is $$c + \sum_\omega r(\omega) \log(x - \omega)$$

You can also express the power series solution in terms of the Lerch Phi function: $$c + \dfrac{x}{n} {\rm LerchPhi}(-x^n,1,1/n)$$

• Ah, interesting idea! Basically equivalent to partial fraction decomposition. Though it suggests I should use complex logarithms to write my $\arctan$. If possible, keeping everything under real numbers is recommended. – Simply Beautiful Art Nov 5 '16 at 0:18
• Robert, SEE THIS, in which I developed a closed-form solution. ;-)) – Mark Viola Nov 5 '16 at 2:12

Slightly different approach to Robert Israel's. Using $$\frac{1}{1+x}=1-x+x^2-x^3+x^4-\cdots,\tag{1}$$ where $$|x|<1$$ you can substitute $$x^n$$ for $$x$$ to obtain $$\int\frac{1}{1+x^n}dx=\int 1-x^n+x^{2n}-x^{3n}+x^{4n}-\cdots dx$$

So we end up with

$$\int\sum_{k=0}^\infty (-1)^kx^{kn}dx=\sum_{k=0}^\infty(-1)^k\frac{x^{kn+1}}{kn+1}+c=\frac{x}{n} \Phi \left(-x^n,1,\frac{1}{n}\right)+c.$$ This actually works for $$x,n\in\mathbb{R}$$, but you'd have to prove that for $$x$$ since it does not follow from (1).