TITLE: Integral with branch cut ( Problem while calculating residue)
QUESTION [5 upvotes]: While calculating this integral $\int_{-1}^{1}\frac{dx}{\sqrt{1-x^2}(1+x^2)}$ , I am really struggling to calculate the residue at (-i), I am getting the value of residue as $\frac{-1}{2\sqrt{2}i}$, but for the value of residue is $\frac{1}{2\sqrt{2}i}$ with no minus sign in it. Now, what I might have been doing wrong since I used $\frac{1}{\sqrt{2}(1+(e^{i.3\pi/2})^2}$. I think I might have been doing some wrong in branch cut. Help me to figure it out.

REPLY [3 votes]: We will do the residue  calculation since it is necessary to conclude on
this problem.
Suppose we seek to compute
$$Q = \int_{-1}^{+1} \frac{dx}{\sqrt{1-x^2}(1+x^2)}.$$
Re-write this as
$$\int_{-1}^{+1} 
\exp(-1/2\mathrm{LogA}(1+z))
\exp(-1/2\mathrm{LogB}(1-z))
\frac{1}{1+z^2} dz$$
and call the function $f(z).$
We  must choose  two  branches of  the  logarithm $\mathrm{LogA}$  and
$\mathrm{LogB}$ so that the cut is on the real axis from $-1$ to $+1.$
This is accomplished when $\mathrm{LogA}$  has the cut on the negative
real axis and $\mathrm{LogB}$ on the positive real axis. The poles are
simple  so to  compute the  residues we  merely need  to  evaluate the
logarithms at these two points.

For the first one at $\rho_0=i$ we put $$1+i = \sqrt{2} e^{1/4\pi i}$$
and $$1-i = \sqrt{2} e^{7/4\pi i}$$ to get the residue
$$\frac{1}{2i}
\exp(-1/2\times \log\sqrt{2} -1/2\times 1/4\pi i)
\exp(-1/2\times \log\sqrt{2} -1/2\times 7/4\pi i)
\\ = \frac{1}{2i} 
\exp(-\log\sqrt{2} - \pi i)
= - \frac{1}{2i\sqrt{2}}.$$

For  the  second  one  at  $\rho_1=-i$  we  put  $$1+(-i)  =  \sqrt{2}
e^{-1/4\pi  i}$$ and  $$1-(-i) =  \sqrt{2} e^{1/4\pi  i}$$ to  get the
residue
$$-\frac{1}{2i}
\exp(-1/2\times \log\sqrt{2} +1/2\times 1/4\pi i)
\exp(-1/2\times \log\sqrt{2} -1/2\times 1/4\pi i)
\\ = - \frac{1}{2i} 
\exp(-\log\sqrt{2})
= - \frac{1}{2i\sqrt{2}}.$$
Now  using  the dogbone  contour  shown  in  the accepted  answer  and
traversed  counterclockwise we  pick  up $2Q.$  This  is because  for
$x\in(-1,1)$ we get above the cut the value
$$\exp(-1/2\log (1+x))\exp(-1/2\log (1-x) -1/2\times 2\pi i)
= - \frac{1}{\sqrt{1-x^2}}$$
and below the cut
$$\exp(-1/2\log (1+x))\exp(-1/2\log (1-x))
= \frac{1}{\sqrt{1-x^2}}.$$
Therefore
$$ 2Q= -2\pi i
\left(\mathrm{Res}_{z=i} f(z)
+ \mathrm{Res}_{z=-i} f(z)
+ \mathrm{Res}_{z=\infty} f(z)\right).$$
The residue at infinity is zero because $f(z)$ is $O(1/R^3)$ on the circle.

This gives
$$2Q = - 2\pi i
\left(- \frac{1}{2i\sqrt{2}} - \frac{1}{2i\sqrt{2}}\right)
= \pi \frac{2}{\sqrt{2}}
\quad\text{or}\quad 
Q = \frac{\pi}{\sqrt{2}}.$$
In order to be rigorous we also need to show continuity across the two overlapping cuts on $(-\infty, -1)$ as shown in this MSE link.
Remark. It really helps to think of the map from $z$ to $-z$ as a $180$ degree rotation when one tries to visualize what is happening here.