Method 1
Solve for x $$ax - a^2 = bx - b^2$$
Collect all terms with x on one side of the equation $$ax - bx = a^2 -b^2$$
Factor both sides of the equation $$(a -b)x = (a+b)(a - b)$$
Divide both sides of the equation by the coefficient of $x$ (which is $a-b$)
$$x = a + b$$ (where $a \neq b$ since this would mean dividing by $0$)
Method 2
Solve for $x$ $$ax - a^2= bx - b^2$$
Bring all the terms to one side of the equation $$ax - a^2 -bx + b^2 = 0$$
Rearrange $$ax - bx -(a^2-b^2)=0$$
Factor $$(a - b)x - (a + b)(a - b) = 0$$
$$(a - b)( x - (a + b)) = 0$$
which is a true statement if $$a-b=0$$ $$a = b$$ or $$x-(a+b)=0$$ $$x = a + b$$
My question is I don't understand how this second method is consistent with the first in terms of the restriction on $a$ and $b$.