Help with the contour for this integral using residues

Make the branch cut for $\sqrt{z}$ along the positive real axis.

enter image description here

The integral over the entire closed curve is $2\pi i$ times the residue at $z=-1$: $$ \begin{align} \oint\frac{\mathrm{d}z}{\sqrt{z}(z^2-1)} &=\oint\frac1{2\sqrt{z}}\left(\frac1{z-1}-\frac1{z+1}\right)\,\mathrm{d}z\\ &=2\pi i\cdot\frac i2\\[9pt] &=-\pi\tag{1} \end{align} $$ The integral along the grey circles vanishes as the small one shrinks and the large one grows.

As it shrinks, the integral along the upper red semicircle is $-\pi i$ times the residue in the upper half plane at $z=1$; that is, $\sqrt{1}=1$: $$ -\pi i\cdot\frac12\tag{2} $$ As it shrinks, the integral along the lower red semicircle is $-\pi i$ times the residue in the lower half plane at $z=1$; that is, $\sqrt{1}=-1$: $$ -\pi i\cdot-\frac12\tag{3} $$ Thus, the integral over the two red semicircles cancel.

The integral over the upper perforated line is $$ \mathrm{PV}\int_0^\infty\frac{\mathrm{d}x}{\sqrt{x}(x^2-1)}\tag{4} $$ The integral over the lower perforated line is in the opposite direction, but $\sqrt{z}=-\sqrt{x}$, so it is also. $$ \mathrm{PV}\int_0^\infty\frac{\mathrm{d}x}{\sqrt{x}(x^2-1)}\tag{5} $$ Combining these gives $$ 2\,\mathrm{PV}\int_0^\infty\frac{\mathrm{d}x}{\sqrt{x}(x^2-1)}=-\pi\tag{6} $$ Therefore, $$ \mathrm{PV}\int_0^\infty\frac{\mathrm{d}x}{\sqrt{x}(x^2-1)}=-\frac\pi2\tag{7} $$


If we interpret the integral as the Principal Value integral

$$\begin{align} I&=\text{PV}\int_0^{\infty}\frac{dx}{x^{1/2}(x^2-1)}\\\\ & =\lim_{\epsilon\to 0}\left(\int_0^{1-\epsilon}\frac{dx}{x^{1/2}(x^2-1)}+\int_{{1+\epsilon}}^{\infty}\frac{dx}{x^{1/2}(x^2-1)}\right) \end{align}$$

then we may evaluate $I$ using contour integration.


We will analyze the integral

$$\oint_C \frac{dz}{z^{1/2}(z^2-1)}$$

where $C$ is the "keyhole" contour comprised of $C_1$, $C_2$, $C_3$, $C_4$, $C_5, C_6$, and $C_7$ where

$C_1$ is the integral along the real axis from $(0,0)$ to $(1-\epsilon,0)$ above the branch cut on the real axis

$C_2$ is the integral along the semi-circle $z=1+\epsilon e^{i\theta}$, above the branch cut, where $\theta$ starts at $\pi$ and ends at $0$

$C_3$ is the integral along the real axis from $(1+\epsilon,0)$ to $(R,0)$ above the branch cut on the real axis

$C_4$ is the integral along the circle $|z|=R$ from $(R,0)$ just above the branch cut to $(R,0)$ just below the branch cut

$C_5$ is the integral along the real axis from $(R,0)$ to $(1+\epsilon,0)$ below the branch cut on the real axis

$C_6$ is the integral along the semi-circle $z=1+\epsilon e^{i\theta}$, below the branch cut, where $\theta$ starts at $0$ and ends at $-\pi$

$C_7$ is the integral along the real axis from $(1-\epsilon,0)$ to $(0,0)$ below the branch cut on the real axis

There is an eight component of the contour integral that surround the branch point, but inasmuch as this integral is trivially seen to contribute zero, we tacitly omitted it herein.


Note that the integral of interest $I$ is given by

$$I=\lim_{R\to \infty}\lim_{\epsilon\to 0}\int_{C_1+C_3}\frac{dz}{z^{1/2}(z^2-1)}$$

and

$$I=\lim_{R\to \infty}\lim_{\epsilon\to 0}\int_{C_5+C_7}\frac{dz}{z^{1/2}(z^2-1)}$$

since below the branch cut $\sqrt{z}=-\sqrt{x}$.


Further note that the integral over $C_4$ vanishes as $R\to \infty$.


We now evaluate the integrals over $C_2$ and $C_6$. These are

$$\begin{align} \int_{C_4}\frac{dz}{z^{1/2}(z^2-1)}&=\int_{\pi}^0\frac{i\epsilon e^{i\theta}}{(1+\epsilon e^{i\theta})^{1/2}(\epsilon e^{i\theta})(2+\epsilon e^{i\theta})}d\theta\\\\ &\to -i\pi/2 \,\,\text{as}\,\,\epsilon \to 0 \end{align}$$

and

$$\begin{align} \int_{C_6}\frac{dz}{z^{1/2}(z^2-1)}&=\int_{0}^{-\pi}\frac{i\epsilon e^{i\theta}}{\left(e^{i2\pi}(1+\epsilon e^{i\theta})\right)^{1/2}(e^{i2\pi}\epsilon e^{i\theta})(1+e^{i2\pi}(1+\epsilon e^{i\theta}))}d\theta\\\\ &\to i\pi/2 \,\,\text{as}\,\,\epsilon \to 0 \end{align}$$

Therefore,

$$\lim_{\epsilon\to 0}\int_{C_2+C_4}\frac{dz}{z^{1/2}(z^2-1)}=0$$


Thus, putting it all together we have

$$\begin{align} 2I&=\lim_{R\to \infty}\lim_{\epsilon\to 0}\oint_C \frac{dz}{z^{1/2}(z^2-1)}\\\\ &=2\pi i \text{Res}\left(\frac{1}{z^{1/2}(z^2-1)}, z=-1\right) \\\\ &=2\pi i \frac{1}{-2i}\\\\ &=-\pi\\\\ I&=-\pi/2 \end{align}$$


You can use a deformed keyhole contour by providing a semicircular detour of radius $\epsilon$ along each branch. Then consider

$$\oint_C dz \frac{z^{-1/2}}{z^2-1} $$

where $C$ is the deformed keyhole contour. Thus, the contour integral is equal to

$$\int_{\epsilon}^{1-\epsilon} dx \frac{x^{-1/2}}{x^2-1} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{(1+\epsilon e^{i \phi})^{-1/2}}{(1+\epsilon e^{i \phi})^2-1}+\int_{1+\epsilon}^R dx \frac{x^{-1/2}}{x^2-1} \\ +i R \int_0^{2 \pi} d\theta \, e^{i \theta} \frac{(1+R e^{i \theta})^{-1/2}}{(1+R e^{i \theta})^2-1} + e^{-i \pi} \int_R^{1+\epsilon} dx \frac{x^{-1/2}}{x^2-1} \\ + i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{(e^{i 2 \pi}+\epsilon e^{i \phi})^{-1/2}}{(e^{i 2 \pi}+\epsilon e^{i \phi})^2-1} + e^{-i \pi} \int_{1-\epsilon}^{\epsilon} dx \frac{x^{-1/2}}{x^2-1} + i \epsilon \int_{2 \pi}^0 d\phi \, e^{i \phi} \frac{\epsilon^{-1/2} e^{-i \phi/2}}{\epsilon^2 e^{i 2 \phi}-1}$$

Note that there eight sections to the contour. We take the limits as $R \to \infty$ and $\epsilon \to 0$. As $R \to \infty$, the fourth integral vanishes. As $\epsilon \to 0$, the eighth integral vanishes. Also, the second integral is $-i \pi/2$ while the sixth integral is $i \pi/2$. The first, third, fifth, and seventh integrals sum to twice the principal value of the original integral. Thus, the contour integral is equal to, in these limits,

$$2 PV \int_0^{\infty} dx \frac{x^{-1/2}}{x^2-1} $$

The contour integral is also equal to $i 2 \pi$ times the residue of the integrand at the pole $z=e^{i \pi}$, so that

$$PV \int_0^{\infty} dx \frac{x^{-1/2}}{x^2-1} = i \pi \frac{e^{-i \pi/2}}{2 (-1)}= -\frac{\pi}{2}$$