Criterion for polynomial solutions to a class of linear differential   equation of second order
  We consider the differential equations y''=\lambda_0(x)y'+s_0(x)y, where \lambda_0(x), s_0(x) are C^{\infty}-functions. We prove (i) if the differential equation, has a polynomial solution of degree n >0, then \delta_n=\lambda_n s_{n-1}-\lambda_{n-1}s_n=0, where \lambda_{n}= \lambda_{n-1}^\prime+s_{n-1}+\lambda_0\lambda_{n-1}\hbox{and}\quad s_{n}=s_{n-1}^\prime+s_0\lambda_{k-1},\quad n=1,2,.... Conversely (ii) if \lambda_n\lambda_{n-1}\ne 0 and \delta_n=0, then the differential equation has a polynomial solution of degree at most n. We show that the classical differential equations of Laguerre, Hermite, Legendre, Jacobi, Chebyshev (first and second kind), Gegenbauer, and the Hypergeometric type, etc, obey this criterion. Further, we find the polynomial solutions for the generalized Hermite, Laguerre, Legendre and Chebyshev differential equations. 
Nasser Saad, Richard L. Hall and Hakan Ciftci