10

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?

hondaman
  • 585
  • The main point is that you do not introduce new solution because you are solving the original equation. In the original equation $x \leq 0$ because $\sqrt{f(y)} \geq 0$. So the new "fictitious" solutions that arise upon squaring both sides are not solutions at all. – glebovg Jul 17 '13 at 07:43
  • 2
    We're not allowed to talk about that. There was a cash settlement with a gag order. – Will Jagy Jul 17 '13 at 08:31

4 Answers4

10

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:

  1. 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.

  2. 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$}.$$

  • I would distinguish the principle of taking the logarithm or square root of a non-negative number from taking the sine of a number between $-\pi/2$ and $\pi/2.$ In the first case the function value isn't even defined if you're outside a certain domain. In the latter case the function is defined by not injective over the larger domain, and that's when "extraneous solutions" creep in. – David K Jan 01 '25 at 17:23
2

The short answer is that in general you can make the solution set remain the same as you manipulate an equation, but in order to do so you often need to write more than just a single equation at the end of your manipulation.


To give a general answer to the question seemingly requires either a lot of abstract notation or a much greater amount of text. So let's start with specific examples instead. I'll assume that you are working strictly with real numbers only.

The easy case is any operation that acts as a well-defined injective function defined on all real numbers. For example, we can add $1$ or divide by $2$ on both sides and not gain or lose any solutions in the solution set.


Now let's look at squaring. Consider the equation $$ x = -\sqrt{y+1} \tag{1a} $$ and what happens if we want to square both sides. Squaring has all real numbers as its domain, but it is not an injective function. In general, if you have $A = B$ then $A^2 = B^2,$ but if you know $A^2 = B^2$ then in order to conclude that $A = B$ you must also know that $A$ and $B$ have the same sign. Equation $(1\mathrm a)$ is therefore equivalent to $$ x^2 = y + 1 \ \mathbf{and}\ \Big[\text{$x$ and $-\sqrt{y+1}$ have the same sign}\Big]. \tag{1b} $$

We can simplify this a little by observing that for $-\sqrt{y+1}$ to have a sign, $y + 1$ must be non-negative, and then the sign of $-\sqrt{y+1}$ is negative or zero. We therefore have the equivalent statement $$ x^2 = y + 1 \ \mathbf{and}\ x \leq 0\ \mathbf{and}\ y + 1 \geq 0. \tag{1c} $$ But notice that $x^2 = y + 1$ already implies that $y + 1 \geq 0,$ so we can simplify further: $$ x^2 = y + 1 \ \mathbf{and}\ x \leq 0. \tag{1d} $$ But if we omit the statement $x \leq 0,$ we get a solution set with two values of $x$ for many values of $y$ where there should have been just one $x.$ The reason people say squaring is "unsafe" or that it causes you to get "extraneous" solutions is that the "squared" equation alone is often not sufficient to make a truly equivalent statement. You may need additional conditions.

But suppose instead that we started with the equation $$ \sqrt5 = \sqrt{1 + x^2}. \tag{2a} $$ We apply the same steps as before to get an equivalent statement, $$ 5 = 1 + x^2 \ \mathbf{and}\ \Big[\text{$\sqrt5$ and $\sqrt{1 + x^2}$ have the same sign}\Big]. \tag{2b} $$ Now we note that in fact $\sqrt5$ and $\sqrt{1 + x^2}$ are both positive for all real $x,$ so the part after the "and" is always true and we can omit it without changing the truth of our statement in any case. The simplified statement is $$ 5 = 1 + x^2, \tag{2c} $$ completely equivalent to Equation $(2\mathrm a)$ and having the same solution set.


Now let's look at square roots. Consider the equation $$ x = y - 1 \tag{3a} $$ and let's see what happens when we take a square root on both sides (ignoring the question of whether this is a useful thing to do). The difficulty is that the domain of the square root function is non-negative numbers only, and there is no indication in the given equation whether either side is positive or negative. We therefore have to consider both cases.

You could, for example, produce the following statement, which is equivalent to Equation $(3\mathrm a).$ $$ \Big[ x \geq 0\ \mathbf{and}\ y - 1 \geq 0\ \mathbf{and}\ \sqrt x = \sqrt{y - 1} \Big] \ \mathbf{or}\ \Big[ x < 0\ \mathbf{and}\ y - 1 < 0\ \mathbf{and}\ x = y - 1 \Big]. \tag{3b} $$

This covers the case where you can take the square root and the case where you cannot, including the conditions required for each case. You could simplify this a bit by noting that if the equation $\sqrt x = \sqrt{y - 1}$ is true, both $x$ and $y - 1$ must be non-negative, since otherwise one or both of the square roots would be undefined and could not be equal to anything. The conditions $x \geq 0$ and $y - 1 \geq 0$ are therefore redundant. You could also observe that $x < 0$ and $x = y - 1$ together imply $y - 1 < 0,$ so $y - 1 < 0$ is redundant if the other two statements are included. The statement then simplifies to $$ \sqrt x = \sqrt{y - 1}\ \mathbf{or}\ \Big[ x < 0\ \mathbf{and}\ x = y - 1 \Big]. \tag{3c} $$

If you try to simplify it further by dropping the part after the "or," you'll lose the part of the solution set where $x$ is negative, which contains an infinite number of solutions of Equation $(3\mathrm a).$

On the other hand, if we start with Equation $(2\mathrm c)$ from the "squaring" discussion and apply this method to it, we get $$ \Big[ 5 \geq 0\ \mathbf{and}\ 1+x^2 \geq 0\ \mathbf{and}\ \sqrt5 = \sqrt{1+x^2} \Big] \ \mathbf{or}\ \Big[ 5 < 0\ \mathbf{and}\ 1+x^2 < 0\ \mathbf{and}\ 5 = 1+x^2 \Big]. $$ But we know that $5 \geq 0$ and $1+x^2 \geq 0$ for all real numbers $x.$ Hence the conditions $5 \geq 0$ and $1+x^2 \geq 0$ are redundant while the conditions $5 < 0$ and $1+x^2 < 0$ are contradictions and the entire clause after the "or" can be eliminated. So the complex statement above simplifies to just Equation $(2\mathrm a).$ Again we find that the two equations are equivalent and have the same solution set, although we worked from the opposite direction this time.


Revisiting what happens when we square both sides of an equation, the extra information about the signs of the two original quantities arises because squaring is not injective on the set of all real numbers. But squaring is injective on the domain of non-negative real numbers, and it is injective on the domain of non-positive real numbers. In a sense, the part of the statement after the first "and" in $(1\mathrm b),$ $(1\mathrm c),$ $(1\mathrm d),$ or $(1\mathrm c)$ turns squaring into an injective function by putting a restriction on the domain from which its input values can come.

Suppose you want to take the cosine of both sides of any equation without getting extraneous solutions. To do that, you have to add a condition such as the statement that there is some integer $k$ such that both sides of the original equation are between $k\pi$ and $(k + 1)\pi.$ When its domain is restricted to one such interval, the cosine function is injective and therefore "safe."


The general case is that you want to solve $$ A(x,y,\ldots) = B(x,y,\ldots) \tag{4a} $$ where $A(x,y,\ldots)$ and $B(x,y,\ldots)$ are mathematical expressions possibly involving $x,$ $y,$ and/or other variables.

There is then a step in many derivations where we "do the same thing to both sides," that is, we apply some function $f$ (which could be "add $1$," "divide by $x$," "square it," or any of many other possibilities). We can then conclude that

$$ f(A(x,y,\ldots)) = f(B(x,y,\ldots)) \tag{4b} $$

provided that

  • The function $f$ actually exists. ("Divide by $x$" is not a function in the case where $x=0$.)
  • $A(x,y,\ldots)$ and $B(x,y,\ldots)$ both are in the domain of $f.$

If it is possible that either $A(x,y,\ldots)$ or $B(x,y,\ldots)$ is not in the domain of $f,$ we need to divide the problem into cases much as we did in $(3\mathrm b)$ so that we can account for the case in which $f$ cannot be applied.

But this gives us an implication in only one direction: $(4\mathrm a) \implies (4\mathrm b).$ To truly have the same solution set, we need the two expressions to be completely equivalent, that is, we also need $(4\mathrm b) \implies (4\mathrm a).$ We can do that if and only if we can map the values on each side of $(4\mathrm b)$ back to their original values in $(4\mathrm a).$ That is, we need the existence of an inverse function $f^{-1}$ such that $$f^{-1}(f(A(x,y,\ldots))) = A(x,y,\ldots)$$ and $$f^{-1}(f(B(x,y,\ldots))) = B(x,y,\ldots).$$ Such a function exists only if $f$ is injective. (We usually say $f$ has to be injective and surjective, that is, one-to-one and onto, but we can make any function "onto" simply by restricting its codomain to be the same as its range. In any case, we know that $f(A(x,y,\ldots))$ and $f(B(x,y,\ldots))$ are both in the range of $f$ because we got them by applying $f$ to both sides of the original equation.)

When the original $f$ is not injective, we can subdivide its domain into pieces on which it is injective. For the function $f(t) = t^2$ two such pieces are the non-negative numbers and the non-positive numbers. Provided that $A(x,y,\ldots)$ and $B(x,y,\ldots)$ are always in the domain of $f,$ from $(4\mathrm a)$ we can derive an equivalent statement $$ f(A(x,y,\ldots)) = f(B(x,y,\ldots)) \ \mathbf{and} \ \left[\begin{array}{l}\text{$f$ restricted to a domain}\\ \text{containing both $A(x,y,\ldots)$} \\ \text{and $B(x,y,\ldots)$ is injective}\end{array}\right]. \tag{4c} $$

The tricky part, which will require you to look at each non-injective function individually, is to figure out the part of $(4\mathrm c)$ in the square brackets.

If we cannot guarantee that both $A(x,y,\ldots)$ and $B(x,y,\ldots)$ are in the domain of $f,$ we need the more general statement

$$ \begin{align} &\left[f(A(x,y,\ldots)) = f(B(x,y,\ldots)) \ \mathbf{and} \ \left[\begin{array}{l}\text{$f$ restricted to a domain}\\ \text{containing both $A(x,y,\ldots)$} \\ \text{and $B(x,y,\ldots)$ is injective}\end{array}\right]\right] \\ &\ \mathbf{or} \Bigg[ A(x,y,\ldots)) = B(x,y,\ldots) \notin \operatorname{dom}(f) \Bigg] . \end{align} $$

And now you know why we don't like to give a completely general answer to this question.

It's often easier to just accept $(4\mathrm a) \implies (4\mathrm b)$ and check the solution set of $(4\mathrm b)$ to eliminate the "extraneous" values.

David K
  • 108,155
  • Thanks for this answer. I'm redoing all my school&uni math after 10 years and now that I have some "mathematical maturity" I keep noticing all these nuances with compound statements in definitions that were never "properly explained" (as in how to handle in an proof or something - when dropping something causes issues etc). Do you think I can get by without doing a course of abstract algebra? Thanks. – S. McDonald Jan 12 '25 at 19:41
  • 1
    @S.McDonald I wouldn't want to discourage someone from taking abstract algebra, but it's really a different kind of algebra and the kind of reasoning I'm talking about flows through all branches of mathematics, so really you can study whichever one takes your fancy. – David K Jan 13 '25 at 00:32
1

Why would squaring both sides lead to more solutions? It is not true. If your solution set is a subset of the real numbers, then $y + 1 \geq 0$. As you are solving for $y$, some potential solution may not satisfy the constraint $y \geq -1$. Overall, whenever you are squaring both sides, taking the logarithm of both sides, etc. you must satisfy certain constraints. Moreover, when you divide, you must make sure that you are not dividing by zero nor losing a root, e.g., $x(x + 1) = 0$ has one more solution than $x + 1 = 0$. Furthermore, if the right-hand side is nonnegative, then squaring both sides will not introduce any "fictitious" solutions. Both solution sets will be identical. I hope this answers your question.

glebovg
  • 10,452
  • 2
    The equation as given has only solutions for negative or zero $x$. If you square both sides, you get an equation which has also solutions for positive $x$ (because $x^2=(-x)^2$). – celtschk Jul 17 '13 at 06:55
  • @celtschk $x$ cannot be positive because $\sqrt{f(y)} \geq 0$. – glebovg Jul 17 '13 at 07:01
  • In the original equation it cannot. If you square both sides, you get the equation $x^2=y+1$ which does have solutions for $x>0$. Which are obviously not solutions of the original equation, that is, the squared equation has additional solutions. Which is the entire point of the question. – celtschk Jul 17 '13 at 07:06
  • @celtschk $(1,0)$ is a solution for $x^2=y+1$ but not for $x=-\sqrt{y+1}$ – hondaman Jul 17 '13 at 07:07
  • @hondaman: Yes, that's an example of what I just wrote. – celtschk Jul 17 '13 at 07:08
  • The problem is that we're assuming the principal branch of the square root. Squaring both sides takes that distinction away, at least explicitly, thought it may still implicitly remain. That's why you made it explicit again in saying "$y \geq -1$". – Eric Tressler Jul 17 '13 at 07:11
  • @celtschk In my example $P(1,0)$, $y=0$ meets the constraint you mentioned and is not a solution for the original equaton. But it is a solution for the second(squared) form. – hondaman Jul 17 '13 at 07:17
  • @celtschk If you are solving the original equation, $x$ cannot be positive. If you square both sides, you do not introduce new solutions because $x$ must remain less than or equal to zero. If, however, you regard $x^2 = y + 1$ as a separate entity, then you are correct. But we, on the other hard, are solving the original equation in which $x \leq 0$. – glebovg Jul 17 '13 at 07:20
  • @glebovg Yes, I was regarding the two equations as separate entities. I wanted to know when I can apply squaring both sides to an equation without worrying about a change to the solution set. – hondaman Jul 17 '13 at 07:39
  • @hondaman When the right-hand side is nonnegative, i.e., $x = \varphi(y) \geq 0$. – glebovg Jul 17 '13 at 07:47
  • 3
    I suggest that this answer be deleted, as it ostensibly does not clarify the situation, to say the least. – Christian Blatter Jul 17 '13 at 13:53
  • 1
    @ChristianBlatter Yes it at least seems to misunderstand the Question. – ryang Apr 15 '22 at 04:23
1

You could refer to the book Elementary Mathematics by Dorofeev, Potapov and Rozov. It has a beautiful explanation as to what happens whilst squaring and also ways in which we allow more solutions than those of the original set.