Functional equation $f(x+1)=af(x)+b$ 
Functional equation $f(x+1)=af(x)+b$

There was a question I solved a few days back that asked for a closed form of an equation for a given system. The function came down to this equation which I solved by noting the pattern. By the way $f(0)=10$
So here's how I saw it:
$f(1)=10a+b(1)$
$f(2)=10a^2+b(1+a)$
$f(3)=10a^3+b(1+a+a^2)$
So I saw the pattern and the geometric series in brackets and I managed to figure it out partly because the question format was leading me in that direction.
My question now is, presented purely with a functional equation $f(x+1)=af(x)+b$ for some constants $a, b \in \mathbb R$, and some starting value $f(0)=5$ maybe, would you solve it the way I did or there's a different approach?
 A: 
Let $a$ and $b$ be real numbers.  We shall determine all $f:\mathbb{R}\to\mathbb{R}$ such that
  $$f(x+1)=a\,f(x)+b\tag{*}$$
  for every $x\in\mathbb{R}$. 

If $a=0$, then $f(x)=b$ for all $x\in\mathbb{R}$.  We assume from now on that $a\neq 0$. We first deal with the case $a>0$.
If $a=1$, then we have $f(x+1)=f(x)+b$ for all $x\in\mathbb{R}$.  By setting $g(x):=f(x)-b\,x$, we see that $g(x+1)=g(x)$ for all $x\in\mathbb{R}$.  That is, $g$ is periodic with period $1$.  Therefore, $$f(x)=g(x)+b\,x$$ for all $x\in\mathbb{R}$, where $g:\mathbb{R}\to\mathbb{R}$ is periodic with period $1$.
If $a\neq 1$, then let $g(x)=\dfrac{1}{a^x}\,\left(f(x)+\dfrac{b}{a-1}\right)$ for all $x\in\mathbb{R}$.  We can then see that $g$ is again periodic with period $1$.  Therefore,
$$f(x)=a^x\,g(x)-\frac{b}{a-1}$$
for all $x\in\mathbb{R}$, where $g:\mathbb{R}\to\mathbb{R}$ is periodic with period $1$.
We now deal with the case $a<0$.  Define $g(x):=\dfrac{(-1)^{\lfloor x\rfloor}}{(-a)^x}\left(f(x)+\dfrac{b}{a-1}\right)$ for all $x\in\mathbb{R}$.  We see that $g(x+1)=g(x)$ for all $x\in\mathbb{R}$.  Thus,
$$f(x)=(-1)^{\lfloor x\rfloor}\,(-a)^x\,g(x)-\frac{b}{a-1}$$
for all $x\in\mathbb{R}$, where $g:\mathbb{R}\to\mathbb{R}$ is periodic with period $1$.

If $f:\mathbb{Z}\to\mathbb{R}$ satisfies (*) for all $x\in\mathbb{Z}$, then the solutions are:


*

*if $a=0$, then $f(x)=b$ for all $x\in\mathbb{Z}$;

*if $a=1$, then there exists a constant $c\in\mathbb{R}$ such that $f(x)=c+b\,x$ for all $x\in\mathbb{R}$;

*if $a\notin\{0,1\}$, then there exists a constant $c\in\mathbb{R}$ such that $f(x)=a^{x}\,c-\dfrac{b}{a-1}$ for all $x\in\mathbb{R}$.

A: Here you are considering a sequence ($x$ on integers).
You can show it with a recursive proof. It is true for $x=0$. And assuming there exists a rank $n$, such that $u(n) = C_1 a^n + \frac{b}{a-1} (a^n - 1)$. Then one can show easily that you get $u(n) = C_1 a^{n+1} + \frac{b}{a-1} (a^{n+1} - 1)$. The constant $C_1$ gives you the family of solutions for all real values of $C_1$ depending on your initial conditions.
A: $$f(x+1)-af(x)=b~~~~(1)$$
Jet $f(x)=g(x)+c$, then
$$g(x+1)+c-ag(x)-ac=b$$
$$g(x+1)-ag(x)=0, c=b/(1-a)$$
Let $$g(x)=d t^x \implies t=a$$
So the solution of (1) is
$$f(x)=da^x+\frac{b}{1-a}$$
