Remember that:
(a + b)(a² - ab + b²) = a³ + b³
(a - b)(a² + ab + b²) = a³ - b³
WHY? Just multiply it out and you'll see that I'm not lying.
Substituting the given to the formula I just gave:
(x - 2)(x² + 2x + 2²) = x³ + 2³ = x³ - 8
(x + 3)(x² - 3x + 3²) = x³ + 3³ = x³ + 27