Can you cancel out a term if equal to zero? quick question here:
In my proofs class we had a problem that after a little work we end up with:
$x(x-y)=(x+y)(x-y)$ where $ x = y $. Now, I know this is pretty basic, but my teacher said that for the next step, one cannot cancel out $(x-y)$ from both sides as $(x-y) = 0 $. 
Can someone explain the logic and/or the reasoning behind this? 
I'm pretty sure this falls under some obscure basic algebra rule that I've forgotten over the years but I cannot find anything about this on the internet. 
Edit:
To clear up some confusion here, I am not looking for how to solve this problem, but rather the why this particular rule is so. 
The problem I am working on gives a proof. I am supposed to mark the errors in the proof. For this problem, the error was that they cancelled out $(x-y)$ and I am trying to understand why that's an error.

If $x=y$ then $x-y=0$ and the equation is equivalent to $0\cdot x =0\cdot (x+y)$
which  means that $0=0$.
So you may have $x=300, y=500$ or $x=1 ,y =3.14$ or anything at all.
This means you cannot find the actual values of $x,y$ because the equation is always $0=0$.
