Let f be an entire function that satisfies the property $f(\mathbb{R}) \subset \mathbb{R}$.
Consider the power series of f: $$f(z) = \sum_{k=0}^\infty a_k z^k \ .$$ The question I'm asking myself is: Do all $a_k$ have to be real?
It seems like this should be true, because if at least one coefficient was not real, then one ought to be able to find some $x$ for which $f(x)$ is not real. However, I'm having difficulties proving this formally. Here is my attempt:
Let $x \in \mathbb{R}$. Then $$f(x) = \sum_{k=0}^\infty a_k x^k \ .$$ Therefore $$\Im(f(x)) = \Im(\sum_{k=0}^\infty a_k x^k) = \sum_{k=0}^\infty \Im(a_k) x^k = 0 \ .$$ Let $$g(z) = \sum_{k=0}^\infty \Im(a_k) z^k$$ which has a positive radius of convergence because f is analytic. Then $$g(\mathbb{R}) = 0$$ and since $\mathbb{R}$ has a limit point in $\mathbb{C}$, it follows by the identity theorem that $$g(z) = 0 \ \ \forall z \in \mathbb{C}$$ and therefore $$\Im(a_k) = 0 \ \ \forall k \ .$$
The points where I'm not quite sure is moving the $\Im( \dots )$ into the sum and applying the identity theorem by constructing $g$.
I appreciate any feedback on whether the proof holds (or perhaps whether or not the statement is true at all).
The statement is correct and your proof is also correct.
The function $v: \mathbb C \to \mathbb C$, defined by $v(z)=\Im (z)$, is continuous, hence, if $z_n \to z_0$, then $v(z_n) \to v(z_0)$. As a consequence we have: if $ \sum_{n=0}^{\infty}c_n$ is a convergent series, then
$$\Im(\sum_{n=0}^{\infty}c_n)=v(\sum_{n=0}^{\infty}c_n)=\sum_{n=0}^{\infty}v(c_n)=\sum_{n=0}^{\infty}\Im(c_n).$$