Q:

Beginner to complex integration

Unfortunately I missed one a week of lectures last week due to a family bereavement and my lecturer doesn't put up her notes (I put a request online if someone could share their notes with me but no one will). I missed quiet an important portion of complex integration. I have searched online for videos or examples but just don't understand whats happening with it. I've attempted a question but don't think I've done it correctly any advice would be brilliant.
Evaluate $$\ \int_C (z^2-z+2)\;dz $$
if C is the upper half of the unit circle (in a counter clockwise direction)
$$\ \int_{-1}^1 (z^2-z+2)\;dz = \left[\frac {z^3} {3}-\frac {z^2}{2}+2z\right]_{-1}^1 $$
$$\ \left[\frac {1} {3}-\frac {1}{2}+2\right] - \left[-\frac {1} {3}-\frac {1}{2}-2\right]$$
$$\ =\frac {14} {3} $$
Do I need to use cos and sin or am I right?
Thanks

A:

Assuming your description of the path of integration $C$ is right (just an arc, not a closed semicircular loop), then you need to parameterize the path. For example, you could take $z=z(t)=e^{it}$ with $t\in [0,\pi]$. The idea is that as $t$ ranges from $0$ to $\pi$, the point $z=e^{it}$ travels along the upper semicircle from $z=e^{0}=1$ to $z=e^{i\pi}=-1$.
Then you would note that $z^2=(e^{it})^2=e^{2it}$ and $dz = \frac{dz}{dt}\;dt=ie^{it}\;dt$, and so write
$$\int_C(z^2-z+2)\;dz = \int_0^{\pi}(\underbrace{e^{2it}-e^{it}+2}_{z^2-z+2})\underbrace{ie^{it}\; dt}_{dz}$$
Simplifying the integrand, 
$$=\int_0^{\pi}(ie^{3it}-ie^{2it}+2ie^{it})\; dt$$
$$=\left[\frac{e^{3it}}{3}-\frac{e^{2it}}{2}+2e^{it}\right]_0^{\pi}$$
$$=\left(-\frac13-\frac12-2\right)-\left(\frac13-\frac12+2\right)$$
$$=-\frac{14}{3}$$
Your solution has two problems: (1) you integrated in the wrong direction, and (2) you didn't parameterize the path correctly (you really used the line segment from $-1$ to $1$). Except for a sign change due to the wrong orientation, your answer matches mine because the integrand is holomorphic so the result of the integral is independent of the path. But even though the answer is (nearly) correct, the technique is wrong as I described.

