TITLE: How does squaring both sides of an equation lead to extraneous solutions?
QUESTION [9 upvotes]: Let’s say I have $x = x + 1$, which is a false statment for real $x$; why can I solve for real $x$ when I square both sides of the equation, giving $x^2=(x+1)^2$?

REPLY [2 votes]: Consider the graph of $y = x^2$:

I sometimes think of a graph (or function in general) as: "you give me $x$, I give you $y$" -- Give me 3, I give you 9. Give me -5 I give you 25, and so on.
Solving $x^2 = 4$ tries to reverse this -- I give you $y$, and you have to come up with the $x$ that would have produced this. 
Graphically, the first process ($x \rightarrow y$) is taking vertical lines and finding the height of the graph where they intersect the red curve. The second process ($y \rightarrow x$) is the reverse -- taking horizontal lines and finding the $x$ value (displacement from the vertical line at $x = 0$) where they intersect the red curve.
For the function $x^2$, we can see that most horizontal lines will intersect the curve twice -- this leads to ambiguity about which $x$ you should "give" me to answer my question. To put this another way, the process of squaring a number means that our tit-for-tat exchange (you give me $x$, I give you $y$; I give you $y$, you give me $x$) can be broken.
Turning to the specific relationship you mentioned, $x = x+1$ vs. $x^2 = (x+1)^2$, think of what the latter means in terms of the graph. 
To solve this we would find an $x$ so that if we move the right by one, the height of intersection is the same at both places. We can see how this might happen due to the "refraction" of the curve at the origin:

The equation "gains" a solution (when going from $x = x+1$ to $x^2 = (x+1)^2$ because of what happens when we pass the origin and the curve bends back upward (technical term: non-monotonicity).
The plot shows what happens to the $y$ value as we jump to the right by one starting from -2.6 (landing at -1.6, -.6, .4, 1.4, 2.4, ...).
Hopefully you can see that if we had chosen a different value (e.g. -2.3, -2.011, -2.78), the exact $y$ values would be different but the pattern would be the same.
The last thing to convince yourself is that there's a "sweet spot" of where we could start jumping (between -3 and -2) so that the $y$ values before and after crossing $x = 0$ are exactly the same, instead of just ~kind of close~. (A bonus is to convince yourself that there's only one such sweet spot)
Here's the R code I used to generate these plots:
Plot 1:
curve(x^2, -3, 3, asp = 1, lwd = 3L, las = 1L,
      ylab = expression(x^2), col = 'red',
      main = 'Non-invertibility of Squaring')
abline(v = 0, h = 0)
abline(h = 4, col = 'blue', lty = 2L)
axis(side = 1L, at = c(-2, 2))
segments(c(-2, 2), c(0, 0), c(-2, 2), c(4, 4),
         col = 'darkgreen', lty = 2L)

Plot 2:
curve(x^2, -2, 2, asp = 1, lwd = 3L,
      ylab = expression(x^2), col = 'red',
      main = 'Inchworming the Graph', 
      xaxt = 'n', yaxt = 'n')
abline(v = 0, h = 0)
x = c(-2.6, -1.6, -.6, .4, 1.4, 2.4)
y = x^2
n = length(x)
arrows(x[-n], y[-n], x[-1], y[-1])
axis(side = 1, at = x)
axis(side = 2, at = y, las = 1L)
segments(x, rep(0, n), x, y,
         col = 'darkgreen', lty = 2L)
abline(h = y, col = 'blue', lty = 2L)