To get the initial term, namely #x^3#, one needs to multiply the divisor, namely #x-4# by #x^2#. Doing this multiplication, of #x-4# by #x^2#, one gets #x^3-4x^2#. Subtracting this from #x^3-6x^2+9x-4# yields the initial remainder #-2x^2+9x-4#.

Once again one needs to divide this by #x-4#. To get the initial term #-2x^2# one needs to multiply #x-4# by #-2x#. Doing this multiplication one gets #-2x^2+8x#. Subtracting this from the initial remainder one gets #x-4#.

One needs to divide this second remainder by #x-4#. Clearly, #x-4# times 1 is #x-4# and there is no remainder. So, by adding up the multipliers, one gets #x^2-2x+1#, which is equal to #(x-1)^2#.