Just trying to solve a non-homogeneous recurrence relation:
$$f(n) = 2f(n-1) + n2^n$$
$$f(0) = 3$$
Characteristic equation is:
$$f(n) - 2f(n-1) = 0$$
$$a-2 = 0$$
$$a = 2$$
Homogeneous solution is:
$$f_H(n) = b_0\cdot (2)^n$$
Right-hand side is:
$$n2^n$$
What is the particular guess I should be taking based on this?
(This is not a guess, but rather an approach to finding the solution.)
Firstly, we rearrange the given relation to get:
$$f(n) - 2f(n-1) = n2^n$$
Divide throughout by $2^n$. This gives us:
$$\frac{f(n)}{2^n} - \frac{f(n-1)}{2^{n-1}} = n$$
Do a summation to exploit the potential cancellations on the LHS:
$$\sum_{i = 1}^n\left(\frac{f(i)}{2^i} - \frac{f(i-1)}{2^{i-1}}\right) = \sum_{i = 1}^n i$$ $$\frac{f(n)}{2^n} - \frac{f(0)}{2^0} = \frac{n(n+1)}{2}$$ $$\frac{f(n)}{2^n} = \frac{n(n+1)}{2} + 3$$ $$f(n) = 2^{n-1}(n^2 + n + 6)$$
In general, if you have stuffs like $a_n - ka_{n-1} = b_n$ where $k$ is a constant, dividing throughout by $k^n$ might be a good way to start.