Disproving 'If $A^2 = AB$, $A =B$' specific proof I don't understand the problem with this proof: 

Let $A$ and $B$ be (2x2) Matrices such that $A^2 = AB$ and $A \ne 0$
  If $A^2 = AB$, then $A^2 - AB = 0$
  Thus $A(A-B) = 0$, and because $A \ne 0$, A can be eliminated such that $A-B = 0$ and thus $A = B$  

I assume it stems from issues factoring matrices, but my problem could be because I don't fully grasp how to generally prove that $A^2=AB$ doesn't necessitate that $A = B$
Thanks for any help in advance!
 A: The problem is that matrix rings are not integral domains. That is, they have zero-divisors, elements $x \neq 0$ such that for some $y \neq 0$ we nonetheless have $xy=0$.
In particular, this means that cancellation is not valid. So (unlike in the integers or real numbers, for example) you cannot conclude from $xy =0$ and $x \neq 0$ that $y = 0$.
So the invalid step is $A(A-B) = 0 \implies A-B = 0$.
A: It’s true that for real numbers $A \neq 0$ and $B$ if,
$$A(A-B)=0$$
That $A-B=0$. The reason that works is because every real number $A \neq 0$ has an (left) inverse $A^{-1}$ such that $A^{-1}A=1$, and so we can multiply both sides of the equation above on the left by it.
However not every $2$ by $2$ matrix $A \neq 0$ has an inverse such that $A^{-1}A=I$. Thus you can’t apply the same reasoning. 
A: Look at the two matrices $A=\begin{bmatrix}1&0\\0&0\end{bmatrix}$ and $B=\begin{bmatrix}0&0\\0&1\end{bmatrix}$. Both are non zero but $AB$ is the zero matrix. Matrix multiplication is very different from number multiplication, you can't just "divide" by a matrix because it is not zero. 
