The associated Legendre polynomials \(P_l^{\vert m_l\vert}\) are a sequence of orthogonal polynomials that are solutions to the associated Legendre differential equation:
$$(1-x^2)\frac{d^2P_l^{\vert m_l\vert}}{dx^2}-2x\biggr(\frac{dP_l^{\vert m_l\vert}}{dx}\biggr)+\biggr[l(l+1)-\frac{\vert m_l\vert^2}{1-x^2}\biggr]P_l^{\vert m_l\vert}=0\;\;\;\;\;\;\;\;360$$
which can also be expressed as
$$\frac{d}{dx}\biggr[(1-x^2)\frac{dP_l^{\vert m_l\vert}}{dx}\biggr]+\biggr[l(l+1)-\frac{\vert m_l\vert^2}{1-x^2}\biggr]P_l^{\vert m_l\vert}=0\;\;\;\;\;\;\;\;360a$$
Eq360 can be derived from the Legendre differential equation. It begins with differentiating eq332 \(\vert m_l\vert\) times using Leibniz’s theorem to give
$$\sum_{k=0}^{\vert m_l\vert}\begin{\pmatrix}\vert m_l\vert\\k\end{pmatrix}\frac{d^k(1-x^2)}{dx^k}\frac{d^{\vert m_l\vert-k+2}P_l}{dx^{\vert m_l\vert-k+2}}-2\sum_{k=0}^{\vert m_l\vert}\begin{\pmatrix}\vert m_l\vert\\k\end{pmatrix}\frac{d^kx}{dx^k}\frac{d^{\vert m_l\vert-k+1}P_l}{dx^{\vert m_l\vert-k+1}}+l(l+1)-\frac{d^{\vert m_l\vert}P_l}{dx^{\vert m_l\vert}}=0\;\;\;\;\;\;\;\;361$$
where \(P_l\) are the Legendre polynomials.
Assuming that \(\vert m_l\vert\geq 2\), only the first three terms and the first two terms of the first sum and the second sum, respectively, survive. So, eq361 becomes
$$(1-x^2)z^{\prime}^{\prime}-2x(\vert m_l\vert+1)z^{\prime}+(l-\vert m_l\vert)(l+\vert m_l\vert+1)z=0\;\;\;\;\;\;\;\;362$$
where \(z=\frac{d^{\vert m_l\vert}}{dx^{\vert m_l\vert}}P_l\).
Let
$$z=\frac{d^{\vert m_l\vert}}{dx^{\vert m_l\vert}}P_l=(1-x^2)^{-\frac{\vert m_l\vert}{2}}P_l^{\vert m_l\vert}\;\;\;\;\;\;\;\;363$$
Substituting \(z\), \(z^{\prime}\) and \(z^{\prime}^{\prime}\) in eq362 yields eq360, where
$$P_l^{\vert m_l\vert}=(1-x^2)^{\frac{\vert m_l\vert}{2}}\frac{d^{\vert m_l\vert}}{dx^{\vert m_l\vert}}P_l\;\;\;\;\;\;\;\;363a$$
Substituting eq348 in eq363a gives the un-normalised associated Legendre polynomials:
$$P_l^{\vert m_l\vert}=(1-x^2)^{\frac{\vert m_l\vert}{2}}\frac{1}{2^ll!}\frac{d^{l+\vert m_l\vert}}{dx^{l+\vert m_l\vert}}(x^2-1)^l\;\;\;\;\;\;\;\;364$$
with the normalisation constant given by eq391.

Finally, when \(m_l=0\), eq360 becomes the Legendre differential equation. Therefore, the associated Legendre differential equation is a generalisation of the Legendre differential equation.

Question
If we have assumed that \(\vert m_l\vert\geq 2\) when we differentiate the Legendre differential equation \(\vert m_l\vert\) times to obtain the associated Legendre differential equation, does it mean that \(\vert m_l\vert\) in the associated Legendre differential equation are restricted to values greater than or equal to two?
Answer
No, the procedure merely demonstrates that the solutions to the associated Legendre differential equation are related to those of the Legendre differential equation by \(P_l^{\vert m_l\vert}=(1-x^2)^{\frac{\vert m_l\vert}{2}}\frac{d^{\vert m_l\vert}}{dx^{\vert m_l\vert}}P_l\). The allowed values of \(\vert m_l\vert\) must be consistent with the solutions to the associated Legendre differential equation. To avoid the trivial solution of \(P_l^{\vert m_l\vert}=0\), we require that \(\vert m_l\vert\leq l\). Thus, \(\vert m_l\vert\) can take values of \(0,1,2,\cdots,l\), and while we may choose to differentiate with \(\vert m_l\vert\geq 2\), the full set of associated Legendre functions exists for \(\vert m_l\vert\leq l\).