This is the result of the substitution of Plm(x) into Ylm(x).


ylm(x)=sqrt[(2*l+1)*((l-m)!)/(4*Pi*((l+m)!))]*w*((-1)^m)*((1-(x^2))^(m/2))
              /((2^l)*(l!))*D[((x^2)-1)^l,{x,(l+m)}]


w=exp[i*m*(phi)]
x=cos(theta)