Clarification of algebraic "fallacies" - Methods of Mathematics by Richard Hamming I am reading the book "Methods of Mathematics" by Richard Hamming. In one section he talks about certain fallacies in algebra to avoid. He gives a very clear example of accidentally dividing by zero, but then follows it with another example which he claims performs such a violation more subtly.
$$\frac{1}{x(x-a)}-\frac{1}{x}= \frac{a}{(x-a)}$$
Okay, I see we cannot have x equal to zero, nor can we have x equal to a. No problem here. He then presents the formula "cleared of fractions".
$$1 - (x-a) = ax $$
$$1-x+a=ax$$
$$1+a=x+ax$$
$$1+a=x(1+a)$$
No problem, I see what he did. He then continues the math to solve for x, yielding
$$ x = 1 $$
And this is where the thinking begins. So it seems that he is saying that the equation is not dependent on the value of $a$. But he says this cannot be true because the original formula is not defined for $x=1$ when $a=1$ because from the original formula we reasoned that $x$ cannot be equal to $a$.  So my questions are below:
1.) Is he claiming that he's used a fallacy to solve the equation; one that results in an incorrect statement? I don't see one.
2.) Or is it that our system of symbolic manipulation is such that given the "fractionless" form initially, we wouldn't have seen the limitation that $x$ cannot equal $a$?
3.) Can the given conditions on $x$ and $a$ be readily seen in the fractionless form?
4.) If not, how do we avoid such errors? By trying multiple forms until such constraints are apparent?
5.) Why is $x$ not able to be equal to $a$? It seems that of course we cannot divide by zero, but using a different form, e.g. the fractionless form, avoids this issue. So how can changing the form of an equation make certain solutions suddenly valid? I think it probably doesn't since they are equivalent. I must be missing something here.
He also notes that when $a=-1$, all solutions for $x$ are valid except $0$ and $-1$. So it really seems like he's saying that our solution, independent of $a$, is not correct. Where did it all fall apart?
 A: The key here is to understand that:
$$\frac{1}{x(x-a)}-\frac{1}{x}=\frac{a}{x-a}$$
and
$$1-(x-a)=ax$$
are not two forms of the same equation: those are two  different equations. Claiming, in general, that they have to have the same solutions amounts to wishful thinking.
However, those equations are related to each other: because the second one has been derived from the first one by, effectively, multiplying both sides with $x(x-a)$, it follows that the second equation is implied by the first one. Every solution of the first equation is also a solution of the second one. The second equation is not equivalent to the first one because the opposite operation (dividing both sides by $x(x-a)$) is possible only if $x\ne 0,x\ne a$.
So, how to avoid confusion and mistakes? I have seen at least the following three methods:

*

*Distinguish the cases. In our case, this means having two cases: (1) $x=0$ or $x=a$, which are obvious non-solutions of the first equation, and (2) $x\ne 0, x\ne a$: in that case, the second equation is equivalent to the first, so we can proceed to solving it and then restricting the set of solutions to our case (i.e. disregarding solutions equal to $0$ or $a$).

*Equivalent transformations: You can directly transform the first equation into an equivalent formula, but this formula may stop being an equation - it may became a logical (predicate) formula. Indeed, $\frac{x}{y}=z$ is equivalent to $x=yz\land y\ne 0$, or, in our case, the first formula is equivalent to:

$$1-(x-a)=ax\land x\ne 0\land x\ne a$$
and, eventually, this transforms further into:
$$(x=1\lor a=-1)\land x\ne 0\land x\ne a$$

*

*Follow the implications but check in the end. Useful when the number of solutions is finite. In this method, we don't worry if we have transformed an equation into an equivalent one: it is sufficient to transform it into one implied by the first equation. This does mean that every subsequent equation may gain some solutions that the original equation did not have. Once you've gone all the way and solved the last equation, go back and check whether those solutions also satisfy the original equation. Those that do are the solutions of the original equation.

For the last method, see this example:$\sqrt{x+1}=x-1$. By squaring both sides (which again does not produce an equivalent equation, since squares of two numbers may be equal even if the numbers themselves are not), we get: $x+1=x^2-2x+1$, i.e. $x^2=3x$, i.e. $x=0\lor x=3$. However, $x=0$ is not the solution of the original equation, and $x=3$ is the only solution.
I believe that, didactically, the third method, whenever it can be used, carries the advantage that it also reinforces the good habit of checking one's work at the end.
Hope this helps.
Edit: Following up rigorously all the conditions (either method!) becomes even more important if you are trying to solve inequalities. For example, $\frac{x}{y}\lt z$ happens to be equivalent to $x\lt yz$ when $y\gt 0$, but is equivalent to $x\gt yz$ when $y\lt 0$...
A: As you say, the original equation excludes the cases $x=0$ and $x=a$. These are not excluded by the forms obtained by clearing the fractions, so when we do that, we need to make a note that $1+a=x(1+a)$ and $x\ne 0$ and $x\ne a$. But the real problem, as noted in the comments, is that we can’t divide through by $1+a$ if $a=-1$; since we don’t know what $a$ is, we have to split the remainder of the calculation into two cases, one for $a=-1$ and one for $a\ne -1$.

*

*If $a=-1$, the final equation reduces to $0=0\cdot x$, which is true for all $x$, and — bearing in mind the original exclusions! — we find that $x$ can be any real number except $-1$ and $0$.

*If $a\ne -1$, we can divide through by $1+a$ to find that $x=1$. Bearing in mind the original exclusions, we see that we actually have two subcases here: if $|a|\ne 1$, the unique solution is $x=1$, and if $a=1$, there is no solution.

