$a_{n+2}+3 a_{n+1}+2 a_n=5 n+3$, where $a_0=1, a_1=4$.
I am trying to solve the homogeneous part first, I have the roots as r = -1 and r = -2, by factorising the characteristic equation which I have as $r^2 + 3r + 2 = 0$.
So I have the homogenous solution as $A(-1)^n + B(-2)^n$
I plug in $a_0 = 1$ into the solution to get $A + B = 1$ hence $A = 1 - B$ then I do the same with $a_1 = 4$ then solve the simultaneous equation to get $B = -5$
However it seems this is wrong upon checking the answer, I'm not sure where I'm going wrong, although I'm not sure what to do with the $5n$ or the $3$ in this part so that might be the reason, haven't really found a helpful source for this type of recurrence relation, any help is appreciated.
The general solution of such a linear recurrence relation is given by $a_n = b_n + c_n$, where $b_n = A(-1)^n + (-2)^n$ is the solution of the associated homogeneous problem, which you have already solved, and $c_n$ is a particular solution to the nonhomogeneous problem.
This particular solution can be determined, by analogy with linear ODEs, thanks to the method of the variation of parameters, i.e. by recycling the homogeneous solution where the parameters $A$ and $B$ are now functions of $n$, such that $c_n = A_n(-1)^n + B_n(-2)^n$; plugging this expression into the nonhomogeneous recurrence relation, you can find suitable $A_n$ and $B_n$.
However, it is usually simpler to consider an ansatz with the same structure as the nonhomogeneous source term. In the present case, let's take $c_n = \alpha n + \beta$, hence $$ c_{n+2} + 3c_{n+1} + 2c_n = 6\alpha n + 5\alpha + 6\beta = 5n+3 $$ from which one finds $\alpha = 5/6$ and $\beta = -7/36$.
The general answer is thus $a_n = A(-1)^n + B(-2)^n + \frac{5}{6}n - \frac{7}{36}$. And now you must use your initial conditions in order to determine the constants $A$ and $B$. Here we have : $$ \left\{ \begin{array}{lll} a_0 = \color{white}{-}A + \color{white}{2}B - \frac{7}{36} = 1 \\ a_1 = -A - 2B + \frac{23}{36} = 4 \end{array} \right. $$ And I'll let you finish from there.