Maximize absolute value of complex logarithm

I'm trying to solve exercise 9 in chapter 14 of Real & Complex Analysis of Walter Rudin:

Suppose $g \in H(U), |\Re(g)|<1$ in $U$, and $g(0)=0$. Prove that $$|g(re^{it})|\le\frac2\pi\log\frac{1+r}{1-r}$$ $U$ is the unit disc.


My thoughts:

Call $\Omega = \{x+iy:-1<x<1\}$. I constructed a one-to-one conformal mapping from $\Omega$ to $ U$:$$f(z) = -i\frac{\exp(\frac\pi2iz)-1}{\exp(\frac\pi2iz)+1}$$ I applied the Schwarz lemma to $f\circ g$ to get:$$\left| \frac{\exp(\frac\pi2ig(re^{it}))-1}{\exp(\frac\pi2ig(re^{it}))+1} \right| \le r$$

But no matter how I manipulate it, I cannot get $|g(re^{it})|$ out of it.


Another approach: Use the inverse of $f$:$$f^{-1}(z) = \frac2{\pi i}\log\frac{1+iz}{1-iz}$$

By using this question and the maximum modulus principle I get: $$|g(re^{it})| \le \max_{t\in[0,2\pi]} |f^{-1}(re^{it})|$$

The right side reaches its maximum at $re^{3\pi i/2}$ per wolfram alpha, but I cannot do it via algebra or calculus (equations and derivatives too complicated).


I feel there is an easier way and I'm missing something. What is it?


Short version $$ \left|\log\frac{1+z}{1-z}\right|=2\left|\int_0^z \frac{d\zeta}{1-\zeta^2}\right| \le 2 \int_0^{|z|} \frac{dt}{1-t^2} =\log\frac{1+|z|}{1-|z|} \tag1$$

Long version

The geometrically natural way to do this is in terms of the hyperbolic (a.k.a. Poincaré) metric, which Rudin does not introduce. It unifies various versions of the Schwarz lemma into a simple statement: "holomorphic maps are contractions in the hyperbolic metric". The hyperbolic metric on $U$ is $$ \rho_U(a,b)=\inf_\gamma \int_\gamma\frac{|d\gamma|}{1-|\gamma|^2} \tag2$$ where the infimum is taken over all curves connecting $a$ to $b$. In this metric every point $z\in U$ with $|z|=r$ is at distance
$$\rho_U(z,0)=\int_0^r \frac{1}{1-r^2}\,dr=\frac{1}{2}\log\frac{1+r}{1-r} \tag3$$ from the origin. The hyperbolic distance between $g(z)$ and $g(0)=0$ in the domain $\Omega$ is no greater than $\rho_U(z,0)$. Using the conformal invariance of the hyperbolic metric, one finds that
$$ \rho_\Omega(a,b)=\inf_\gamma \int_\gamma \frac{\pi}{4}\frac{|d\gamma|}{\cos ( (\pi/2) \operatorname{Re}\gamma)} \tag4$$ This is not as easy to calculate, but since the determinant is at most $1$, we have $\rho_\Omega(a,b)\ge \frac{\pi}{4}|a-b|$. Conclusion: $$ |g(z)-g(0)|\le \frac{4}{\pi}\rho_\Omega(g(z),g(0))\le \frac{4}{\pi}\rho_U(z,0) = \frac{2}{\pi} \log\frac{1+|z|}{1-|z|} \tag5$$