<s>[INST] 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.
 [/INST] 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.
</s>