If $ \frac {z^2 + z+ 1} {z^2 -z +1}$ is purely real then $|z|=$? If z is a complex number and $ \frac {z^2 + z+ 1} {z^2 -z +1}$   is purely  real then find the value of $|z|$ .
I tried to put $ \frac {z^2 + z+ 1} {z^2 -z +1} =k $ then solve for $z$ and tried to find |z|, but it gets messy and I am stuck.
The answer given is |z|=1

First note:
$$\frac{z^2 + z + 1}{z^2 - z + 1} = 1 + \frac{2z}{z^2 - z + 1}$$
So the given fraction is real if and only if the fraction $\frac{z}{z^2 - z + 1}$ is real. But a fraction is real if and only if its reciprocal is, so we need:
$$\frac{z^2 - z + 1}{z} = z - 1 + z^{-1}$$
To be a real number. So we get:
$$\boxed{\text{The fraction is real if and only if } z + z^{-1} \text{ is real (or } z= 0).}$$ 
Now if $z = a + bi$, with $z \neq 0$, the imaginary part of $z + z^{-1}$ is $b - \frac{b}{a^2 + b^2} = \frac{b(a^2 + b^2 - 1)}{a^2 + b^2} = \frac{b(|z| - 1)}{|z|}$. Hence we get:
$$\boxed{\text{Either } |z| = 1 \text{ or } z \text{ is real.}}$$
