problem solving - functions


A function is defined as
f(x+2) = 3 + f(x) when x is even
f(x+2) = x + f(x) when x is odd

f(1) = 4 and f(2) = 3

Find f(f(f(1))) + f(f(f(2)))
Answer: 17
Explanation:

f(f(f(1))) + f(f(f(2))) = f(f(4)) + f(f(3))
Now f(4) can be found by using the definition of the function when x is even. Take x = 2.

f(2+2) = 3 + f(2)
f(4) = 3 + 3

f(4) = 6
Likewise, f(3) can be found by using the definition of the function when x is odd. Take x = 1.

f(1+2) = 1 + f(1)
f(3) = 1 + 4

f(3) = 5
Therefore, f(f(4)) + f(f(3)) = f(6) + f(5)

Again, take x = 4.
f(4+2) = 3 + f(4)

f(6) = 3 + 6
f(6) = 9

Take x = 3.
f(3+2) = 3 + f(3)

f(5) = 3 + 5
f(5) = 8.

Hence f(6) + f(5) = 9 + 8 = 17.