We know the formula,Dividend = Divisor x quotient + Remainderp(x)=g(x)×q(x)+r(x)Substitute the values, we getx3−3x2 +x+2=g(x)×(x−2)−2x+4Add 2x and subtract 4 both side,x3−3x2+x+2+2x−4=g(x)×(x−2)Simplify and divide by x−2x−2x3−3x2+3x−2​=g(x)g(x)=x−2(x−2)(x2−x+1)​So, g(x)=x2−x+1