Start by hoping to find integer coefficient factors:
#{:
("factors of " x^2 ,color(white)("XX"),"factors of constant",color(white)("XX"),"sum of"),
( "coefficient",color(white)("XX")," coefficient",color(white)("XX"),"cross product"),
((1,2),color(white)("XX"),(-1,4), color(white)("XX"), 1xx4+2xx(-1) = 6),
( ,color(white)("XX"),(1,-4), color(white)("XX"), 1xx(-4)+2xx(-1)=-2),
( ,color(white)("XX"),(-2,2), color(white)("XX"), 1xx2+2xx(-2) = -2),
( ,color(white)("XX"),(2,-2), color(white)("XX"), 1xx(-2)+2xx2=2),
( ,color(white)("XX"),(-4,1), color(white)("XX"), 1xx1+2x(-4)=-7),
(,color(white)("XX"),(4,-1),color(white)("XX"), 1xx(-1)+2xx(4)= 7)
:}#
The pairs #(1,2) and (-4,1)# give us the middle coefficient that we need.
Therefore the factors are:
#color(white)("XXX")(1x-4)(2x+1)#