Let
$$a_n - 3a_{n-1} + 2a_{n-2} = 2n - 1$$ $$a_0 = a_1 = 0$$
Be a recurrence relation. To solve it, we need to find homogenous and particular solution. I found out that the homogenous solution is $b_1 + b_2 \cdot 2^n$ for some constants $b_1, b_2$. To find the particular solution, I say that $a_n ^p = cn + d$ for some constants $c, d$. But when we put it into the recurrence, we get that
$$cn+d - 3(cn - c + d) + 2(cn - 2c + d) = 2n-1$$ $$ (c-3c+2c)n + (d+3c-3d-4c+2d) = 2n-1 $$ $$ -c = 2n-1 $$
and therefore we cant find $d$, so probably guessing that $a_n ^p = cn + d$ is wrong. How do i find the particular solution then? Because I thought that the particular solution is $cn+d$ when $d(n) = \alpha n + \beta$ ( where $d(n)$ is the non homogenous part of the recurrence )... Thanks to everyone helping!