Transforming Coordinates with the Calculus of Variations

Coordinate Transformations via the Calculus of Variations

Coordinate Transformations for ODEs

Readers familiar with theoretical mechanics will already appreciate how useful the calculus of variations can be for changing coordinate systems. For example, suppose we want to transform the equations of the planar two-body problem

$$\left\{\begin{aligned}\frac{d^2 x}{dt^t}=\frac{-\mu x}{(x^2+y^2)^{3/2}}\\ \frac{d^2 y}{dt^t}=\frac{-\mu y}{(x^2+y^2)^{3/2}}\end{aligned}\right.\tag{1}$$

into polar coordinates. Substituting directly and grinding through the computation would be a rather tedious affair. But we know that these equations are nothing more than the Lagrange equations obtained by varying the action

$$S=\int \left[\frac{1}{2}\left(\dot{x}^2+\dot{y}^2\right)+\frac{\mu}{\sqrt{x^2+y^2}}\right]dt\tag{2}$$

so we can instead perform the coordinate transformation directly on the action. Since the action generally only involves first-order derivatives, transforming the action tends to be much simpler. For instance, it's easy to write down that $(2)$ in polar coordinates takes the form

$$S=\int \left[\frac{1}{2}\left(\dot{r}^2+r^2\dot{\theta}^2\right)+\frac{\mu}{r}\right]dt\tag{3}$$

Varying $(3)$, the resulting Lagrange equations are

$$\left\{\begin{aligned}&\ddot{r}=r\dot{\theta}^2-\frac{\mu}{r^2}\\ &\frac{d}{dt}\left(r^2\dot{\theta}\right)=0\end{aligned}\right.\tag{4}$$

and just like that, we've completed the change of coordinate system. If you'd rather brute-force it by substituting directly into $(1)$, see Equations and the Universe: The Ins and Outs of the Two-Body Problem (Part 1) at (/archives/549/).

Coordinate Transformations for PDEs

That covers coordinate transformations for ODEs; now let's turn to PDEs. In courses on partial differential equations and vector analysis, one of the most common exercises is transforming the Laplacian into polar, spherical, or other orthogonal coordinate systems in order to accommodate different boundary conditions. Here too, the calculus of variations can be of some help. Taking the two-dimensional Laplacian as an example, consider the equation

$$\Delta^2 u=\frac{\partial^2 u}{\partial x^2}+\frac{\partial^2 u}{\partial y^2}=F\tag{5}$$

where $F$ is a constant (what purpose does introducing $F$ serve? I leave that for the reader to think about). To find the form of $(5)$ in polar coordinates, we only need to notice that it arises from varying the action

$$S=\int \left[\frac{1}{2}\left(\left(\frac{\partial u}{\partial x}\right)^2+\left(\frac{\partial u}{\partial y}\right)^2\right)+F u\right] dxdy\tag{6}$$

We can transform $(6)$ into polar coordinates directly, and then take the variation afterward. This quickly gives us

$$S=\int \left[\frac{1}{2}\left(\left(\frac{\partial u}{\partial r}\right)^2+\left(\frac{1}{r}\frac{\partial u}{\partial \theta}\right)^2\right)+F u\right] rd\theta dr\tag{7}$$

Taking the variation yields (don't forget the $r$ in front of $d\theta dr $)

$$\frac{\partial}{\partial r}\left(r\frac{\partial u}{\partial r}\right)+\frac{1}{r}\frac{\partial^2 u}{\partial \theta^2}=F r\tag{8}$$

that is,

$$\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{\partial u}{\partial r}\right)+\frac{1}{r^2}\frac{\partial^2 u}{\partial \theta^2}=F$$

Comparing this with equation $(5)$, we obtain

$$\frac{\partial^2 }{\partial x^2}+\frac{\partial^2 }{\partial y^2}=\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{\partial }{\partial r}\right)+\frac{1}{r^2}\frac{\partial^2 }{\partial \theta^2}$$

The computational effort here should be somewhat lower than substituting directly into the coordinate transformation formulas and grinding through it by brute force.

Some readers might object: you're cheating! Your calculation is fast only because you'd already worked out the Jacobian determinant for polar coordinates ahead of time (for the change of variables in multiple integrals), and the transformation of the kinetic energy term isn't so obvious either! If you count all of that computation, the total time might well exceed that of direct substitution.

Readers who think this way are indeed correct — if you first have to compute a Jacobian determinant, and only then simplify and take the variation, the total amount of work is considerable too. But what I want to emphasize here is this: a simple answer might admit a simple derivation (if the answer itself is inherently complicated, then no trick will make the derivation simple), and an unfamiliar problem can sometimes be converted into a familiar one. In the case of transforming the Laplacian, this transformation process is, at least for me, unfamiliar territory, whereas by contrast, the Jacobian determinants of polar coordinates (and spherical coordinates) are familiar, and the calculus of variations is a familiar tool as well. So I'd rather use this variational trick — seemingly roundabout as it is — to derive the transformation of the Laplacian.

Moreover, both polar and spherical coordinates are orthogonal coordinate systems, and for orthogonal coordinate systems, writing down the Jacobian determinant isn't particularly difficult. For polar coordinates, for instance, we only need to notice that $r d\theta$ and $dr$ are the orthogonal line elements in the polar coordinate system, and we can immediately write down $dxdy=r d\theta dr$ and $\left(\frac{\partial u}{\partial x}\right)^2+\left(\frac{\partial u}{\partial y}\right)^2=\left(\frac{\partial u}{\partial r}\right)^2+\left(\frac{1}{r}\frac{\partial u}{\partial \theta}\right)^2$.

One More Example

Let's give another example: the orthogonal coordinate system $(\xi,\eta)$

$$\left\{\begin{aligned}&x=\xi^2-\eta^2\\ &y=2\xi\eta\end{aligned}\right.$$

(Why is $(\xi,\eta)$ orthogonal? Here I've admittedly cheated a bit — this comes from expanding $x+yi=(u+vi)^2$, and the real and imaginary parts of an analytic function are necessarily orthogonal.)

We can compute

$$ds^2=dx^2+dy^2=\left(\xi^2+\eta^2\right)\left(d\xi^2+d\eta^2\right)$$

giving the two orthogonal line elements as $\sqrt{\xi^2+\eta^2}d\xi,\sqrt{\xi^2+\eta^2}d\eta$. From this we can quickly write down

$$\begin{aligned}&dxdy=\sqrt{\xi^2+\eta^2}d\xi\cdot\sqrt{\xi^2+\eta^2}d\eta=\left(\xi^2+\eta^2\right)d\xi d\eta\\ &\left(\frac{\partial u}{\partial x}\right)^2+\left(\frac{\partial u}{\partial y}\right)^2=\left(\frac{1}{\sqrt{\xi^2+\eta^2}}\frac{\partial u}{\partial \xi}\right)^2+\left(\frac{1}{\sqrt{\xi^2+\eta^2}}\frac{\partial u}{\partial \eta}\right)^2\end{aligned}$$

so that the action transforms into

$$S=\int \left[\frac{1}{2}\left(\left(\frac{\partial u}{\partial \xi}\right)^2+\left(\frac{\partial u}{\partial \eta}\right)^2\right)+F u \left(\xi^2+\eta^2\right) \right] d\xi d\eta$$

and the variation gives

$$\frac{\partial^2 u}{\partial \xi^2}+\frac{\partial^2 u}{\partial \eta^2}=F\cdot\left(\xi^2+\eta^2\right) $$

hence

$$\frac{\partial^2 }{\partial x^2}+\frac{\partial^2 }{\partial y^2}=\frac{1}{\xi^2+\eta^2}\left(\frac{\partial^2 u}{\partial \xi^2}+\frac{\partial^2 u}{\partial \eta^2}\right)$$

The Spherical Coordinate Example

Now let's move to the three-dimensional case, considering only spherical coordinates

$$\left\{\begin{aligned}&x=r\sin\theta\cos\phi\\ &y=r\sin\theta\sin\phi\\ &z=r\cos\theta\end{aligned}\right.$$

We can compute

$$\begin{aligned}ds^2&=\left[d\left(r\sin\theta\right)\right]^2+\left(r\sin\theta\right)^2 d\phi^2+\left[d\left(r\cos\theta\right)\right]^2\\ &=dr^2+r^2 d\theta^2 +\left(r\sin\theta\right)^2 d\phi^2\end{aligned}$$

where the first step simply applies the polar coordinate transformation formula directly to the first two coordinates (treating the radius as $\left(r\sin\theta\right)$); overall, this just uses the polar coordinate transformation formula twice. From this we obtain the orthogonal line elements on the sphere $dr,r d\theta,r\sin\theta d\phi$, giving us

$$\begin{aligned}&dxdydz=r^2\sin\theta dr d\theta d\phi\\ &\left(\frac{\partial u}{\partial x}\right)^2+\left(\frac{\partial u}{\partial y}\right)^2+\left(\frac{\partial u}{\partial z}\right)^2=\left(\frac{\partial u}{\partial r}\right)^2+\left(\frac{1}{r}\frac{\partial u}{\partial \theta}\right)^2+\left(\frac{1}{r\sin\theta}\frac{\partial u}{\partial \phi}\right)^2\end{aligned}$$

so the action becomes

$$S=\int {\left[\frac{1}{2}\left(\left(\frac{\partial u}{\partial r}\right)^2+\left(\frac{1}{r}\frac{\partial u}{\partial \theta}\right)^2+\left(\frac{1}{r\sin\theta}\frac{\partial u}{\partial \phi}\right)^2\right)+F u\right] r^2\sin\theta dr d\theta d\phi}$$

and the variation gives

$$\frac{\partial}{\partial r}\left(r^2\sin\theta\frac{\partial u}{\partial r}\right)+\frac{\partial}{\partial \theta}\left(\sin\theta\frac{\partial u}{\partial \theta}\right)^2+\frac{1}{\sin\theta}\frac{\partial^2 u}{\partial \phi^2}=F r^2\sin\theta$$

which, after simplification, finally yields

$$\Delta u=\frac{1}{r^2}\frac{\partial}{\partial r}\left(r^2\frac{\partial u}{\partial r}\right)+\frac{1}{r^2\sin\theta}\frac{\partial}{\partial \theta}\left(\sin\theta\frac{\partial u}{\partial \theta}\right)+\frac{1}{r^2\sin^2\theta}\frac{\partial^2 u}{\partial \phi^2}$$

Which approach is actually simpler? I'll leave that for readers to judge for themselves. ^_^

English translation of a post from 科学空间 | Scientific Spaces by 苏剑林. Original: https://kexue.fm/archives/3181
Translated automatically with claude-sonnet-5; all equations are reproduced verbatim from the source. Copyright remains with the original author.