Question on complex self maps of the unit disk This is a question from an old exam that I'm stuck on.
Question: Consider $f$ that is analytic on a domain containing the closure of the disk $D=\{|z|<1\}$ and such that $f(D)\subset D$ and $f(\partial D)\subset\partial D$. Suppose that there is a $w_0\in D$ that has only one preimage in $D$ (i.e, $\{z_0\}=f^{-1}(w_0)\cap D)$. Show that if $f'(z_0)\neq0$ then $f$ is of the form
$$f(z)=e^{i\theta}\frac{z-a}{1-\bar{a}z}$$
for some $a\in D$ and $\theta\in\mathbb{R}$. Give a counter-example with $f'(z_0)=0$. 
Ideas: The counter example was easy just take $f(z)=z^2$. I tried the rest using Schwarz lemma and or Pick's Lemma but didn't get there. Another idea was to use the argument principle to show the number of pre images is constant as $w$ varies over $D$. Which would force the automorphism form. For $w_0$ we have
$$\frac{1}{2\pi i}\int_{\partial D}\frac{f'(z)}{f(z)-w_0}\,\text{d}z=1.$$
How does this hold for any $w\in D$?
 A: I think I found a solution, but it seems a little bit long and complicated. Tell me what you think of it.
For $a \in D$, we define on $\mathbb{C}\setminus\left\lbrace\dfrac{1}{\bar{a}}\right\rbrace$ the function $\phi_a : z \mapsto \dfrac{z-a}{1-\bar{a}z}$.
It is well known that :


*

*$\phi_a$ is an automorphism of $D$

*$\phi_a(\partial D)=\partial D$

*$\phi_a^{-1}=\phi_{-a}$


Then, let us consider $g=\phi_{w_0}\circ f \circ \phi_{z_0}^{-1}=\phi_{w_0}\circ f \circ \phi_{-z_0}$. It is clear that $g(D)=D$ and $g(\partial D)=\partial D$.
We have $g(0)=\phi_{w_0}\circ f \circ \phi_{-z_0}(0)=\phi_{w_0} \circ f (z_0) = \phi_{w_0} (w_0)=0$.
Thus, we can apply Schwarz lemma to $g$. We have $|g(z)|\leq |z|$ for all $z\in D$ and $g'(0)\leq 1$.
Moreover, if $g'(0)=1$ or if there exist $z\in D^*$ such that $|g(z)|=|z|$, then $g=R_\theta$ for a certain $\theta\in\mathbb{R}$, where $R_\theta:z\mapsto e^{i\theta}z$. Then, we would have $f=\phi_{-w_0} \circ R_\theta \circ \phi_{z_0}$, which would end the demonstration (developping this expression, we find that $f$ would be of the wanted form for some $a$ function of $z_0,w_0$ and $\theta$).
We will then procedeed by contradiction : let us suppose that $g'(0)<1$ and $|g(z)|<|z|$ for every $z\in D^*$.
We define $h(z)=\dfrac{g(z)}{z}$ for $z\in \bar{D}^*$ and $h(0)=g'(0)$. Then :


*

*$h$ is holomorphic on $D$, continuous on $\bar{D}$

*$h(D)=D$ (because $g(z)<z$ for $z \in D^*$ and $g'(0)<1$)

*$h(\partial D)=\partial D$


$|h|$ is continous on the compact $\bar{D}$ so it possesses a minimum. It is clear that this minimum is in $D$. So by the maximum modulus principle, $h$ must cancel in $D$.
Yet, $h(0)=g'(0)\neq 0$, because $f'(0)\neq 0$ (composition of derivation gives $g'(0)$ directly proportionnal to $f'(0)$). Thus, there exists $v \in D^*$ such that $h(v)=0$ and then $g(v)=0$, or again $f(\phi_{-z_0}(v))=w_0$. This is in contradiction with the fact that $f^{-1}(w_0)=\lbrace z_0 \rbrace$, which ends the demonstration.
A: By the special case of the residue theorem known as the argument principle, if $h$ is meromorphic on $\overline{V}$, where $V\subset \mathbb{C}$ is a bounded open set with sufficiently regular boundary and $h$ has neither zeros nor poles on $\partial V$,
$$\frac{1}{2\pi i}\int_{\partial V} \frac{h'(z)}{h(z)}\,dz$$
is the number of zeros of $h$ in $V$ minus the number of poles of $h$ in $V$, both counted with multiplicities. In particular, the value of that integral is always an integer.
Taking $h(z) = f(z) - w$ for $w\in D$, the premises are satisfied, since $f(\partial D) \subset \partial D$, $f(z) - w$ has no zero on $\partial D$, and $f(z)-w$ has no poles since $f$ is holomorphic. Thus
$$N(w) = \frac{1}{2\pi i}\int_{\partial D} \frac{f'(z)}{f(z)-w}\,dz$$
is the number of times $f$ attains the value $w$ in $D$, counting multiplicities. Since the integrand depends continuously on $w\in D$, so does the integral. Thus $N \colon D \to \mathbb{Z}$ is continuous, hence constant. By assumption, there is a $w_0\in D$ with $N(w_0) = 1$, and by constancy it follows that $N(w) \equiv 1$ on $D$. That means $f$ attains every $w\in D$ exactly once (counting multiplicities), and since by assumption $f(D)\subset D$, that means that $f$ is a bijection $D\to D$, i.e. an automorphism of $D$. The automorphisms of $D$ are precisely the maps of the form
$$z \mapsto e^{i\theta}\frac{z-a}{1-\overline{a}z}$$
with $a\in D$ and $\theta\in \mathbb{R}$.
