Any harmonic function $u$ can be represented in [[Spherical Coordinates| spherical coordinates]] $(r, \theta, \phi)$ as
$
u(r, \theta, \phi) = \sum_{\ell=0}^\infty \sum_{m=-\ell}^\ell \left(L_{\ell}^mr^\ell + \frac{M_{\ell}^m}{r^{\ell+1}}\right)
$
with
$
Y_\ell^m \equiv \sqrt{\frac{2\ell+1}{4\pi}}
\sqrt{\frac{(\ell-|m|)!}{(
\ell+|m|)!}}P_\ell^{|m|}(\cos\theta)e^{im\phi}
$
the spherical harmonics of degree $\ell$ and order $m$. The function $P_\ell^{|m|}$ is the corresponding [[Associated Legendre Functions|associated Legendre Function]].
## Orthogonality
The spherical harmonics form an orthonormal basis of $L^2$ over the unit sphere in the sense that
$
\int_{\theta=0}^\pi\int_{\phi=0}^{2\pi}
Y_{\ell}^m(\theta, \phi)Y_{\ell'}^{m'}(\theta, \phi) = \delta_{mm'}\delta_{\ell\ell'}.
$
## References
- Gimbutas, Z. & Greengard, L. A fast and stable method for rotating spherical harmonic expansions. _J. Comput. Phys._ **228**, 5621–5627 (2009).
- [[https://en.wikipedia.org/wiki/Spherical_harmonics#Contraction_rule| Spherical Harmonics on Wikipedia]]