I am a student who is preparing for IIT exam. I was just practicing calculus and encountered this problem. I tried different substitutions but none of them seemed to work. So what is the primitive function of $$\int \frac{1}{x^{2n} +1} \, \mathrm{d}x $$ ?

  • 1
    $\begingroup$ There's no simple form which is valid for all $n \in \mathbb{N}$ (you need to use hypergeometric functions). That's why your substitutions lead to nowhere. $\endgroup$
    – Glorfindel
    Jul 8, 2015 at 16:58
  • $\begingroup$ Hmm... it seems the result involves hypergeometric functions... are you sure this is the correct problem? $\endgroup$
    – Cristopher
    Jul 8, 2015 at 16:59
  • 2
    $\begingroup$ You can solve that by decomposition in simple fractions, as the roots are easy to find. But the computation is tedious. $\endgroup$
    – user65203
    Jul 8, 2015 at 17:00
  • 1
    $\begingroup$ Yah, it is. My teacher told that this is one of the hardest Integration sum for our level. Well I have never heard of hypergeometric functions before. $\endgroup$ Jul 8, 2015 at 17:00
  • 1
    $\begingroup$ Yes, you can use the "roots of unity". x^n=k have a set of solutions which are spread on a circle in the complex plane for n even you can probably pair them together to get real coefficients. $\endgroup$ Jul 8, 2015 at 17:06

3 Answers 3


We have $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)$$


The integral of $\frac{1}{1+x^{2n}}$ is a special case for the development herein. Simply let $n\to 2n$.


As requested, we will 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}}$$

  • 2
    $\begingroup$ After the factorization given by Dr. MV we see that $|x_k|<1$ so that we may use geometric series such as $$ \int {\frac{{dx}}{{x^{2n} + 1}}} = \int {\sum\limits_{k = 0}^\infty {\left( { - 1} \right)^k x^{2nk} } dx} = \sum\limits_{k = 0}^\infty {\left( { - 1} \right)^k \int {x^{2nk} dx} } = \sum\limits_{k = 0}^\infty {\left( { - 1} \right)^k \frac{{x^{2nk + 1} }}{{2nk + 1}}} $$ $\endgroup$ Jul 8, 2015 at 23:55
  • $\begingroup$ yes, you r right $\endgroup$ Jul 9, 2015 at 0:09
  • 1
    $\begingroup$ @mwomath And a finite sum seems more elegant than an infinite series solution. Don't you agree? $\endgroup$
    – Mark Viola
    Jul 9, 2015 at 0:13
  • 1
    $\begingroup$ The most interesting part is the computation of the $a_k$'s. How do you get that result ? $\endgroup$
    – user65203
    Jul 9, 2015 at 7:33
  • 1
    $\begingroup$ @paraskhosla And that user's assertion that $|x_k|<1$ is not correct. But certainly for $x\in(-1,1)$, that series expansion is valid. $\endgroup$
    – Mark Viola
    Feb 27, 2019 at 18:38

It has no simple closed form, unless you also give some nice integration endpoints, such as $\int \limits _0 ^\infty$. For your curiosity, you get $x \space {}_2 F _1 (\frac 1 {2n}, 1, 1+ \frac 1 {2n}, -x ^{2n})$, where ${}_2 F _1$ is the hypergeometric function.

  • 4
    $\begingroup$ By partial fraction decomposition, you get a linear combination of $2n$ terms $\ln(x-z_k)$, where $z_k$ is a $2n^{th}$ root of $-1$, nothing really exotic. $\endgroup$
    – user65203
    Jul 8, 2015 at 17:18
  • $\begingroup$ @YvesDaoust: I feel that the OP hasn't studied complex analysis yet. Plus, even with complex functions, you would still get a sum of simple terms - it depends on your taste whether you call that a closed formula or not. $\endgroup$
    – Alex M.
    Jul 8, 2015 at 17:20
  • 3
    $\begingroup$ I do, as long as the sum is finite. $\endgroup$
    – user65203
    Jul 8, 2015 at 18:14

First find $x^{2n}+1 = 0$, then split into sum of fractions $1/(x+b)$ and $1/(x^2+bx+c)$ and integrate those. I seem to have forgotten what it's called in English. Not partial integration or integration by parts. Partial fraction decomposition maybe?

  • 1
    $\begingroup$ Partial fraction decomposition. All of these roots have nice expression in trigonometric form. So maybe the intended answer is a sum of $n$ things involving trig functions. $\endgroup$
    – GEdgar
    Jul 8, 2015 at 17:05
  • 1
    $\begingroup$ Yes, logarithms and arctan and maybe a few others. $\endgroup$ Jul 8, 2015 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.