Detail on the the choice of sign when computing $\int_{-1}^1\sqrt{1-x^2} \, dx$ by residues Say I want to compute $\int_{-1}^1\sqrt{1-x^2}\,dx$ by residues. I use the traditional dog bone contour. The small circuits around $-1$ and $1$ do not contribute, while the segments in the middle add up to twice the integral I want. The total result is the residue at infinity. So far, so good.
My problem is that when I want to compute the reside at infinity of  $\sqrt{1-z^2}$ I write $z=1/w$, $dz=-dw/w^2$ so
$$\sqrt{1-z^2} \, dz=-\frac{1}{w^2}\sqrt{1-\frac{1}{w^2}} \, dw=-\frac{1}{w^3} \sqrt{w^2-1} \, dw$$
and I need to expand $\sqrt{w^2-1}$ around $w=0$. This is done by writing
$$\sqrt{w^2-1}=\sqrt{(-1)(1-w^2)}=\pm i\sqrt{1-w^2}$$
and then expanding $\sqrt{1-w^2}$.
My question is very specific: how do I decide whether to take $+i$ or $-i$ above?
 A: 
This answer provides a primer, and this one, and this one provide examples on integrating around the dog bone contour.


First, we require $\sqrt{1-x^2}\ge 0$ for $x\in [-1,1]$.  Next, we select branch cuts from $-1$ to $-\infty$ and from $1$ to $-\infty$ with
$$\begin{align}
-\pi\le \arg(z\pm 1)\le \pi\tag1
\end{align}$$
With this choice for the branch cuts and associated branches, then we have
$$\sqrt{1-z^2}=-i\sqrt{z^2-1}\tag2$$


To see the rational for the minus sign in $(2)$, we examine $-i\sqrt{z^2-1}$ for values of $z\in [-1,1]$ on the upper portion of the branch cut (i.e. $z=x+i0^+$, with $x\in [-1,1]$).
On the upper portion of the branch cut and on the interval $[-1,1]$, $\arg(z^2-1)=\pi$ and hence $\sqrt{z^2-1}=i\sqrt{|z^2-1|}$.  Inasmuch as we require $\sqrt{1-z^2}\ge 0$ for $z\in [-1,1]$ on the upper portion of the branch cut, we must multiply $\sqrt{z^2-1}=i\sqrt{|z^2-1|}$ by $-i$


These branch cuts coalesce along the ray from $-1$ to $-\infty$ and, as chosen, render $\sqrt{z^2-1}$ analytic on $\mathbb{C}\setminus[-1,1]$.

Cauchy's Integral Theorem guarantees that the value of the integral of $\sqrt{1-z^2}$ over the classical dog bone contour, $C_{D}$, is, therefore, equal to the value of the integral of $\sqrt{1-z^2}$ over the circle $|z|=R>1$ for any $R>1$.  Hence, we have for $R>1$
$$\begin{align}
\oint_{C_D}\sqrt{1-z^2}\,dz&=\oint_{C_D}(-i\sqrt{z^2-1})\,dz\\\\
&=-i\oint_{|z|=R}\sqrt{z^2-1}\,dz\\\\
&=-i\int_{-\pi}^\pi \sqrt{R^2e^{i2\phi}-1}\,\,(iRe^{i\phi})\,d\phi\tag3
\end{align}$$
We can write $\sqrt{R^2e^{i2\phi}-1}$ as
$$\begin{align}
\sqrt{R^2e^{i2\phi}-1}&=Re^{i\phi}\sqrt{1-\frac1{R^2e^{i2\phi}}}\\\\
&=Re^{i\phi} \left(1-\frac1{2R^2e^{i2\phi}}+O\left(\frac1{R^4e^{i4\phi}}\right)\right)\tag4
\end{align}$$
Using $(4)$ in $(3)$, and letting $R\to \infty$ we find that
$$\oint_{C_d}\sqrt{1-z^2}\,dz=-\pi$$.
Finally, noting that the integration around the closed contours were taken counter-clockwise, we have
$$\int_{-1}^1\sqrt{1-x^2}\,dx=-\frac12\oint_{C_D}\sqrt{1-z^2}\,dz=\frac\pi2$$
And we are done!


If we wish to appeal to the residue at infinity, then we have
$$\begin{align}
\oint_{C_D}\sqrt{1-z^2}\,dz&=-2\pi i \text{Res}\left(\sqrt{1-z^2}, z=\infty\right)\tag5
\end{align}$$
where
$$\begin{align}
\text{Res}\left(\sqrt{1-z^2}, z=\infty\right)&=-i\text{Res}\left(\sqrt{z^2-1}, z=\infty\right)\\\\
&-i\text{Res}\left(-\frac1{w^2}\sqrt{\frac1{w^2}-1}, w=0\right)\\\\
&=i\text{Res}\left(\frac1{w^3}\sqrt{1-w^2}, w=0\right)\\\\
&=-\frac{i}{2}\tag6
\end{align}$$
Using $(5)$ and $(6)$, we find that
$$\int_{-1}^1\sqrt{1-x^2}\,dx=\frac\pi2$$
as expected!
