# Should the sign be reversed if I square both sides of an inequality?

Let us say I have the following:

$$x>y$$

Now, I want to take the square of both sides. Should it result in $$x^2>y^2$$ or $$x^2<y^2$$

I suspect there is no way to give a general answer to this. I would like to know how to analyze this nevertheless.

• Similarly, I'd like to know how to square $x<y$ as well. Apr 25, 2013 at 5:23
• Unless both have the same sign there isn't a satisfactory answer. $1 > -2$, but $1^2 < (-2)^2$. On the other hand, $2 > -1$ and $2^2 > (-1)^2$. Apr 25, 2013 at 5:35
• Similar question (perhaps a duplicate): Showing $a^2 < b^2$, if $0 < a < b$. Apr 25, 2013 at 7:48
• @MartinSleziak Unless I missed something in one of the answers, this question is much more general. So it is not an exact duplicate. Apr 25, 2013 at 8:35
• @user1729 Perhaps it is more general, I am not sure about much more general. Well, I've cast my vote to close, so I cannot undone this. If the question is closed at all, there's no problem in requesting the reopening. (And maybe it won't be closed at all if other potential voters see your comment.) Apr 25, 2013 at 8:59

You have to know where zero is to do anything. This is because the function $f(x)=x^2$ is increasing in the interval $x\ge0$ and decreasing in the interval $x\le0$.

The general principle (LEARN THIS! You can later apply it to more difficult functions) is that if you apply an increasing function to both side of an inequality, you keep the original order. OTOH if you apply a decreasing function to both sides of an inequality the order is reversed.

So if you know that $x$ and $y$ are both $\ge0$ , then the inequality $x>y$ is true if and only if the inequality $x^2>y^2$ is true.

OTOH if you know that $x$ and $y$ both $\le0$, then the inequality $x>y$ is true if and only if the inequality $x^2<y^2$ is true.

I leave it to you to think, what you can deduce about the truth of $x>y$, if $x$ and $y$ have opposite signs.

Anyway, when you contemplate squaring both sides of an inequality, you have to split the solution to cases according to where zero lies. With some other functions the situation may be better. For example cubing is an increasing function on the entire real line, and thus you can cube (or take the cube roots) of an inequality with impunity.

• Am I right in flipping the sign when applying ^x/b to both sides when both sides have values between 0 and 1 and x<b? Oct 8, 2015 at 20:44
• What about multiplying both sides of an inequality by $y = -1$ ? That switches the order however y is not a decreasing function May 20, 2016 at 13:53
• @Amir: Then you are not applying the same function to both sides of the inequality, and all bets are off. May 20, 2016 at 16:32
• And @Amir: More importantly. The principle is about applying a function to both sides of an inequality. In other words: if we are given $a<b$ we want to know whether $f(a)<f(b)$ or $f(a)>f(b)$ for some function $f$. Multiplication by $-1$ means that you apply the decreasing function $f(x)=-x$. Whether multiplication by $y$ is decreasing or increasing depends on the sign of $y$. Oct 16, 2016 at 6:08
• @Uq'''12wn1F12u2x3uW31H1JBk9m That would be applying the function f(x)=-x to both sides, which is decreasing. May 6, 2018 at 23:37

If $x^2-y^2>0, (x+y)(x-y)>0$

Now, if $x-y>0,$ i.e.,if $x>y; x+y>0$

or if $x-y<0,$ i.e.,if $x<y; x+y<0$

So, $x>y$ and $x+y>0 \implies x^2>y^2$ [Ex. $5>\pm 3$ and $5\pm 3>0\implies 5^2>(\pm3)^2$]

and $x<y$ and $x+y<0 \implies x^2>y^2$ [Ex. $-5<-3$ and $-5+(-3)=-8<0\implies (-5)^2>(-3)^2$]

• Since the original question assumed $x > y$, I would write it this way. If $x > y$, then $x^2 - y^2 = (x+y)(x-y)$ and $x + y$ have the same sign. Thus $x^2 > y^2$ if $x + y > 0$, $x^2 < y^2$ if $x + y < 0$, $x^2 = y^2$ if $x + y = 0$. Apr 25, 2013 at 5:46
• @RobertIsrael, very precis. I also wanted to show $x<y$ along with $x>y$. I excluded $x=y$ as the question Apr 25, 2013 at 5:49

Maybe this will be helpful: $$x \geq y \Longleftrightarrow \mathrm{sgn}(x)x^2 \geq \mathrm{sgn}(y)y^2$$

Where $\mathrm{sgn}(\cdot)$ is the sign function. It is what I use to test inequalities for computational purposes. You can check it on a case-by-case level, i.e. by checking the three possible cases

1. $x\geq0,y\geq0$,
2. $x\geq 0,y\leq 0$,
3. $x\leq 0,y\leq 0$.