# Confirming orthogonality of spherical harmonics symbolically

One can confirm the orthogonality of the SphericalHarmonicYs for specific values of their parameters (l, m, ll, mm) as I showed in my solution here, but I have been unable to verify it for the general case, as in:

Assuming[{l, ll, m, mm} ∈ Integers &&
-l <= m <= l && -ll <= mm <= ll ,
Integrate[
Conjugate[
SphericalHarmonicY[l, m, ϑ, φ]]
SphericalHarmonicY[ll, mm, ϑ, φ]
Sin[ϑ],
{ϑ, 0, π}, {φ, 0, 2 π}]]


Are there any tricks, or assumptions, or other techniques that enable Mathematica to symbolically evaluate that integral (leading to a product of KroneckerDelta functions)? I even tried FunctionExpand to express each SphericalHarmonicY using exponentials and other simpler functions, but the integral was still not evaluated.

• You probably mean Kronecker deltas, not Dirac deltas. Commented Apr 30, 2021 at 20:10
• The $\phi$ integral is easy, as $Y_{\ell}^m(\theta ,\phi)=\sqrt{\frac{2\ell+1}{4\pi}\frac{(\ell-m)!}{(\ell+m)!}}P_{\ell}^m(\cos \theta)e^{i m\phi}$. The difficult part is to show that the Legendre polynomials are orthogonal. This may simplify your question to showing in an abstract way that standard orthogonal polynomials are indeed orthogonal. Commented Apr 30, 2021 at 20:18
• I think you can do the conjugation symbolically by replacing φ -> -φ Commented Apr 30, 2021 at 22:14
• @mikado: Yes. You can even perform the symbolic integration over $\phi$, which accomplishes the same thing. The remaining difficulty seems to be the $\theta$ integral, which is resisting all my creative attempts! Commented Apr 30, 2021 at 23:19
• I don't think the game is worth the candle. Of course, these integrals can be implemented as table values. Commented May 1, 2021 at 4:57

Not an answer but an extended comment.

This may be difficult. Let's look at the $$\phi$$ dependence, which for $$\mu=m-m'$$ can be reduced to the integral $$\int_0^{2\pi}e^{i \mu \phi}d\phi = 2\pi\delta_{\mu,0}$$ for $$\mu\in\mathbb{Z}$$. In Mathematica, even this simplified case does not work:

Assuming[Element[μ, Integers],
Integrate[Exp[I*μ*φ], {φ, 0, 2π}]]
(*    0    *)


We see that Mathematica only gives the general case $$\mu\neq0$$ and overlooks the special case $$\mu=0$$. Mathematica often gives generic solutions and skips over non-generic ones.

With this in mind, I think that showing polynome orthogonality or even orthonormality will be difficult, and tricks are needed that I'm not familiar with.

• Thanks. (+1). I too found exactly this example and it led me to your general conclusion that Mathematica, in "default" mode, could not solve even these "simple" integrals. But I'm trying to collect heuristics and hacks that can expand Mathematica's symbolic capability and hoped that there might be one for this orthogonality problem. Example hack: Mathematica fails at some multi-variable integrals in default mode, but succeeds when you perform the individual (single-variable) component integrals individually. Perhaps I'll post a "bigger" question to this effect as a service. Commented May 1, 2021 at 16:00