Holomorphic function real on $S^1$, then constant on open unit disk. Suppose $f\colon\mathbb{C}\to\mathbb{C}$ is holomorphic and $f(S^1)\subset\mathbb{R}$. It is to show that $f$ is constant on $D:=\{z\in\mathbb{C}: \lvert z\rvert<1\}$.
Hint: For $z\in D$ there exists a Möbius transformation $\varphi_A\colon D\to D$ with $\varphi_A(0)=z$. Consider the composition $g=f\circ\varphi_A$ and apply the fact that if $h\colon\mathbb{C}\to\mathbb{C}$ is holomorphic with $h(S^1)\subset\mathbb{R}$ then $h(0)\in\mathbb{R}$ because it says that $g(0)=f(z)\in\mathbb{R}$ for $z\in D$?
I have literally no idea why I should need this hint!

I write $f=u+iv$ and know that $u$ and $v$ are holomorphic. On $S^1=\partial D$, I have that $v=0$ and thus, by maximum principle, $v=0$ on $D$, i.e. $f$ is real not only on $S^1$ but also on $D$.
Now I think I have to use the open mapping theorem which says that $f$ must be constant on $D$.
So where do I need that strange hint? Is this just an alternative way to argue that $f(D)\subset\mathbb{R}$? Do we have $\varphi_A(S^1)\subset S^1$?
 A: The first step is proving $f(0)\in \mathbb{R}$. This follows from Cauchy integral formula, since
$$f(0)=\frac{1}{2\pi i}\oint_{\partial D}\frac{f(z)}{z}dz=\frac{1}{2\pi}\int_0^{2\pi}f(e^{i\vartheta})d\vartheta \in \mathbb{R}$$
Now, consider a general point $z\in D$. By composing with the suitable Mobius transformation $\varphi$, we consider the function $g(z):=f\circ\varphi$. Since $\varphi:\partial D\to \partial D$, this function still satisfies your hypotesis (i.e. is real on the boundary of $D$), and so thanks to the first step we get $\mathbb{R}\ni g(0)=f(z)$. Since $z$ was chosen general, we obtain the assertion.
Actually, two easy slight generalizations of this result are possible:


*

*With the same hypotesis it follows from the identity principle that $f$ is constant on all of $\mathbb{C}$

*The same conclusion follows if we weaken the hypotesis to $f$ holomorphic in an open set containing $\overline{D}$
The second generalization can be extended still to requiring $f$ to be holomorphic only in $D$ and continuous on $\partial D$, as can be proven by means of the Schwarz reflection principle
