The associate Legendre equation is given as:
$(1-x^2)\frac{d^2}{dx^2}y-2x\frac{d}{dx}y+\left[n(n+1)-\frac{m^2}{1-x^2}\right] y=0$
This becomes the standard unassociated Legendre equation for $m=0$. For positive m, the solutions to this equation can be expressed in terms of unassociated Legendre polynomials ($P_n(x)$) as:
$P_n^m(x)=(1-x^2)^{m/2}\frac{d^m}{dx^m}P_n(x)$
I would therefore expect that if I use this relationship as a solution to the associated Legendre equation that I should recover the unassociated Legendre equation.
I find the first and second derivative to be:
$\frac{d}{dx}P_n^m=(1-x^2)^{m/2}\left[\frac{d^{m+1}}{dx^{m+1}}P_n -\frac{mx}{1-x^2}\frac{d^m}{dx^m}P_n \right]$
$\frac{d^2}{dx^2}P_n^m=(1-x^2)^{m/2}\left[\frac{d^{m+2}}{dx^{m+2}}P_n-\frac{2mx}{1-x^2}\frac{d^{m+1}}{dx^{m+1}}P_n+\frac{m(m-1)x^2-m}{(1-x^2)^2}\frac{d^m}{dx^m}P_n \right]$
Using these two results with the associated Legendre equation and simplifying I find:
$(1-x^2)\frac{d^2}{dx^2}P_n-2x\frac{d}{dx}P_n+n(n+1)P_n-m(2x\frac{d}{dx}P_n+m(m+1)P_n)=0$
Clearly this is the unassociated Legendre equation with a little bit of extra stuff that didn't cancel. I am not seeing any way to make these terms vanish though--so what am I doing wrong here?