hello :
p(x) = (x+1)g(x)+4.......(1)
p(x) = (x-2)h(x)+7........(2)
find : R.... p(x) =(x+1)(x-2)L(x)+R ( R: remainder)
multiply (1) by : (x-2) and (2) by :(x+1)
(x-2)p(x) = (x-2)(x+1)g(x) +4(x-2).....(a)
(x+1)p(x) = (x-2)(x+1)h(x)+7(x+1)........(b)
(b) -(a) :
(x+1)p(x) - (x-2)p(x) = (x-2)(x+1)h(x) - (x-2)(x+1)g(x) + 7(x+1) - 4(x-2)
((x+1)-(x-2))p(x) = (x-2)(x+1)(h(x)-g(x)) +3x+15
3p(x) = (x-2)(x+1)(h(x)-g(x)) +3(x+5)
p(x) = (x-2)(x+1)((h(x)-g(x))/3) +(x+5)
so : L(x) = ((h(x)-g(x))/3)
and : R = x+5 is the remainder when divided p(x) by (x+1)(x-2).