x4 - 30x2 + 31x - 30
= x4 + x - 30x2 + 30x - 30
= x(x3 + 1) - 30(x2 - x + 1)
= x(x + 1)(x2 - x + 1) - 30(x2 - x + 1)
= (x2 - x + 1)[x(x + 1) - 30]
= (x2 - x + 1)(x2 + x - 30)
= (x2 - x + 1)(x2 - 5x + 6x - 30)
= (x2 - x + 1)[x(x - 5) + 6(x - 5)]
= (x2 - x + 1)(x - 5)(x + 6)