Contour integral over semicircle Evaluate the integral $$\int_{2}^{i} \frac{dz}{1-z^2}$$
where the path is the semicircle $|z-1|=1$ in $\mbox{Im}(z)\leq0$ and the imaginary axis.
My attempted solution: 
The primitive function to the definite integral is $$\frac{1}{2}(\log(z+1)-\log(1-z))$$
I need to find a suitable branch. If we draw a line segment from $0,0$ to $i-1$ we have a line that doesn't cross the path. The branch would then be $(\frac{-5\pi}{4}, \frac{3\pi}{4})$. Is this thought process correct?
 A: We have that 
$$\frac{d}{dz}\left(\frac{1}{2}\log\left(\frac{z+1}{z-1}\right)\right)=\frac{1}{1-z^2}$$
where the $\log$ has a branch cut along $[0,+\infty)$. Hence
$$\int_{\gamma} \frac{dz}{1-z^2}=\left[\frac{1}{2}\log\left(\frac{z+1}{z-1}\right)\right]_2^i=\left[\frac{1}{2}\log\left(w\right)\right]_3^{-i}=
\frac{1}{2}\left(\frac{3\pi}{2}i-\ln(3)\right)=-\frac12 \log{3} + i \frac{3\pi}{4}.$$
Note that $\gamma$ is transformed by $\frac{z+1}{z-1}$ into a the upper half-circle from $3$ to $-1$ union the lower quarter-circle from $-1$ to $-i$.
This curve does not intersect $[0,+\infty)$.
P.S. Direct calculation.
Let $\gamma_1$ be the lower half circle from $2$ to $0$:
$$\int_{\gamma_1} \frac{dz}{1-z^2}
=\int_{t=0}^{-\pi} \frac{d(1+e^{it})}{1-(1+e^{it})^2}=
-i\int_{t=0}^{-\pi} \frac{dt}{2+e^{it}}=-\frac{1}{2}\log 3+\frac{i\pi}{2}.$$
(confirmed by WA).
Let $\gamma_2$ be the segment from $0$ to $i$:
$$\int_{\gamma_2} \frac{dz}{1-z^2}=\int_{t=0}^1 \frac{d(it)}{1-(it)^2}=
i\int_{t=0}^1 \frac{dt}{1+t^2}=i[\arctan(t)]_0^1=\frac{i\pi}{4}.$$
Hence,
$$\int_{\gamma} \frac{dz}{1-z^2}=\int_{\gamma_1} \frac{dz}{1-z^2}+\int_{\gamma_2} \frac{dz}{1-z^2}=-\frac12 \log{3} + i \frac{3\pi}{4}.$$
A: I'll let $\log z$ denote the principal value logarithm. We have
$$\frac{1}{1-z^2} = \frac{1}{2}\left (\frac{1}{1+z}+ \frac{1}{1-z}\right).$$
Now $\log (1+z)$ is analytic on $\mathbb C\setminus (-\infty-1],$ where its derivative is $1/(1+z).$ There is no trouble here for our contour $\gamma,$ so we have
$$\int_\gamma \frac{dz}{1+z} = \log (1+z)\big|_2^i = \log (1+i) - \log 3 = \ln \sqrt 2 +i\pi/4 - \ln 3.$$
On the other hand $-\log (1-z)$ is analytic on $\mathbb C\setminus [1,\infty),$ where its derivative is $1/(1-z).$ Since $\gamma$ begins at $2\in [1,\infty)$ we have to be a little careful. Let $\gamma_a$ be the part of $\gamma$ that starts at $1+e^{ia}$ for small negative $a.$ We can then say
$$\int_{\gamma_a} \frac{dz}{1-z} = -\log (1-z)\big|_{1+e^{ia}}^i = -\ln \sqrt 2 +i\pi/4  + \log (-e^{ia}).$$
As $a\to 0^-,$ $ \log (-e^{ia})\to i\pi.$ So we get
$$\int_{\gamma} \frac{dz}{1-z} =  -\ln \sqrt 2 +i5\pi/4.$$
Putting it all together gives $-\ln 3 +3\pi i /4$ for the final answer. 
