Homework - Resolve the recurrence relation What's the closed formula of this recurrence relation?
$$a_n = a_{n-1}+2a_{n-2}+2^n \text{ with } a_0=1, a_1=2 $$

The best course of action for simple inhomogeneous recurrences is to make use of a smart "change of variables" (read: substitute with another recurrence relation) to turn it into a homogeneous recurrence. A nice observation here is to notice that $2^n$ is itself a recurrence relation, namely: 
$$y_n=2y_{n-1},\,\,(y_0=1)$$ 
Let's use this to our advantage:
$$\begin{align}
a_n=a_{n-1}+2a_{n-2}+2^n &\Leftrightarrow 2^n=a_n-a_{n-1}-2a_{n-2} \\
&\Leftrightarrow 2\cdot2^{n-1}=a_n-a_{n-1}-2a_{n-2} \\
&\Leftrightarrow 2\cdot (a_{n-1}-a_{n-2}-2a_{n-3})=a_n-a_{n-1}-2a_{n-2} \\
&\Leftrightarrow a_n-3a_{n-1}+4a_{n-3}=0
\end{align}$$
Bam, homogeneous recurrence. Can apply the characteristic equation and finish it by yourself?
Edit: The characteristic equation for the last recurrence is $x^3-3x+4=0$, whose roots are $2,2$ and $-1$. It is well-known then, that given these roots, the solution is of the form:
$$a_n=(An+B)2^n+C(-1)^n$$
For some constants $A,B,C$. To find out what the constants are, we plug in values of $n$ for which the value of $a_n$ is known. The values of $a_0,a_1$ were given, but we need three to solve a linear system with three variables. We can easily calculate $a_2$: $$a_2=a_1+2a_0+2^2=8$$
Now we solve the system:
$$\begin{cases}
(A\cdot0+B)2^0+C(-1)^0=1 \\
(A\cdot1+B)2^1+C(-1)^1=2 \Rightarrow \\
(A\cdot2+B)2^2+C(-1)^2=8
\end{cases}$$
$$\Rightarrow \begin{cases}
B+C=1 \\
2(A+B)-C=2 \\
4(2A+B)+C=8
\end{cases}$$
Solving this will yield $A=\frac{2}{3}$,$B=\frac{5}{9}$ and $C=\frac{4}{9}$. Therefore, the closed form is:
$$a_n=\frac{(6n+5)2^n+4(-1)^n}{9}$$
