Theory
For a given function \(\rho(x,y,z)\), the solution \(\Phi(x,y,z)\) of the Poisson equation \(\nabla^2\Phi=-4\pi \rho\) with vanishing Dirichlet boundary conditions at infinity is
Examples of this are the electrostatic and Newtonian gravitational potential. If you need to evaluate \(\Phi(x,y,z)\) at many points, calculating the integral for each point is computationally expensive. As a faster alternative, we can express \(\Phi(x,y,z)\) in terms of the multipole moments \(q_{lm}\) or \(I_{lm}\) (note some literature uses the subscripts \((\cdot)_{nm}\)):
for a exterior expansion, or
for an interior expansion; where \(r, \theta, \varphi\) are the usual spherical coordinates corresponding to the cartesian coordinates \(x, y, z\) and \(Y_{lm}(\theta, \varphi)\) are the spherical harmonics.
The multipole moments for the exterior expansion are:
and the multipole moments for the interior expansion are:
This approach is usually much faster because the contributions \(\Phi^{(l)}\) are getting smaller with increasing l. So we just have to calculate a few integrals for obtaining some \(q_{lm}\) or \(I_{lm}\).
Some literature considers the \(\sqrt{\frac{4\pi}{2l+1}}\) as part of the definition of \(Y_{lm}(\theta, \varphi)\).