Solving system of recurrence relations

2.1k Views Asked by At

Base Case:

$$ \left\{ \begin{array}{c} T(1) = 1 \\ T(2) = 1 \\T(3) = 4\end{array} \right. $$

I have the system:

$$ \left\{ \begin{array}{c} T(N) = G(N-1) + F(N-1) \\ G(N) = F(N-1) + G(N-1) \\ F(N) = 2H(N-1) + F(N-2) \\ H(N) = H(N-1) + F(N-1)\end{array} \right. $$

I seems $$T(N) = H(N) = G(N)$$ so we now have only two equations:

$$ \left\{ \begin{array}{c} T(N) = T(N-1) + F(N-1) \\ F(N) = 2T(N-1) + F(N-2)\end{array} \right. $$

I figured

$T(N) = T(N-k) + \sum_{i=1}^k F(N-i) $

and

$F(N) = F(N-2) +2T(N-k) + 2\sum_{i=2}^k F(N-i) $

But after mixing these expressions in a similar way, I came unstuck.

I tried following another example but it didn't help.

I would like to find $T(10^{12})$. Probably by using matrix exponentiation.

2

There are 2 best solutions below

1
On BEST ANSWER

Note that

$$ \begin{pmatrix} T_n \\ F_n \\ F_{n - 1} \end{pmatrix} = \begin{pmatrix} 1 & 1 & 0 \\ 2 & 0 & 1 \\ 0 & 1 & 0 \end{pmatrix} \begin{pmatrix} T_{n-1}\\ F_{n-1}\\ F_{n-2} \end{pmatrix}. $$

So starting with $(T_1, F_1, F_0)$ you can find $(T_n, F_n, F_{n-1})$ quickly by matrix exponentiation. The latter can be done by the squaring method.

3
On

Since $T(N)=T(N-1)+F(N-1)$ so $$2T(N)=2T(N-1)+2F(N-1)$$ minus this $F(N)=2T(N-1)+F(N-1)$ you get $$2T(N)-F(N)=F(N-1)$$ which means $$T(N)=\frac{1}{2}(F(N)+F(N-1))$$ so by institution it back to $F(N)=2T(N-1)+F(N-2)$ for $N-1$, you get $$F(N)=F(N-1)+2F(N-2)$$ Using the base case we have $$2T(1)=F(1)+F(0)=2$$ Also $$2T(2)=F(2)+F(1)=F(1)+2F(0)+F(1)=2(F(1)+F(0))=2$$ So there is an inconsistency in the base case you gave.