Solution of a recurrence relation

I want to solve $$a_{n+1} = (1 + \alpha) a_n + \gamma$$, where $$\alpha$$ and $$\gamma$$ are some constants. Wolfram alpha returns:

$$a_n = \frac{\gamma ((1+\alpha)^n-1)}{\alpha} + c (1+\alpha)^{n-1}$$.

Any idea how Wolfram alpha has solved this?

I think CASes apply a usual method of solving linear recurrence relations with constant coefficients (for example, see Wiki for info). In any case the result of the command of Maple

infolevel[all] := 4: rsolve(a(n+1) = k*a(n)+b, a(n));


confirms that guess.

Addition. As step-by-step solution by W|A shows, the generating function is used to this end there.

Addition 2. See here and here and here.

• @Martin: As an exception, I added screens to my answer. Commented Sep 27, 2022 at 13:36
\$Version

(* "13.1.0 for Mac OS X x86 (64-bit) (June 16, 2022)" *)

WolframAlpha["step-by-step solve a[n+1]==(1+α) a[n]+γ"]


Clear[a, \[Alpha], n]
RSolve[a[n + 1] == (1 + α) a[n] + γ, a[n], n]


$$\left\{\left\{a(n)\to -\frac{\gamma \left(1-(\alpha +1)^n\right)}{\alpha }+c_1 (\alpha +1)^{n-1}\right\}\right\}$$

EDIT

For a step-by-step solution type == and paste equation into Mathematica:

• May be Wolfram alpha can provide the step by step solution but I don't know the command for that.
– Syed
Commented Sep 27, 2022 at 12:46
• Updated the answer. It is quite a series of steps to get there.
– Syed
Commented Sep 27, 2022 at 13:01