A recurrence relation of this type: F_n = 2F_{n - 1} + 3F_{n - 2} + 3 , where sum of the coefficient of recurring terms on both side of the equation is not equal.
I have seen a codechef video ( by Kevin ) where they explain the offset adding to solve this type of recurrence by removal of the constant term. The recurrence can be converted to G_n = 2G_{n-1} + 3G_{n-2} and later use matrix exponentiation to solve it with matrix \begin{bmatrix} 2&3\\ 1&0\\ \end{bmatrix} to obtain the value of G_n \textit{ mod }M. For example,
\begin{aligned} &\text{Let, }F_n = G_n + C\\ &\Rightarrow G_n + C = 2\left [ G_{n - 1} + C \right ] + 3\left [ G_{n - 2} + C \right ] + 3 \\ &\Rightarrow G_n + C = 2G_{n - 1} + 3G_{n - 2} + 5C + 3 \\ &\Rightarrow G_n= 2G_{n - 1} + 3G_{n - 2} + 4C + 3 \\ &\Rightarrow C = -\frac{3}{4} \\ \end{aligned}
Now after calculating the value of G_n \textit{ mod }M how to recover F_n?
Thanks!