In mathematics, the associated Legendre polynomials are the canonical solutions of the general Legendre equation
or equivalently
where the indices ℓ and m (which are integers) are referred to as the degree and order of the associated Legendre polynomial respectively. This equation has nonzero solutions that are nonsingular on [−1, 1] only if ℓ and m are integers with 0 ≤ m ≤ ℓ, or with trivially equivalent negative values. When in addition m is even, the function is a polynomial. When m is zero and ℓ integer, these functions are identical to the Legendre polynomials. In general, when ℓ and m are integers, the regular solutions are sometimes called "associated Legendre polynomials", even though they are not polynomials when m is odd. The fully general class of functions with arbitrary real or complex values of ℓ and m are Legendre functions. In that case the parameters are usually labelled with Greek letters.
The Legendre ordinary differential equation is frequently encountered in physics and other technical fields. In particular, it occurs when solving Laplace's equation (and related partial differential equations) in spherical coordinates. Associated Legendre polynomials play a vital role in the definition of spherical harmonics.