Where's the error in this $2=1$ fake proof? [duplicate]

I'm reading Spivak's Calculus:

2 What's wrong with the following "proof"? Let $x=y$. Then

$$x^2=xy\tag{1}$$

$$x^2-y^2=xy-y^2\tag{2}$$

$$(x+y)(x-y)=y(x-y)\tag{3}$$

$$x+y=y\tag{4}$$

$$2y=y\tag{5}$$

$$2=1\tag{6}$$

I guess the problem is in $(3)$, it seems he tried to divide both sides by $(x-y)$. The operation would be acceptable in an example such as:

$$12x=12\tag{1}$$

$$\frac{12x}{12}=\frac{12}{12}\tag{2}$$

$$x=1\tag{3}$$

I'm lost at what should be causing this, my naive exploration in the nature of both examples came to the following: In the case of $12x=12$, we have an imbalance: We have $x$ in only one side then operations and dividing both sides by $12$ make sense.

Also, In $\color{red}{12}\color{green}{x}=12$ we have a $\color{red}{coefficient}$ and a $\color{green}{variable}$, the nature of those seems to differ from the nature of

$$\color{green}{(x+y)}\color{red}{(x-y)}=y(x-y)$$

It's like: It's okay to do the thing in $12x=12$, but for doing it on $(x+y)(x-y)=y(x-y)$ we need first to simplify $(x+y)(x-y)$ to $x^2-y^2$.


Solution 1:

We have $x = y$, so $x - y = 0$.

EDIT: I think I should say more. I'll go through each step:

$x = y \tag{0}$

This is our premise that $x$ and $y$ are equal.

$$x^2=xy\tag{1}$$

Note that $x^2 = xx = xy$ by $(0)$. So completely valid.

$$x^2-y^2=xy-y^2\tag{2}$$

Now we're adding $-y^2$ to both sides of $(1$) so completely valid and we can see that it's another way of expressing $0 = 0$ as $x=y$, but nothing wrong here yet.

$$(x+y)(x-y)=y(x-y)\tag{3}$$

$$x+y=y\tag{4}$$

Step $(3)$ is just basic factoring, and it is around here where things begin to go wrong. For $(4)$ to be a valid consequence of $(3)$, I would need $x - y \neq 0$ as otherwise, we would be dividing by $0$. However, this is in fact what we've done as $x=y$ implies that $x - y =0$. So $(3)-(4)$ is where things go wrong.

$$2y=y\tag{5}$$

$$2=1\tag{6}$$

As a consequence of not being careful, we end up with gibberish.

Hope this clarifies more!

Solution 2:

We have $x=y$ firstly and from $3$ to $4$ we assume $x\ne y$ simultaneously.