Recurrence Relation where n+1th Term is A by nth term + B to the n

Theorem
Let $\sequence {a_n}$ be the sequence defined by the recurrence relation:


 * $a_n = \begin {cases} 0 & : n = 0 \\ A a_{n - 1} + B^{n - 1} & : n > 0 \end {cases}$

for numbers $A$ and $B$.

Then the closed form for $\sequence {a_n}$ is given by:


 * $a_n = \begin {cases} \dfrac {A^n - B^n} {A - B} & : A \ne B \\ n A^{n - 1} & : A = B \end {cases}$

Proof
The proof proceeds by induction.

For all $n \in \Z_{\ge 0}$, let $P \left({n}\right)$ be the proposition:
 * $a_n = \begin {cases} \dfrac {A^n - B^n} {A - B} & : A \ne B \\ n A^{n - 1} & : A = B \end {cases}$

$\map P 0$ is the case:

When $A = B$:

Thus $\map P 0$ is seen to hold.

Basis for the Induction
$\map P 1$ is the case:

When $A = B$:

Thus $\map P 1$ is seen to hold.

This is the basis for the induction.

Induction Hypothesis
Now it needs to be shown that, if $\map P k$ is true, where $k \ge 1$, then it logically follows that $\map P {k + 1}$ is true.

This is the induction hypothesis:
 * $a_k = \begin {cases} \dfrac {A^k - B^k} {A - B} & : A \ne B \\ k A^{k - 1} & : A = B \end {cases}$

from which it is to be shown that:
 * $a_{k + 1} = \begin {cases} \dfrac {A^{k + 1} - B^{k + 1} } {A - B} & : A \ne B \\ \paren {k + 1} A^k & : A = B \end {cases}$

Induction Step
This is the induction step:

First let $A \ne B$.

When $A = B$ we have for $k > 0$:

So $\map P k \implies \map P {k + 1}$ and by the Principle of Mathematical Induction:


 * $a_n = \begin {cases} \dfrac {A^n - B^n} {A - B} & : A \ne B \\ n A^{n - 1} & : A = B \end {cases}$