If f(z) is analytic then u(x,y)=Re(f(x+iy)) is harmonic [duplicate]
Solution 1:
Let $f(z) = f(x + iy) = u(x, y) + iv(x, y)$. Then, if $f$ is holomorphic, it satisfies the Cauchy-Riemann equations: $$\begin{cases} u_x = v_y\\ u_y = -v_x \end{cases}$$
Hence it follows that $$\begin{cases} u_{xx} = v_{yx}\\ u_{yy} = -v_{xy} \end{cases}$$
Now, it is well known that holomorphic functions are infinitely differentiable (this is usually proved after introducing complex integrals), and thus $u, v \in \mathcal C^2$. From Schwarz's theorem we have that $v_{yx} = v_{xy}$ and so we can conclude $$u_{xx} + u_{yy} = v_{yx} - v_{xy} = 0.$$
The same can be said about $v(x, y)$.