=x^2(a+b)-x(a+b)+a+b
=(a+b)(x^2-x+1)
\(ax^2+bx^2-bx-ax+a+b=a\left(x^2-x\right)+b\left(x^2-x\right)+\left(a+b\right)=\left(a+b\right)\left(x^2-x\right)+\left(a+b\right)=\left(a+b\right)\left(x^2-x-1\right)\)
ax^2+bx^2-bx-ax+a+b
=ax^2-ax+a+bx^2-bx+b
=a(x^2-x+1)+b(x^2-x+1)
=(a+b)(x^2-x+1)