a)x(x-4)-x(x+2)+6x
=x*x+x*(-4)-x*x-x*2+6x
=x^2-4-x^2-2x+6x
=(x^2-x^2)+(-2x+6x)-4
=4x-4
b) (x-3).(x2-3x+9)-x(x2-1)
=x(x2-3x+9)-3(x2-3x+9)-x(x2-1)
=x*x2+x*-3x+x*9-3*x2-3*-3x-x*+9-x*x2-x*-1
=2x^2-3x^2+9x-6x+9x-9x-2x^2+1x
=(2x^2-3x^2-2x^2)+(9x-6x+9x-9x+1x)
=-3x^2+4x