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.


Solution 1:

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.

Solution 2:

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$]

Solution 3:

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