x + 2 is a factor, so plugging in -2 into the function will get 0.
-8a + 4b - 8 = 0
when divided by x - 1, the remainder is 4, so plugging in 1 should get 4.
a + b - 5 = 4
We now have a system of equations:
-8a + 4b = 8
a + b = 9
Multiply the second equation by 8 to eliminate a.
-8a + 4b = 8
8a + 8b = 72
------------------------
12b = 80
b = 20/3
a = 9 - 20/3 = 7/3