# Computing the primitive $\int\frac{1}{1+x^n} dx$

Well, this might be a really simple one. But still... What will be the soln. to --- \begin{aligned} \int\frac{1}{1+x^n} dx \end{aligned}

Is substituting \begin{aligned} 1+x^n \end{aligned} by tan z the correct step?

Thanks for the Help.

• Are you allowed complex analysis? – user88595 May 1 '14 at 17:07
• No. But do we really need to do that? – Rishav Madcap Rakshit May 1 '14 at 17:11
• It's not simple at all. Partial fraction decomposition will work in principle, but it will quickly turn messy as $n$ increases. – Hans Lundmark May 1 '14 at 17:17
• Hmm. Yes, I guess you're right. Let me look into it. – Rishav Madcap Rakshit May 1 '14 at 17:19
• There is no general approach to this problem, but $\displaystyle\int_0^\infty\frac{dx}{1+x^n}=\frac\pi n\cdot\csc\frac\pi n$ – Lucian May 1 '14 at 17:21

Here is an approach. You can get a nice closed form in terms of the hypergeomtric function

$$I = \int\frac{1}{1+x^n} dx = \sum_{k=0}^{\infty}(-1)^k \int x^{kn} dx= \sum_{k=0}^{\infty}\frac{(-1)^kx^{nk+1}}{kn+1} + c$$

$$\implies I = x\,{\mbox{_2F_1}(1,{n}^{-1};\,1+{n}^{-1};\,-{x}^{n})}+c.$$

• I think you're missing a $(-1)^k$ in the integrand – b00n heT May 1 '14 at 18:12
• @b00nheT: You are right. Thanks for the comment. – Mhenni Benghorbal May 1 '14 at 18:13
• Alright. I'll work through it. Thank you – Rishav Madcap Rakshit May 1 '14 at 18:15
• @b00nheT: It is a fact that we can integrate or differentiate a power series within its radius of convergence. – Mhenni Benghorbal May 1 '14 at 18:21
• Thank you! I wasn't 100% sure anymore. $\ddot\smile$ – b00n heT May 1 '14 at 18:23

What follows is an essentially unedited translation to LaTex of a 28 October 2006 sci.math post of mine.

The factorization and partial fraction decomposition of $$\frac{1}{x^n + 1}$$ was essentially done by Roger Cotes (1682-1716), although he expressed his results in a geometric way that makes it difficult for someone not familiar with the notion of his era to interpret.

$$\text{EVALUATION OF} \;\; \int \frac{dx}{x^4 + 1}$$

There are several elementary calculus texts that include as an exercise the evaluation of $$\int \frac{dx}{x^4 + 1},$$ but not many texts include this as one of their worked examples. You can find this integral as a worked example in Courant/John  (pp. 289-290), Federer/Jonsson  (pp. 609-610) [Federer/Jonsson's worked example is actually $$\int \frac{x^3 + x^2 + 6}{x^4 + 36}dx,$$ but the essential details are the same], Hairer/Wanner  (p. 120), and Peters  (pp. 99-100). The advanced calculus text Taylor/Mann  (Section 22.6, Exercise 9, p. 736) asks the reader to evaluate this integral "by expressing the integrand in terms of partial fractions with quadratic denominators" and the resulting antiderivative is given in the text.

$$\text{EVALUATION OF} \;\; \int \frac{dx}{x^5 + 1}$$

Edwards  (Exercise #14(iv), p. 163) asks for the evaluation of $$\int \frac{dx}{x^5 + 1}.$$ Edwards mentions that this integral appeared on an 1891 Cambridge College Examination Paper. The answer is given on p. 887. However, the answer is stated in terms of $$\cos{\frac{\pi}{5}}$$ and $$\cos{\frac{3\pi}{5}}.$$ Edwards  (Exercise #42, p. 167) asks the reader to show that $$\int_{0}^{\infty} \frac{x}{x^5 + 1}dx \; = \; \frac{4 \pi}{5 \sqrt{10} \; + \; 2 \sqrt{5}}.$$

$$\text{EVALUATION OF} \;\; \int \frac{dx}{x^6 + 1}$$

Courant/John  (Exercise #1, p. 321) and Spivak  (Section 19, Exercise #7(x), p. 381) ask for the evaluation of $$\int \frac{dx}{x^6 + 1}$$ (neither gives the answer). Edwards  (Exercise #15, p. 163) asks the reader to show that $$\int_{0}^{\infty} \frac{dx}{x^6 + 1} = \frac{\pi}{3}.$$ [Edwards mentions that this integral appeared on an 1881 St. John's College Examination Paper.] Federer/Jonsson  (Exercise #1(t), p. 616) gives an integral to evaluate whose denominator is $$x^6 + 1$$ (no answer is given). Vallee Poussin  (Exercise 1, 4th integral, p. 189) asks the reader to evaluate $$\int \frac{dx}{2 - x^6}$$ (the answer is given).

$$\text{FACTORING} \;\; x^n + 1$$

The factorizations of $$x^n + 1$$ for $$n$$ both even and odd into linear and irreducible quadratic factors making use of the cosine function are given in Archbold  (Example 1, p. 154) and Mostowski/Stark  (Exercise 1, p. 278). The same factorizations of $$x^n + 1$$ are derived using De Moivre's formula in Durell/Robson  (p. 220, eqs. 3 & 4). Hobson  (pp. 117-119, eqs. 26 & 27) gives a derivation without the use of De Moivre's formula (due to Norman MaCleod Ferrers in Messenger of Mathematics, Volume 5) and Hobson  (Example 2, pp. 239-240) gives a derivation that makes use of De Moivre's formula. Factorizations of $$x^n + a^n$$ for $$n$$ both even and odd are given in Tignol  (p. 100, eqs. 3 & 4; see also pp. 108-109, 125). Tignol  also gives a detailed discussion of the historical development and importance of these factorizations in Chapter 7 (pp. 97-107). Durell/Robson  (p. 226), Hobson  (item 3, p. 240), and Jack  give factorizations of $$x^{2n} - 2x^{n}\cos{\theta} + 1$$ into $$n$$ quadratic polynomials. By replacing $$x$$ with $$\frac{x}{a},$$ this last result allows us to factor $$x^{2n} - 2a^{n}x^{n}\cos{\theta} + a^{2n}.$$ The factorizations in which $$\cos{\theta}$$ is a parameter can be used to obtain useful finite product expressions for $$\sin{n\theta}$$ and $$\cos{n\theta},$$ and other identities.

$$\text{PARTIAL FRACTION EXPANSIONS OF} \;\; \frac{1}{x^n + 1}$$

The partial fraction expansions of $$\frac{1}{x^n + 1}$$ for $$n$$ both even and odd appear in Barnard/Child  (Exercise #21, p. 305) (the answers are given, but not a detailed solution). The partial fraction expansion of $$\frac{1}{x^n + 1}$$ for $$n$$ even appears in Durell/Robson  (Exercise #11, p. 236) (the answer is given, but not a detailed solution). Hobson  (pp. 241-242) derives the partial fraction decompositions of $$\frac{x^{m-1}}{x^n + 1}$$ for $$n$$ both even and odd, and for $$m = 1,$$ $$2,\,\ldots,$$ $$n-1$$ (use $$m=1$$ to get the expansion for $$\frac{1}{x^n + 1}).$$ Edwards  (Section 166, pp. 158-159) derives the partial fraction expansion and the antiderivative of $$\frac{x^m}{x^{2n} \; - \; 2a^{n}x^{n}\cos{n\theta} \; + \; a^{2n}}$$ for integers $$m,\,n$$ with $$0 \leq m < 2n.$$ [By choosing $$a=1$$ and $$m=0$$ and the angle $$\theta$$ so that $$\cos{n\theta} = 0,$$ we get the partial fraction expansion and the antiderivative of $$\frac{1}{x^n + 1}$$ for $$n$$ even.]

$$\text{EVALUATION OF} \;\; \int \frac{dx}{x^n + 1}$$

Gopalan/Ravichandran  begin by mentioning $$\int \frac{dx}{x^n + 1}$$ is explicitly evaluated for $$n=1,$$ $$2,$$ $$3,$$ $$4,$$ $$5,$$ $$6,$$ $$8,$$ and $$10$$ in Ramanujan  (their paper's only reference). These evaluations of Ramanujan's are also cited in Berndt . In an attempt to evaluate this integral for all positive integers $$n$$ (apparently they were not aware of the above results), they were able to effect an evaluation for any $$n$$ that is a power of $$2.$$ See Ravichandran  for some more details regarding this decomposition.

Palagallo/Price  begin by mentioning the results in Gopalan/Ravichandran  and Ramanujan . Then they show how to evaluate $$\int \frac{dx}{x^n + 1}$$ where $$n$$ is any positive rational number. They do this by first evaluating $$\int \frac{dx}{x^n + 1}$$ for positive integers n (using De Moivre's Theorem and employing the cosine function to express the coefficients that arise) and then making an appropriate change of variables to reduce the $$n = \frac{p}{q}$$ case to the positive integer case. This more general type, where $$n$$ is a positive rational number, is a special case of an even more general type of integral -- the binomial integral. Note: The change of variables that Palagallo/Price  employ is a standard technique for evaluating certain types of binomial integrals. Binomial integrals are not mentioned in their paper, and their only references are Gopalan/Ravichandran  and Ramanujan .

Edwards  (Exercise #40, p. 167) asks for the evaluation of $$\int \frac{x^{p-1}}{x^n + a^n}dx$$ for $$p - 1 < n$$ and the answer is given for both $$n$$ even and $$n$$ odd. (I believe $$p$$ is to be an integer greater than or equal to $$1.)$$ Taylor/Mann  (Exercise 11, p. 740) asks the reader to show that if $$a > 1,$$ then $$\int_{0}^{\infty}\frac{dx}{1 + x^a} \; = \; \frac{\pi}{a}\csc {\frac{\pi}{a}}.$$

 John W. Archbold, Algebra, Sir Isaac Pitman & Sons, 1958.

 Samuel Barnard and James M. Child, Higher Algebra, MacMillian, 1960.

 Bruce C. Berndt, Ramanujan's notebooks, Mathematics Magazine 51 (1978), 147-164.

 Richard Courant and Fritz John, Introduction to Calculus and Analysis, Volume I, Interscience Publishers, 1965.

 Clement V. Durell and Alan Robson, Advanced Trigonometry, Dover Publications, 1930/2003.

 Joseph W. Edwards, A Treatise on the Integral Calculus Volume I, Chelsea, 1930/1954.

 Herbert Federer and Bjarni Jonsson, Analytic Geometry and Calculus, Ronald Press, 1961.

 M. A. Gopalan and V. Ravichandran, Note on the evaluation of $$\int \frac{1}{1 + t^{2^n}}dt,$$ Mathematics Magazine 67 (1994), 53-54.

 Ernst Hairer and Gerhard Wanner, Analysis by Its History, Springer-Verlag, 1996.

 Ernest W. Hobson, A Treatise on Plane and Advanced Trigonometry, 7th edition, Dover Publications, 1928/1957.

 John Jack, The factorisation of $$1 - 2x^{n}\cos {\alpha} + x^{2n},$$ Proceedings of the Edinburgh Mathematical Society 15 (1897), 97.

 Andrzej W. Mostowski and Marceli Stark, Introduction to Higher Algebra, Pergamon Press, 1964.

 Judith A. Palagallo and Thomas E. Price, Some remarks on the evaluation of $$\int \frac{dt}{t^m + 1},$$ Mathematics Magazine 70 (1997), 59-63.

 J. Matthew H. Peters, Some numerical series from $$\int \frac{dx}{1 + x^n},$$ Mathematical Gazette 67 #440 (June 1983), 95-101.

 Srinivasa Ramanujan, Notebooks of Srinivasa Ramanujan, Vol. 2, Tata Institute of Fundamental Research, Bombay, 1957.

 V. Ravichandran, On a series considered by Srinivasa Ramanujan, Mathematical Gazette 88 #511 (March 2004), 105-110.

 Michael Spivak, Calculus, 3rd edition, Publish or Perish, 1994.

 Angus E. Taylor and W. Robert Mann, Advanced Calculus, 2nd edition, Xerox College Publishing, 1972.

 Jean-Pierre Tignol, Galois' Theory of Algebraic Equations, World Scientific Publishing Company, 2001.

 Charles Jean Vallee Poussin, Cours d'Analyse Infinitesimale, Volume I, 12th edition, Gauthier-Villars and Librairie Universitaire (Louvain), 1959.

• Yes, Thank You. That cleared a lot of my doubts and helped with the concept. Thank You so much. – Rishav Madcap Rakshit May 2 '14 at 1:42
• Answers of this depth deserve a bounty – seeker Jan 17 '15 at 17:46
• @seeker: Wow ... and thanks! – Dave L. Renfro Jan 20 '15 at 16:24

Let $f(x)=\frac{1}{x^n+1}$. Note that we can write

$$f(x)=\prod_{k=1}^n(x-x_k)^{-1} \tag {1}$$

where $x_k=e^{i(2k-1)\pi/n}$, $k=1, \cdots,n$.

We can also express $(1)$ as

$$f(x)=\sum_{k=1}^na_k(x-x_k)^{-1} \tag {2}$$

where $a_k=\frac{-x_k}{n}$.

Now, we can write

\begin{align} \int\frac{1}{x^n+1}dx=-\frac1n\sum_{k=1}^nx_k\log(x-x_k)+C \end{align}

which can be more explicitly written as

$$\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)$$

NOTE :

Here, we derive the form $a_k=-\frac{x_k}{n}$. To that end, we use $(2)$ and observe that

\begin{align} \lim_{x\to x_\ell}\left((x-x_{\ell})\sum_{k=1}^{n}a_k(x-x_k)^{-1}\right)&=\lim_{x\to x_\ell}\left((x-x_{\ell})\frac{1}{1+x^n}\right) \tag 3 \end{align}

The left-hand side of $(3)$ is simply $a_{\ell}$. For the right-hand side, straightforward application of L'Hospital's Rule yields

\begin{align} \lim_{x\to x_\ell}\left(\frac{(x-x_{\ell})}{1+x^n}\right)&=\frac{1}{nx_{\ell}^{n-1}} \end{align}

Finally, we note that since $x_{\ell}^n=-1$, then

\begin{align} \frac{1}{nx_{\ell}^{n-1}}&=\frac{x_{\ell}}{nx_{\ell}^n}\\\\ &=-\frac{x_{\ell}}{n} \end{align}

Thus, we have that

$$\bbox[5px,border:2px solid #C0A000]{a_{k}=-\frac{x_k}{n}}$$