TITLE: If $f$ is a complex polynomial such that $f(z) \in \mathbb{R}$ whenever $|z| = 1$, then $f$ is constant.
QUESTION [5 upvotes]: Let $f \in \mathbb{C}[z]$ a complex polynomial such that $f(S^1) \subset \mathbb{R},$ where
  $$
S^1 = \{ z \in \mathbb{C} : |z| = 1 \}.
$$
  Show that $f$ is constant.

My attempt is: define a function $g(z) = e^{if(z)}$ and plug some roots of unity in $g,$ but how can I conclude from this?
I know that if $\Omega$ is open, connected and $f(\Omega) \subset \mathbb{R},$ then $f$ is constant.

REPLY [2 votes]: The imaginary part $\text{Im}\;f(z)$ of $f(z)$ is harmonic, and zero on the unit circle, hence by the maximum principle for harmonic functions, we conclude that  $\text{Im}\;f(z)$ is identically zero in the ball.  Thus $f$ is real in the ball.  Of course a non-constant real function cannot have complex derivative at $0$; in particular $f$ is not a polynomial.