Graph Geodesics via the Calculus of Variations

Length and energy have the same minimizers, and energy is the one worth varying.

This is the third in a series of posts on multiple ways to compute the geodesic equation for surfaces in R3\mathbb{R}^3 described as the graph of a function z=f(x,y)z=f(x,y). I’ve ended up re-doing these calculations several times in the past while writing various programs, so want to record them in one spot for my future reference (and hopefully, the benefit of others!).

The two previous notes got to the same pair of equations twice over: first by grinding out the Christoffel symbols of the induced metric and expanding γ˙γ˙=0\nabla_{\dot\gamma}\dot\gamma=0 in coordinates, and then much more quickly by stepping out into R3\mathbb{R}^3 and asking that the acceleration be normal to the surface. Both of them assume we already know what a geodesic is. Here we do something different - we ask for the shortest path, and let the equation come out. This is the only one of the three routes that defines a geodesic instead of assuming one.

We keep the notation of the previous notes. The graph is parameterized by F(x,y)=(x,y,f(x,y))F(x,y)=(x,y,f(x,y)), and a curve on it is specified by giving xx and yy as functions of time,

γ(t)=(x(t),y(t),f(x(t),y(t)))\gamma(t)=\left(x(t),\,y(t),\,f(x(t),y(t))\right)

Throughout, a dot is a time derivative along the curve, so that in particular

f˙=ddtf(x(t),y(t))=fxx˙+fyy˙\dot{f}=\frac{d}{dt}f(x(t),y(t))=f_x\dot{x}+f_y\dot{y}

which is exactly the vertical component of the velocity. This lets us write the speed with no reference to the metric components at all:

γ˙2=x˙2+y˙2+f˙2\|\dot\gamma\|^2=\dot{x}^2+\dot{y}^2+\dot{f}^2

Length, and Varying It

The obvious thing to minimize is the length,

L[γ]=abγ˙dt\mathcal{L}[\gamma]=\int_a^b\|\dot\gamma\|\,dt

but it is not obvious what minimizing it should even mean. The domain of L\mathcal{L} is the set of all curves joining two points, which is infinite dimensional, and not the sort of thing we can differentiate over directly.

The calculus of variations gets around this by never looking at the whole space at once. Pick a curve γ\gamma, and pick any smooth one parameter family γs\gamma_s passing through it at s=0s=0, with every member sharing γ\gamma‘s endpoints. Such a family is a variation: a one dimensional slice through the space of curves. Restricted to that slice L[γs]\mathcal{L}[\gamma_s] is just a real valued function of the single variable ss, and we know what to do with those. If γ\gamma is shortest among all curves then it is shortest along every slice through it, so

ddss=0L[γs]=0for every variation γs\frac{d}{ds}\Big|_{s=0}\mathcal{L}[\gamma_s]=0\hspace{1cm}\text{for every variation } \gamma_s

That’s the whole strategy, and in principle we could stop right here: expand the derivative in coordinates, demand it vanish for every variation, and read off a differential equation. Nobody does, because the integrand γ˙=x˙2+y˙2+f˙2\|\dot\gamma\|=\sqrt{\dot{x}^2+\dot{y}^2+\dot{f}^2} has a square root in it. Every derivative of it has the square root too, and the equations come out in a form that needs cleaning up before it is any use.

Energy

The standard fix is to square the integrand and be rid of the root. Define the energy

E[γ]=12abγ˙2dt=12ab(x˙2+y˙2+f˙2)dt\mathcal{E}[\gamma]=\frac{1}{2}\int_a^b\|\dot\gamma\|^2\,dt=\frac{1}{2}\int_a^b\left(\dot{x}^2+\dot{y}^2+\dot{f}^2\right)dt

This is a polynomial in the velocities, so varying it is routine. The question is whether we are still varying the same thing. Squaring is not an innocent operation on an integral: g2\int g^2 and (g)2\left(\int g\right)^2 are different objects, and there is no general reason a minimizer of one should minimize the other.

Along a slice the two graphs do move together, and both are stationary in the same place. That is no coincidence.

TheoremLength and Energy Have the Same Minimizers

Among curves γ ⁣:[a,b]S\gamma\colon[a,b]\to S with fixed endpoints,

L[γ]22(ba)E[γ]\mathcal{L}[\gamma]^2\le 2(b-a)\,\mathcal{E}[\gamma]

with equality if and only if γ˙\|\dot\gamma\| is constant. Consequently the minimizers of E\mathcal{E} are exactly the minimizers of L\mathcal{L} traversed at constant speed.

The inequality is Cauchy-Schwarz applied to the functions 11 and γ˙\|\dot\gamma\| on [a,b][a,b]:

(ab1γ˙dt)2(ab12dt)(abγ˙2dt)=(ba)2E[γ]\left(\int_a^b 1\cdot\|\dot\gamma\|\,dt\right)^2\le\left(\int_a^b 1^2dt\right)\left(\int_a^b\|\dot\gamma\|^2dt\right)=(b-a)\cdot 2\mathcal{E}[\gamma]

and Cauchy-Schwarz is an equality precisely when the two functions are proportional, which here means γ˙\|\dot\gamma\| is constant.

To see why that gives what we want, take any curve γ\gamma. Traversing the same route at constant speed leaves L\mathcal{L} alone and drops E\mathcal{E} all the way to L2/2(ba)\mathcal{L}^2/2(b-a), the smallest value it could possibly have for that length. So every curve can be improved in energy without changing its length, and the ones that cannot be improved are exactly the constant speed ones. Minimizing E\mathcal{E} finds the shortest route and, among the many ways of walking it, insists on the one that wastes nothing.

Reparameterization

That last point deserves a section of its own, because it is a reason to prefer E\mathcal{E} even setting the square root aside.

Length is reparameterization invariant: it depends on the route and not on the schedule. Walk the same path faster here and slower there and L\mathcal{L} doesn’t change at all. This is not a small blind spot. The reparameterizations of a single curve form an infinite dimensional family, an entire flat valley on which L\mathcal{L} is constant, and a variation along that valley is a slice where L\mathcal{L} is not merely stationary but identically equal to its value at the center:

E\mathcal{E} isn’t fooled. Along the same slice it has a strict minimum, and by the equality case above that minimum sits exactly at the constant speed schedule.

This is what makes E\mathcal{E} the functional to vary. L\mathcal{L} can’t determine x(t)x(t) and y(t)y(t), and no differential equation could, since L\mathcal{L} gives the same value to every reparameterization and has nothing to tell them apart with. E\mathcal{E} picks out a single parametrized curve from that valley, which is the sort of thing a pair of differential equations can describe. So we go looking for them.

One consequence before we start. Geodesics are usually said to be affinely parameterized, and that is usually presented as an extra condition imposed by hand. It isn’t: it’s the equality case of Cauchy-Schwarz, and it shows up whether we ask for it or not.

The Euler-Lagrange Equations

So we minimize

E=12ab(x˙2+y˙2+f˙2)dt\mathcal{E}=\frac{1}{2}\int_a^b\left(\dot{x}^2+\dot{y}^2+\dot{f}^2\right)dt

Write Λ=12(x˙2+y˙2+f˙2)\Lambda=\frac{1}{2}\left(\dot{x}^2+\dot{y}^2+\dot{f}^2\right) for the integrand and vary xx first. The only place xx and x˙\dot{x} appear is through f˙=fxx˙+fyy˙\dot{f}=f_x\dot{x}+f_y\dot{y}, so

Λx˙=x˙+f˙f˙x˙=x˙+f˙fxΛx=f˙f˙x=f˙(fxxx˙+fxyy˙)\begin{align*} \frac{\partial\Lambda}{\partial\dot{x}}&=\dot{x}+\dot{f}\frac{\partial\dot{f}}{\partial\dot{x}}=\dot{x}+\dot{f}f_x\\ \frac{\partial\Lambda}{\partial x}&=\dot{f}\frac{\partial\dot{f}}{\partial x}=\dot{f}\left(f_{xx}\dot{x}+f_{xy}\dot{y}\right) \end{align*}

Now take the total time derivative of the first of these, remembering that fxf_x is being evaluated along the curve so that ddtfx=fxxx˙+fxyy˙\frac{d}{dt}f_x=f_{xx}\dot{x}+f_{xy}\dot{y}:

ddtΛx˙=x¨+f¨fx+f˙(fxxx˙+fxyy˙)\frac{d}{dt}\frac{\partial\Lambda}{\partial\dot{x}}=\ddot{x}+\ddot{f}f_x+\dot{f}\left(f_{xx}\dot{x}+f_{xy}\dot{y}\right)

The Euler-Lagrange equation sets this equal to Λ/x\partial\Lambda/\partial x, and the entire last term cancels against it:

x¨+f¨fx=0\ddot{x}+\ddot{f}f_x=0

The same computation in yy gives the companion, and together they are startlingly simple:

x¨=fxf¨y¨=fyf¨\ddot{x}=-f_x\ddot{f}\hspace{1cm}\ddot{y}=-f_y\ddot{f}

The horizontal acceleration is the gradient of ff, scaled by the vertical acceleration and pointing the other way. Everything the surface does to the particle is in that one number f¨\ddot{f}.

Solving for the Vertical Acceleration

The equations above are not yet explicit, because f¨\ddot{f} contains x¨\ddot{x} and y¨\ddot{y}. Differentiating f˙=fxx˙+fyy˙\dot{f}=f_x\dot{x}+f_y\dot{y} once more,

f¨=(fxxx˙+fxyy˙)x˙+fxx¨+(fxyx˙+fyyy˙)y˙+fyy¨=fxxx˙2+2fxyx˙y˙+fyyy˙2+fxx¨+fyy¨\begin{align*} \ddot{f}&=\left(f_{xx}\dot{x}+f_{xy}\dot{y}\right)\dot{x}+f_x\ddot{x}+\left(f_{xy}\dot{x}+f_{yy}\dot{y}\right)\dot{y}+f_y\ddot{y}\\ &=f_{xx}\dot{x}^2+2f_{xy}\dot{x}\dot{y}+f_{yy}\dot{y}^2+f_x\ddot{x}+f_y\ddot{y} \end{align*}

Abbreviate the second-derivative terms as A=fxxx˙2+2fxyx˙y˙+fyyy˙2A=f_{xx}\dot{x}^2+2f_{xy}\dot{x}\dot{y}+f_{yy}\dot{y}^2 and substitute the two equations we just derived:

f¨=A+fx(fxf¨)+fy(fyf¨)=A(fx2+fy2)f¨\begin{align*} \ddot{f}&=A+f_x\left(-f_x\ddot{f}\right)+f_y\left(-f_y\ddot{f}\right)\\ &=A-\left(f_x^2+f_y^2\right)\ddot{f} \end{align*}

which is now a linear equation in f¨\ddot{f} alone:

(1+fx2+fy2)f¨=A\left(1+f_x^2+f_y^2\right)\ddot{f}=A

    f¨=A1+fx2+fy2\implies \ddot{f}=\frac{A}{1+f_x^2+f_y^2}

Putting this back into x¨=fxf¨\ddot{x}=-f_x\ddot{f} proves, for the third time, the theorem of the series:

TheoremGeodesics on a Graph

If γ(t)=(x(t),y(t))\gamma(t)=(x(t),y(t)) is a geodesic on the graph (x,y,f(x,y))(x,y,f(x,y)) of a function f ⁣:R2Rf\colon\mathbb{R}^2\to\mathbb{R}, then x¨=fxfxxx˙2+2fxyx˙y˙+fyyy˙21+fx2+fy2\ddot{x}=-f_x\frac{f_{xx}\dot{x}^2+2f_{xy}\dot{x}\dot{y}+f_{yy}\dot{y}^2}{1+f_x^2+f_y^2} y¨=fyfxxx˙2+2fxyx˙y˙+fyyy˙21+fx2+fy2\ddot{y}=-f_y\frac{f_{xx}\dot{x}^2+2f_{xy}\dot{x}\dot{y}+f_{yy}\dot{y}^2}{1+f_x^2+f_y^2}

← All notes