I am having problems factoring this cubic polynomial. I can't find how they got to the factored form on the right.

However i was able to get to the same answer but first factored, then found possible zeros using p/q, then did long division, then used the quadratic formula. Is there a faster way to do this?

Thanks.