Solving linear recurrence relation Solve the following linear recurrence relation:
$$h_n=4h_{n-1}-4h_{n-2}+n^2 2^n$$
for $n\geq2$ and $h_0=h_1=1$

Use generating functions. Define $H(z) = \sum_{n \ge 0} h_n z^n$, and write the recurrence as:
$$
h_{n + 2} = 4 h_{n + 1} - 4 h_n + 4 (n + 2)^2 2^n
$$
By the properties of ordinary generating functions (see e.g. Wilf's "generatingfunctionology") with the operator $z D = z \dfrac{d}{d z}$
:
$$
\begin{align*}
\frac{H(z) - 1 - z}{z^2} &= 4 \frac{H(z) - 1}{z} - 4 H(z)
     + 4 (z D + 2)^2 \frac{1}{1 - 2 z} \\
H(z) &= \frac{2}{(1 - 2 z)^5} 
           - \frac{3}{(1 - 2 z)^4}
           - \frac{3}{(1 - 2 z)^3}
           + \frac{21}{2 (1 - 2 z)^2}
           - \frac{19}{2 (1 - 2 z)}
           + 4
\end{align*}
$$
Using $\binom{-r}{s} = (-1)^r \binom{r + s - 1}{r - 1}$ the powers give polynomials in $n$ multiplying $2^n$, a computer algebra system like maxima
reduces this mess to a simpler expression.
