How do I turn this recursive function $A_n = 5A_{n-1} + 2$ into a non-recursive function?

70 Views Asked by At

The function is

$$\begin{align} A_1 &= 1 \\ A_n &= 5A_{n-1} + 2 \end{align}$$

I'm strugling with it for two days

1

There are 1 best solutions below

0
On BEST ANSWER

Expanding yields

$$\begin{align} A_n = 5A_{n-1}+2 &= 5(5A_{n-2}+2)+2 = \\ &= 5(5(5A_{n-3}+2)+2)+2 = \\ &= 5(5(5(5A_{n-4}+2)+2)+2)+2 = \\ &= \ ... \ = \\ &= 5^{n-1}A_1 + 5^{n-2}\cdot 2 + 5^{n-3}\cdot 2 + \dots + 5^1\cdot 2 + 2 \end{align}$$

Or, using the sum notation this is further equal to

$$= 5^{n-1}A_1 + 2\sum_{k=0}^{n-2}5^k.$$

Using the formula for the geometric sum this is further equal to:

$$\begin{align} &= 5^{n-1}A_1 + 2\frac{1-5^{n-1}}{1-5} = \\ &= 5^{n-1}A_1 + 2\frac{5^{n-1}-1}{4} = \\ &= 5^{n-1}A_1 + \frac{5^{n-1}-1}{2} \end{align}$$

With $A_1=1$, the summation formula is

$$A_n = 5^{n-1} + \frac{5^{n-1}-1}{2}$$

Or

$$A_n = \frac{3}{2}5^{n-1}-\frac{1}{2}$$

This indeed works, for $n=1,2,3,4$ it yields

$$1,7,37,187,\dots$$

Which is what you would get from the $5x+2$ chain, starting from $x=1$.