Answer:
f(x) = 3x³ -6x² -21x -12
Explanation:
You want a polynomial function that touches the x-axis at x = -1, crosses it at x = 4, and goes through the point (-2, -18).
Factored form
Each zero (p) of a polynomial corresponds to a linear factor (x -p). If the zero has even multiplicity, the function will not change sign there, but will touch the x-axis and "bounce".
The requirements indicate a factor (x +1) with even multiplicity, and a factor (x -4). The least-degree such polynomial will have the factored form ...
f(x) = a(x +1)²(x -4)
Scaling
The value of this polynomial at x = -2 is ...
f(-2) = a(-2 +1)²(-2 -4) = -6a
We want this to be -18, so ...
-6a = -18 ⇒ a = 3
Then the factored polynomial is ...
f(x) = 3(x +1)²(x -4)
When we multiply this out, we get ...
f(x) = 3x³ -6x² -21x -12
__
Additional comment
The attached graph verifies the desired characteristics.