TITLE: Argument at branch cut
QUESTION [6 upvotes]: I try to use residue to calculate this integral $$\int_1^2 \frac{\sqrt {(x-1)(2-x)}} {x}\ dx$$
I let $$f(z)=\frac{\sqrt {(z-1)(2-z)}} {z}$$ and evaluate the integral $$\int_{(\Gamma)} f(z)dz$$ along the contour $\Gamma$ consisting of: $(1)$ circle$(1;\epsilon)$; $(2)$ circle$(2;\epsilon)$; $(3) $circle$(0;R)$; $(4)$ segments $[1+\epsilon,2-\epsilon]$ - upper and lower sides of branch cut $[1,2]$, and $(5)$ segments $[2+\epsilon,R]$  
My problem is how to define the argument of $z-1$ and $2-z$ at upper and lower sides of branch cut
In a similar example: http://en.wikipedia.org/wiki/Methods_of_contour_integration#Example_.28VI.29_.E2.80.93_logarithms_and_the_residue_at_infinity
why $\arg(z)$ ranged from $-\pi$ to $\pi$ while $\arg(3-z)$ ranged from $0$ to $2\pi$

REPLY [2 votes]: This answer refers to the following
MSE post
and duplicate material has been omitted.

With these  types of integrals usually  what is being asked  for is to
use two  branches of  the logarithm whose  cuts cancel outside  of the
integration interval.
Suppose we seek to compute
$$Q = \int_1^2 \frac{1}{x} \sqrt{(x-1)(2-x)} dx.$$
Re-write this as
$$\int_1^2 \frac{1}{z}
\exp(1/2\mathrm{LogA}(z-1))
\exp(1/2\mathrm{LogB}(2-z)) 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 $2.$
This is accomplished when $\mathrm{LogA}$  has the cut on the negative
real  axis and  $\mathrm{LogB}$ on  the  positive real  axis with  the
arguments being $(-\pi,\pi)$ and $(0,2\pi).$

We use  a dogbone contour  which is traversed  counterclockwise.  Then
$\mathrm{LogA}$  gives   the  real  value  just  above   the  cut  but
$\mathrm{LogB}$ contributes  a factor of $\exp(2\pi  i \times 1/2).$
Below the  cut $\mathrm{LogA}$  again produces the  real value  but so
does $\mathrm{LogB}.$ This implies that
$$Q (1 - \exp(2\pi i \times 1/2))
= - 2\pi i \times 
(\mathrm{Res}_{z=0} f(z)
+ \mathrm{Res}_{z=\infty} f(z))$$
or
$$Q = - \pi i \times 
(\mathrm{Res}_{z=0} f(z)
+ \mathrm{Res}_{z=\infty} f(z))$$
For the residue at zero we get
$$\exp(1/2\mathrm{LogA}(-1))
\exp(1/2\mathrm{LogB}(2))
\\ = \exp(1/2\times (-i\pi))\exp(1/2\log2)
= -i\sqrt{2}.$$
Now for the residue at infinity we use the formula
$$\mathrm{Res}_{z=\infty} h(z)
= \mathrm{Res}_{z=0} 
\left[-\frac{1}{z^2} h\left(\frac{1}{z}\right)\right].$$
In  the following we  need to  distinguish between  the upper  and the
lower half-plane. Assume $z=R e^{i\theta}$ with $0\le\theta\lt2\pi.$
Upper half-plane.
Here we have $$\mathrm{LogA}(1/z-1) = 
\mathrm{LogA}(1-z) - \mathrm{LogA}(z)$$
and $$\mathrm{LogB}(2-1/z) = 
\mathrm{LogB}(2z-1) - \mathrm{LogB}(z).$$
This gives for the function to evaluate the  residue the term
$$- \frac{z}{z^2}
\exp(1/2\mathrm{LogA}(1-z))
\exp(-1/2\mathrm{LogA}(z))\\ \times
\exp(1/2\mathrm{LogB}(2z-1))
\exp(-1/2\mathrm{LogB}(z)).$$
But we have in the upper half plane
$$\exp(-1/2\mathrm{LogA}(z))\exp(-1/2\mathrm{LogB}(z))
= \frac{1}{z},$$
so this becomes
$$- \frac{1}{z^2}
\exp(1/2\mathrm{LogA}(1-z))
\exp(1/2\mathrm{LogB}(2z-1)).$$
Lower half-plane.
Here we have $$\mathrm{LogA}(1/z-1) =
\mathrm{LogA}(1-z) - \mathrm{LogA}(z)$$
and $$\mathrm{LogB}(2-1/z) = 2\pi i +
\mathrm{LogB}(2z-1) - \mathrm{LogB}(z).$$
This gives for the function to evaluate the residue the term
$$- \frac{z}{z^2}
\exp(1/2\mathrm{LogA}(1-z))
\exp(-1/2\mathrm{LogA}(z))\\ \times
\exp(1/2\times 2\pi i)
\exp(1/2\mathrm{LogB}(2z-1))
\exp(-1/2\mathrm{LogB}(z)).$$
But we have in the lower half plane
$$\exp(-1/2\mathrm{LogA}(z))\exp(-1/2\mathrm{LogB}(z))
= -\frac{1}{z},$$
so this becomes
$$- \frac{1}{z^2}
\exp(1/2\mathrm{LogA}(1-z))
\exp(1/2\mathrm{LogB}(2z-1)).$$
We have  established matching  terms for the  upper and  the lower
half  plane. 
The cut  from the first term starts  at one and extends  to the right.
The cut  from the second term starts  at one half and  also extends to
the right  and we have cancelation  of the overlapping  segments for a
final cut being $[1/2, 1].$
Hence we certainly have  analyticity of the exponential term in
a disk  of radius one half round the  origin.

We now evaluate the residue for this branch.
Here we have first that 
$$\mathrm{LogA}(1-z) = - \mathrm{LogA}\frac{1}{1-z}$$
and second
$$\mathrm{LogB}(2z-1) = \pi i - \mathrm{LogB}\frac{1}{1-2z}.$$
where we choose  $\pi i$ from the upper half  plane to get analyticity
at the origin.
This finally yields
$$-\frac{1}{z^2} \exp(\pi i/2)
\exp\left(-\frac{1}{2}\mathrm{LogA}\frac{1}{1-z}\right)
\exp\left(-\frac{1}{2}\mathrm{LogB}\frac{1}{1-2z}\right).$$
We can extract coefficients from  this either with the Newton binomial
or recognizing the mixed  generating function of the unsigned Stirling
numbers of the first kind. Using the latter we find that
$$[z^n] \exp\left(u\log\frac{1}{1-z}\right)
= \frac{1}{n!} \times u(u+1)\cdots(u+n-1).$$
We need the first two terms of each. These are for the term
in $\mathrm{LogA}$
$$1 - \frac{1}{2} z +\cdots$$
and for the term in $\mathrm{LogB}$
$$1 - \frac{1}{2} 2z +\cdots$$
We have determined the residue at infinity of the original function to
be $$- \exp(\pi i/2) \times -\frac{3}{2} =
\frac{3}{2} i.$$
Recall that we had
$$Q = - \pi i \times 
(\mathrm{Res}_{z=0} f(z)
+ \mathrm{Res}_{z=\infty} f(z))$$
so substituting the computed values for the residues gives
$$-\pi i \left(-\sqrt{2}i + \frac{3}{2}i\right)
= \pi i \left(\sqrt{2}i - \frac{3}{2}i\right)
= \pi \left(-\sqrt{2} + \frac{3}{2}\right).$$

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.