TITLE: What are some common pitfalls when squaring both sides of an equation?
QUESTION [8 upvotes]: Squaring both sides of the equation $x=-\sqrt{y+1}$ leads to an equation that has more solutions than the original equation. 
When can we be sure that squaring both sides will result in the same solution set? What operations on both sides are "safe"(such as addition) and which ones are "not safe"(such as squaring or taking the root of both sides)?
As a side point, I don't remember encountering this pitfall in basic algebra. Is there any specific literature I can consult for a more in-depth treatment of equations?

REPLY [6 votes]: Briefly, it's "safe" to apply an injective (one-to-one) function whose domain is $\mathbb{R}$ to both sides of an equation. This condition is generally too strong, see below, but I think it properly addresses the original question.
In more detail, say your original equation has the form $A=B$, in which $A$ and $B$ are (for simplicity, real-valued) expressions in one or more variables. After transformation, your equation has the form $f(A)=f(B)$ for some function $f$. The question is: "When is the solution set of $f(A)=f(B)$ identical to that of $A=B$?" Injectivity, by definition, means that "$f(A)=f(B)$ implies $A=B$". (The converse implication is built into the definition of a function.)
In the original question, $f$ was "squaring", $f(A)=A^2$, which of course is not injective on $\mathbb{R}$. "Safe" choices of $f$ might represent adding an expression, multiplying by a non-zero expression, extracting an odd root, or exponentiation.
Once this idea makes sense, it's easy to extend. For example, if you know that $A$ and $B$ represent positive real numbers for all values of the variables, it's "safe" to take (real) logarithms or (non-negative) square roots of both sides. If you know $|A|$ and $|B|$ are no larger than $\pi/2$, it's "safe" to take the sine of both sides, etc., etc.
Two tangential remarks:

One reason increasing functions are useful is that they preserve inequalities: $A<B$ if and only if $f(A)<f(B)$. Similar statements for decreasing and non-decreasing functions are left as an exercise.
Over the complex numbers, exponentiation isn't injective, so log has branches, which leads to all manner of fun. My favorite example (found by a classmate many years ago) is this short "proof":
$$e^z = (e^{2\pi i})^{z/2\pi i} = 1^{z/2\pi i} = 1\quad\text{for all complex $z$}.$$