Calculating $\int_{\gamma}(\cos z+z^2)dz$

I would like to calculate the integral:

$\int_{\tau}(\cos z+z^2)dz$, where $\tau$ is described by $z(t)=e^{it}$, $0\leq t\leq \pi$.

It appears to me that this is already parametrized, so I do:

  1. $z=e^{it}$, $dz=ie^{it}dt$.
  2. Boundary of integration $0\leq t\leq \pi$.
  3. Set up the integral with variable t and considering the first integral to be substituted $u=e^{it}, du=ie^{it}dt$:

\begin{equation} i\int_0^{\pi}\cos(e^{it})e^{it}dt+i\int_0^{\pi}e^{2it}e^{it}dt=\int_{ln^{-i}(0)}^{ln^{-i}(\pi)}\cos(u)du+i\int_0^{\pi}e^{3it}dt\\=-i\sin(e^{it})|_{ln^{-i}(0)}^{ln^{-i}(\pi)}+\frac{ie^{3it}}{3}|_0^{\pi}. \end{equation}

But $-i\sin(e^{it})|_{ln^{-i}(0)}^{ln^{-i}(\pi)}$, is not defined.


Since an antiderivative of $\cos(z)+z^2$ is $\sin(z)+\frac{z^3}3$, you have\begin{align}\int_\tau\cos(z)+z^2\,\mathrm dz&=\left.\sin(z)+\frac{z^3}3\right|_{z=\tau(0)}^{z=\tau(\pi)}\\&=-\sin(1)-\sin(1)-\frac13-\frac13\\&=-2\sin(1)-\frac23.\end{align}


A separate approach. Let $f(z)=\cos(z)+z^{2}$

You have the contour of integration being the semi-circular arc in the anticlock direction. So you complete the semi-circular perimeter by joining the two endpoints $-1+0i$ and $1+0i$. with the arrow pointing towards right to maintain the anticlock direction. Now this closed contour say $\gamma$ is the sum of $\gamma_{1}$ and $\gamma_{2}$ where $\gamma_{1}$ is the semi-circular one and $\gamma_{2}$ is the line along the x-axis.

Here's a picture :-

enter image description here

Then you have by Cauchy-Goursat Theorem, the integral over $\gamma=\gamma_{1}+\gamma_{2}$ is $0$ as $\cos(z)+z^{2}$ is analytic everywhere and hence within this semicircular region also.

So $$\int_{\gamma_{1}}f(z)\,dz+\int_{\gamma_{2}}f(z)\,dz=\int_{\gamma}f(z)\,dz=0$$.

So $$\int_{\gamma_{1}}f(z)\,dz=-\int_{\gamma_{2}}f(z)\,dz$$.

But $\displaystyle\int_{\gamma_{2}}f(z)\,dz$ can be calculated easily as $z=x$ along this contour(well just a segment of x-axis).

It is just $$\displaystyle\int_{-1}^{1}f(x)dx=\int_{-1}^{1}\cos(x)dx+\int_{-1}^{1}x^{2}dx=2\sin(1)+\frac{2}{3}$$.

So $$\int_{\gamma_{1}}f(z)\,dz=-\int_{\gamma_{2}}f(z)\,dz=-(2\sin(1)+\frac{2}{3})$$