\(\text{The possible rational roots are of the form }\dfrac p q \\ \text{where }p \text{ is a factor of the constant term, in this case -4}\\ \text{and }q \text{ is a factor of the highest order term, i.e. 2}\\ \text{so possible roots are}\\ \text{factors of -4 are} \pm 1,~\pm 2,~\pm 4\\ \text{factors of 2 are }\pm 1,~\pm 2\\ \text{so our possible roots are}\\ x=\pm \dfrac 1 2,~\pm 1,~\pm 2,~\pm 4\)
\(\text{we plug these into }f(x) \text{ to determine which are actually roots}\\ \text{and see that}\ x = -2,~-\dfrac 1 2,~2\\ \text{are the only actual roots, and as }f(x) \text{ is degree 3 that is all 3 of them}\\ \text{so }f(x) = c(x+2)\left(x+\dfrac 1 2\right)(x-2), \text{ for some }c \in \mathbb{Q} \\ c \text{ is the coefficient of the }x^3 \text{ term so}\\ f(x) = 2(x+2)\left(x+\dfrac 1 2\right)(x-2)\)
.