Contour Integral of $\frac{1}{z} dz$ for any contour in the right half-plane from $z=-3i$ to $z=3i$ Contour Integral of $\frac{1}{z} dz$ for any contour in the right half-plane from $z=-3i$ to $z=3i$.
I've seen some examples where I can just take the definite integral of $\frac{1}{z} dz$ from $-3i$ to $3i$. But the answer is $i\pi$, so it doesn't seem like I can do that. How should I do this then?
 A: First suppose the contour $\gamma$ is the semicircle formed by taking the right half of the circle $\{z\in\mathbb{C}:|z|=3\}$. Parametrizing the contour by $z=3e^{i\theta}$ (so that $dz=3ie^{i\theta}d\theta$), we see that
$$
\int_{\gamma}\frac{dz}{z}=\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\frac{3ie^{i\theta}}{3e^{i\theta}}d\theta=\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}id\theta=\pi i
$$
If you are given some other contour $\gamma'$ from $-3i$ to $3i$ contained in the right half-plane, then the contour $\beta$ formed by traversing $\gamma$ and then $\gamma'$ in reverse forms a closed loop in the right half-plane. By Cauchy's Theorem (as $\frac{1}{z}$ is holomorphic away from the origin), and decomposing $\beta$ into $\gamma-\gamma'$:
$$
\int_{\beta}\frac{dz}{z}=\int_\gamma\frac{dz}{z}-\int_{\gamma'}\frac{dz}{z}=0$$
Thus
$$
\int_{\gamma'}\frac{dz}{z}=\int_{\gamma}\frac{dz}{z}=\pi i.$$
A: In fact, you can. 
First: We know that if $f(z)$ is analytic in a simply connected domain $D$, then $f(z)$ has an antiderivative $F(z)$ in $D$. 
Second: Consider $ln_\tau(z)$, the branch of the logarithmic function defined by
$$ln_\tau (z)=log_e\left | z \right |+iArg_\tau(z)$$
where $\left | z \right |\neq 0$ and $Arg_\tau(z)\in (\tau,\tau+2\pi]$ for any real number $\tau$.
It can be easily shown that $\frac{1}{z}$ is the derivative of $ln_\tau(z)$ for any simply connected domain $D$ consisting of the whole complex plane except the branch cut emanating from the origin and consisting of all those points $z$ with $arg(z) = \tau$ modulo $2\pi$ (i.e., the set of points consisting of the origin along with the ray $arg(z)=\tau$.) On this domain, the Cauchy-Riemann equations are satisfied throughout this cut plane and we have
$$\frac{d}{dz}ln_\tau(z)=\frac{1}{z}$$

How to use these ideas?
Consider the principal branch $ln_{-\pi}=Ln(z)$ (an arbitrary choice - any branch with a ray on the left half plane would work.) Under this circumstance, $D$ is the simply connected domain made up the whole plane except the nonpositive real axis. In this case, $Ln(z)$ is an antiderivative of $\frac{1}{z}$, since both these functions are analytic in $D$. Hence the integral is path independent and depends on end points only and we can write 
$$\int_{C}^{ }\frac{1}{z}dz=\int_{-3i}^{3i}\frac{1}{z}dz$$
where $C$ denotes any contour on the right half-plane connecting $-3i$ to $3i$.
Using the last fact, we find
$$\int_{C}^{ }\frac{1}{z}dz=Ln(z)|_{-3i}^{3i}=Ln(3i)-Ln(-3i)=\left (log_e\left | 3 \right |+j\frac{\pi}{2}  \right )-\left (log_e\left | 3 \right |-j\frac{\pi}{2}  \right )=j\pi$$ 
