Fibonacci Number plus Arbitrary Function in terms of Fibonacci Numbers/Lemma
== Lemma for Fibonacci Number plus Arbitrary Function in terms of Fibonacci Numbers ==  Let $f \left({n}\right)$ be an arbitrary arithmetic function. Let $\left\langle{a_n}\right\rangle$ be the sequence defined as: :$a_n = \begin{cases} 0 & : n = 0 \\ 1 & : n = 1 \\ a_{n - 1} + a_{n - 2} + f \left({n - 2}\right) & : n > 1 \end{cases}$ Then: :$a_n = F_n + \displaystyle \sum_{k \mathop = 0}^{n - 2} F_{n - k - 1} f \left({k}\right)$  == Proof == Trying out a few values: {{begin-eqn}} {{eqn | l = a_0       | r = 0       | c =  }} {{eqn | r = F_0       | c =  }} {{end-eqn}} {{begin-eqn}} {{eqn | l = a_1       | r = 1       | c =  }} {{eqn | r = F_1       | c =  }} {{end-eqn}} {{begin-eqn}} {{eqn | l = a_2       | r = a_1 + a_0 + f \left({0}\right)       | c =  }} {{eqn | r = F_1 + F_0 + f \left({0}\right)       | c =  }} {{eqn | r = F_2 + F_1 f \left({0}\right)       | c =  }} {{end-eqn}} {{begin-eqn}} {{eqn | l = a_3       | r = a_2 + a_1 + f \left({1}\right)       | c =  }} {{eqn | r = F_2 + F_1 f \left({0}\right) + F_1 + f \left({1}\right)       | c =  }} {{eqn | r = F_3 + F_2 f \left({0}\right) + F_1 f \left({1}\right)       | c =  }} {{end-eqn}} {{begin-eqn}} {{eqn | l = a_4       | r = a_3 + a_2 + f \left({2}\right)       | c =  }} {{eqn | r = F_3 + F_2 f \left({0}\right) + F_1 f \left({1}\right) + F_2 + F_1 f \left({0}\right) + f \left({2}\right)       | c =  }} {{eqn | r = F_4 + F_3 f \left({0}\right) + F_2 f \left({1}\right) + F_1 f \left({2}\right)       | c =  }} {{end-eqn}} {{begin-eqn}} {{eqn | l = a_5       | r = a_4 + a_3 + f \left({3}\right)       | c =  }} {{eqn | r = F_4 + F_3 f \left({0}\right) + F_2 f \left({1}\right) + F_1 f \left({2}\right) + F_3 + F_2 f \left({0}\right) + F_1 f \left({1}\right) + f \left({3}\right)       | c =  }} {{eqn | r = F_5 + F_4 f \left({0}\right) + F_3 f \left({1}\right) + F_2 f \left({2}\right) + F_1 f \left({3}\right)       | c =  }} {{end-eqn}} The proof proceeds by induction. For all $n \in \Z_{\ge 0}$, let $P \left({n}\right)$ be the proposition: :$a_n = F_n + \displaystyle \sum_{k \mathop = 1}^{n - 1} F_{n - k - 1} f \left({k}\right)$ $P \left({0}\right)$ is the case: {{begin-eqn}} {{eqn | l = F_0 + \sum_{k \mathop = 0}^{0 - 2} F_{0 - k - 1} f \left({k}\right)       | r = F_0       | c = as the summation is vacuous }} {{eqn | r = 0       | c = {{Defof|Fibonacci Number}}: $F_0 = 0$ }} {{eqn | r = a_0       | c = by definition }} {{end-eqn}} Thus $P \left({0}\right)$ is seen to hold. === Basis for the Induction === $P \left({1}\right)$ is the case: {{begin-eqn}} {{eqn | l = F_1 + \sum_{k \mathop = 0}^{1 - 2} F_{1 - k - 1} f \left({k}\right)       | r = F_1       | c = as the summation is vacuous }} {{eqn | r = 1       | c = {{Defof|Fibonacci Number}}: $F_1 = 1$ }} {{eqn | r = a_1       | c = by definition }} {{end-eqn}} Thus $P \left({1}\right)$ is seen to hold. $P \left({2}\right)$ is the case: {{begin-eqn}} {{eqn | l = F_2 + \sum_{k \mathop = 0}^{2 - 2} F_{2 - k - 1} f \left({k}\right)       | r = F_2 + F_1 f \left({0}\right)       | c =  }} {{eqn | r = F_2 + f \left({0}\right)       | c = {{Defof|Fibonacci Number}}: $F_1 = 1$ }} {{eqn | r = F_1 + F_0 + f \left({0}\right)       | c = {{Defof|Fibonacci Number}} }} {{eqn | r = 1 + 0 + f \left({0}\right)       | c = {{Defof|Fibonacci Number}}: $F_1 = 1, F_0 = 0$ }} {{eqn | r = a_1 + a_0 + f \left({0}\right)       | c = by definition }} {{end-eqn}} Thus $P \left({2}\right)$ is seen to hold. This is the basis for the induction. === Induction Hypothesis === Now it needs to be shown that, if $P \left({r}\right)$ is true, where $r \ge 1$, then it logically follows that $P \left({r + 1}\right)$ is true. So this is the induction hypothesis: :$a_r = F_r + \displaystyle \sum_{k \mathop = 0}^{r - 2} F_{r - k - 1} f \left({k}\right)$ and: :$a_{r - 1} = F_{r - 1} + \displaystyle \sum_{k \mathop = 0}^{r - 3} F_{r - k - 2} f \left({k}\right)$ from which it is to be shown that: :$a_{r + 1} = F_{r + 1} + \displaystyle \sum_{k \mathop = 0}^{r - 1} F_{r - k} f \left({k}\right)$ === Induction Step === This is the induction step: {{begin-eqn}} {{eqn | l = a_{r + 1}       | r = a_{r - 1} + a_r + f \left({r - 1}\right)       | c =  }} {{eqn | r = \left({F_{r - 1} + \sum_{k \mathop = 0}^{r - 3} F_{r - k - 2} f \left({k}\right)}\right) + \left({F_r + \sum_{k \mathop = 0}^{r - 2} F_{r - k - 1} f \left({k}\right)}\right) + f \left({r - 1}\right)       | c = Induction Hypothesis }} {{eqn | r = F_{r + 1} + \sum_{k \mathop = 0}^{r - 3} F_{r - k - 2} f \left({k}\right) + \sum_{k \mathop = 0}^{r - 2} F_{r - k - 1} f \left({k}\right) + F_1 f \left({r - 1}\right)       | c = {{Defof|Fibonacci Number}} }} {{eqn | r = F_{r + 1} + \sum_{k \mathop = 0}^{r - 3} \left({F_{r - k - 2} + F_{r - k - 1} }\right) f \left({k}\right) + F_{r - \left({r - 2}\right) - 1} f \left({r - 2}\right) + F_1 f \left({r - 1}\right)       | c = factoring out the summation }} {{eqn | r = F_{r + 1} + \sum_{k \mathop = 0}^{r - 3} F_{r - k} f \left({k}\right) + F_1 f \left({r - 2}\right) + F_1 f \left({r - 1}\right)       | c = {{Defof|Fibonacci Number}} and simplifying }} {{eqn | r = F_{r + 1} + \sum_{k \mathop = 0}^{r - 3} F_{r - k} f \left({k}\right) + F_2 f \left({r - 2}\right) + F_1 f \left({r - 1}\right)       | c = {{Defof|Fibonacci Number}}: $F_1 = F_2 = 1$ }} {{eqn | r = F_{r + 1} + \sum_{k \mathop = 0}^{r - 1} F_{r - k} f \left({k}\right)       | c =  }} {{end-eqn}} So $P \left({k}\right) \implies P \left({k + 1}\right)$ and the result follows by the Principle of Mathematical Induction. Therefore: :$a_n = F_n + \displaystyle \sum_{k \mathop = 0}^{n - 2} F_{n - k - 1} f \left({k}\right)$