1) X^3 + X^2 + 18 = X^3 +18 + 9 - 9 + X^2 = ( X^3 + 27) + (X^2 - 9)=( X^3 + 3^3)+(X^2-3^2)= (X+3)(X^2-3X+9)+(X-3)(X+3)=(X+3)(X^2-3X+9+X-3)=(X+3)(X^2-2X+6)
2) a^3 -3ab^2-2b^3 = a^3 -2b^3 - 6b^3 +6b^3 -3ab^2 = (a^3 -8b^3) -( 3ab^2 -6b^3)=
(a-2b)(a^2+2ab+4b^2) -3b^2 (a-2b) = (a-2b)(a^2+2ab+4b^2-3b^2) =
(a-2b)(a^2+2ab+b^2) =(a-2b)(a+b)^2