Explanation:
to have "roots" means that the function delivers 0 as function result for these values of x.
so,
f(x) = 0 for x = -2, x = 0 and x = 4
we can build this function as a product of factors.
each factor is an expression of x that turns 0 for the given value of x.
what is the simplest expression of x that turns 0, when x = -2 ?
well : x + 2
as you can easily see, this is 0, when x = -2.
and the easiest existing of x that is 0, when x = 0 ?
totally simple : just x.
and then x - 4 for x = 4
so, our function is
f(x) = x(x + 2)(x - 4)
but : this is one of infinite possibilities.
let's see what happens, if we use the x coordinate (-1) of the given point (-1, 10).
we know, the result must be 10.
-1×(-1 + 2)(-1 - 4) = -1×1×-5 = 5
aha ! so, in order to get 10 instead of just 5 we must multiply the whole thing by 2.
as n×0 is always still 0, this does not change our 0 points (or roots).
so, our full function is :
f(x) = 2x(x + 2)(x - 4)
or, if you need the function as a polynomial, we need to do the multiplications :
f(x) = 2x(x² - 4x + 2x - 8) = 2x(x² - 2x - 8) = 2x³ - 4x² - 16x