$f(n)=6f(n-1)-9f(n-2)+(n^2+1)3^n$
The root for the above relation is 3 two times. So its general term will be:
$f(n) = c_{1}3^n + c_{2}n3^n + something$
According to my notes $something: n^2(n^2p_{2,0}+np_{1,0}+p_{0,0})3^n = (n^2+1)3^n$
That should have been correct if it was: $+n^23^n$
But it is: $+(n^2+1)3^n = 3^nn^2+3^n$
so it should be: $n^2(n^2p_{2,0}+np_{1,0}+p_{0,0})3^n + n^2(p_{0,1})3^n=(n^2+1)3^n$
Is my reasoning wrong?
$$\implies g(n)=2g(n-1)-g(n-2)+n^2+1$$
Let $g(r)=h(r)+a_0+a_1r+a_2r^2+\cdots$
$$\implies h(n)+a_0+a_1n+a_2n^2+a_3n^3+\cdots$$ $$=2[h(n-1)+a_0+a_1(n-1)+a_2(n-1)^2+a_3(n-1)^3+\cdots]-[h(n-2)+a_0+a_1(n-2)+a_2(n-2)^2+a_3(n-2)^3+\cdots]+n^2+1$$
$$=2h(n-1)-h(n-2)+[n^3(a_3)+n^2(a_2+1)]$$ Now compare the coefficients of $n,n^2.n^3,\cdots$
– lab bhattacharjee May 02 '15 at 13:44