# When is the square of the module of an analytic function harmonic?

Let $$f$$ be an analytic function. When is $$\lvert f(x+iy) \rvert^2$$ a harmonic function? So we know that if $$f$$ is analytic then $$f = u(x,y) + iv(x,y)$$ and $$u$$ and $$y$$ are both harmonic. So we can write $$\lvert f(x+iy) \rvert^2 = u^2 + v^2 = h(x,y)$$. In order for $$h$$ to be harmonic we need $$h_{xx} + h_{yy} = 0$$. So calculating $$h_x = 2u\cdot u_x + 2v \cdot v_x, \quad h_y = 2u \cdot u_y + 2v \cdot v_y$$ and $$h_{xx} = 2u_x^2 + 2v_x^2 + 2u \cdot u_{xx} + 2v \cdot v_{xx} \\ h_{yy} = 2u_y^2 + 2v_y^2 + 2u \cdot u_{yy} + 2v \cdot v_{yy}$$ So if we need $$h_{xx} + h_{yy} = 0$$ and knowing that $$u$$ and $$v$$ are harmonic we get the criteria $$u_x^2 + u_y^2 + v_x^2 + v_y^2 = 0$$ My question is that is this correct and can this criteria be improved some way?

This can be seen quickly using Wirtinger derivatives. Note that $$\frac{\partial^2}{\partial x^2}+ \frac{\partial^2}{\partial y^2} = 4 \frac{\partial}{\partial z} \frac{\partial}{\partial \overline{z}}$$ and $$\frac{\partial}{\partial z} \frac{\partial}{\partial \overline{z}} \lvert f(z)\rvert^2 = \lvert f’(z)\rvert^2.$$
Note that for any constant $$c \in \mathbb{C}$$ and any holomorphic $$f$$ the difference $$\lvert f(z) \rvert^2 - \lvert f(z)-c \rvert^2$$ is harmonic. In particular if $$\lvert f(z) \rvert^2$$ is harmonic then so is $$\lvert f(z)-c\rvert^2$$. In that case $$\lvert f(z)-f(z_0) \rvert^2$$ is harmonic around $$z_0$$ and by the mean value property of harmonic functions $$\lvert f(z)-f(z_0) \rvert^2$$ must be identically zero around $$z_0$$.