Drag to orbit

A point crawls along the sphere $x^2 + y^2 + z^2 = 9$. We know the surface bends - but how much does it bend? Can we measure the curvature without ever solving for $z$?

The Setup - Slopes We Already Know

Let's start with something familiar. We have a surface defined implicitly - say the sphere $x^2 + y^2 + z^2 = 9$. We can't easily write $z = \ldots$ in a neat formula (well, for a sphere we can, but imagine a more complicated surface where we genuinely can't).

From §2.10, we already know how to find first-order slopes. The key trick: differentiate the whole equation $F(x, y, z(x,y)) = 0$ with respect to $x$, then solve for $z_x$. This gives us:

$$\frac{\partial z}{\partial x} = -\frac{F_x}{F_z} \qquad \frac{\partial z}{\partial y} = -\frac{F_y}{F_z}$$

Try it on the sphere below. Drag the sliders to move along the surface - the orange tangent plane shows the local slope at each point. Notice how the plane tilts more steeply as you approach the equator.

Drag to orbit
z = 2.236 z_x = -0.447 z_y = -0.447

Differentiating Once - Where the Formula Comes From

Before we go to second derivatives, let's make sure we really understand the first. It turns out there's a lovely little mechanism behind that $-F_x/F_z$ formula.

We start from $F(x, y, z(x,y)) = 0$. This is true for all $x$ and $y$ near our point. So we can differentiate both sides with respect to $x$ (holding $y$ constant). The chain rule gives us three contributions - and watch them light up:

$F_x$ $+$ $F_z$ $\cdot$ $\dfrac{\partial z}{\partial x}$ $= 0$

Two sources of change when we nudge $x$: the direct effect ($F_x$) and the indirect effect through $z$ ($F_z \cdot z_x$). Solve for $z_x$ and you get our formula:

$$\frac{\partial z}{\partial x} = -\frac{F_x}{F_z}$$

Why the minus sign? Think about it: if increasing $x$ pushes $F$ up ($F_x > 0$), then $z$ has to decrease to keep $F = 0$. The surface compensates.

Differentiating Twice - The Big Formula

Now here's where it gets interesting. We already have the equation $F_x + F_z \cdot z_x = 0$. What if we differentiate this again with respect to $x$?

This is the most genius step: every term in $F_x + F_z \cdot z_x = 0$ is itself a function of $x$ (both directly and through $z$), so we need the chain rule again - and for the $F_z \cdot z_x$ piece, the product rule too. It's a bit of a chain-rule explosion:

$F_{xx}$ $+$ $F_{xz}\,z_x$ $+$ $\bigl(F_{zx}\,z_x + F_{zz}\,z_x^2\bigr)$ $+$ $F_z\,z_{xx}$ $= 0$

I'll be honest - this looks intimidating at first glance. But notice: $z_{xx}$ appears in exactly one place (the last term). Everything else involves $F$-partials and $z_x$, which we already know. So we solve for $z_{xx}$ and substitute $z_x = -F_x/F_z$:

$$\frac{\partial^2 z}{\partial x^2} = -\frac{F_{xx}\,F_z^2 - 2F_{xz}\,F_x\,F_z + F_{zz}\,F_x^2}{F_z^3}$$

Don't memorize this - understand its three pieces:

Mixed Partials - Does the Order Matter?

What if we differentiate $z_x$ with respect to $y$ instead of $x$? We'd get the mixed partial $z_{xy}$. And we could also start from $z_y$ and differentiate with respect to $x$ to get $z_{yx}$.

A natural question: should we expect $z_{xy} = z_{yx}$? Clairaut's theorem says yes - as long as $F$ has continuous second partials, the order doesn't matter. But here's a nice sanity check: let's derive both and watch them match.

The mixed partial comes from differentiating $z_x = -F_x/F_z$ with respect to $y$. Using the quotient rule (remembering that $F_x$ and $F_z$ both depend on $y$ through $z$):

$$\frac{\partial^2 z}{\partial x\,\partial y} = -\frac{(F_{xy} + F_{xz}\,z_y)\,F_z - F_x\,(F_{zy} + F_{zz}\,z_y)}{F_z^2}$$

The trap: It's tempting to forget that $F_x$ depends on $y$ through $z$. When you differentiate $F_x$ with respect to $y$, you need $F_{xy} + F_{xz} \cdot z_y$, not just $F_{xy}$. This is the single most common mistake on exams.

Try it on the ellipsoid below. Move the point around - you'll see $z_{xy}$ and $z_{yx}$ always agree, confirming Clairaut's theorem in action.

Drag to orbit
z_xy = ? z_yx = ? Symmetric

Derivative Playground

Now let's put the whole machinery to work. Pick any surface, move the point around, and watch all six quantities update in real time - $z$, both first partials, and all three second partials. No explicit formula for $z$ needed anywhere.

Drag to orbit
z
--
z_x
--
z_y
--
z_xx
--
z_yy
--
z_xy
--

A Harmonic Function Hiding in Plain Sight

The function $f = \arctan(y/x)$ is the angle in polar coordinates - the $\theta$ you've been drawing since trig class. It has a singularity at the origin (the angle isn't defined there). But away from the origin, is it harmonic?

Predict before computing: the angle function $\theta = \arctan(y/x)$ is smooth and well-behaved everywhere except the origin. Does its Laplacian vanish?

Let's find out. We need $f_{xx} + f_{yy}$ and hope it equals zero.

Step 1: First partials. Using the chain rule with $u = y/x$:

$$f_x = \frac{1}{1+(y/x)^2}\cdot\frac{-y}{x^2} = \frac{-y}{x^2+y^2}, \qquad f_y = \frac{1}{1+(y/x)^2}\cdot\frac{1}{x} = \frac{x}{x^2+y^2}$$

Step 2: Second partials. Let $r^2 = x^2+y^2$. Differentiating $f_x = -y(x^2+y^2)^{-1}$ with respect to $x$:

$$f_{xx} = -y \cdot \frac{-2x}{(x^2+y^2)^2} = \frac{2xy}{(x^2+y^2)^2}$$

And differentiating $f_y = x(x^2+y^2)^{-1}$ with respect to $y$:

$$f_{yy} = x \cdot \frac{-2y}{(x^2+y^2)^2} = \frac{-2xy}{(x^2+y^2)^2}$$

Step 3: The Laplacian.

$$\nabla^2 f = f_{xx} + f_{yy} = \frac{2xy}{(x^2+y^2)^2} + \frac{-2xy}{(x^2+y^2)^2} = 0 \;\checkmark$$

The cancellation is exact. And there's a deep reason: $\arctan(y/x)$ is the imaginary part of $\log(x+iy)$, and every analytic function's real and imaginary parts are harmonic. We keep seeing this pattern - the complex-analytic connection is no coincidence.

The Biharmonic Equation - Applying the Laplacian Twice

Every harmonic function solves $\nabla^2 f = 0$. What if we apply the Laplacian twice - requiring $\nabla^2(\nabla^2 f) = 0$? That's the biharmonic equation, and it governs elasticity and plate bending in engineering.

$$\nabla^4 f \;=\; \nabla^2(\nabla^2 f)$$

If $f$ is harmonic, then $\nabla^2 f = 0$. So $\nabla^4 f = \nabla^2(0) = 0$. One line. Done. Every harmonic function is automatically biharmonic.

But the converse is false. Here's a clean counterexample.

Take $f = x^2 + y^2$. Its Laplacian:

$$\nabla^2 f = \frac{\partial^2}{\partial x^2}(x^2+y^2) + \frac{\partial^2}{\partial y^2}(x^2+y^2) = 2 + 2 = 4 \neq 0$$

So $f = x^2+y^2$ is not harmonic. But now apply the Laplacian again:

$$\nabla^4 f = \nabla^2(4) = 0$$

The Laplacian of a constant is zero. So $x^2+y^2$ is biharmonic but not harmonic.

Predict: the gap between harmonic and biharmonic is exactly the functions whose Laplacian is a nonzero constant. Can you see why? If $\nabla^2 f = c$ for some constant $c$, then $\nabla^4 f = \nabla^2(c) = 0$, but $\nabla^2 f \neq 0$ whenever $c \neq 0$.

The trap: don't confuse "biharmonic" with "twice harmonic." Biharmonic means $\nabla^4 f = 0$, which is weaker than $\nabla^2 f = 0$. Every harmonic function passes the biharmonic test, but many biharmonic functions fail the harmonic test. The hierarchy goes one way only.

Practice Problems - §2.18

From Kaplan, problems after §2.18

1(a) Find $\dfrac{\partial^2 w}{\partial x^2}$ and $\dfrac{\partial^2 w}{\partial y^2}$ if $w = \dfrac{1}{\sqrt{x^2 + y^2}}$
Find $\dfrac{\partial^2 w}{\partial x^2}$ and $\dfrac{\partial^2 w}{\partial y^2}$ if $w = \dfrac{1}{\sqrt{x^2 + y^2}}$.

Step 1: Find $\partial w/\partial x$

We write $w = (x^2 + y^2)^{-1/2}$ and use the chain rule:

$$\frac{\partial w}{\partial x} = -\tfrac{1}{2}(x^2+y^2)^{-3/2}\cdot 2x = -\frac{x}{(x^2 + y^2)^{3/2}}$$

Step 2: Find $\partial^2 w/\partial x^2$

Differentiate $w_x = -x(x^2+y^2)^{-3/2}$ using the product rule:

$$\frac{\partial^2 w}{\partial x^2} = -(x^2+y^2)^{-3/2} + 3x^2(x^2+y^2)^{-5/2}$$
$$= \frac{-(x^2+y^2) + 3x^2}{(x^2+y^2)^{5/2}} = \frac{2x^2 - y^2}{(x^2+y^2)^{5/2}}$$

Step 3: Find $\partial^2 w/\partial y^2$ by symmetry

The function $w = 1/\sqrt{x^2+y^2}$ treats $x$ and $y$ symmetrically - swapping $x \leftrightarrow y$ gives $w_{yy}$:

$$\frac{\partial^2 w}{\partial y^2} = \frac{2y^2 - x^2}{(x^2+y^2)^{5/2}}$$

Step 4: Verify with the Laplacian (formula 2.138)

Kaplan notes that formula (2.138) can be used as a check. The 2D Laplacian $\nabla^2 w = w_{xx} + w_{yy}$:

$$\nabla^2 w = \frac{2x^2 - y^2 + 2y^2 - x^2}{(x^2+y^2)^{5/2}} = \frac{x^2+y^2}{(x^2+y^2)^{5/2}} = \frac{1}{(x^2+y^2)^{3/2}}$$

This is nonzero, so $w = 1/\sqrt{x^2+y^2}$ is not harmonic in 2D - unlike $\log\sqrt{x^2+y^2}$, which is. (In 3D, $1/r$ is harmonic - that's a nice contrast for Problem 3.)

2(b) Verify three third-order mixed partials are identical for $w = \sqrt{x^2 + y^2 + z^2}$
Verify that $\dfrac{\partial^3 w}{\partial x\,\partial y\,\partial z}$, $\dfrac{\partial^3 w}{\partial z\,\partial y\,\partial x}$, and $\dfrac{\partial^3 w}{\partial y\,\partial z\,\partial x}$ are identical for $w = \sqrt{x^2 + y^2 + z^2}$.

Step 1: First partials

Let $r = \sqrt{x^2+y^2+z^2}$, so $w = r$. By the chain rule:

$$w_x = \frac{x}{r}, \quad w_y = \frac{y}{r}, \quad w_z = \frac{z}{r}$$

Step 2: Second mixed partials

Differentiating $w_z = z/r$ with respect to $y$:

$$w_{yz} = \frac{\partial}{\partial y}\!\left(\frac{z}{r}\right) = -\frac{yz}{r^3}$$

Similarly $w_{yx} = -xy/r^3$ and $w_{zx} = -xz/r^3$. Notice all have the same structure $-(\text{product of two coords})/r^3$.

Step 3: Route 1 - $\frac{\partial}{\partial x}\frac{\partial}{\partial y}\frac{\partial w}{\partial z} = \frac{\partial}{\partial x}\bigl(-yz/r^3\bigr)$

$$= -yz\cdot\frac{-3x}{r^5} = \frac{3xyz}{r^5}$$

Step 4: Routes 2 and 3

Route 2: $\frac{\partial}{\partial z}\frac{\partial}{\partial y}\frac{\partial w}{\partial x} = \frac{\partial}{\partial z}\bigl(-xy/r^3\bigr) = -xy\cdot\frac{-3z}{r^5} = \dfrac{3xyz}{r^5}$ ✓

Route 3: $\frac{\partial}{\partial y}\frac{\partial}{\partial z}\frac{\partial w}{\partial x} = \frac{\partial}{\partial y}\bigl(-xz/r^3\bigr) = -xz\cdot\frac{-3y}{r^5} = \dfrac{3xyz}{r^5}$ ✓

All three give $3xyz/r^5$. The symmetry of $w = r$ makes this inevitable - each differentiation pulls down one coordinate and adds a factor of $-1/r^2$, so the result is always $3xyz/r^5$ regardless of order.

3(a) Show that $w = e^x \cos y$ is harmonic in $x$ and $y$
Show that $w = e^x \cos y$ is harmonic in $x$ and $y$ - that is, $\nabla^2 w = \dfrac{\partial^2 w}{\partial x^2} + \dfrac{\partial^2 w}{\partial y^2} = 0$.

Step 1: Compute $\partial w/\partial x$ and $\partial^2 w/\partial x^2$

Since $\cos y$ is just a constant with respect to $x$:

$$\frac{\partial w}{\partial x} = e^x \cos y, \qquad \frac{\partial^2 w}{\partial x^2} = e^x \cos y$$

Step 2: Compute $\partial w/\partial y$ and $\partial^2 w/\partial y^2$

Now $e^x$ is the constant factor:

$$\frac{\partial w}{\partial y} = -e^x \sin y, \qquad \frac{\partial^2 w}{\partial y^2} = -e^x \cos y$$

Step 3: Check the Laplacian

$$\nabla^2 w = \frac{\partial^2 w}{\partial x^2} + \frac{\partial^2 w}{\partial y^2} = e^x \cos y + (-e^x \cos y) = 0 \;\checkmark$$

The two second derivatives cancel perfectly. This is no accident - $e^x \cos y$ is the real part of $e^{x+iy} = e^z$, and real parts of analytic functions are always harmonic. That connection between complex analysis and the Laplacian is one of the most beautiful facts in mathematics.

3(b) Show that $w = x^3 - 3xy^2$ is harmonic
Show that $w = x^3 - 3xy^2$ is harmonic in $x$ and $y$ - that is, $\nabla^2 w = \dfrac{\partial^2 w}{\partial x^2} + \dfrac{\partial^2 w}{\partial y^2} = 0$.

Step 1: Compute $\partial^2 w/\partial x^2$

Differentiating with respect to $x$ (treating $y$ as constant):

$$w_x = 3x^2 - 3y^2, \qquad w_{xx} = 6x$$

Step 2: Compute $\partial^2 w/\partial y^2$

Now differentiating with respect to $y$:

$$w_y = -6xy, \qquad w_{yy} = -6x$$

Step 3: Check the Laplacian

$$\nabla^2 w = w_{xx} + w_{yy} = 6x + (-6x) = 0 \;\checkmark$$

This is no accident: $x^3 - 3xy^2$ is the real part of $(x+iy)^3 = x^3 + 3x^2(iy) + 3x(iy)^2 + (iy)^3 = (x^3-3xy^2) + i(3x^2y - y^3)$. Real parts of analytic functions are always harmonic.

4(b) Show that $xe^x\cos y$ is biharmonic
Show that $w = xe^x\cos y$ is biharmonic - that is, $\nabla^4 w = \nabla^2(\nabla^2 w) = 0$.

Step 1: Second partials of $w = xe^x\cos y$

We need $w_{xx}$ and $w_{yy}$:

$$w_x = (x+1)e^x\cos y, \qquad w_{xx} = (x+2)e^x\cos y$$
$$w_y = -xe^x\sin y, \qquad w_{yy} = -xe^x\cos y$$

Step 2: Compute $\nabla^2 w$

$$\nabla^2 w = (x+2)e^x\cos y + (-xe^x\cos y) = 2e^x\cos y$$

So $w$ is not harmonic (the Laplacian is nonzero). But we need to check whether the Laplacian of the Laplacian vanishes.

Step 3: Compute $\nabla^4 w = \nabla^2(2e^x\cos y)$

From Problem 3(a), we already showed that $e^x\cos y$ is harmonic - its Laplacian is zero. Therefore:

$$\nabla^4 w = \nabla^2(2e^x\cos y) = 2\,\nabla^2(e^x\cos y) = 2 \cdot 0 = 0 \;\checkmark$$

This is a nice example of the distinction: $xe^x\cos y$ is biharmonic but not harmonic. The biharmonic condition $\nabla^4 w = 0$ is strictly weaker than the harmonic condition $\nabla^2 w = 0$.

4(d) Choose constants $a$, $b$, $c$, $d$ so that $ax^3 + bx^2y + cxy^2 + dy^3$ is harmonic
Choose the constants $a$, $b$, $c$, $d$ so that $ax^3 + bx^2y + cxy^2 + dy^3$ is harmonic.

Step 1: Compute the second partials

Let $w = ax^3 + bx^2y + cxy^2 + dy^3$. We need $w_{xx}$ and $w_{yy}$:

$$w_{xx} = 6ax + 2by, \qquad w_{yy} = 2cx + 6dy$$

Step 2: Apply the harmonic condition

Setting $\nabla^2 w = w_{xx} + w_{yy} = 0$ for all $x$ and $y$:

$$\nabla^2 w = (6a + 2c)x + (2b + 6d)y = 0$$

For this to vanish identically, the coefficient of $x$ and the coefficient of $y$ must each be zero.

Step 3: Solve the system

We get two equations:

$$6a + 2c = 0 \implies c = -3a$$
$$2b + 6d = 0 \implies b = -3d$$

Two degrees of freedom remain: $a$ and $d$ are free. For example, taking $a = 1$, $d = 0$ gives $w = x^3 - 3xy^2$, which is exactly Problem 3(b). Taking $a = 0$, $d = 1$ gives $w = -3x^2y + y^3 = -(3x^2y - y^3)$, the imaginary part of $(x+iy)^3$. The general harmonic cubic is a linear combination of these two.