We want to find a polynomial
f(x) = a x³ + b x² + c x + d
such that the roots of f are x = -3, x = -1, and x = 4, and f(x) takes on a value of -24 when x = -2.
The factor theorem for polynomials tells us that we can factorize f(x) as
a x³ + b x² + c x + d = a (x + 3) (x + 1) (x - 4)
Expand the right side:
(x + 3) (x + 1) (x - 4) = x³ - 13x - 12
So we have
a x³ + b x² + c x + d = a x³ - 13a x - 12a
In order for both sides to be equal, the coefficients of both polynomials on terms of the same degree must be equal. This means
a = a (of course)
b = 0 (there is no x² term on the right)
c = -13a
d = -12a
We also have that f (-2) = -24, which means
f (-2) = a (-2 + 3) (-2 + 1) (-2 - 4)
-24 = 6a
a = -4
which in turn tells us that c = 52 and d = 48.
So we found
f(x) = -4x³ + 52x + 48