Find the values of real numbers and such that:

is divisible by both and

Do I need to extract the factors (x-1) and (x+2) FIRST and then try to solve for a and b or how do I start?

Also, the answers provided are a = 7 and b = 12 but when I try to divide into I get a remainder of 1 which means that it does not divide it and a and b are incorrect values right?