Holomorphic function mapping a set onto a straight line

I wonder if this is correct: there is a holomorphic function on an open connected subset $G$ of $\mathbb{C}$ which maps $G$ onto a subset of a straight line, and I have to show that the function is constant.

I thought I can suppose that the straight line is the real axis (otherwise I can find a rotation and a traslation that will do so) and so using the Cauchy-Riemann equations I find that the function is constant since its imaginary part is zero. Is that correct? Thank you


See the Open mapping theorem: the image of an open set in a non-constant holomorphic function is open. No non-empty subset of a line is open, so if the image is contained in a line, the function must be constant.

That said, proving the open mapping theorem may depend on already having results like the one you ask for. In that case your approach is fine.

Here's an informal way of looking at it: pick a point $z$ in the domain of $f$ and reason that sufficiently close to $z$, $f$ is well-approximated by multiplication by $f^\prime(z)$, which is a scale and/or rotation of the complex plane. Hence there must be some direction you can go from $z$ such that $f(z)$ moves away from the line, unless $f^\prime(z)$ is $0$. So if you always stay within a line, $f^\prime(z)$ must always be $0$, i.e. $f$ must be constant. This approach uses no heavy machinery, just basic facts about the derivative.


The open mapping theorem says that any nonconstant analytic function is an open map. A map taking an open subset of the plane into a line cannot be open; therefore, it is constant.