Integral of the month: \( \int \frac{ dx}{x^n+ 1} \)

We want to compute the integral \(I=\int_0^\infty \frac{dx}{x^n + 1 }\) where \(n\) is an integer. As it is typically done, we first upgrade real valued parameter \(x\) to a complex number \(z\), and define \(f(z)\): \[\begin{equation} f(z)\equiv\frac{1}{z^n +1}.\tag{1} \end{equation}\] \(f(z)\) has \(n\) poles at \(z_k=e^{\frac{\pi i (1+2k)}{n}}\) with \(0\leq k<n\).

\(n\)

An interactive plot of showing the roots. Change the slider to see different cases.

Figure 1: An interactive plot of showing the roots. Change the slider to see different cases.

Let’s be extravagant and solve the problem with three different methods.

A sneaky method

We need to decide on the complex contour. It needs to include the real line from \(0\) to \(\infty\), and we need to come back to \(0\) to close the loop. Since we have \(x^n\) term, if we return to the origin at an angle of \(\frac{2\pi}{n}\), i.e., \(z=r e^{\frac{2\pi i}{n}}\) , the \(n^\text{th}\) power will remove the phase and will leave behind \(r^n\). So, we can try the contour in Fig 2.
The contour  encloses only one pole, which is $z_1=e^{\frac{i\pi}{n}}$. The return path is selected so that $z^n$ is a real number.

Figure 2: The contour encloses only one pole, which is \(z_1=e^{\frac{i\pi}{n}}\). The return path is selected so that \(z^n\) is a real number.

\[\begin{eqnarray} \oint f(z)dz &=& \int_{\gamma_0} dz f(z)+\int_{\gamma_R} dz f(z)+\int_{\gamma_1} dz f(z)= 2\pi i \text{Res}(f,z_1)\nonumber\\ &=& \int_0^R \frac{dx}{x^n + 1 }+ i\int_0^{\frac{2\pi}{n}} d\theta e^{i\theta}\frac{R}{R^n e^{in\theta}+ 1 }+e^{i\frac{2\pi}{n}}\int_R^0 \frac{dx}{x^n + 1 }\nonumber\\ &=& (1-e^{i\frac{2\pi}{n}}) \int_0^R \frac{dx}{x^n + 1 }+ i\int_0^{\frac{2\pi}{n}} d\theta e^{i\theta}\frac{R}{R^n e^{in\theta}+ 1 }. \tag{2} \end{eqnarray}\] It is easy to show that the angle integral will vanish as \(R\rightarrow\infty\). This is because \(\left|\frac{R}{R^n e^{in\theta}+ 1 }\right|\rightarrow \frac{1}{R^{n-1} }\rightarrow 0\) for large \(R\). We can simplify the factor in front of the integral as follows: \[\begin{eqnarray} (1-e^{i\frac{2\pi}{n}})=e^{i\frac{\pi}{n}}\left(e^{-i\frac{\pi}{n}}-e^{i\frac{\pi}{n}}\right)=-2i e^{i\frac{\pi}{n}} \sin(\frac{\pi}{n}). \tag{3} \end{eqnarray}\] Putting it back into Eq. (2) gives \[\begin{eqnarray} \int_0^\infty \frac{ dx}{x^n + 1 }=-\frac{\pi \text{Res}(f,z_1)}{e^{i\frac{\pi}{n}} \sin(\frac{\pi}{n})}. \tag{4} \end{eqnarray}\] All there is left is to compute the residue of \(f(z)\) at \(z=z_1=e^{\frac{i\pi}{n}}\): \[\begin{eqnarray} \text{Res}(f,z_1)=\lim_{z\rightarrow z_1}\frac{z-z_1}{z^n+1}=\lim_{z\rightarrow z_1}\frac{1}{\frac{d}{dz}(z^n+1)}=\frac{1}{n z_1^{n-1}}=\frac{e^{\frac{-i\pi(n-1)}{n}}}{n}, \tag{5} \end{eqnarray}\] where we used L’Hôpital’s rule. Inserting the result into Eq. (4) we get \[\begin{eqnarray} \int_0^\infty \frac{dx}{x^n + 1 }=-\frac{\pi e^{\frac{-i\pi(n-1)}{n}}}{e^{i\frac{\pi}{n}} n \sin(\frac{\pi}{n})}=\frac{\pi}{ n\sin(\frac{\pi}{n})}, \tag{6} \end{eqnarray}\] which is the final answer.

A typical method

When \(n\) is even, we can extend the lower limit of the integral from \(0\) to \(-\infty\) and divide the result by \(2\). We can try the contour in Fig 3.
The contour encloses all the poles on the upper half.

Figure 3: The contour encloses all the poles on the upper half.

It may look like we got ourselves into a lot of work as we will need to compute all the residues for the poles in the upper half and add them up. Maybe, it won’t be as hard as it looks. We do this for fun, anyways. One trick we will use is this: since \(z_j^n+1=0\), we have \(z_j^{n-1}=\frac{z_j^n}{z_j}=-\frac{1}{z_j}\) \[\begin{eqnarray} I&=& i \pi \sum_{j=0}^{\frac{n}{2}-1}\text{Res}(f,z_j)=-i \pi \sum_{j=0}^{\frac{n}{2}-1}\frac{1}{nz_j^{n-1}}=-i \pi \sum_{j=0}^{\frac{n}{2}-1}z_j =-ie^{\frac{\pi i}{n}}\frac{\pi}{n} \sum_{j=0}^{\frac{n}{2}-1}e^{\frac{2 \pi i j}{n}} =-ie^{\frac{\pi i}{n}} \frac{\pi}{n} \frac{1-e^{\frac{2 \pi i n/2}{n}}}{1-e^{\frac{2 \pi i}{n}}}\nonumber\\ &=& \frac{\pi}{n}\frac{2}{ie^{\frac{-\pi i}{n}}(1-e^{\frac{2 \pi i}{n}})} =\frac{\pi}{n}\frac{2}{i(e^{\frac{-\pi i}{n}}-e^{\frac{ \pi i}{n}})}=\frac{\pi}{n}\frac{2}{2 sin(\frac{\pi}{n})}=\frac{\pi}{ n\sin(\frac{\pi}{n})} \tag{7} \end{eqnarray}\]

A fancy method

Do you dislike branch cuts? Maybe, just maybe, you just don’t understand and appreciate them. They usually appear naturally if the functions involve fractional powers or logarithms. Let’s introduce a logarithm into our problem by hand \[\begin{equation} \tilde f(z)\equiv\frac{ln(z)}{z^n +1},\tag{8} \end{equation}\] and try to evaluate this contour integral: \[\begin{equation} I_C=\oint_C dz \tilde f(z) \tag{9}. \end{equation}\] We need to introduce a branch cut for the logarithm and promise not to cross it. Let’s take it to be the positive real axis and define the contour:
Key-hole contour to evaluate the integral. The dashed line shows the possible positions of the poles.

Figure 4: Key-hole contour to evaluate the integral. The dashed line shows the possible positions of the poles.

We can now evaluate the integral \[\begin{eqnarray} I_C&=& \oint_C dz \tilde f(z)= 2 \pi i \sum_{j=0}^{n-1}\text{Res}\left(\tilde f(z),z_j\right)=2 \pi i \sum_{j=0}^{n-1} \frac{ln(z_j)}{n z_j^{n-1}}=-2 \pi i \sum_{j=0}^{n-1} \frac{z_j ln(z_j)}{n }=-\frac{2 \pi^2 }{n^2} \sum_{j=0}^{n-1} (1+2j) e^{\frac{\pi i (1+2j)}{n}} \nonumber\\ &=&-\frac{2 \pi^2 }{n^2} e^{\frac{\pi i}{n}} \left(\sum_{j=0}^{n-1} e^{\frac{2 \pi i j}{n}}+2\sum_{j=0}^{n-1} je^{\frac{2 \pi i j}{n}}\right)=\frac{4 \pi^2 }{n} e^{\frac{\pi i}{n}} \sum_{j=0}^{n-1} j e^{\frac{2 \pi i j}{n}} = -\frac{4 \pi^2 }{n^2} e^{\frac{\pi i}{n}} \frac{n}{2\pi i}\left[\frac{d}{d\alpha}\left(\sum_{j=0}^{n-1} e^{\frac{2 \pi\alpha i j}{n}}\right)\right]_{\alpha=1}\nonumber\\ &=& -\frac{4 \pi^2 }{n^2} e^{\frac{\pi i}{n}} \frac{n}{2\pi i}\left[\frac{d}{d\alpha}\left(\frac{1-e^{2 \pi i \alpha}}{1-e^{\frac{2 \pi\alpha i}{n}}}\right)\right]_{\alpha=1}=-\frac{4 \pi^2 }{n^2} e^{\frac{\pi i}{n}} \frac{n}{2\pi i}\frac{-2 \pi i}{1-e^{\frac{2 \pi i}{n}}}=-\frac{2 i \pi^2}{ n \sin(\frac{\pi }{n})}. \tag{10} \end{eqnarray}\] It is not obvious yet how this contour integral ties to our original one, \(I\). It will be clearer as we chop the integral into pieces as follows: \[\begin{eqnarray} \oint \tilde f(z)dz &=&\int_{C_1} dz \tilde f(z)+ \int_{C_\epsilon} dz \tilde f(z)+\int_{C_2} dz \tilde f(z)+\int_{C_R} dz \tilde f(z). \tag{11} \end{eqnarray}\] There is really nothing exciting for \(\int_{C_R} dz \tilde f(z)\) since it will be bounded by \(2 \pi \frac{ln R}{ R}\). It will vanish as \(R\rightarrow\infty\). The integral over the small circle \(\int_{C_\epsilon} dz \tilde f(z)\) will be bounded by \(\epsilon \,ln (\epsilon)\), hence it will too vanish as \(\epsilon\rightarrow 0\). The magic happens with the integrals over the segments \(C_{1,2}\). On \(C_1\), \(z=x e^{i\epsilon}\), i.e., it is hovering just above the real axis. On \(C_2\), \(z=x e^{i(2\pi-\epsilon)}\), i.e., it is hovering just below the real axis. Note the \(2\pi\) shift in the phase, which came from our promise of not crossing the branch cut. Putting this inside \(ln\) will make the big difference. \[\begin{eqnarray} \oint \tilde f(z)dz &=&\lim_{\epsilon\rightarrow 0}\int_0^\infty dx\frac{ln(x e^{i\epsilon})}{x^n +1}+\lim_{\epsilon\rightarrow 0}\int_\infty^0dx \frac{ln(x e^{i(2\pi-\epsilon)})}{x^n +1} =\int_0^\infty dx\frac{ln(x)}{x^n +1}-\int_0^\infty dx\frac{ln(x) +2\pi i}{x^n +1}\nonumber\\ &=&-2\pi i \int_0^\infty \frac{dx}{x^n +1}=-\frac{2 i \pi^2}{ n \sin(\frac{\pi }{n})}, \tag{12} \end{eqnarray}\] from which we get \[\begin{eqnarray} \int_0^\infty \frac{dx}{x^n +1}&=&\frac{ \pi}{ n \sin(\frac{\pi }{n})}. \tag{13} \end{eqnarray}\] There you have it, three ways of evaluating this lovely integral.

Related