$$\int_{\gamma} \frac{dz}{z^{2}+z+1} = 0.$$
I know that by Cauchy's Theorem, if $f$ is analytic everywhere on and inside a simple closed curve, then $\int_{\gamma} f(z)\,dz = 0$. So I thought that the above equation would hold for any simple closed curve not containing the roots of the denominator.
However, the solution in the book says it is true for any closed curve containing neither OR both of the roots.
I don't get the “or both” part.
Edit: Part of my confusion lies in the fact that in my class, we did an example:
$$\int_{|z|=9} \frac{-3z+2}{(z-6)(z-2)}\,dz$$ where both roots lied in the region, and yet the answer was non-zero. So it seems that the “or both” part is not always true, but for the problem I am working on it is true. Can someone explain the difference?
Edit#2: In the case that one of the roots lies outside the curve, say, the root $-\frac{1}{2}-\frac{\sqrt3i}{2}$, this means that the integral $\int_{\gamma}\frac{1}{z+\frac{1}{2}+\frac{\sqrt3i}{2}}$ is analytic everywhere in that curve, and so it has value $0$. Then the other integral has value some constant multiplied by $2\pi i$, and so the sum of the two integrals is non-zero.
Is edit#2 correct?
If $r$ and $s$ are the roots of $x^2+x+1$, then$$\frac1{x^2+x+1}=\frac1{(x-r)(x-s)}=\frac{\frac1{s-r}}{x-s}-\frac{\frac1{s-r}}{x-r}.$$Therefore (in the “both” case),$$\int_\gamma\frac1{x^2+x+1}\,\mathrm dz=2\pi i\left(\frac1{s-r}-\frac1{s-r}\right)=0.$$