Spherical Harmonics and Rotations

  1. viz 1 (available in VR)
  2. viz 2 (available in VR)

Spherical harmonics are an infinite family of real-valued functions on the two-dimensional sphere that arise when solving Laplace's equation in three-dimensional space or when solving the time-independent Schrödinger equation for the hydrogen atom, which is closely related.

Laplace's equation is given by: \[\nabla ^2 f = \frac{\partial ^2 f}{\partial x^2} + \frac{\partial^2 f}{\partial y ^2} + \frac{\partial^2 f}{\partial z^2} = 0\]

Schrödinger's equation for the hydrogen atom is given by: \[ \left( - \frac{\hbar ^2}{2m} \nabla ^2 + V(r) \right) \psi = E \psi\]

Typically, the spherical harmonics are given integer parameters \(l\) and \(m\), where \(l = 0,1,2, \ldots \) and \(m = -l, -l+1, \ldots l-1, l\).

In the visualization above, above each direction radiating outward from the origin, we have plotted the absolute value of the spherical harmonic function for the corresponding point on the 2-dimensional sphere. For instance, when \(l\) and \(m\) are equal to 0, we see a sphere, which means that this spherical harmonic function is constant. The color indicates the sign of the value, green for positive, and red for negative

Algebraically, the spherical harmonic functions may be written as

\[ (-1)^m \sqrt{2}\sqrt{\frac{2l+1}{4 \pi}\frac{(l-|m|)!}{(l+|m|)!}} P_l^{|m|}(\cos \theta) \sin(|m|\phi) \quad \mathrm{if} \quad m \le 0\] \[ \sqrt{\frac{2l+1}{4 \pi}} P_l^{m}(\cos \theta) \quad \mathrm{if} \quad m = 0\] \[ (-1)^m \sqrt{2}\sqrt{\frac{2l+1}{4 \pi}\frac{(l-m)!}{(l+m)!}} P_l^{m}(\cos \theta) \cos(m\phi) \quad \mathrm{if} \quad m \geq 0\]

Here, \(P_l^m\) denotes the associated Legendre polynomials. The normalization constants in these expressions ensure that these functions form an orthonormal basis for functions on the sphere. In particular the square integral of each function on the sphere is equal to 1. The fact that these functions form a basis means that arbitrary functions on the sphere can be approximated arbitrarily well by a linear combinations of the spherical harmonics.

The spherical harmonics can be written more compactly when we allow them to take on complex values, but the complex-valued functions are not easily visualized.

By moving the sliders we can see how the spherical harmonics develop as \(l\) and \(m\) evolve. As \(l\) increases, the spherical harmonics sprout more and more arms. As \(|m|\) increases, there is an increasing number of vertical flaps that emerge, with the number of vertical flaps equal to \(2|m|\). As the number of vertical flaps increase, the number of arms in each flap decreases. And we see that the number of arms in each flap is equal to \(l - |m| + 1\). The flaps alternate in sign when moving to the left, right, above, or below.

When we go from \(m\) to \(-m\), we see that the spherical harmonic has the same form, but slightly rotated so that the flaps fill in the spaces that were gaps, and has gaps where there were once flaps.

Representation Theory of Rotations

The spherical harmonics have an incredible relationship with rotations in three-dimensions. No matter how you rotate any of the spherical harmonics, the rotated function can be reconstructed as a scaled sum of the other (unrotated) spherical harmonics of the same \(l\) value. The visualization above demonstrates what I mean.

Here, the \(l\) and \(m\) parameters specify which spherical harmonic function is to be rotated. The alpha, beta, and gamma parameters specify the rotation via their Euler angles. The view axis parameter lets you choose which axis the functions are viewed along. The reset camera button will return the camera to its starting axis. Feel free to move the camera around by dragging, zooming and panning around the scene.

The rotations in three-dimensions, with the operation of composition of rotations, form a group. We have encountered groups in the Rubik's Cube and Living on a Torus blog posts. The scaled sums of spherical harmonics of a given \(l\) form a \(2l + 1\)-dimensional vector space. The rotations act linearly on the vector space of spherical harmonics, which just means that rotations of sums are sums of rotations and rotations of scaled functions are equal to rotated functions scaled. This situation, where a group acts linearly on a vector space is called a group representation. Group representations are central to a lot of important and rich mathematical theory.

These representations of the rotation group on the \(2l+1\)-dimensional vector spaces of spherical harmonics are irreducible, which means that within each vector space of spherical harmonic functions, there is no smaller vector space on which the rotations act without passing outside the vector space. Irreducible representations are the fundamental building blocks of all finite-dimensional representations. It is known that these spherical harmonic representations comprise all of the possible irreducible representations of the three-dimensional rotation group.

Implementation Notes

In order to create this visualization, I mainly needed to compute the associated Legendre polynomials \(P_l^m(x)\). As it turned out, the computation is easier when reparametrized as \(P_l^m(\cos \theta)\), which is convenient because this is precisely the parametrization that is used in the formulas for the spherical harmonics.

The formula for \(P_l^m(\cos \theta)\) is given by:

\[P^m_l(\cos \theta) = (-1)^m(\sin \theta)^m \frac{d^m}{d(\cos\theta)^m} P_l(\cos\theta)\]

Here, \(P_l\) are the Legendre polynomials, which are the associated Legendre polynomials, \(P_l^m\), when \(m=0\). There are many formulas for computing the Legendre polynomials. The one I used for the visualization was:

\[ P_l(x) = 2^l \sum_{k=0}^{[\frac{n}{2}]} (-1)^k \binom{n}{k}\binom{2n-2k}{n}x^{n-2k} \]

I chose this form, because it made it very convenient to compute the \(m\)-th derivatives needed for the associated Legendre polynomials.

For the rotation visualization, I mainly needed to determine the coefficient of each of the spherical harmonic components. To do this, I generated \(2l + 1\) random points on the sphere, then I used the fact that the rotated function equals the linear combination of spherical harmonics to get \(2l + 1\) equations in \(2l + 1\) unknowns, at which point obtaining the coefficients is just a matter of some linear algebra.