How to solve these recurrence relations by using generating function [closed]
Here's a (partial) solution for the second recurrence relation. There's no particular reason for me having chosen this particular recurrence among the other two; this is just used as an example to give you an idea of how to solve the others. I intentionally left out most of the details to let this serve more as a reference for you to check your solution at different checkpoints rather than as an answer key. $$\begin{cases}a_k=4a_{k-1}-4a_{k-2}+k^2\\ a_0=2\\ a_1=5\end{cases}$$ Let $f(x)$ denote the generating function for the sequence $a_k$; that is, $f(x)=\sum\limits_{k\ge0}a_kx^k$. Taking the first equation, multiply each term by $x^k$ and sum each term over all positive $k\ge2$. (Why?) $$\color{red}{\sum_{k\ge2}a_kx^k}=4\color{blue}{\sum_{k\ge2}a_{k-1}x^k}-4\color{green}{\sum_{k\ge2}a_{k-2}x^k}+\color{orange}{\sum_{k\ge2}k^2x^k}$$ The idea is to manipulate each term so that you can write them as expressions in terms of the generating function $f(x)$ and known series representations. For instance, consider the LHS: $$\begin{align*}\sum_{k\ge2}a_kx^k&=\sum_{k\ge2}a_kx^k+a_1x+a_0-a_1x-a_0\\&=\sum_{k\ge0}a_kx^k-a_1x-a_0\\&=f(x)-5x-2\end{align*}$$ Doing the same throughout, you end up with a rewritten equation that can be solved for $f(x)$. $$\begin{align*}\color{red}{f(x)-5x-2}&=4\color{blue}{x(f(x)-2)}-4\color{green}{x^2f(x)}+\color{orange}{\frac{x(1+x)}{(1-x)^3}-x}\\[1ex] f(x)&=\frac{2}{(1-x)^3}+\frac{5}{(1-x)^2}+\frac{13}{1-x}+\frac{6}{(1-2x)^2}-\frac{24}{1-2x} \end{align*}$$ From here, you need to determine an appropriate series representation for $f(x)$. All the information you need happens to be contained in the geometric series, $$\sum_{k\ge0}x^k=\frac{1}{1-x}\quad\text{for }|x|<1$$ and its derivatives.
You should arrive at the final solution $$a_k=20-9(2^{1+k})+8k+3k(2^{1+k})+k^2$$