a = - 8 and b = 9
Using the Remainder Theorem.
p(x) divided by (x - a) has remainder p(a)
p(1) = 1³ + a + b = 2⇒ 1 + a +b = 2 ⇒ a + b = 1 ..... (1)
p(2)=2³ + 2a + b = 1 ⇒ 8 +2a + b =1 ⇒ 2a + b = - 7 .....(2)
(2) - (1) gives a = - 8
substitute a = - 8 into (1) : - 8 + b = 1 ⇒ b=9