Matrix method to solve linear recceurences with slight variations How can we construct a matrix to define linear reccurence relations such as
$F_{\mathrm{i}} =2F_{\mathrm{i-1}} + 3F_{\mathrm{i-2}} + 5$  and
$F_{\mathrm{i}} =F_{\mathrm{i-1}} +2\mathrm{i^2} + 3\mathrm{i} + 5$
This answer was quite helpful but addition of a constant term or a term with degree two is a bit confusing.
 A: Such reccurences can be written as
$$\vec F_n=A\vec F_{n-1}+\vec v_n$$
for a matrix $A$ and vector $\vec v_n$. For example, the first one can be written as
$$\begin{bmatrix}F_n\\F_{n+1}\end{bmatrix}=\begin{bmatrix}0&1\\2&3\end{bmatrix}\begin{bmatrix}F_{n-1}\\F_n\end{bmatrix}+\begin{bmatrix}0\\5\end{bmatrix}$$
These can be made homogeneous by finding a particular solution $\vec P_n$ to the recurrence i.e. any solution to
$$\vec P_n=A\vec P_{n-1}+\vec v_n$$
Then we could write $\vec F_n=\vec H_n+\vec P_n$, where $\vec H_n$
$$\vec H_{n+1}=A\vec H_n\implies\vec H_n=A^n\vec H_0$$
is the solution to the homogeneous equation. For your first example, we may substitute the constant vector $\vec P_n=C\begin{bmatrix}1\\1\end{bmatrix}$ to get
\begin{align}C\begin{bmatrix}1\\1\end{bmatrix}&=C\begin{bmatrix}0&1\\2&3\end{bmatrix}\begin{bmatrix}1\\1\end{bmatrix}+\begin{bmatrix}0\\5\end{bmatrix}\\&=C\begin{bmatrix}1\\5\end{bmatrix}+\begin{bmatrix}0\\5\end{bmatrix}\\\implies C&=5C+5\\\implies C&=-\frac54\end{align}
and hence
$$\vec F_n=A^n\vec H_0+\vec P_n=\begin{bmatrix}0&1\\2&3\end{bmatrix}^n\vec H_0-\frac54\begin{bmatrix}1\\1\end{bmatrix}$$
The second recurrence is not particularly special since it results in a 1 by 1 system:
$$[F_n]=[1][F_{n-1}]+[2n^2+3n+5]$$
and the particular solution $\vec P_n$ may be obtained by substituting in a cubic polynomial.
