If $|f|$ is constant, so is $f$ for $f$ analytic on a domain $D$.

I'm reading through a development of the maximum modulous principle, but I am stuck verifying a remark:

$$\text{"it is enough to show that |f| is constant, from which we may conclude that f is.''}$$

So I am trying to prove it as a lemma:

Let $f$ be analytic on a domain $D$. If $|f|$ is constant then so is $f$.

I tried using the fact that $|f|$ constant implies $|f|$ is analytic.

From here this means that $Re(|f(x,y)|)$ is harmonic.

I wrote out the consequence to this using Laplace's Equation, hoping to force the partial derivatives of $f$ to vanish, but it didn't seem to go anywhere.

Any suggestions?

-
damien's answer is correct. also note that more generally, every holomorphic function is either open (ie the image of any open set is open) or constant. –  Glougloubarbaki Feb 4 '13 at 22:11
@Glougloubarbaki: Well, yes, as long as your domain is connected, which I'm sure you meant to say. –  J. Loreaux Feb 4 '13 at 22:16
@J.Loreaux : yes. for some people (me among them!) "domain" means connected open set –  Glougloubarbaki Feb 4 '13 at 22:17

Let $f=u+iv$ be analytic on some domain $D$. Suppose the modulus is constant, so $u^2+v^2$ is constant. It follows that $$u\frac{\partial u}{\partial x}+v\frac{\partial v}{\partial x}=0$$ and $$u\frac{\partial u}{\partial y}+v\frac{\partial v}{\partial y}=-u\frac{\partial v}{\partial x}+v\frac{\partial u}{\partial x}=0.$$ These imply that $\dfrac{\partial u}{\partial x}=0=\dfrac{\partial v}{\partial x}$ save when $u^2+v^2$ vanishes. This follows by considering the matrix equation $$\left(\begin{array}{cc} u & v\\ v & -u\end{array}\right)\left(\begin{array}{c} \frac{\partial u}{\partial x}\\ \frac{\partial v}{\partial x}\end{array}\right)=0$$ However, if $u^2+v^2=0$ at some point, then it is constantly $0$ in which case $f(z)$ vanishes identically.