I am following the solution for a problem, and I am stuck at the following equation:
$$2a_2+\sum_{n=1}^\infty \left[(n+2)(n+1)a_{n+2}-a_{n-1}\right]x^n=0\tag1$$
Now, the professor equates the coefficients to zero, and he gets:
$$n=0: a_2=0\tag2$$ $$n=1,2,3..: a_{n+2}=\frac{a_{n-1}}{(n+2)(n+1)}\tag3$$
The thing that confuses me is: If there is a term outside the summation sign, as we have here (I'm referring to the $2a_2$ term in equation 1), then equation 1 cannot ever be set to zero simply by having the coefficients of $x^n$ equal to zero, since that would merely make it equal to $2a_2$.
I have two simple notes
Now if we have the following equal polynomials $$a_0+a_1x+a_2x^2+\cdots=b_0+b_1x+b_2x^2+\cdots$$ then by equating coefficients of $x^n$ we get $$x^0:\ \ \ \ \ \ a_0=b_0 \\ x^1:\ \ \ \ \ \ a_1=b_1 \\ x^2:\ \ \ \ \ \ a_2=b_2$$ In your case the right hand sides are all zeros and so the first equation becomes $$2a_2=0$$ and the rest equations becomes $$(n+2)(n+1)a_{n+2}-a_{n-1}=0$$ for $n=1,2,3, \cdots$