Solving a non-homogenous linear recurrence relation with initial conditions Given the recurrence relation:
$$
a_n = 1.04a_{n-1} + 100
$$
$$
a_0 = 0
$$
How can I solve this? Here is my attempt at a solution:


*

*Solve the non-homogeneous part. Set up a polynomial $p_n$:
$$
p_n = D
$$
$$
D = 1.04D + 100
$$
$$
-0.04D = 100
$$
$$
\therefore D = -2500
$$

*Solve the homogeneous part. This part appears to be correct (per my textbook's listed solution):
$$
a_n = 1.04a_{n-1}
$$
$$
Characteristic \ polynomial: \ x = 1.04(x)^0
$$
$$
\therefore x = 1.04
$$


*Add the solutions:


$$
a_n = C_1(1.04)^n - 2500
$$
$$
For \ n=0: a_0 = 0 = C_1(1.04)^0 - 2500
$$
$$
C_1 = 2500
$$
$$
\therefore a_n = 2500(1.04)^n - 2500
$$
Right? But my book says the solution is $a_n = 1250(1.04)^n - 1250$. How can this be? Did I do something incorrectly?
 A: Your solution is good. I'll present a slightly different approach.
Let's consider the more general $a_{n+1}=ha_n+k$, $a_0=0$. We have
$$
a_{n+2}=ha_{n+1}+k=ha_{n+1}+a_{n+1}-ha_n=(h+1)a_{n+1}-ha_n
$$
which is a second order recursion, with initial data $a_0=0$, $a_1=k$.
The characteristic polynomial is $X^2-(h+1)X+h$, whose roots are $h$ and $1$. Thus the general solution, assuming $h\ne1$, is
$$
a_{n}=Ah^n+B
$$
and we have
\begin{cases}
A+B=0\\
Ah+B=k
\end{cases}
hence $B=-A$ and $A(h-1)=k$, so
$$
A=\frac{k}{h-1},\quad B=-\frac{k}{h-1}
$$
For $h=1.04$ and $B=100$, we have
$$
A=\frac{100}{0.04}=2500,\qquad B=-2500
$$
A: Your solution is correct. You can tell that the book's solution is wrong with a counter-example:
Using the solution given by the book (Letting $n=1$):
$$a_1=1250(1.04)^1-1250=50$$
But if we substitute this into your recurrence relation:
$$a_1=1.04a_0+100$$
$$50\neq 100$$
And thus, the solution provided by your book is incorrect.
You can prove that the solution you've obtained is correct using Mathematical Induction.
A: I'd like to present and alternative which relies on reducing the problem into something simpler, by removing the constant in front of $a_n$.
In general assume we want to solve $a_{n + 1} = ba_n + k$. We divide both sides by $b^{n+1}$ so that we get
$$\frac{a_{n + 1}}{b^{n+1}} = \frac{a_n}{b^n} + \frac{k}{b^{n + 1}}$$
This essentially transforms our problem into solving
$$c_{n + 1} = c_n + \frac{k}{b^{n + 1}}$$
where $c_n = \frac{a_n}{b^n}$.
This is pretty straight forward: We move $c_n$ to the left hand side:
$$c_{n + 1} -c_n = \frac{k}{b^{n + 1}}$$
We then sum up both sides from $n = 1$ to $n = N$. On the left, we observe the simplest ever telescoping series and to on the right hand side, we observe a rather simple geometric series.
With this we get a closed expression for $c_{N + 1}$ and can extract $a_{N + 1}$ with a simple mulitplication of $b^{N + 1}$ on both sides.
Hopefully this comes in useful when you forget any formulas pertaining to the solutions or characteristic polynomials or what not.
A: We can solve it with a simple substitution, which really gives an intuition on why your method works.
$$a_n = 1.04a_{n-1} + 100$$
$$-2500=1.04(-2500)+100$$
Subtracting both equations gives,
$$a_n+2500=1.04(a_{n-1}+2500)$$
Let $b_n=a_n+2500$ this gives,
$$b_n=1.04b_{n-1}$$
$$b_n=b_0(1.04^n)=(a_0+2500)(1.04^n)$$
Which means,
$$a_n=(a_0+2500)(1.04^n)-2500$$
