By synthetic division
Noting that #(x+2)=0# if #x=color(red)(-2)#
#{:
(,,,x^2,x^1,x^0),
(,," | ",4,-1,-1),
(underline(color(white)("XX")),underline(color(white)("XX")),underline(" | "),underline(color(white)("X")),underline(-8),underline(+18)),
(color(red)(-2),xx," | ",4,-9,+17),
(,,,x^1,x^0,R)
:}#
By long division
#color(white)("XXX")underline(color(white)("x")4xcolor(white)("x")-9color(white)("XXXX"))#
#x+2 ) 4x^2color(white)("x")-xcolor(white)("x")-1#
#color(white)("XXxX")underline(4x^2color(white)("x")+8x)#
#color(white)("XXXXxXX")-9x#
#color(white)("XXXxXXX")underline(-9xcolor(white)("x")-18)#
#color(white)("XXXXXXXXXXX")+17#