<s>[INST] Recurrence relation $a_n = 11a_{n-1} - 40a_{n-2} + 48a_{n-3} + n2^n$ I didn't do a lot of maths in my career, and we asked me to solve the following recurrence relation:
$$a_{n} = 11a_{n-1} - 40a_{n-2} + 48a_{n-3} + n2^n$$
with 
$a_0 = 2$, $a_1 = 3$ and $a_2 = 1$
What is the procedure to solve such relation? So far, I just know that $a_n$ could be split into two difference recurrence relations (homogeneous and non-homogeneous) as $a_n = b_n + c_n$, where 
$$b_n = 11b_{n-1} - 40b_{n-2} + 48b_{n-3}$$
and 
$$c_n = n2^n$$
 [/INST] Just to offer another approach, generating functions can be used as well:
$\begin{align}
G(x) &= \sum_{n=0}^{\infty} a_n x^n \\
G(x) &= 2x^0 + 3x^1 + x^2 + \sum_{n=3}^{\infty}(11a_{n-1} - 40a_{n-2} + 48a_{n-3} + n2^n)x^n \\
G(x) &= 2 + 3x + x^2 + 11\sum_{n=3}^{\infty}a_{n-1}x^n - 40\sum_{n=3}^{\infty}a_{n-2}x^n + 48\sum_{n=3}^{\infty}a_{n-3}x^n + \sum_{n=3}^{\infty}n2^nx^n \\
G(x) &= 2 + 3x + x^2 + 11x\sum_{n=2}^{\infty}a_{n}x^{n} - 40x^2\sum_{n=1}^{\infty}a_{n}x^{n} + 48x^3\sum_{n=0}^{\infty}a_{n}x^{n} + \sum_{n=3}^{\infty}n2^nx^n \\
G(x) &= 2 + 3x + x^2 + 11x(-a_{0}x^{0} -
 a_{1}x^{1} + \sum_{n=0}^{\infty}a_{n}x^{n}) - 40x^2(-a_{0}x^{0} + \sum_{n=0}^{\infty}a_{n}x^{n}) + 48x^3\sum_{n=0}^{\infty}a_{n}x^{n} + (- 2x -2 \cdot 2^2x^2 + \sum_{n=0}^{\infty}n2^nx^n) \\
G(x) &= 2 + 3x + x^2 + 11x(-2 -
 3x + G(x)) - 40x^2(-2 + G(x)) + 48x^3G(x) + (- 2x -2 \cdot 2^2x^2 + (2 x)/(2 x - 1)^2) 
\end{align}$
Solve for $G(x)$:
$$G(x) = \frac{-160 x^4 + 244 x^3 - 132 x^2 + 27 x - 2}{(3 x - 1) (8 x^2 - 6 x + 1)^2}$$
Apply partial fraction decomposition:
$$G(x) = 49 \cdot \frac{1}{1 -3 x} - 38 \cdot \frac{1}{1 - 4 x} + 5 \cdot \frac{1}{(1 - 4 x)^2} - 12 \cdot \frac{1}{1 - 2 x} - 2 \cdot \frac{1}{(1 - 2 x)^2}$$
Take the $n$th coefficient of the resulting generating function, which will bring us to the final result:
$$a_n = 49 \cdot 3^n - 38 \cdot 4^n + 5 \cdot 4^n(n+1) - 12 \cdot 2^n - 2 \cdot 2^n (n+1)$$
</s>