The real and imaginary parts of an analytic function are not arbitrary. Differentiating the Cauchy–Riemann equations once more (using mixed partials) shows that each of them solves Laplace's equation, the equation of steady heat flow and electrostatics. This link is one reason complex analysis matters in physics.
🔑 Key idea
A real function $u(x, y)$ with continuous second partials is harmonic if $u_{xx} + u_{yy} = 0$. If $f = u + iv$ is analytic, then $u$ and $v$ are harmonic. Conversely, if $u$ is harmonic on a disk, there is a harmonic conjugate $v$ (unique up to adding a constant) with $u + iv$ analytic; find it from $v_y = u_x$ and $v_x = -u_y$.
💡 Why it works
From $u_x = v_y$, differentiate in $x$: $u_{xx} = v_{yx}$. From $u_y = -v_x$, differentiate in $y$: $u_{yy} = -v_{xy}$. Mixed partials are equal (an analytic function has continuous partials of all orders, proved later in the course), so $u_{xx} + u_{yy} = v_{yx} - v_{xy} = 0$. The same argument works for $v$.
$u = x^2 - y^2 = \operatorname{Re}(z^2)$ is a saddle: curving up in one direction exactly as much as it curves down in the other, so $u_{xx} + u_{yy} = 2 - 2 = 0$. A harmonic function has no peaks or pits inside its domain.
Worked examples
✏️ Worked example: Testing for harmonic
Is $u = x^3 - 3xy^2 + y$ harmonic? Is $u = x^2 + y^2$?
First: $u_{xx} = 6x$ and $u_{yy} = -6x$, so the sum is $0$: harmonic (it is $\operatorname{Re}(z^3 - iz)$).
Second: $u_{xx} + u_{yy} = 2 + 2 = 4 \ne 0$: not harmonic, so $x^2 + y^2$ is not the real part of any analytic function.
Answer: yes; no
✏️ Worked example: Finding a harmonic conjugate
Find $v$ with $v(0, 0) = 0$ so that $u + iv$ is analytic, for $u = x^2 - y^2 + 3x$.
$v_y = u_x = 2x + 3$. Integrate in $y$: $v = 2xy + 3y + g(x)$, where $g$ is any function of $x$ (it disappears when we differentiate in $y$).
$v_x = 2y + g'(x)$ must equal $-u_y = 2y$, so $g'(x) = 0$ and $g$ is a constant.
$v(0, 0) = 0$ makes the constant $0$: $v = 2xy + 3y$. Check: $u + iv = z^2 + 3z$.
Answer: $v = 2xy + 3y$
✏️ Worked example: An exponential example
Find the harmonic conjugate of $u = e^x\cos y$ with $v(0, 0) = 0$.
$v_y = u_x = e^x\cos y$, so $v = e^x\sin y + g(x)$.
$v_x = e^x\sin y + g'(x)$ must equal $-u_y = e^x\sin y$, so $g$ is constant, and $v(0, 0) = 0$ makes it $0$.
$v = e^x\sin y$, and $u + iv = e^x(\cos y + i\sin y) = e^z$.
Answer: $v = e^x\sin y$
A geometric bonus: where $f'(z) \ne 0$, the level curves $u = c_1$ and $v = c_2$ cross at right angles, because $\nabla u \cdot \nabla v = u_xv_x + u_yv_y = u_xv_x - v_xu_x = 0$ by the Cauchy–Riemann equations. In a steady flow, $u$ can be the potential and $v$ the stream function: the flow lines cross the equipotential lines at right angles.
⚠️ Common mistake
Adding a plain constant after integrating. When you integrate $v_y = u_x$ with respect to $y$, the "constant" of integration can be any function $g(x)$, because $\frac{\partial}{\partial y}g(x) = 0$. Example: $u = x^2 - y^2 + 5y$. Then $v_y = 2x$ gives $v = 2xy + g(x)$, and $v_x = 2y + g'(x)$ must equal $-u_y = 2y - 5$, so $g(x) = -5x$ and $v = 2xy - 5x$. Writing $v = 2xy + C$ would miss the $-5x$. Always finish with the check $v_x = -u_y$.
Practice
Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.