Let $z = x + yi,$ where $x$ and $y$ are real numbers.  Since $|z| = 1,$ $x^2 + y^2 = 1.$  Then
\begin{align*}
|1 + z| + |1 - z + z^2| &= |1 + x + yi| + |1 - x - yi + x^2 + 2xyi - y^2| \\
&= |(1 + x) + yi| + |(1 - x + x^2 - 1 + x^2) + (-y + 2xy)i| \\
&= |(1 + x) + yi| + |(-x + 2x^2) + (-y + 2xy)i| \\
&= \sqrt{(1 + x)^2 + y^2} + \sqrt{(-x + 2x^2)^2 + (-y + 2xy)^2} \\
&= \sqrt{(1 + x)^2 + y^2} + \sqrt{(-x + 2x^2)^2 + y^2 (1 - 2x)^2} \\
&= \sqrt{(1 + x)^2 + 1 - x^2} + \sqrt{(-x + 2x^2)^2 + (1 - x^2) (1 - 2x)^2} \\
&= \sqrt{2 + 2x} + \sqrt{1 - 4x + 4x^2} \\
&= \sqrt{2 + 2x} + |1 - 2x|.
\end{align*}Let $u = \sqrt{2 + 2x}.$  Then $u^2 = 2 + 2x,$ so
\[\sqrt{2 + 2x} + |1 - 2x| = u + |3 - u^2|.\]Since $-1 \le x \le 1,$ $0 \le u \le 2.$

If $0 \le u \le \sqrt{3},$ then
\[u + |3 - u^2| = u + 3 - u^2 = \frac{13}{4} - \left( u - \frac{1}{2} \right)^2 \le \frac{13}{4}.\]Equality occurs when $u = \frac{1}{2},$ or $x = -\frac{7}{8}.$

If $\sqrt{3} \le u \le 2,$ then
\[u + u^2 - 3 = \left( u + \frac{1}{2} \right)^2 - \frac{13}{4} \le \left( 2 + \frac{1}{2} \right)^2 - \frac{13}{4} = 3 < \frac{13}{4}.\]Therefore, the maximum value is $\boxed{\frac{13}{4}}.$
Question:
Let $z$ be a complex number such that $|z| = 1.$  Find the maximum value of
\[|1 + z| + |1 - z + z^2|.\]
Answer:
Let's think step by step.

user
\frac{13}{4}
Let $z$ be a complex number such that $|z| = 1.$  Find the maximum value of
\[|1 + z| + |1 - z + z^2|.\]
test