Let's say we have the recurrence relation $$ x_n = \begin{cases} x_{n-1} + y_{n-2} + y_{n-3} + n2^n, & \mbox{if } n\ \geq 0 \\ 1 & \mbox{if } n \lt 0 \end{cases}\\ y_n = \begin{cases} y_{n-2} + x_{n-1} + x_{n-1} + n4^n, & \mbox{if } n\ \geq 0 \\ 1 & \mbox{if } n \lt 0 \end{cases} $$
How to build a transformation matrix for the recurrence relation and solve it with matrix exponentiation?
If it would be possible to get rid of $n2^n$ and $n4^n$, then we can build the transformation matrix for the linear recurrence relation:
$$ T = \begin{bmatrix} 1 & 0 & 1 & 1 \\ 2 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ \end{bmatrix} $$
And eventually, we will be able to use $\vec{V_n} = T^{n+1} \cdot \vec{V_{-1}}$ formula to find $x_n$ and $y_n$.
However, the recurrence is no longer linear with the additional parts. As I understand, it's possible to represent additional part other way: $d^{n+1} = d(d^n) => (n+1)d^{n+1} = d(nd^n) + d(d^n)$, but I don't know where to move further.
I would really appreciate it if you could help me to find a way to build a transformation matrix for this recurrence.
My target is to be able to find $x_n$ and $y_n$ for arbitrary positive integer $n$ using matrix exponentiation. Just some sort of competitive programming task, but focused on math. I'm not linear algebra expert and decided to start from basics, however, I've stuck with this question.
My first guess was that it's possible to calc $x_{n−1}+y_{n−2}+y_{n−3}$ and $n2^n$ separately and sum the results, as it should be done for non-homogeneous relation, but I can't adapt it.
– Furdarius Jul 04 '20 at 21:07Btw, could it be possible to simplify the relation here to linear one?
– Furdarius Jul 05 '20 at 07:48