Why dividing by zero still works Today, I was at a class. There was a question:

If $x = 2 +i$, find the value of $x^3 - 3x^2 + 2x - 1$.

What my teacher did was this:
$x = 2 + i \;\Rightarrow \; x - 2 = i \; \Rightarrow \; (x - 2)^2 = -1 \; \Rightarrow \; x^2 - 4x + 4  = -1 \; \Rightarrow \; x^2 - 4x + 5 = 0 $. Now he divided $x^3 - 3x^2 + 2x - 1$ by $x^2 - 4x + 5$.
The quotient was $x + 1$ and the remainder $x - 6$. Now since $\rm dividend = quotient\cdot divisor + remainder$, he concluded that $x^3 - 3x^2 + 2x - 1 = x-6$ since the divisor is $0$.
Plugging $2 + i$ into $x - 6$, we get $-4 + i$.
But my question is, how was he able to divide by zero in the first place? Why did dividing by zero work in this case?

The division your teacher did is polynomial division. He did not divide by zero; he divided by $x^2 - 4x + 5$.
The long division he did is just an algorithm that allows you to get the following identity:
$$x^3 - 3x^2 + 2x - 1 = (x^2 - 4x + 5)(x+1) + x-6$$
This is an identity involving multiplication, not division. Now, when you plug in $x = 2 + i$, you're not dividing by zero; you're multiplying by zero, which you should agree is allowed.
