Factor out a 6
6 / 6x^2 = x^2
6 / -12x = -2x
6 / -18 = -3
6(x^2 - 2x - 3)
Multiply the first term to the last
1 x -3 = -3
(a x b) = -3
(a + b) = -2 (middle term)
(1 x -3) = -3
(1 + -3) = -2
Plug them in by replacing -2x and simplify
6(x^2 - 1x - 3x - 3)
6((x^2 - 1x) - (3x - 3))
6(x(x - 1) - 3(x - 1))
6(x - 3)(x - 1)
Or in this case, 6(x - 1)(x - 3)