[Math] Find all solutions of the recurrence relation $a_n = 5a_{n-1} – 6a_{n-2} + 2^n + 3n$

discrete mathematicsrecurrence-relations

Question:
Find all solutions of the recurrence relation $a_n = 5a_{n-1} – 6a_{n-2} + 2^n + 3n$ (Hint: Look for a particular solution of the form $qn2^n + p_1n + p_2$, where $q, p_1, p_2$ are constants).

Attempt:
The Hint indicates that the solution is of the form $qn2^n + p_1n + p_2$, thus

$$a_n = qn2^n + p_1n + p_2\\\iff a_n = qn2^n + p_1n + p_2= 5(qn2^{n-1} + p_1(n-1) + p_2) – 6(qn2^{n-2} + p_1(n-2) + p_2) + 2^n + 3n$$

I just need if this is a right approach, since I've already wasted hours solving this and I keep getting minute calculation error since my paper is not big enough (I write big apparently). I know for sure that $p_1 = \dfrac{3}{2}$. If my approach above is correct, I'll let this question rest.

Edit:
I think the hint is given due to the fact that $2^n + 3n$ looks nothing like linear homogenous recurrence nor does it even look like a "typical" linear nonhomogenous recurrence relation, since $2^n + 3n$. You might want to comment about that, but I think this book will cover this in future chapters.

Best Answer

Rewrite the LHS as $$ q(n-1)2^n+q2^n+p_1n+p_2$$ and the RHS as $$ q(n-1)2^n+(\frac{3q}{2}+1)2^n+(3-p_1)n+(7p_1-p_2) $$ Then compare the coefficients of $2^n$, $n$ and the constant term to get $$ q=\frac{3q}{2}+1,p_1=3-p_1,p_2=7p_1-p_2 $$ from which you can have $$ q=-2,p_1=\frac{3}{2},p_2=\frac{21}{4}. $$