Explain the error in the following "proof" that 2=1

\( x = y \). Then

$$x^2=xy$$ $$x^2-y^2=xy-y^2$$ $$(x+y)(x-y)=y(x-y)$$ $$x+y=y$$ $$2y=y$$ $$2=1.$$

Solution

Everything here seems fine until step 4 where \(x-y\) is divided on both sides to get \(x+y=y\). This is incorrect because we cannot divide it by \(x-y\) since earlier we assumed \(x=y\) which implies \(x-y=0\)! And it's a well known fact that division by zero is mathematically incorrect.