change "f(x)" to "g(x)" to match with problem statement