# The integral of $\frac{1}{1+x^n}$

Motivated by this question:

Integration of $\displaystyle \int\frac{1}{1+x^8}\,dx$

I got curious about finding a general expression for the integral $\int \frac{1}{1+x^n},\,n \geq 1$. By factoring $1+x^n$, we can get an answer for any given $n$ (in terms of logarithms, arctangents, etc), but I was wondering whether a general one-two-liner formula in terms of elementary functions is known/available (WolframAlpha trials for specific $n$ show some structure.).

• The answer to the linked question is one approach: there is pleasant factorization over the complex numbers. – André Nicolas May 22 '13 at 5:09
• @Amzoti Hypergeometrics are not allowed :) I have tried for specific $n$, say for $n=56$: integrals.wolfram.com/… Although it is perfectly plausible that that hypergeometric function has a "closed" form expression in terms of logarithms, arctangents. – Lord Soth May 22 '13 at 5:09
• It "appears" from the form for $n=56$ that one or two summations will do the job. – Lord Soth May 22 '13 at 5:10
• As an aside, $$\int_0^\infty\frac{dx}{1+x^n}=\frac{\frac\pi n}{\sin\left(\frac\pi n\right)}$$ – Lucian Dec 9 '13 at 2:08
• @LordSoth: the answer to this question could be interesting for you. – Watson Jul 25 '16 at 12:20

$$\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'}$$
where $x_{kr}$ and $x_{ki}$ are the real and imaginary parts of $x_k$, respectively, and are given by
$$x_{kr}=\text{Re}\left(x_k\right)=\cos \left(\frac{(2k-1)\pi}{n}\right)$$
$$x_{ki}=\text{Im}\left(x_k\right)=\sin \left(\frac{(2k-1)\pi}{n}\right)$$