Spherical harmonics are defined
,
where
is associated Legendre function and
is Legendre polynomial.
The spherical harmonics in spherical coordinates can be converted into Cartesian coordinates by substitution
.
Spherical harmonics of first few degrees