Factoring the left and right parts separately gives:
q3 - q2 + 2q - 2
= q(q2 - 1) + 2(q - 1)
= q(q + 1)(q - 1) + 2(q - 1)
Now we have a common factor (q - 1) that we can take out. I'll
combine the remaining terms again:
(q - 1)[q(q + 1) + 2(q - 1)]
= (q - 1)[q2 + q + 2q - 2]
= (q - 1)(q2 + 3q - 2)
The right part has no obvious factorization; but you can use the
quadratic formula to get the factors, which will probably include
square roots.