# How to calculate $\int\limits_{|z-1| = 2}\frac{1}{z} \ dz$ by definition?

Consider the problem of calculating $\int\limits_\gamma \frac{1}{z} \ dz$ where $\gamma$ is the circle given by $|z-1| = 2$. This encloses the singularity so by Cauchy's residue theorem the integral equals $2\pi i$. We now try and directly calculate this integral by the substitution $z = 1+2e^{i\theta}$ which gives us $$2\pi i = \int\limits_0^{2\pi} \frac{ie^{i\theta} \ d\theta}{e^{i\theta}+\frac{1}{2}}$$

How can I do the integral directly without invoking any powerful theorems (i.e no power series etc.)? Essentially I am asking how to calculate the contour integral around a circle not centred at a branch point.

• I can't see how your substitution gives you that...\ – DonAntonio Dec 31 '17 at 23:16
• Yeah, sorry, sign error, fixed now. – Hadi K says thanks to Monica Dec 31 '17 at 23:34

$$z=1+2e^{i\theta}\implies dz=2ie^{i\theta}d\theta\implies$$

$$\oint_{|z-1|=2}\frac{dz}z=\int_0^{2\pi}\frac{2ie^{i\theta}d\theta}{1+2e^{i\theta}}=\int_0^{2\pi}\frac{d(1+2e^{i\theta})}{1+2e^{i\theta}}=\left.\mathrm{Log}\left(1+2e^{i\theta}\right)\right|_0^{2\pi}=$$

$$=\left[\log|1+2e^{i\theta}|+i\arg(1+2e^{i\theta})\right]_0^{2\pi}=\log3+\phi i-(\log3+(\phi-2\pi)i)=2\pi i$$

In the last calculation we had to add $\;-2\pi\;$ to the angle $\;\phi\;$ of $\;1+2e^{i\theta}=\;$ the logarithm's argument as we went around zero (we first evaluate it at $\;2\pi\;$ and then went back around a circle to angle zero)

The integral that you are interested in is equal to\begin{multline}\int_0^{2\pi}\frac{-\sin(\theta)+i\cos(\theta)}{\cos(\theta)+\frac12+i\sin(\theta)}\,\mathrm d\theta=\\=-\frac12\int_0^{2\pi}\frac{\sin(\theta)}{\left(\cos(\theta)+\frac12\right)^2+\sin^2(\theta)}\,\mathrm d\theta+\frac i2\int_0^{2\pi}\frac{\cos(\theta)+2}{\left(\cos(\theta)+\frac12\right)^2+\sin^2(\theta)}\,\mathrm d\theta.\end{multline}The first of these integrals is $0$, because it is equal to$$\int_{-\pi}^{\pi}\frac{\sin(\theta)}{\left(\cos(\theta)+\frac12\right)^2+\sin^2(\theta)}\,\mathrm d\theta$$which is the integral of an odd function. The second one is$$\frac i2\int_0^{2\pi}\frac{\cos(\theta)+2}{\cos(\theta)+\frac54}\,\mathrm d\theta.\tag{1}$$Formally, a primitive of the function integrated here is$$\theta\mapsto t-2\arctan\left(3\cot\left(\frac t2\right)\right).$$ But this is not defined at $0$ or at $2\pi$. A primitive is$$\begin{array}{rccc}F\colon&[0,2\pi]&\longrightarrow&\mathbb R\\&t&\mapsto&\begin{cases}-\pi&\text{ if }t=0\\t-2\arctan\left(3\cot\left(\frac t2\right)\right)&\text{ if }t\in(0,2\pi)\\3\pi&\text{ if }t=2\pi.\end{cases}\end{array}$$Therefore, the value of $(1)$ will be $3\pi-(-\pi)=4\pi$ and so$$\int_0^{2\pi}\frac{-\sin(\theta)+i\cos(\theta)}{\cos(\theta)+\frac12+i\sin(\theta)}\,\mathrm d\theta=\frac i2\times4\pi i=2\pi i.$$

Here's a way to do numerical calculation of complex integrals: $$\int_{a}^{b} f(x) dx = (b-a)\cdot av_f(a,b)$$, i.e. calculate the size of the integration range and multiply it by the average of $f$ within the range.

Average of $f$ in $[a..b]$ range can be calculated in many ways, but my fafourite way is: $$av_f(a,b) = \frac{\sum_{s} f(p_i)}{s}$$, where $p_i$ is a sample taken randomly from integraion range [a..b], and $s$ is number of samples in the sum.

This method can be extended to the situation above, by taking the samples from the given circle. Size of the circle is known/$2\pi r$.

Unfortunately, doing this calculation usually requires computer software, and doing the steps manually by hand is too burdensome, but it's nice for numerical calculations.