# How to evaluate $\int_0^\infty \frac{1}{x^n+1} dx$ [duplicate]

Noticed that the integral $$\int_0^\infty \frac{1}{x^n+1} dx$$ is often approached with partial fraction decomposition, but this gets increasingly ugly as $n$ gets bigger. Is there a neat trick to do these all in one fell swoop? Or a famous name for these integrals that I can look up for more info?

## marked as duplicate by dustin, Jonas Meyer, OR., Joel Reyes Noche, Joe Johnson 126Mar 31 '15 at 1:16

This can also be done using complex variables when $n\ge 2.$ Use a pizza slice contour consisting of the line $\Gamma_1$ from zero to $R$ on the real axis, an arc $\Gamma_2$ along the circle $|z|=R$ from the real axis to $\theta = 2\pi/n$ and a line $\Gamma_3$ back to the origin parameterized by $z=\exp(2\pi i/n)t.$

Set $$f(z) = \frac{1}{z^n+1}$$ We integrate $f(z)$ around this contour and use the fact that the integral is equal to the residues times $2\pi i$ of the poles contained therein. Along $\Gamma_2$ we have $$|f(z)| \in \Theta(R^{-n})$$ so that the contribution is bounded by $$\frac{2\pi R}{n} \times R^{-n} \to 0$$ as $R\to\infty$ when $n\ge 2$ and the contribution from $\Gamma_2$ vanishes.

Along $\Gamma_1$ the integral goes to the value $I(n)$ being sought as $R\to\infty.$ Along $\Gamma_3$ we get in the limit $$\int_\infty^0 \frac{1}{(e^{2\pi i/n} t)^n + 1} e^{2\pi i/n} dt = - e^{2\pi i/n}\int_0^\infty \frac{1}{t^n+1} dt = - e^{2\pi i/n} I(n).$$

There is just one pole inside the pizza slice contour at $z=e^{i\pi/n}$ and we get $$I(n) (1 - e^{2\pi i/n}) = 2\pi i \times \mathrm{Res}\left(f(z); z=e^{i\pi/n}\right).$$

The pole is simple and hence the residue is $$\lim_{z\to e^{i\pi/n}}\frac{z-e^{i\pi/n}}{z^n+1} = \lim_{z\to e^{i\pi/n}}\frac{1}{n z^{n-1}} = \lim_{z\to e^{i\pi/n}}\frac{z}{n z^n} = \frac{e^{i\pi/n}}{n e^{i\pi}} = - \frac{e^{i\pi/n}}{n}.$$

This finally yields $$I(n) = - 2\pi i\frac{e^{i\pi/n}}{n(1 - e^{2\pi i/n})} = - 2\pi i\frac{1}{n(e^{-i\pi/n} - e^{\pi i/n})} \\ = \pi\frac{2i}{n(e^{\pi i/n} - e^{-i\pi/n})} = \frac{\pi}{n\sin(\pi/n)}.$$

The given integral indeed has a closed-form: $$\int_0^\infty\frac{1}{1+x^n}\ dx=\frac{\pi}{n\sin\left(\frac{\pi}{n}\right)}.$$ For the complete proof, you may refer to this OP: Prove $\int_0^{\infty}\! \frac{\mathbb{d}x}{1+x^n}=\frac{\pi}{n \sin\frac{\pi}{n}}$ using real analysis techniques only

Hint. You may recall the celebrated $\Gamma$ function defined by $$\Gamma(\alpha)=\int_0^\infty u^{\alpha-1} e^{-u}\:{\rm{d}}u, \quad \alpha>0$$ and you may write \begin{align} \int_0^\infty \frac{1}{x^n+1} \:{\rm{d}}x&=\int_0^\infty\int_0^\infty e^{-(x^n+1)t} \:{\rm{d}}t\:{\rm{d}}x \\&=\int_0^\infty e^{-t}\int_0^\infty e^{-x^n t} \:{\rm{d}}t\:{\rm{d}}x \\&=\int_0^\infty e^{-t}\left(\int_0^\infty e^{-x^n t}\:{\rm{d}}x\right)\:{\rm{d}}t \\&=\frac1n\int_0^\infty t^{-\frac1n}e^{-t}\left(\int_0^\infty u^{\frac1n-1} e^{-u}{\rm{d}}u\right)\:{\rm{d}}t \\&=\frac1n \Gamma\left(1-\frac1n\right)\Gamma\left(\frac1n\right) \\&=\frac{\pi}{n\sin \frac{\pi}{n}} \end{align}


The result is valid when $\ds{\Re\pars{1 - {1 \over n}} > 0}$ and $\ds{\Re\pars{1 \over n} > 0}$ $\ds{\imp\ \color{#c00000}{0 < \Re\pars{1 \over n} < 1}}$.