A closed form expression for the finite-difference Euler's method Consider the ODE
$$f(u) \equiv u' = au+b, \>\>\> u(t_0 = 0)\equiv u^0 = u_0$$
For a timestep $k$, the forward-difference approximator for $u'$ gives the Euler update as
$$
u^{n+1} = u^n + kf(u^n) = u^n + k(au^n + b)
$$
I am trying to come up with a closed form expression for $u^n$, that is, one that involves only the constants $a, b, u_0, k$.
I've tried to do this by first writing $u^{n}$ as a cumulative sum
$$
u^n = u^n + k(au^n + b) = u_0 + \sum_{i=0}^{n-1}k(au^i+b)
$$
I then tried to expand the sum on the right and see if there was any easily identifiable pattern to write more generally, or if it would perhaps resemble an expansion of some other known function.After some ugly algebra, this is something like
$$
\begin{align}
u^n &= u_0 + k(au_0 + b) + k(au_1 + b) + k(au_2 + b) + ...\\
&= u_0 + k(au_0 + b) + (k^2a + k)(au_0 + b) + (k^3a^2 + 2k^2a + k)(au_0 + b) + ...\\
&= u_0 + (k^3a^2 + 3k^2a + 3k + ...)(au_0+b)
\end{align}
$$
Nothing jumps out to me, and I'm not sure this approach is promising. Any ideas?
I've massaged it some more and found that it can be written as
$$u^n = (1+ka)^nu_0 + C_n$$
Where C is a function of $a,b,k,n$, which I've yet to deduce...
 A: From the same principles that you would solve a linear DE with, you get for the linear recursion a complementary part and a particular solution that can be found via undetermined coefficients
$$
u^n=c(1+ka)^n-\frac{b}{a}.
$$
To determine the constant of the homogeneous solution, insert into the initial condition
$$
u^0=c-\frac{b}{ka}\implies u^n=(1+ka)^nu^0+\frac{(1+ka)^n-1}{a}b
$$

(edit/verification) Transformation of the equation to a geometric progression
$$
u^{n+1}=(1+ka)u^n+kb=(1+ka)u^n+\frac{b}{a}((1+ka)-1)
\\~\\
\left(u^{n+1}+\frac{b}{a}\right)=(1+ka)\left(u^n+\frac{b}{a}\right)
\\~\\
u^n=(1+ka)^n\left(u^0+\frac{b}{a}\right)-\frac{b}{a}
=(1+ka)^nu^0+\frac{b}{a}\left((1+ka)^n-1\right)
$$
A: I did not solve your specific problem, but your problem can be written as a non-homogenous linear recurrence equation with constant coefficients. C. f. https://en.wikipedia.org/wiki/Recurrence_relation#Solving_non-homogeneous_linear_recurrence_relations_with_constant_coefficients .
$$u^{n+1} = (1 + ka) u^n + kb$$
