If you find yourself in a hole, stop digging, Will Rogers

Definition. Let $D \subseteq \mathbb{R}^2$ be a domain (open and connected set). A function $\phi (x, y): D \to \mathbb{R}$ is said to be $C^2$ on D if $\phi$ and its partial derivatives $\frac{\partial \phi}{\partial x}, \frac{\partial \phi}{\partial y}, \frac{\partial^2 \phi}{\partial x^2}, \frac{\partial^2 \phi}{\partial y^2}$ are all continuous on D. According to this definition, the following conditions are met.
The standard (stronger) meaning of $C^2$ on D requires all partial derivatives up to order 2 — including the mixed partials — to exist and be continuous on D: $\phi, \frac{\partial \phi}{\partial x}, \frac{\partial \phi}{\partial y}, \frac{\partial^2 \phi}{\partial x^2}, \frac{\partial^2 \phi}{\partial y^2}, \frac{\partial^2 \phi}{\partial y \partial x}, \frac{\partial^2 \phi}{\partial x \partial y}$.
Definition. The Laplacian of a function $\phi (x, y)$ is the sum of its unmixed second partial derivatives $\nabla^2 \phi := \frac{\partial^2 \phi}{\partial x^2} + \frac{\partial \phi^2}{\partial y^2} ↭ \nabla^2 \phi := \phi_{xx}+ \phi_{yy}$.
The Laplace’s equation is the condition $\nabla^2 \phi = 0$, i.e., $\frac{\partial^2 \phi}{\partial x^2} + \frac{\partial^2 \phi}{\partial x^2} = 0$.
The standard notations for the Laplacian of a function $\phi (x, y)$ are $\nabla^2 \phi \text{ or } \Delta \phi $. The standard notations for partial derivatives: $\frac{\partial \phi}{\partial x} \text{ or } \phi_x$ for first partials, and for second partials, $\frac{\partial^2 \phi}{\partial x²} \text{ or } \phi_{xx}$. The superscript 2 on the numerator should precede the variable (applies to the differential operator $\partial$) to denote the second derivative; the notation $\frac{\partial^2 \phi}{\partial x^2}$ means “apply $\frac{\partial}{\partial x}$ twice to $\phi$.”
Definition. A real-valued function $\phi (x, y)$ is harmonic on a domain $D \subseteq \mathbb{R}^2$ if it is $C^2$ on D and satisfies Laplace’s equation: $\nabla^2 \phi = \frac{\partial \phi^2}{\partial x^2} + \frac{\partial \phi^2}{\partial y^2} = 0$.
Let’s try to understand what a harmonic function is. Imagine you have a thin, homogeneous metal plate with no internal heat sources or sinks:
At steady state, the temperature function $u(x,y)$ is harmonic - it satisfies Laplace’s equation: $\nabla^2 u = \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 0$
A harmonic function u(x,y) describes this steady-state temperature at every point (x,y) on the plate.
Consider a small square region around a point (x, y) and examine what Laplace’s equation says about the shape of the surface $z = u(x, y)$ (the second derivative measures concavity - curvature):
The equation $\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 0$ says that at every point, the function curves in the x-direction and y-direction in such a way that they perfectly cancel each other out. It requires that these curvatures exactly balance:
As a consequence, harmonic functions cannot have local maxima (a sharp peek) or minima (a deep well) in the interior of their domain — any interior extremum would represent a point where heat accumulates or depletes, violating the steady-state condition (instead the graph looks like a saddle surface). This is the maximum principle.
The mean value property has a beautiful physical explanation. If you have a steady-state temperature distribution, the temperature at any point must equal the average temperature of its immediate surroundings.
More precisely, if $u$ is harmonic in a domain $D$ and $\overline{B(z_0, r)} \subset D$, then $\boxed{u(x_0, y_0) = \frac{1}{2\pi}\int_0^{2\pi} u(x_0 + r\cos(\theta) y_0 + r\sin(\theta)) d\theta.}$
The value at the center of any disk equals the average over the boundary circle. If the center were hotter than the average of the surrounding ring, heat would flow outward, contradicting the steady state. If it were cooler, heat would flow inward. Equilibrium demands exact equality.
Theorem. Let $f(z) = u(x,y) + iv(x,y)$ be analytic on a domain D (with z = x + iy). Then:
A real-valued function $u(x,y)$ is called harmonic if it satisfies Laplace’s equation: $\Delta u = \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 0 \iff u_{xx} + u_{yy} = 0$. Geometrically, harmonic functions often look like saddles, where the curve curves upward in one direction and downward in the other, perfectly balancing out to zero.
Proof that u is harmonic.
Before we can take second derivatives to check Laplace’s equation, we have to guarantee those second derivatives actually exist.
In real calculus, a function can be differentiable once but not twice. However, complex analysis has a “profound” property: if a complex function is analytic (differentiable even once) on a domain, it is infinitely differentiable ($C^\infty$) on that domain. Because $f(z)$ is infinitely differentiable, its components $u$ and $v$ are also infinitely differentiable. This guarantees two crucial things:
Clairaut’s Theorem. If a function f(x,y) is “smooth enough” (the mixed partial derivatives are continuous in a neighborhood of a point (a, b)) then the order in which you take partial derivatives does not matter: $\frac{\partial^2 f}{\partial x\partial y}=\frac{\partial^2 f}{\partial y\partial x}.$
Because $f(z)$ is analytic, $u$ and $v$ must satisfy the Cauchy-Riemann equations:
Definition. If u(x, y) is a harmonic function on a domain D, a function v(x, y) is called a harmonic conjugate of u if:
Theorem. Harmonic conjugates yield analytic functions. If u(x, y) is a harmonic function on a domain D and v is a harmonic conjugate of u, then f(z) = u(x, y) + iv(x, y) is analytic on D, where z = x + iy.
Proof:
Example. Let $u(x, y) = x^2 - y^2$. Verify harmonicity: $\frac{\partial u^2}{\partial x^2} + \frac{\partial u^2}{\partial x^2} = 2 -2 = 0$.
To find a harmonic conjugate v, we use the Cauchy-Riemann equations: $\frac{\partial u}{\partial x} = 2x = \frac{\partial v}{\partial y}$ and $\frac{\partial u}{\partial y} = -2y = - \frac{\partial v}{\partial x}$
Integrating the first equation $\frac{\partial v}{\partial y} = 2x$ with respect to y: v(x, y) = $\int 2xdy = 2xy + h(x)$ where $h(x)$ is an arbitrary function of x.
Now, differentiate with respect to x and use the second Cauchy-Riemann equation: $\frac{\partial v}{\partial x} = 2y + h'(x) = 2y \text{ (since } -\frac{\partial v}{\partial x} = -2y \leadsto \frac{\partial v}{\partial x} = 2y \text{ ). } \quad \Longrightarrow \quad h(x) = C.$ (a constant). Setting C = 0 for simplicity, v(x, y) = 2xy.
Thus, $f(z) = (x^2 - y^2) + i(2xy) = (x + iy)^2 = z^2$. This is a polynomial, hence entire — confirming the theorem.
The theorem assumes the existence of a harmonic conjugate v on D. For a harmonic conjugate to exist, D must be simply connected (no holes). The harmonic conjugate v is unique up to an additive constant (as seen in the example, where h(x) = C).
Theorem. Existence of Harmonic Conjugates. If $u \in C^2(D)$ is harmonic and D is simply connected, then there exists v with $\frac{\partial u}{\partial x} = \frac{\partial v}{\partial y}$ and $\frac{\partial u}{\partial y} = - \frac{\partial v}{\partial x}$, and $f(z) = u(x, y) + iv(x, y)$ is analytic on D. The conjugate v is unique up to an additive constant.
A harmonic conjugate exists for any harmonic function on a simply connected domain -a domain with no holes, such as a disk, a half-plane or the entire plane.
The following example shows that simple connectivity is essential.
$u(x, y) = \frac{log(x² + y²)}{2}$ is harmonic on the domain $\mathbb{R}^2 \setminus \{(0,0)\}$, but it does not have a single-valued harmonic conjugate on this domain because it is not simply connected.
This is directly related to the topology of the domain $\mathbb{R}^2 \setminus \{(0,0)\}$. This domain is not simply connected because there exist closed curves (specifically, those loops encircling around the origin) that cannot be continuously contracted to a point without leaving the domain.
In topology, a space is simply connected if it’s both. 1. Path‑connected: Any two points in $D$ can be joined by a continuous path lying entirely in $D$. 2. Loop‑shrinkable: Every closed loop in the space can be continuously deformed (contracted) to a single point without leaving the space. Examples: $\mathbb{C}$ itself, open disks, open half-planes, convex sets. Counterexamples: $\mathbb{C} \setminus \{0\}$ (the punctured plane), an annulus, a doughnut shape (torus) — in each case, there exist loops around the missing point(s) or hole(s) that cannot be contracted.
In simply connected domains, every harmonic function has a single-valued harmonic conjugate. However, in domains that are not simply connected, this property is not guaranteed, as we see in this case.
Connection to the complex logarithm. Writing $z = x + i y = re^{i\theta}$ with: $r = |z| = \sqrt{x^2 + y^2}, \theta = \arg(z),$ the complex logarithm is $\log(z) = \underbrace{\ln(r)}_{= \frac{1}{2}\ln(x^2 + y^2) = u(x,y)} + \underbrace{i\theta}_{= iv(x,y)}.$
The real part $u = \frac{1}{2}\ln(x^2 + y^2)$ is single-valued, but the imaginary part $v = \arg(z)$ is multi-valued precisely because $\arg(z)$ is multi-valued (as one loops around the origin $\arg(z)$ increases by $2\pi$), and this is why we must define branches of the logarithm when working with it.
The main question is as follows: Given a harmonic function u, can we always find its partner function (harmonic conjugate, such that f(z) = u + iv is analytic) v? And if so, is it unique?
The Cauchy-Riemann equations give us the exact rules for how $u$ and $v$ must relate: $v_x = -u_y \quad \text{and} \quad v_y = u_x$
The theorem states: In a simply connected domain, every harmonic function has a single-valued harmonic conjugate, which is unique up to an additive constant.
The Blueprint for $v$ (The Total Derivative). If $v(x,y)$ exists, its total change (the total differential $dv$) as we move a tiny amount $dx$ and $dy$ must be: $dv = \frac{\partial v}{\partial x}dx + \frac{\partial v}{\partial y}dy$.
Since we don’t know $v$ yet, we use the Cauchy-Riemann equations to rewrite this entirely in terms of our known function $u$: $dv = -\frac{\partial u}{\partial y} dx + \frac{\partial u}{\partial x} dy$
We call the right side of this equation a 1-form and label it $\omega$. The question now becomes: Is $\omega$ actually the derivative of some real function?
Is the blueprint consistent? (Closed Forms). A 1-form $\omega = P dx + Q dy$ is called closed if it passes the “cross-partial” test: $\frac{\partial P}{\partial y} = \frac{\partial Q}{\partial x}$.
Let’s test our specific $\omega$, where $P = -u_y$ and $Q = u_x$: $\frac{\partial P}{\partial y} = \frac{\partial}{\partial y}(-u_y) = -u_{yy}$ and $\frac{\partial Q}{\partial x} = \frac{\partial}{\partial x}(u_x) = u_{xx}$
For $\omega$ to be closed, these must be equal: $-u_{yy} = u_{xx} \implies u_{xx} + u_{yy} = 0$ and this is exactly Laplace’s equation. Since we already know $u$ is harmonic, $u_{xx} + u_{yy} = 0$ is a guaranteed fact. Therefore, $\omega$ is closed ()
Just because a blueprint is locally consistent doesn’t mean it works globally. If a domain has a hole in it (a “multiply connected” domain, like a donut), integrating around that hole might give you different starting and ending values, making it impossible to define a single, unambiguous function $v$.
A simply connected domain is a space with no holes. The Poincaré Lemma is a powerful theorem that states: On a simply connected domain, every closed form is exact. “Exact” simply means that there is absolute certainty that a parent function $v$ exists such that $dv = \omega$.
Because $\omega$ is exact on a domain with no holes, we can find $v$ by picking a starting point $(x_0, y_0)$ and integrating along any path to our destination (in other words,$v$ can be defined unambiguously via) $(x, y)$: $\boxed{v(x,y) = \int_{(x_0, y_0)}^{(x, y)} \left( -\frac{\partial u}{\partial y} dx + \frac{\partial u}{\partial x} dy \right) + C}$
The question was “if I know the slope of a hill everywhere (dw), can I reconstruct the hill (w) itself?”
Suppose $v_1$ and $v_2$ are two harmonic conjugates of $u$. Both satisfy the same Cauchy–Riemann equations: $\frac{\partial v_1}{\partial y} = \frac{\partial v_2}{\partial y} = \frac{\partial u}{\partial x}, \qquad \frac{\partial v_1}{\partial x} = \frac{\partial v_2}{\partial x} = -\frac{\partial u}{\partial y}.$
Subtracting, $\frac{\partial(v_1 - v_2)}{\partial x} = 0, \qquad \frac{\partial(v_1 - v_2)}{\partial y} = 0.$
The function $v_1 - v_2$ has zero partial derivatives everywhere in $D$. Since $D$ is connected (simply connected domains are always connected), this implies $v_1 - v_2$ is constant throughout $D$. Therefore $v_1 = v_2 + C$ for some constant $C \in \mathbb{R}$.