Let $G$ be a connected set and $f : G \rightarrow \mathbb{C}$ a real valued analytic function. Prove that $f$ is constant.
My idea to prove the result is to prove a subset $A \neq \varnothing$ of the connected set $G$ is both open and closed. So $G=A$ Take $f(w) = a$ $$A = \{z\colon z \in G, f(z) = a\}$$ Now I want to show that $A$ is infinite. How to do it? After that it is easy to prove $A=G$.