I'm having trouble calculating the below integral to get the right answer:
$$\frac{1}{2\pi i}\int_\gamma \frac{3}{z-2}\; dz$$ where $\gamma$ is parametrised by $\gamma(t)=3e^{it}, t\in [0,2\pi]$. So using this parametrisation I achieve: $$\frac{1}{2\pi i}\int_\gamma \frac{3}{z-2}\; dz=\frac{1}{2\pi}\int_0^{2\pi}\frac{9e^{it}}{3e^{it}-2}\; dt$$ Now by observation I can see that $$\frac{d}{dt}\left ( -3i \ln\left ( 3e^{it}-2 \right )\right )=\frac{9e^{it}}{3e^{it}-2}$$ and so I have that my integral is equal to $$\frac{1}{2\pi} \left [ -3i\ln(3e^{it}-2)\right ]_0^{2\pi}=0.$$ $\textbf{However}$ if I put this integral into wolfram alpha it gives the answer as $3$ (which I know is the correct answer). I also see that I could have observed that $$\frac{d}{dt}\left ( -3i\ln(2-3e^{it})\right )=\frac{9e^{it}}{3e^{it}-2}$$ and now the integral is equal to $$\frac{1}{2\pi} \left [ -3i\ln(2-3e^{it})\right ]_0^{2\pi}=3$$ Using that $\ln(-1)=i\pi$.
Therefore my question is how can two seeming correct methods give different answers? What is wrong with the first method?
This is something called a branch cut. The natural logarithm is actually multivalued on the complex plane; note that $e^{2\pi i}=e^{0}=1$. So is $\ln{1} = 0$ or $2\pi i$?
The way to resolve this problem is to choose a branch, that is, restrict the argument of the natural log to be between two values, say $-\pi$ and $\pi$. That means if we look at the complex plane, there is what we call a branch cut where the negative real numbers are; that's where the argument jumps by $2\pi$. Your integral from $0$ to $2\pi$ crosses the branch cut; that'll give you the $2\pi i$.