(x-1)(x+2) is the H.C.F of the polynomials

f(x)=(x^2-5x+4)(x^2+ax+b)
g(x)=(x^2-x-6)(x^2+3x+b)

What do you want to do? find a and b?

f(x) = (x-1)(x-4)(x^2+ax+b)
g(x) = (x-3)(x+2)(x^2+3x+b)
we know that
(x-3) divides x^2+ax+b
(x-1) divides x^2+3x+b

so, b+4 = 0 and b = -4
3a+5 = 0, so a = -5/3

f(x) = (x-1)(x-4)(3x+5)(x-3)
g(x) = (x-3)(x+2)(x-4)(x+1)