How do I compute $ \int _{C} (z^3 + 2z +{\bf Re} z)\,dz$ where C is a triangle of vertices $z=0$, $z=1+2i $ and $z=1$.
The solution given is $i$
Anyone showing me how to deal with these problems will be extremely helpful, as this entire subject quite unclear to me.
The function $z^3+2z$ in triangle is analytic so it's integral over $C$ is zero. With paramerization of $C$ we have \begin{cases} C_1:~t+2it&0\leq t\leq1, \\ C_2:~1+2i(1-t)&0\leq t\leq1, \\ C_3:~1-t&0\leq t\leq1. \end{cases} this parametrization is counter-clockwise (according to the vertices in the question), so we split the integral over $C$: \begin{align} \int_{C} (z^3 + 2z +{\bf Re} z)dz &= \int_{C} {\bf Re} z\,dz \\ &= \int_{C_1} {\bf Re} z\,dz+\int_{C_2} {\bf Re} z\,dz+\int_{C_3} {\bf Re} z\,dz \\ &= \int_0^1t(1+2i)\,dt+\int_0^1-2i\,dt+\int_0^1(1-t)(-1)\,dt \\ &= \int_0^1(2t+2it-2i-1)\,dt \\ &= \color{blue}{-i} \end{align} if we change the direction of path, we will have $i$ as answer instead of $-i$.