When you are working with Spherical harmonics, then the Legendre Differential Equation does not appear in its natural form i.e

Instead, it appears in this form:

It seems daunting but the above is the same as the LDE. We can arrive at it by taking and proceeding as follows:

Now, applying chain rule, we obtain that

Now simplifying the above expression, we obtain that:

Plugging in the values of and into the Legendre Differential Equation,

Now if we do some algebra and simplify the trigonometric identities, we will arrive at the following expression for the Legendre Differential Equation:

If we take the solution for the LDE as , then the solution to the LDE in the above form is merely .