Back

Solution: 2014 Winter Final - 10

Author: Michiel Smid

Question

Consider the following recursive function:
$f(0)$ $\;=\;$ $3,$
$f(n + 1)$ $\;=\;$ $f(n) + 10n + 2\; \ \text{for all}$ $\text{integers}\ n \geq 0.$
Which of the following is true?
(a)
for all $n \geq 0$: $f(n) = 5n^{2} - 3n + 2$
(b)
for all $n \geq 0$: $f(n) = 5n^{2} - 3n + 3$
(c)
for all $n \geq 0$: $f(n) = 5n^{2} + 3n + 3$
(d)
for all $n \geq 0$: $f(n) = 5n^{2} - 2n + 3$

Solution

Calculate $ f(1) $ $ f(1) = f(0) + 10(0) + 2 $

$ f(1) = 3 + 0 + 2 $

$ f(1) = 5 $

Now, we test

  • $ f(n) = 5n^{2} - 3n + 2 $
    $ f(1) = 5{(1)}^2 - 3(1) + 2 = 5 - 3 + 2 = 4 $
  • $ f(n) = 5n^{2} - 3n + 3 $
    $ f(1) = 5{(1)}^2 - 3(1) + 3 = 5 - 3 + 3 = 5 $
  • $ f(n) = 5n^{2} + 3n + 3 $
    $ f(1) = 5{(1)}^2 + 3(1) + 3 = 5 + 3 + 3 = 11 $
  • $ f(n) = 5n^{2} - 2n + 3 $
    $ f(1) = 5{(1)}^2 - 2(1) + 3 = 5 - 2 + 3 = 6 $