write a cubic function whose graph is shown.\n$f(x) = \\square$

write a cubic function whose graph is shown.\n$f(x) = \\square$
Answer
Explanation:
Step1: Identify roots from x-intercepts
The x-intercepts are $x=-1$, $x=1$, $x=2$, so the cubic function has factors $(x+1)$, $(x-1)$, $(x-2)$. We write the function as: $f(x)=a(x+1)(x-1)(x-2)$
Step2: Use y-intercept to find $a$
The y-intercept is $(0,2)$, substitute $x=0$, $f(0)=2$: $2=a(0+1)(0-1)(0-2)$ Simplify the right-hand side: $2=a(1)(-1)(-2)=2a$ Solve for $a$: $a=\frac{2}{2}=1$
Step3: Expand the function
First multiply $(x+1)(x-1)=x^2-1$, then multiply by $(x-2)$: $f(x)=(x^2-1)(x-2)$ $=x^2(x-2)-1(x-2)$ $=x^3-2x^2-x+2$
Answer:
$f(x)=x^3-2x^2-x+2$