An Exercise from Chapter 2 of Stein's Complex Analysis I have been working through Stein and Shakarchi's Complex Analysis and I'm stuck on Exercise 15 from Chapter 2. The question states:
Suppose $f$ is a non-vanishing continuous function on $\overline{D}$ that is holomorphic in $D$. Prove that if
$$|f(z)| = 1$$
whenever $|z|=1$, then $f$ is constant. [Hint: Extend $f$ to all of $\mathbb{C}$ by $f(z) = 1/\overline{f(1/\overline{z})}$ whenever $|z|>1$, and argue as in the Schwarz Reflection Principle.]
I have made some progress with the hint. Namely I have shown that $1/\overline{f(1/\overline{z})}$ is holomorphic whenever $|z|>1$. Furthermore, since $|f(z)|=1$ whenever $|z|=1$, we know that the following function is well defined:
$$ g(z) = \begin{cases} 
      f(z) & |z|<1 \\
      f(z) = 1/\overline{f(1/\overline{z})} & |z|=1 \\
      1/\overline{f(1/\overline{z})} & |z|>1 
   \end{cases}
$$
However, since we only have continuity at $|z|=1$, I'm not sure how we can use something like the Symmetry Principle to conclude that $g$ is a holomorphic function on $\mathbb{C}$. Once we have this, I'm pretty sure that we can deduce by Liouville's Theorem that $g$ is constant since it would be bounded and entire.
Any hints or suggestions would be greatly appreciated.
 A: Since this seems to be a popular question, here is my full-credit solution:
Consider the following function
$$g(z) = \begin{cases} 
      f(z) & \text{ if }|z|\leq 1 \\
      \frac{1}{\overline{f(1/\overline{z})}} & \text{ if }|z|\geq 1 
   \end{cases}
$$
Note that $g$ is well defined since $\frac{1}{\overline{z}} = z$ for $z$ such that $|z| = 1$, $|f(z)| = 1$ whenever $|z| = 1$, and
$$\frac{1}{\overline{f(1/\overline{z})}} = \frac{1}{\overline{f(z)}} = f(z)$$
We now verify that $\frac{1}{\overline{f(\frac{1}{\overline{z}}})}$ is holomorphic for $|z|>1$. Since $f(z)$ is holomorphic and non-vanishing on $D$, we know that $\frac{1}{f(\frac{1}{z})}$ is holomorphic for $z \in \mathbb{C}$ such that $|z|>1$ as it is the composition of holomorphic functions. Thus, by Theorem 4.4 in Chapter 2 of Stein, for every $z_0 \in \mathbb{C}$ such that $|z_0|>1$, there is a disc centered at $\overline{z_0}$ such that $\frac{1}{f(\frac{1}{z})} = \sum_{n=0}^\infty a_n(z-\overline{z_0})^n$. Then,
$$\frac{1}{\overline{f(\frac{1}{\overline{z}}})} =\sum_{n=0}^\infty\overline{a_n}(z-z_0)^n$$
Thus, $\frac{1}{\overline{f(\frac{1}{\overline{z}}})}$ is holomorphic on $\big\{z \in \mathbb{C}:|z|>1\big\}$. We claim that $\int_T g(z)dz =0$ for every triangle in the complex plane. By Cauchy's Theorem, we know that if a triangle is completely inside $D$ or $\big\{z:|z|>1\big\}$, $\int_Tg(z)dz = 0$. Consider now a triangle as that depicted below:

Zooming in on the region of intersection,

We then see by Cauchy's theorem that the only contributor to $\int_T g(z)dz$ is the following contour

Note here that the treatment of the case where the triangle touches the unit disk at one point is in the proof Stein provides of the Symmetry Principle in Chapter 2. If we continue this process for both triangles in the above diagram, and continue doing so for those that follow, the resultant limiting line integrals will be zero. Thus, we conclude that
$$\int_T g(z)dz = 0$$
for all triangles in the complex plane. Thus, by Morera's Theorem, $g$ is holomorphic in $\mathbb{C}$. Furthermore, as $g$ is clearly bounded, we know by Liouville's Theorem that $g$ is constant. We conclude then that $f$ is constant.
For those who potentially need it, there are lots of free copies of Stein's text online. Here is a link that I use: Complex Analysis
A: Why not use maximal modules thm in D?We want to prove that |f(z)|=1 in D,then f(z) is a constant.If |f(z0)|<1 ,then we can see 1/f,and use the maximal modules thm to contradict.
