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.
Let $B$ be the open unit ball centered at the origin. Then its closure $\bar{B}$ is the closed unit ball centered at the origin, and its boundary $\partial B$ is the unit circle $S^1$. We are given that $f(\partial B) \subset \Bbb{R}$. Suppose for the sake of contradiction that $f$ is a nonconstant polynomial function.
We show that $\partial(f(B)) \subset f(\partial B)$. Since $\bar{B}$ is compact, and the continuous image of a compact set is compact, $f(\bar{B})$ is compact. By the Heine-Borel theorem, $f(\bar{B})$ is closed and bounded. Hence, $$ B \subset \bar{B} \implies f(B) \subset f(\bar{B}) \implies \overline{f(B)} \subset \overline{f(\bar{B})} = f(\bar{B}). $$ Therefore, $$ \overline{f(B)} \subset f(\bar{B}).\tag{$*$} $$ Now, by definition we have $\partial(f(B)) = \overline{f(B)} \setminus f(B)^o$, where $f(B)^o$ is the interior of $f(B)$. Since polynomial functions are holomorphic, by the open mapping theorem $f(B)$ is open, so $f(B)^o = f(B)$. Using this and $(*)$, we get $$ \partial(f(B)) = \overline{f(B)} \setminus f(B)^o \subset f(\bar{B}) \setminus f(B) \subset f(\bar{B} \setminus B) = f(\partial B). $$
Hence, $$ \partial(f(B)) \subset f(\partial B) \subset \Bbb{R}.\tag{$\dagger$} $$
Now, since $f(B) \subset f(\bar{B})$ which is bounded, $f(B)$ is a bounded open subset of $\Bbb{C}$. Therefore, $f(B)$ must have boundary points lying outside $\Bbb{R}$ as well, which contradicts $(\dagger)$. To see why this is true, choose any $z \in f(B)$ and suppose wlog that $\mathrm{Im}(z) \geq 0$. Consider the vertical ray in the upper half plane starting at $z$, given by $\{ z + it : t \geq 0 \}$. Since $f(B)$ is bounded, there exists $t \geq 0$ such that $z+it \not\in f(B)$. Let $s = \inf \{t \geq 0 : z+it \not\in f(B)\}$. Then, $s$ exists and $s > 0$, and the point $z+is$ is a boundary point of $f(B)$ that does not lie on the real axis. (If $\mathrm{Im}(z) \leq 0$, then we consider the vertical ray in the lower half plane starting at $z$ and arrive at a contradiction in a similar manner.)
Thus, we have a contradiction, and hence $f$ must be constant.