In this problem we need to find the value of a and b. So given that the function should be in the form f(n) = an + b and we know each value of n, then out goal is to find a and b.
For getting this purpose, we need to find a system of two equations (given that we have two unknown variables)
Therefore:
(1) f(0) = a(1) + b = 18
∴ a + b = 18
(2) f(1) = a(2) + b = 24
∴ 2a + b = 24
Solving for a and b we have:
a = 6
b = 12
Finally:
f(n) = 6n + 12