# Is there a nice general formula for $\int \frac{dx}{x^n-1}$ and/or $\int \frac{dx}{\Phi_n(x)}$?

Question is in the title, where $$\Phi_n$$ denotes the $$n$$-th cyclotomic polynomial.

Motivation: I'm just teaching my calculus students basic integration of rational functions with $$\log$$ and $$\arctan$$, so I wondered about this.

Observation and more precise question: Pairing complex conjugates, over $$\mathbb R$$ these polynomials split into factors of the forms $$x-1$$, $$x+1$$, and $$f_{k,n}(x) = x^2-2\cos(2k\pi/n)x +1,$$ where the reciprocal of the last one, if I'm not mistaken, has antiderivative $$\frac{1}{\sin(2k\pi/n)}\arctan\left(\frac{x-\cos(2k\pi/n)}{\sin(2k\pi/n)}\right).$$ Now using partial fractions and then integrating, one gets summands of the following types:

• A) $$\log|x-1|$$
• B) $$\log|x+1|$$
• C) $$\frac{1}{\sin(2k\pi/n)}\arctan\left(\frac{x-\cos(2k\pi/n)}{\sin(2k\pi/n)}\right)$$
• D) $$\log (f_{k,n}(x))$$.

(The last two, which come from taking apart something of the form $$\frac{\text{linear}}{f_{k,n}(x)},$$ are of course the only ones in $$\int \frac{dx}{\Phi_n(x)}$$ for $$n\ge 3$$.)

These bits I recognise in the example formulae below and I'm happy to have these as "building blocks" in a general formula. So I guess all I'm really asking for is a formula which gives the coefficients of each of the terms A)-D) in the integrals. In other words, we have

$$\int \frac{dx}{x^n-1} = \color{red}{A_n} \cdot \log|x-1| + \color{red}{B_n} \cdot \log|x+1| + \sum_{1\le k <\frac{n}{2}} \frac{\color{red}{C_{n,k}}}{\sin(2k\pi/n)}\arctan\left(\frac{x-\cos(2k\pi/n)}{\sin(2k\pi/n)}\right) + \sum_{1\le k <\frac{n}{2}} \color{red}{D_{n,k}} \log(f_{n,k})$$

and for $$n \ge 3$$,

$$\int \frac{dx}{\Phi_n(x)} = \sum_{1\le k <\frac{n}{2}\\gcd(k,n)=1} \frac{\color{red}{E_{n,k}}}{\sin(2k\pi/n)}\arctan\left(\frac{x-\cos(2k\pi/n)}{\sin(2k\pi/n)}\right) + \sum_{1\le k <\frac{n}{2}\\gcd(k,n)=1} \color{red}{F_{n,k}} \log(f_{n,k})$$

and I'm looking for closed formulae depending on $$n$$ and $$k$$ for the coefficients in red.

Idea: I assume if one goes to $$\mathbb C$$ one just gets terms of the form $$\log (x-\zeta)$$ where $$\zeta$$ runs through the respective roots of unity, and choosing the right branches of $$\log$$ and grouping complex conjugates together might give a formula for the coefficients. But going through this is beyond me at this point.

Edit:

From Eric Wofsey's answer one gets, by pairing complex conjugates and using the well-known relation (1, 2, 3) between arctan and complex logarithm (leaving out domain restriction and integration constants):

$$\int \frac{dx}{x^n-1} = \color{red}{\frac{1}{n}} \cdot \log|x-1| + \color{blue}{(}(\color{red}{-\frac{1}{n}}) \cdot \log|x+1|\color{blue}{)} + \sum_{1\le k <\frac{n}{2}} \color{red}{\frac{-2\sin(2k\pi/n)}{n}}\arctan\left(\frac{x-\cos(2k\pi/n)}{\sin(2k\pi/n)}\right) + \sum_{1\le k <\frac{n}{2}} \color{red}{\frac{\cos(2k\pi/n)}{n}} \log(f_{n,k})$$

(where the term in $$\color{blue}{\text{blue}}$$ brackets appears iff $$n$$ is even), i.e my original normalisation of the arctan-term was bad, would give $$C_{n,k} = -2\sin^2(2k\pi/n)/n$$),;

and for $$n \ge 3$$,

$$\int \frac{dx}{\Phi_n(x)} = \sum_{1\le k <\frac{n}{2}\\gcd(k,n)=1} \color{red}{-2\cdot\mathfrak{Im}\left(\frac{1}{\Phi'_n(\zeta_k)}\right)}\arctan\left(\frac{x-\cos(2k\pi/n)}{\sin(2k\pi/n)}\right) + \sum_{1\le k <\frac{n}{2}\\gcd(k,n)=1} \color{red}{\mathfrak{Re}\left(\frac{1}{\Phi'_n(\zeta_k)}\right)} \log(f_{n,k})$$

(where $$\zeta_{k,n} = \exp(2k\pi i/n)$$).

Remains only the question if there is a nice general formula for the real/imaginary part of $$\displaystyle \frac{1}{\Phi'_n(\zeta_k)}$$. I have asked that as a new question here.

• In terms of a general formula $$\displaystyle \int \frac{dx}{x^n-1} = -x\;_2F_1\left(1,\frac{1}{n};1+\frac{1}{n},x^n\right)$$ which contains a hypergeometric function. I have played around with the more general cyclotomic case but did not get anywhere in terms of hypergeometric functions. – Benedict W. J. Irwin Jun 4 '18 at 9:50
• Probably somebody somewhere has needed and calculated $\Phi_n'(\zeta_k)$! The easy case of $n=p$ a prime gives $$\Phi_p'(\zeta_k)=\frac{p}{\zeta_k(\zeta_k-1)}.$$ If I really needed to know more I would next try the prime power case and then some kind of Chinese remainder thingy :-) – Jyrki Lahtonen Jun 30 '18 at 7:49
• @JyrkiLahtonen: If I'm not mistaken, $$\frac{1}{\Phi_n'(\zeta)} = \frac{\zeta}{n} \cdot \prod_{\,d|n \\d\neq n} \Phi_d(\zeta)$$ for all roots $\zeta$ of $\Phi_n$. Whether one can be more explicit about that as a complex number ...? WolframAlpha says that e.g. for $n=5$ the results are the roots of $x^4+5x^3+125$, I wonder where that comes from exactly and if one can generate such polynomials for all $n$; maybe a new question. – Torsten Schoeneberg Jul 3 '18 at 16:18
• @BenedictWilliamJohnIrwin: Would you care to turn your comment into an answer and amend just a few words on how to get that formula? – Torsten Schoeneberg Jul 24 '18 at 0:49
• Substitute $x^n=-y^n$ and you end up with my integral. – Simply Beautiful Art Oct 4 '18 at 0:59

## 2 Answers

You can get a pretty simple expression using partial fractions over $\mathbb{C}$. In general, if $f(x)=(x-a_1)\dots(x-a_n)$ is a monic polynomial with distinct roots over $\mathbb{C}$, then we have the partial fractions decomposition $$\frac{1}{f(x)}=\sum_{k=1}^n\frac{1}{f'(a_k)(x-a_k)}.$$ (You can verify that this decomposition is correct by multiplying both sides by $x-a_k$ and taking the limit as $x\to a_k$: on the left side you have the limit of $\frac{x-a_k}{f(x)}$ which is exactly the reciprocal of the difference quotient for $f'(a_k)$ and so converges to $\frac{1}{f'(a_k)}$.)

Thus an antiderivative can be computed as $$\int\frac{1}{f(x)}dx=\sum_{k=1}^n\frac{\log(x-a_k)}{f'(a_k)}+C.$$ You can apply this to either $f(x)=x^n-1$ or $f(x)=\Phi_n(x)$. So, when you write everything over $\mathbb{C}$ and do not attempt to combine terms to get something that is obviously real-valued, the coefficients just come from the reciprocal of the derivative of the polynomial evaluated at each root. In the case of $x^n-1$, at least, you can write this quite explicitly since the derivative is easy to evaluate: $$\int\frac{1}{x^n-1}dx=\frac{1}{n}\sum_{k=1}^n\zeta^k\log(x-\zeta^k)+C$$ where $\zeta$ is a primitive $n$th root of unity (here the $f'(\zeta^k)$ in the denominator became $n(\zeta^k)^{n-1}=n(\zeta^k)^{-1}$).

• That's helpful, thanks. I would like to have it written it in real terms though, but it does not look too hard to pair conjugates together from these formulae. I'll try to do that when I have time later this week. – Torsten Schoeneberg Jun 5 '18 at 15:00

In terms of a general formula $$\displaystyle \int \frac{dx}{x^n-1} = -x\;_2F_1\left(1,\frac{1}{n};1+\frac{1}{n},x^n\right)$$ which contains a hypergeometric function. I have played around with the more general cyclotomic case but did not get anywhere in terms of hypergeometric functions.

We have in general from a geometric series $$\frac{1}{x^n-1} = -1 - x^n -x^{2n} -x^{3n} -\cdots = -\sum_{k=1}^\infty x^{n k}$$ if we integrate term by term then we have $$\int \frac{1}{x^n-1}\;dx = -x - \frac{x^{n+1}}{n+1} -\frac{x^{2n+1}}{2n+1} -\frac{x^{3n+1}}{3n+1} -\cdots = - \sum_{k=1}^\infty \frac{x^{kn+1}}{kn+1}$$ $$\int \frac{1}{x^n-1}\;dx = - x\sum_{k=1}^\infty \frac{x^{kn}}{kn+1}$$ If we consider the definition of the hypergeometric function $$\;_2F_1(a,b;c,x) = \sum_{k=1}^\infty \frac{(a)_k (b)_k x^k}{(c)_k k!}$$ with $(\cdot)_k$ the Pochhammer symbol. For this example we have $$\;_2F_1\left(1,\frac{1}{n};1+\frac{1}{n},x\right) = \sum_{k=1}^\infty \frac{\left(1\right)_k \left(\frac{1}{n}\right)_k x^k}{\left(1+\frac{1}{n}\right)_k k!}$$ we have that $(1)_k=k!$ so $$\;_2F_1\left(1,\frac{1}{n};1+\frac{1}{n},x\right) = \sum_{k=1}^\infty \frac{ \left(\frac{1}{n}\right)_k x^k}{\left(1+\frac{1}{n}\right)_k} =\sum_{k=1}^\infty \frac{x^{kn}}{kn+1}$$