# General solution to a recursive equation

What is the general solution of the following recursive equation?

$$N(t)=(1+f)\cdot\left(N(t-1)-N(t-T)+N(t-T-1)\right)$$

By "general solution" I mean an equation where $N(t)$ stands alone on the left hand-side and is expressed only in terms of f and T only.

This recursive equation has been written for a case-study in biology where $N(0)=1$. Also, I guess that we should consider that $N(any.negative.number)=1$ (although it makes no sense for my study-case to have a negative value in the N(..) function) so that when t is lower than T, the equation simplifies into $N(t)=(1+f)\cdot N(t-1)$

Let me know if my question makes sense and if all informations to solve this equation are given.

Here is a "constructive" attempt. Sorry if it is long. First of all, let $$X(k)=\left[\begin{array}{c}N(t)\\N(t+1)\\\vdots\\N(t+T)\end{array}\right], X(k+1)=\left[\begin{array}{c}N(t+T+1)\\N(t+T+2)\\\vdots\\N(t+2T + 1)\end{array}\right]$$ The idea is that we can write your equation in a matricial form $$X(k+1) = MX(k)$$, where M is a $(T+1) \times (T+1)$ matrix. To do this, let's pose $g = 1 + f$. Then: $$N(t+T+1) = g(N(t) - N(t+1) + N(t+T)) \Rightarrow$$ $$X_1(k+1) = g(X_1(k) - X_2(k) + X_{T+1}(k))$$ $$N(t+T+2) = g(N(t+1) - N(t+2) + N(t+T+1)) \Rightarrow$$ $$X_2(k+1) = g(X_2(k) - X_3(k)) + g X_{1}(k+1)$$ $$\cdots$$ $$N(t+2T) = g(N(t+T-1) - N(t+T) + N(t+2T-1)) \Rightarrow$$ $$X_{T}(k+1) = g(X_{T}(k) - X_{T+1}(k)) + g X_{T-2}(k+1)$$ $$N(t+2T+1) = g(N(t+T) - N(t+T+1) + N(t+2T)) \Rightarrow$$ $$X_{T+1}(k+1) = gX_{T+1}(k) + g(-X_{1}(k+1)+X_{T}(k+1))$$
This means that we have the following: $$X(k+1) = AX(k) + BX(k+1)$$ where $A$ and $B$ are $(T+1)\times(T+1)$ matrices, and then $$X(k+1) = (I-B)^{-1}AX(k)$$ with $M = (I-B)^{-1}A$
$$A=\left[\begin{array}{ccccccc}g & -g & 0 & 0 & \cdots & 0 & g\\0 & g & -g & 0 & \cdots & 0 & 0\\\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots\\0 & 0 & 0 & 0 & \cdots & g & -g\\0 & 0 & 0 & 0 & \cdots & 0 & g\end{array}\right]$$
$$B=\left[\begin{array}{ccccccc}0 & 0 & 0 & \cdots & 0 & 0 & 0\\g & 0 & 0 & \cdots & 0 & 0 & 0\\0 & g & 0 & \cdots & 0 & 0 & 0\\\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots\\0 & 0 & 0 & \cdots & g & 0 & 0\\-g & 0 & 0 & \cdots & 0 & g & 0\end{array}\right]$$
Given $f$ and $T$, you can build $A$, $B$ and then $M$. At this point, you can evaluate the solution at any time. That is $$X(k+h) = M^h X(k)$$ where $$X(k+h)=\left[\begin{array}{c}N(t+h(T+1))\\N(t+h(T+1)+1)\\\vdots\\N(t+h(T+1)+ T)\end{array}\right]$$