From homogeneous to non-homogeneous linear recurrence relation I'm trying to do the following exercise:
Find a non-homogeneous recurrence relation for the sequence whose general term is
$$a_n = \frac{1}{2}3^n - \frac{2}{5} 7^n$$
From this expression we can obtain the roots of the characteristic polynomial $P(x)$, which are $3$ and $7$, so $P(x) = x^2 - 10x + 21$ and $a_n = 10a_{n-1} - 21a_{n-2} \; \forall \; n \ge 2, \; a_0 = \frac {1}{10}, \; a_1 = -\frac{13}{10}$.
Now I don't know how to obtain a non-homogeneous recurrence relation given this homogeneous recurrence relation.
 A: Write the relations for two consecutive terms:
$$
\begin{align}
\begin{cases}
a_n &=\, \dfrac{1}{2}\,3^n - \dfrac{2}{5}\, 7^n
\\ a_{n+1} &=\, \dfrac{1}{2}\,3^{n+1} - \dfrac{2}{5}\, 7^{n+1} \,=\, \dfrac{3}{2}\,3^n-\dfrac{14}{5}\,7^n
\end{cases}
\end{align}
$$
Eliminate (for example) $\,7^n\,$ between the two:
$$
\require{cancel}
a_{n+1} - 7 a_n = \left(\dfrac{3}{2}\,3^n-\cancel{\dfrac{14}{5}\,7^n}\right) - \left(\dfrac{7}{2}\,3^n - \cancel{\dfrac{14}{5}\, 7^n}\right) \;\iff\; a_{n+1} = 7a_n-2\cdot 3^n
$$
Note that the non-homogeneous recurrence is not unique. If you chose to eliminate the other power $\,3^n\,$, for example, you would get $\,a_{n+1} = 3a_n-\dfrac{8}{5}\,7^n\,$, which is equally valid, as are many others.
A: Just start with your favorite term containing $a_n$ and $a_{n-1}$, say
$a_n - a_{n-1}$, calculate the difference, here
$$ a_n - a_{n-1} = \frac 12 3^n - \frac 25 7^n - \frac 12 3^{n-1} + \frac 25 7^{n-1} $$
giving you the inhomogeneous recurrence
$$ a_n = a_{n-1} + \frac 12 3^n - \frac 25 7^n - \frac 12 3^{n-1} + \frac 25 7^{n-1}, \quad n \ge 1 $$
