assume x=2 X = 2
multiply by x on both sides X*X = 2X
subtract 4 from both sides X*X - 4 = 2X - 4
factorise (X+2)(X-2) = 2(X-2)
divide by (x-2) on both sides X+2 = 2
subtract 2 from both sides X = 0

We started with X = 2 but we have showed that X = 0 at the same time! Where does the logic fail?

[Ref: ZBHF]

On line 5 we are dividing by (X - 2), but X = 2 so we are actually dividing by 0, which is not allowed as the resulting answer is meaningless.