Analytic function from $\mathbb D$ to $\mathbb D$ that preserves the boundary is a rational function

Assume that $$f(z)$$ is analytic on the open unit disk and continuous on the boundary $$|z|=1$$ with $$|f(z)|=1$$ if $$|z|=1$$. Show that $$f$$ is a rational function.

My attempt:

Since $$f$$ maps the boundary of the unit disk to the boundary of the unit disk, we can compose $$f$$ with some conformal map $$\varphi$$, such that $$F\colon=\varphi^{-1}\circ f\circ\varphi$$ maps the upper half-plane to the upper half-plane and preserves the real axis. For example, we may set $$\varphi(z)=\frac{z-i}{z+i} .$$ Therefore, we can extend $$F$$ to an entire function with $$F(z)=\overline{F(\bar z)}$$ if $$z$$ lies in the lower half-plane.

Now it suffices to show that $$\infty$$ is a pole then we invoke that every meromorphic function on $$\overline{\mathbb{C}}$$ is a rational function to conclude. But I am stuck... Any help?

Edit:

Can we claim that $$\lim_{z\to\infty}F(z)=\lim_{z\to x_0}z=x_0$$ where $$x_0\in\mathbb R\cup\{\infty\}$$ by tracing the images of the point which goes to infinity?

Since $$f$$ does not vanish on $$|z|=1$$ it follows that it has at most finitely many zeros. Let $$c_1,c_2,...,c_N$$ be the zeros counted according to multiplicities. Consider $$g(z)=\prod_{j \leq N} \frac {z-c_j} {1-\overset {-} {c_j}z }$$. Observe that $$|g(z)|=1$$ when $$|z|=1$$. Verify that $$h(z)=\frac {f{(z)}} {g(z)}$$ is analytic on the open unit disk (ignoring removable singularities) and continuous on the closed disk with no zeros. Apply MMP to $$h$$ and $$\frac 1 h$$ to conclude that $$|h|$$ is a constant. This implies that $$h$$ is a constant and completes the proof.
• Technically, $h$ as written is meromorphic, with removable singularities. Jul 30 '19 at 7:49
• It should be $g(z)=\prod_{j \leq N} \frac {z-c_j} {1-\bar{c_j}z }$ (Blaschke product) if you take the approach. Jul 30 '19 at 8:04
• @MartinR Thank you very much. I was so careless. I indeed wanted $z-c_j$ in the numerator. Jul 30 '19 at 8:08
Yes, your approach works. Just define $$F=\varphi^{-1}\circ f\circ\varphi$$ on the extended upper half-plane $$\overline H = \{ z: \operatorname{Im} z \ge 0 \} \cup \{ \infty \} \subset \hat{\Bbb C} \,.$$ That is possible because $$f$$ is continuous on $$\overline{\Bbb D}$$. Then extend $$F$$ to the lower half-plane via the Schwarz reflection principle, as you did. Now $$F$$ is meromorphic in $$\hat{\Bbb C}$$ and therefore a rational function.
Alternatively extend $$f$$ directly to a meromorphic function on $$\Bbb C$$ via reflection at the unit circle: $$g(z) = \begin{cases} f(z) & \text{ if } |z| \le 1 \\ \frac{1}{\overline{f(1/\bar z)}} &\text{ if } 1 < |z| < \infty . \end{cases}$$ Then $$\lim_{z \to \infty} g(z) = \frac{1}{\overline{f(0)}}$$ so that $$g$$ has a removable singularity or a pole at $$\infty$$, and therefore is a rational function.
• @Bach: $g$ is continuous, because $f(z) \cdot \overline{f(z)} = |f(z)|^2 = 1$ on the unit circle. Jul 30 '19 at 8:09