The relatión is that f(x) is the derivative of p(x).
p'(x) = 5x^4 + 32x^3 - 90x^3 +60x - 31 = f(x)
p(1) = 1 + 8 - 30 + 30 - 31 + 22 = 0 => critical point at x=1
p(2) = 32 + 128 - 240 + 120 - 62 + 22 = 0 => critical point at x =2
When the derivative = 0 we are in a critical point and we do not know if the function is increasing, decreasing or reachs a maximum or a minimum. We need more information, which is provided by the second derivative.