How to prevent loss of roots in equations? I was studying the Theory of Equations when I came across a line which was something like this:

Cancellation of common factors from both sides of equation leads to a loss of root.
         For example, consider an equation 
  \begin{align*}
   x^2-2x&=x-2\\
   x(x-2)&=x-2\\
   x&=1
\end{align*}

They then proceed on to explain that if, instead of factoring out $x-2$, they had simply subtracted $x-2$ and made the RHS zero, they would have two solutions, namely, $x=1$ and $x=2$. I have not provided the entire process.
However, as I started solving some problems, I came across a problem like this:

$\dfrac{x^2+3x+2}{x^2-6x-7}=0$
Solve the above equation

I was stuck in this problem, and didn't cancel out the factors that came upon factorisation of the numerator and denominator, mainly because I was apprehensive about cancelling out the roots.  But in the solution of this problem given with the answers, the solution was like this:

Since the domain of the solution set is $\Bbb R - \{7,-1\}$
$\dfrac{(x+1)(x+2)}{(x+1)(x-7)}=0$
$x=-2$

But isn't this process leading to a loss of the solution of the equation
$\dfrac1{x-7}=0$?
Please help. If you think this question does not meet the standards of this marvellous site, please inform before giving any downvote.
 A: Loss of roots happens if you divide instead of factor.  Division like this is technically not even allowed since it results from dividing both sides by a variable whose value you don't know yet.  For example:
$$x^2 = 2x$$
If we divide both sides by $x$ then we get $x = 2$.  But this is not a legal operation because we don't know if $x$ could be zero or not.  Now, we could say "Suppose $x \ne 0$.  Then $x^2=2x$ gives us $x=2$."  But then we'd still have to separately consider the case where $x=0$.  It's extra work that's much more easily done by simply factoring:
\begin{align*}
x^2 &= 2x\\
x^2-2x &= 0\\
x(x-2) &= 0\\
x = 0 &\text{ or } x=2
\end{align*}

But isn't this process leading to a loss of the solution of the equation
  $\dfrac1{x-7}=0$?

No.  A simplified rational expression is zero if and only if its numerator is zero.  This concept actually has nothing to do with losing roots by dividing instead of factoring.  The rational expression in your case is $\dfrac{(x+1)(x+2)}{(x+1)(x-7)}$.  But that's not simplified.  First make a note that $x=-1$ is not in the domain (and $x=7$ is not in the domain, but especially note $x=-1$ since we're about to cancel those factors).  Then simplify to get $\dfrac{x+2}{x-7}$.  This expression will be zero if and only if its numerator is zero, and that only happens when $x=-2$.
