Problem 2: Calculate directly the integral $\int_{L} Re(z)\ dz$ where L is the path,consisting of two $\frac{1}{4}$-circles of radius 3 and 1 centered at 0 and two straight segment on the figure.
Answer:
Consider $L_1$ be the line from 1 to 3:
$L_1: \gamma_1(x) = x$, $x \in [1,3]$, and $\gamma_1'(x) = 1$
Consider $L_2$ be the curve of circle centered at 0 with radius $r=3$:
$L_2: \gamma_2(t) = 3e^{it}$, $t \in [0,\frac{\pi}{2}]$, and $\gamma_2'(t) = 3ie^{it}$
Consider $L_3$ be the line from 3i to i:
$L_3: \gamma_3(y) = iy$, $y \in [3,1]$, and $\gamma_3'(y) = i$
Consider $L_4$ be the curve of circle centered at 0 with radius $r=4$:
$L_4: \gamma_4(t) = e^{it}$, $t \in [\frac{\pi}{2},0]$, and $\gamma_4'(t) = ie^{it}$
Let $f(z)=Re(z)$.
$f(\gamma_1(x))=x$
$f(\gamma_2(t))=3cost$
$f(\gamma_3(y))=0$
$f(\gamma_4(t))=cost$
Now, we have
\begin{align*}
\int_{L} Re(z)\ dz &= \int_{L_1} f(\gamma_1(x))\gamma_1'(x)\ dx+\int_{L_2} f(\gamma_2(t))\gamma_2'(t)\ dt+\int_{L_3} f(\gamma_3(y))\gamma_3'(y)\ dy+\int_{L_4} f(\gamma_4(t))\gamma_4'(t)\ dt\\
&= \int_{1}^{3} x\ dx + \int_{0}^{\frac{\pi}{2}} 3cost \cdot3ie^{it}\ dt+\int_{3}^{1}0\cdot i\ dy+\int_{\frac{\pi}{2}}^{0} cost \cdot ie^{it}\ dt\\
&= (\frac{1}{2}x^2)|_{1}^{3}+9i\int_{0}^{\frac{\pi}{2}} cos^2t+isintcost\ dt+i\int_{\frac{\pi}{2}}^{0} cos^2t+isintcost\ dt\\
&= (\frac{9}{2}-\frac{1}{2}) +8i\int_{0}^{\frac{\pi}{2}} \frac{cos2t+1}{2}+i\frac{sin2t}{2}\ dt\\
&= 4 +8i(\frac{sin2t}{4}+\frac{1}{2}-i\frac{cos2t}{4})|_{0}^{\frac{\pi}{2}}\\
&=4 +8i(0+\frac{\pi}{4}+\frac{1}{2}i)\\
&=4+2\pi i -4\\
&=2\pi i
\end{align*}
Therefore, $\int_{L} Re(z)\ dz =2\pi i$