HINT $\rm\quad f(x)\ =\ x^3 - a\ x^2 - b\ x + a\:b\: \ =\: \ x^2\ (x- a) - b\ (x - a)\ =\ \cdots$
Alternatively, by the Rational Root Test, the only possible rational roots are integer factors of $\rm\:a\:b\:.\:$ But clearly $\rm\ x = a\ $ is a root since it makes the first and last pair of terms cancel out. Therefore, since $\rm\:f(a) = 0\:$ we deduce that $\rm\:f(x)\:$ has the factor $\rm\:x-a\:$ by the Factor Theorem.
For more efficient polynomial factorization algorithms see my post here and the following survey.
Kaltofen, E. Factorization of Polynomials, pp. 95-113 in:
Computer Algebra, B. Buchberger, R. Loos, G. Collins, editors, Vienna, Austria, 1982.