<s>[INST] Recursive sequence. Value is resetting to 0 
Solve
$$\begin{cases}
{a_n} = 5a_{n-1} - 6a_{n-2} + 6 \cdot 3^{n}\\
{a_0} = 1, a_1=50
\end{cases}$$

The problem I've got here is the C resetting.
It happens to me sometimes and I don't know why.
Hope someone can clear it up for me.
Thanks.

 [/INST] $a_n-5a_{n-1}+6a_{n-2}=6\cdot 3^n$, with $a_0=1$, $a_1=50$.
First we find solution of homogenous recurrence relation
$$a_n-5a_{n-1}+6a_{n-2}=0.$$
$r^2-5r+6=0$, we have $r=2$ with multiplicity 1 and $r=3$ with multiplicity 1. So,
$$a_n^h=A\cdot 2^n+B\cdot 3^n.$$
Because in the right-hand side $$a_n-5a_{n-1}+6a_{n-2}=6\cdot 3^n,$$
Now we have $r=2$ with multiplicity 1 and $r=3$ with multiplicity 2. Let the particular solution
$$a_n^p=C\cdot 2^n+D\cdot 3^n + E\cdot n\cdot 3^n.$$
Now delete the terms which appear similar in the $a_n^h$,
$$a_n^p=E\cdot n\cdot 3^n.$$
Substituting new $a_n^p$ into $$a_n-5a_{n-1}+6a_{n-2}=6\cdot 3^n,$$
we have
\begin{eqnarray}
a_n-5a_{n-1}+6a_{n-2}&=&6\cdot 3^n\\
E\cdot n\cdot 3^n-5E\cdot (n-1)\cdot 3^{n-1}+6E\cdot (n-2)\cdot 3^{n-2}&=&6\cdot 3^n\\
E\cdot n\cdot 3^n-\dfrac{5}{3}E\cdot (n-1)\cdot 3^{n}+\dfrac{2}{3}E\cdot (n-2)\cdot 3^{n}&=&6\cdot 3^n\\
E\cdot n\cdot 3^n-\dfrac{5}{3}E\cdot n\cdot 3^{n}+\dfrac{5}{3}E\cdot 3^{n}+\dfrac{2}{3}E\cdot n\cdot 3^{n}-\dfrac{4}{3}E\cdot 3^{n}&=&6\cdot 3^n\\
\dfrac{1}{3}E\cdot 3^{n}&=&6\cdot 3^n\\
\end{eqnarray}
Now, we have $E=18$. So, the particular solution will be
$$a_n^p=18\cdot n\cdot 3^n.$$
Now,
$$a_n=a_n^h+a_n^p.$$
$$a_n=A\cdot 2^n+B\cdot 3^n+18\cdot n\cdot 3^n.$$
To find $A$ and $B$, we substitute initial value.
$$a_0=A\cdot 2^0+B\cdot 3^0+18\cdot 0\cdot 3^0=A+B=1.$$
$$a_1=A\cdot 2^1+B\cdot 3^1+18\cdot 1\cdot 3^1=2A+3B+54=50\iff 2A+3B=-4.$$
Solving last two equations, we get $A=7$ and $B=-6$. So we get the solution is
$$a_n=7\cdot 2^n-6\cdot 3^n+18\cdot n\cdot 3^n.$$
</s>