A weird value obtained by using Cauchy Principal Value on $\int_{-\infty}^{\infty}\frac{1}{x^2}dx$ so I'm trying to evaluate the integral in the title,
$$\int_{-\infty}^{\infty}\frac{1}{x^2}dx$$
by using complex plane integration. I've chosen my contour to be a infinte half circle with it's diameter on the real axis. (integration is preformed ccw).
when R tends to infinity, the arch part of the contour yields zero, and so we are left with the part along the real axis, which is the one I'm trying to evalute.
there are no other poles in my contour, only a second order pole at $z=0$ lying on it. the residue of this pole is $0$ so the integral sums up to be zero (by using Cauchy principal value.)
However my function is always positive and greater than $0$, so this doesn't make sense.
Any help would be appreciated
 A: The integral diverges even if you chose the principal value. To show this by using residue theorem, first chose a contour C composed by the following:
$$C_R: \text{ big semicircle centered at origin, with radius $R$, counterclockwise}$$
$$C_1: \text{ straight line from  $-R$ to $-r$, towards $+\infty$}$$
$$C_r: \text{ small semicircle centered at origin, with radius $r$, clockwise}$$
$$C_2: \text{ straight line from  $R$ to $r$, towards $+\infty$}$$
$$\int_C\frac{dz}{z^2}=0$$ by residue theorem.
$$\int_{-\infty}^\infty\frac{dx}{x^2}=0-\lim_{R\to\infty}\int_{C_R}\frac{dz}{z^2}-\lim_{r\to0}\int_{C_r}\frac{dz}{z^2}\\
=0-0-(-\infty)=\infty$$
The calculation of the limits is left to readers.
A: Usually you'd need this kind of contour if you happen to have poles on the real axis. We take the small radius $r\to 0$ and the large radius $R\to\infty$. The value on the bigger half circle should decay fast enough so the value of the integral would depend on the limit of the smaller half circle.
You can see this example of a similar calculation.

