You made mistake in simplification of (x+2)(x+1)(x-1).
From the graph given the zero's are -2, ,-1, 1 and it passes through the point (0,-2)
I did this:
x+2, x+1, x-1
-2 = a(0+2)(0+1)(0-1)
-2=a(2)(1)(-1)
-2/-2=a
1=a
f(x)=1(x+2)(x+1)(x-1)
f(x) = x^2+x+2x+2+x^3-x^2+x^2-x+2x^2-2x^2+2x-2
f(x) = x^3+x^2+4x+0
However the answer is suppose to be f(x) = x^3 + 2x^2 - x - 2
Where did I go wrong?