The math in your signature is faulty…
(A+B)A+B=X(A+B) should be (A+B)(A+B)=X(A+B), though this is probably just a typo.
The real problem with the math is in the fourth step. A + B − X = 0, so what you actually have is
A × 0 = B × 0
Which is, of course, true. Then you try to divide by zero. However, 0 ÷ 0 ≠ 1! Division by zero is undefined.