Difference equation solution My question : $y_{n+1}= ay_n+b$ ;  $y_0 = \alpha$
We solved this difference equation in a class and got that $y_n = a^nc + \beta$
Can someone please explain the way how to solve it? And what is the was to solve differential equations in general? Is there some good literature with difference equations theory and examples?
 A: Note that it must be: $y_n=a^n\color{red}{\alpha}+\beta$.
If $a=1$, it is just an $n$-th term of an  Arithmetic Progression.
Assume $a\ne 1$.
Method $1$:
$$\begin{align}y_{n+1}&= ay_n+b=\\
&=a(ay_{n-1}+b)+b= \qquad \qquad \qquad \ \ \ \ \ \ \ \ \ \ \ \ \ \ a^2y_{n-1}+(a+1)b=\\
&=a^2(ay_{n-2}+b)+(a+1)b=\qquad \qquad \qquad a^3y_{n-2}+(a^2+a+1)b=\\
&\ \ \ \vdots \\
&=a^n(ay_{0}+b)+(a^{n-1}+a^{n-2}+\cdots+1)b=a^{n+1}y_{0}+(a^n+a^{n-1}+\cdots+1)b=\\
&=a^{n+1}y_0+\frac{(a^{n+1}-1)b}{a-1}=\\
&=a^{n+1}y_0+a^{n+1}\frac{b}{a-1}-\frac{b}{a-1}=\\
&=a^{n+1}\left(y_0+\frac{b}{a-1}\right)-\frac{b}{a-1} \Rightarrow \\
y_n&=a^n\left(y_0+\frac b{a-1}\right)-\frac{b}{a-1}=a^n\underbrace{y_0}_{\alpha}+\underbrace{(a^n-1)\cdot \frac b{a-1}}_{\beta}
\end{align}$$
Method 2:
$$y_{n+1}=ay_n+b \Rightarrow y_{n+1}+\frac{b}{a-1}=a(y_n+\frac b{a-1})\\
z_n=y_n+\frac b{a-1}, z_0=y_0+\frac b{a-1}\\
z_{n+1}=az_n \Rightarrow z_n=a^nz_0=a^n\left(y_0+\frac b{a-1}\right)=y_n+\frac b{a-1} \Rightarrow \\
y_n=a^n\left(y_0+\frac b{a-1}\right)-\frac b{a-1}=a^n\underbrace{y_0}_{\alpha}+\underbrace{(a^n-1)\cdot \frac b{a-1}}_{\beta}.$$
