Holomorphic function satisfying $f^{-1}(\Bbb R)=\Bbb R$ is of the form $f(z)=az+b$
Solution 1:
The answer provided in this link uses the big Picard theorem. But that is a big weapon to use here. Here's a proof based on a more elementary result. Below $H_+,H_-$ denote the open upper and lower half planes.
Theorem: Suppose $v$ is continuous on $\overline {H_+},$ $v$ is positive and harmonic on $H_+,$ and $v=0$ on $\mathbb R.$ Then there exists $a>0$ such that $v(x,y) = ay$ for all $(x,y)\in \overline {H_+}.$
I'll sketch a proof of the theorem below. For now, on to our problem: The hypotheses imply $f(H_+)\subset H_+\cup H_-.$ Since $H_+,H_-$ are disjoint nonempty open sets, we have by continuity and connectedness that one of the following holds: i) $f(H_+)\subset f(H_+)$ ii) $f(H_+)\subset H_-.$ Suppose WLOG i) holds.
Writing $f=u+iv,$ we then see that $v,$ restricted to $\overline {H_+},$ satisfies the hypotheses of the theorem. Note also that since $f:\mathbb R\to \mathbb R,$ we have $f(\bar z) = \overline {f(z)}.$ This implies $v(x,-y) = -v(x,y).$ The theorem thus implies there is $a>0$ such that $v(x,y) = ay$ everywhere.
From this it follows easily that $u(x,y) = ax +b$ for some real constant $b.$ Thus $f(x+iy) = a(x+iy) + b$ as desired.
Proof of Thm: The analogue for the unit disc is better known. There we would have $v$ continuous on $\overline {\mathbb D}\setminus \{1\},$ $v$ positive and harmonic on $\mathbb D,$ and $v=0$ on the boundary minus the point $1.$ In this situation, $v$ must be a positive constant multiple of $(1-|z|^2)/|1-z|^2,$ which you will recognize as the Poisson kernel for the disc, based at $1.$ This result falls right out of the representation of positive harmonic functions in the disc as Poisson integrals of finite positive measures on the boundary. For us the important thing is that all of these functions are positive constant multiples of each other. Via a conformal map of $\mathbb D$ onto $H_+$ that takes $1$ to $\infty,$ we see the same is true for the functions in the theorem. Since we know one such function, namely $(x,y)\to y,$ we have the desired conclusion.