A second order problem on recurrence relation equals 3^n I had this Recurrence Relation problem:
$a_{n+2} + a_{n+1} - 12a_n = 0$
And I solved in a form like this $a_n = A(r_1)^n + B(r_2)^n$
$r^{n+2} + r^{n+1} - 12r^n = 0$ -> Divided the hole eqation by the lowest $r$
Result of this:
$r^2+r -12 = 0$
And then i found the roots: $r_1 = 3$ and $r_2=-4$
And the solution of this problem is: $a_n = 2/7*(3)^n -7/2*(-4)^n $
The next one, is what i don´t get. It is exact like this one in stead it is equal to $3^n$, like is: $a_{n+2} + a_{n+1} - 12a_n = 3^n$
How do I solve this one ?

 A: You didn't mentioned the initial conditions of the recurrence relation, but by the solution that you obtained
$$a_n = \frac{2}{7}(3)^n − \frac{7}{2}(−4)^n$$
one can infer the initial conditions
$$a_0 = -\frac{45}{14} \;\;\;\;\;\;\;\; a_1 = \frac{104}{7}$$
That made me think that maybe there is a typo and you intended
$$a_n = \frac{2}{7}(3)^n − \frac{2}{7}(−4)^n$$ 
so
$$a_0 = 0  \;\;\;\;\;\;\;\;  a_1 = 2$$
I'll solve both cases just in case.

What you are trying to do is to solve a non-homogeneous linear recurrence relation.
  $$ a_{n+2} + a_{n+1} - 12a_{n} = 3^n = f(n)$$
The first step is to solve the the associated homogeneous linear recurrence:
  $$ a_{n+2} + a_{n+1} - 12a_{n} = 0 $$
The associated characteristic polynomial is
 $$r^2 + r - 12$$
with roots $r_1 = 3$ and $r_2 = -4$.
Hence the homogeneous solution is of the form
$$h_n = A 3^n + B(-4)^n$$
Instead to plug-in the initial conditions, we now need to find a particular solution to the non-homogeneous equation.
As $f(n) = 3^n$, we would guess a solution of the form $g_n = C 3^n$, where $C$ is a constant.
But $3$ is a root of characteristic polynomial of the homogeneous part, hence the correct guess is $g_n = C n 3^n$.
We now find $C$ by plugging it on the recurrence:
$$ C(n+2)3^{n+2} + C(n+1)3^{n+1} - 12Cn3^n = 3^n$$
$$ 9C(n+2) + 3C(n+1) - 12Cn = 1 $$
have to hold for all $n$, in particular for $n = 0$, hence:
$$ 18 C + 3 C = 1 \Rightarrow C = \frac{1}{21} $$
Hence we have the particular solution $g_n = \frac{1}{21} n 3^n$.
Therefore, the final solution is of the form:
$$ a_n = h_n + g_n = \left( A + \frac{n}{21} \right) 3^n + B(-4)^n$$
where the constants $A$ and $B$ are to be determined from the initial conditions through the linear system:
$$\begin{cases}
a_0 = A + B \\
a_1 = 3A - 4B + \frac{1}{7}
\end{cases}$$
Using $a_0 = -\frac{45}{14}$ and  $a_1 = \frac{104}{7}$ we have: $A = \frac{13}{49}$ and $B = - \frac{341}{91}$ hence the solution:
$$ a_n = \left( \frac{13}{49} + \frac{n}{21} \right) 3^n - \frac{341}{91}(-4)^n $$
Using $a_0 = 0$ and  $a_1 = 2$ we have: $A = \frac{13}{49}$ and $B = - \frac{13}{49}$ hence the solution:
$$ a_n = \left( \frac{13}{49} + \frac{n}{21} \right) 3^n - \frac{13}{49}(-4)^n $$
If you had another set of initial values in mind, you can just plug in and find $A$ and $B$.
A: $\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
$\ds{a_{n + 2} + a_{n + 1} - 12a_{n} = 3^{n}:\ {\large ?}}$.

First, write $\ds{a_{n} = \pars{b_{n} + \mu n}3^{n}}$ such that 
  \begin{align}
3^{n}&=\pars{b_{n + 2} + \mu n + 2\mu}3^{n + 2}
+\pars{b_{n + 1} + \mu n + \mu}3^{n + 1} - 12\pars{b_{n} + \mu n}3^{n}
\\[5mm]&=3^{n}\pars{9b^{n + 2} + 3b_{n + 1} - 12b_{n}} + 21\mu  3^{n}
\end{align}

With $\ds{\quad\mu \equiv {1 \over 21}\quad}$ we'll get $\ds{\quad9b^{n + 2} + 3b_{n + 1} - 12b_{n} = 0\quad}$ and you can use your first procedure.

Once you find $\ds{b_{n}}$, as a function of $\ds{n}$, you'll recover $\ds{a_{n}}$ as:
  $$
a_{n} = \pars{b_{n} + {n \over 21}}3^{n}
$$

