Complex integral Let $C$ denote the unit circle  centered at the origin in Complex Plane
What is the value of 
$$ \frac{1}{2\pi i}\int_C |1+z+z^2 |dz,$$ where the integral is taken anti-clockwise along $C$?


*

*0

*1

*2

*3


What I have answered is 0 because it seems like $f(z)$ is analytic at 0 hence by Cauchy's Theorem.
 A: HINT
Note that if $z = x+yi$ then
$$
\left|1+z+z^2\right| 
  = \left|\left(x^2-y^2+x+1\right) +y(2x+1)i\right|
$$
Now parameterize $C$ as $x = \cos t, y = \sin t$ and $t \in [0,2\pi]$, then
$$
\int_C |1+z+z^2 |dz
  = \int_{t=0}^{t=2\pi} \left|\left(x^2-y^2+x+1\right) +y(2x+1)i\right|
$$
where $x,y$ are functions of $t$ as in the parameterization. Can you finish this?
A: Put $z=e^{it}, 0\le t\le 2π$ and $dz=i.e^{it}dt$.
So $I_1=\int_0^{2π}|1+e^{it}+e^{i2t}|^2ie^{it}dt=i\int_0^{2π}(1+e^{it}+e^{i2t})(1+e^{-it}+e^{-i2t})e^{it}dt$
$=i\int_0^{2π}g(t)dt$, where $g(t)$ is the integrand and $g(2π+t)=g(t)$. So $I_1=...$
A: We want the integral
$$\frac{1}{2\pi i}\int_C |1+z+z^2|dz=\frac{1}{2\pi}\int_0^{2\pi}|1+z+z^2|z~d\theta$$
since $z=e^{i\theta}$.
Now consider the absolute value portion,
$$
\begin{align}
|1+z+z^2|
&=\sqrt{(1+z+z^2)(1+z+z^2)^*}\\
&=\sqrt{(1+z+z^2)(1+z^{-1}+z^{-2})}\\
&=\sqrt{(1+z+z^2)(1+z^{-1}+z^{-2})\frac{z^2}{z^2}}\\
&=\sqrt{\left(\frac{1+z+z^2}{z} \right)^2}\\
&=\sqrt{\left(\frac{1}{z}+1+z \right)^2}\\
&=\sqrt{(1+2\cos\theta)^2}\\
&=|1+2\cos\theta|
\end{align}
$$
We can return to solve the integral
$$
\begin{align}\frac{1}{2\pi i}\int_C |1+z+z^2|dz
&=\frac{1}{2\pi}\int_0^{2\pi}|1+2\cos\theta|(\cos\theta+i\sin\theta)~d\theta\\
&=\frac{1}{2\pi}\int_0^{2\pi}|1+2\cos\theta|\cos\theta~d\theta\\
&=\frac{1}{3}+\frac{\sqrt{3}}{2\pi}\approx0.60900
\end{align}$$
This is in agreement with our own numerical solution as well as that of others noted previously.
