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?
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.$$