What is the principal value of the integral $$\int \limits \_0^\infty \left( \frac {1}{x^2}-\frac{\cot(x)}{x} \right) dx ?$$ Maple finds $PV \int\_0^\infty \tan(x)/x dx = \pi/2.$ Such integrals arise in physics. I unsuccessfully asked it in SE.



Principal value of integral
formula 3.749.2 from Gradshteyn & Ryzhik gives:


$$\int\_0^{\infty}\frac{1-x\;{\rm cotan}x}{x^2+\epsilon^2}dx=\frac{\pi}{2\epsilon}-\frac{\pi}{e^{2\epsilon}-1}\quad{\rm for}\quad \epsilon>0.$$


taking the limit $\epsilon\downarrow 0$ gives your $\pi/2$; G&R do not explicitly say that their formula is a principal value integral, but it's the only sensible way to avoid the poles of the cotangent at $\pi,2\pi,...$; note that there is no singularity at $x=0$, so the limit $\epsilon\downarrow 0$ gives no ambiguity.




---


Here's the derivation by contour integration, as promised. The integral over $1/(x^2+\epsilon^2)$ is elementary, so I only do the one involving the cotangent:


$${\cal P}\int\_{0}^{\infty}dx\frac{x\;{\rm cotan}x}{x^2+\epsilon^2}=
\frac{1}{4}\lim\_{\delta\rightarrow 0}\left(\int\_{-\infty+i\delta}^{\infty+i\delta}dx\frac{x\;{\rm cotan}x}{x^2+\epsilon^2}+
\int\_{-\infty-i\delta}^{\infty-i\delta}dx\frac{x\;{\rm cotan}x}{x^2+\epsilon^2}\right)$$


$$=\frac{1}{4}\lim\_{\delta\rightarrow 0}\left(\int\_{-\infty+i\delta}^{\infty+i\delta}\frac{dx}{\sin x}\frac{x\;e^{ix}}{x^2+\epsilon^2}+
\int\_{-\infty-i\delta}^{\infty-i\delta}\frac{dx}{\sin x}\frac{x\;e^{-ix}}{x^2+\epsilon^2}\right)$$


$$=\frac{1}{4}\lim\_{\delta\rightarrow 0}\left(\int\_{-\infty+i\delta}^{\infty+i\delta}\frac{dx}{\sin x}\frac{x\;e^{ix}}{x^2+\epsilon^2}+
\int\_{-\infty-i\delta}^{\infty-i\delta}\frac{dx}{\sin x}\frac{x\;e^{-ix}}{x^2+\epsilon^2}\right)$$


$$=\frac{1}{4}\left(\int\_{C\_+}\frac{dz}{z-i\epsilon}\frac{z\;e^{iz}}{(z+i\epsilon)\sin z}+
\int\_{C\_-}\frac{dz}{z+i\epsilon}\frac{z\;e^{-iz}}{(z-i\epsilon)\sin z}\right)$$


$$=\frac{1}{4}\times 2\pi i\times\left(\lim\_{z\rightarrow i\epsilon}\frac{z\;e^{iz}}{(z+i\epsilon)\sin z}-
\lim\_{z\rightarrow -i\epsilon}\frac{z\;e^{-iz}}{(z-i\epsilon)\sin z}\right)$$


$$=\frac{1}{4}\times 2\pi i\times 2\times \frac{1}{\sin i\epsilon}\frac{i\epsilon\;e^{-\epsilon}}{2i\epsilon}$$


$$=\frac{\pi}{e^{2\epsilon}-1}$$


In the first equality I inserted the definition of principal value; in the second equality I used that $xe^{\pm ix}/\sin x = x\;{\rm cotan}x\pm ix$ and the second term vanishes upon integration because it is an odd function of $x$; in the third and following equalities I have closed the contour in the upper half of the complex plane for the first integral (contour $C\_+$, picking up the pole at $z=i\epsilon$), and in the lower half of the complex plane for the second integral (contour $C\_-$, pole at $z=-i\epsilon$). And so I arrive at the answer from Gradshteyn & Ryzhik, confirming that theirs was indeed a principal value result.


