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.

There is no such thing as "cancelling out".
In this case you want to divide both sides of the equation by (x-y). But always remember before dividing: you can't divide by zero. But if x=y then in fact (x-y) = 0 and so you would in fact divide by zero which you are not allowed to. But only professors are allowed to divide by zero. :-) Just kidding.
