Solving recurence relations
Here's a general technique on linear recurrences that's useful to know. Observe that:

$$
\begin{bmatrix}
T(n) \\
T(n+1)
\end{bmatrix} =
\begin{bmatrix}
0 &amp; 1 \\
2 &amp; -1
\end{bmatrix}^{n}
\begin{bmatrix}
2 \\
5
\end{bmatrix}$$

If we can perform an eigendecomposition of $M$:

$$M = Q \Lambda Q^{-1}$$

where $\Lambda$ is a diagonal matrix, then:

$$M^n = Q \Lambda^n Q^{-1}$$

Raising a diagonal matrix to a power is trivial. This gives you a closed form for $M^n$.

In your case:

$$\begin{bmatrix}
0 &amp; 1 \\ 2 &amp; -1
\end{bmatrix} =
\begin{bmatrix}
-\frac{1}{\sqrt{5}} &amp; \frac{1}{\sqrt{2}} \\
\frac{2}{\sqrt{5}} &amp; \frac{1}{\sqrt{2}}
\end{bmatrix}
\begin{bmatrix}
-2 &amp; 0 \\
0 &amp; 1
\end{bmatrix}
\begin{bmatrix}
\frac{-\sqrt{5}}{3} &amp; \frac{\sqrt{5}}{3} \\
\frac{2\sqrt{2}}{3} &amp; \frac{\sqrt{2}}{3}
\end{bmatrix}$$

So:

$$
\begin{bmatrix}
T(n) \\
T(n+1)
\end{bmatrix} =
\begin{bmatrix}
-\frac{1}{\sqrt{5}} &amp; \frac{1}{\sqrt{2}} \\
\frac{2}{\sqrt{5}} &amp; \frac{1}{\sqrt{2}}
\end{bmatrix}
\begin{bmatrix}
-2 &amp; 0 \\
0 &amp; 1
\end{bmatrix}^n
\begin{bmatrix}
\frac{-\sqrt{5}}{3} &amp; \frac{\sqrt{5}}{3} \\
\frac{2\sqrt{2}}{3} &amp; \frac{\sqrt{2}}{3}
\end{bmatrix}
\begin{bmatrix}
2 \\
5
\end{bmatrix}$$

Multiplying the matrices together, taking the top row, and simplifying gives:

$$T(n) = 3 - (-2)^n$$

It's a lot of work (if you don't have a computer algebra system handy), but it always gives an answer if the system is linear and diagonalisable.