1

This is a fairly basic question, however, I don't know what I am missing here. Solving the equation $\vert x- y\vert = \vert x \vert -\vert y \vert$ yields: \begin{align} \vert x- y\vert &= \vert x \vert -\vert y \vert \\ (x-y)^2&=x^2+y^2-2\vert xy\vert \\ xy & = \vert xy \vert \end{align} Which is obviously true if $xy\geq 0$. However, if I set $x=0$, this equality does not hold. For instance $x=0$ and $y=5$, then: $$ \vert0-5\vert=\vert0\vert-\vert5\vert \\ 5 = -5 $$ On the other hand, if $y=0$, it works out fine. So, I would conclude that we need $xy\geq 0$ and $x \neq 0$ for this equation to hold. I wonder whether there is an "analytical way" to see this rather than plugging in numbers.

N. F. Taussig
  • 76,571
Count
  • 113

6 Answers6

3

However, if I set $x=0$, this equality does not hold.

This is because your first step introduced extraneous solutions.

So, I would conclude that we need $xy\geq 0$ and $x \neq 0$ for this equation to hold.

Not true: $(x,y)=(0,0)$ is a solution of the given equation.

I wonder whether there is an "analytical way" to see this rather than plugging in numbers

Here's one method: \begin{align} &\vert x- y\vert = \vert x \vert -\vert y \vert \\ \iff{}& (x-y)^2 =x^2+y^2-2\vert xy\vert \quad\text{and}\quad \vert x\vert\ge \vert y\vert\\ \iff{}& xy = \vert xy\vert \quad\text{and}\quad \vert x\vert\ge \vert y\vert\\ \iff{}& y=0 \quad\text{or}\quad (\text{$x$ and $y$ have the same sign} \quad\text{and}\quad \vert x\vert\ge \vert y\vert) \\ \iff{}& y=0 \quad\text{or}\quad (x\ge y>0 \quad\text{or}\quad 0>y\ge x)\\ \iff{}& x\le y\le 0 \quad\text{or}\quad 0\le y\le x. \end{align}

Here, every line is equivalent to the line above and below it; in particular, notice that in the first step this was achieved by introducing the restriction $\vert x\vert\ge \vert y\vert,$ which is missing from your working.

ryang
  • 38,879
  • 14
  • 81
  • 179
2

By raising to the $2$nd power, you can get extraneous solutions. For instance, suppose I dont know how to solve $2x=x+4$ (the solution is $x=4$). If I raise to the $2nd$ power, I get $4x^2=x^2+8x+16 \implies (3x+4)(x-4)=0,$ so I get the solution $x=-\frac{4}{3},$ which is incorrect with respect to the original equation. The same applies here with your example.

Trobeli
  • 3,242
2

Since you are squaring an equation involving real numbers, the first line implies the second, but the converse is a priori not true. Namely, "$|x-y|=|x|-|y| \implies |xy|=xy$" is a true statement but the converse ("$xy=|xy| \implies |x-y|=|x|-|y|$") is false, as your counter-example shows.

The trick is to consider $a=|x-y|+|y|$ and $b=|x|$. Now, $a$ and $b$ are nonnegative real numbers, so $a=b \iff a^2=b^2$. Now,

$$ \begin{aligned} |x| = |x-y|+|y| & \iff & x^2 = (x-y)^2+2|x-y||y|+y^2 \\ & \iff & x^2-y^2-(x-y)^2 = 2|x-y||y| \end{aligned} $$

which is equivalent (after simplification) to

$$ (x-y)y = |(x-y)y| $$

itself being equivalent to $(x-y)y \ge 0$. Note that this implies that $xy\ge 0$, but the converse is false.

Taladris
  • 11,339
  • 5
  • 32
  • 58
1

You have that $$ |x-y| = |x| - |y| \qquad\implies\qquad (x-y)^2 = x^2 + y^2 - 2|xy| $$ which is an implication but not an equivalence. The problem is that squaring adds solutions, for example $1\neq-1$ but $1^2=(-1)^2$.

If you'd take the square root of the right equation, you'd get $$|x-y| = \big|\,|x|-|y|\,\big|$$ The left side, however, must have $|x|\geqslant|y|$. Thus:

$$ |x- y| = |x| - |y| \qquad\Longleftrightarrow\qquad (x-y)^2 = x^2 + y^2 - 2|xy| \ \text{ and }\ |x|\geqslant|y| $$


One way to solve the equation is the rather tedious split into cases:

$$|x-y| = |x| - |y| \quad\Longleftrightarrow\quad \begin{cases} x-y = x-y; &x\geqslant y, x\geqslant 0, y\geqslant 0 \\ x-y = x+y; &x\geqslant y, x\geqslant 0, y < 0 \\ x-y = -x-y; &x\geqslant y, x < 0, y\geqslant 0 \\ x-y = -x+y; &x\geqslant y, x < 0, y < 0 \\ y-x = x-y; &x < y, x\geqslant 0, y\geqslant 0 \\ y-x = x+y; &x < y, x\geqslant 0, y < 0 \\ y-x = -x-y; &x < y, x < 0, y\geqslant 0 \\ y-x = -x+y; &x < y, x < 0, y < 0 \\ \end{cases}$$

Some cases vanish because they are always false, others reduce due to $x=0$ or $x=y$: $$|x-y| = |x| - |y| \quad\Longleftrightarrow\quad \begin{cases} \text{true}; &x\geqslant y\geqslant 0 \\ x = y; &x\geqslant y, x < 0, y < 0 \\ y = 0; &x < y, x < 0, y\geqslant 0 \\ \text{true}; &x < y < 0 \\ \end{cases}$$

That is: $$|x-y| = |x| - |y| \quad\Longleftrightarrow\quad \begin{cases} x\geqslant y\geqslant 0 \\ x = y < 0 \\ x < y \leqslant 0 \\ \end{cases}$$ This 3 cases can finally be rewritten as 2 cases: $$|x-y| = |x| - |y| \quad\Longleftrightarrow\quad \begin{cases} x \geqslant y\geqslant 0 \\ x \leqslant y \leqslant 0 \\ \end{cases}$$

emacs drives me nuts
  • 10,390
  • 2
  • 12
  • 31
0

The equality obviously implies that $|x|\ge |y|$. Let $x=a|x|$ where $a=\pm1$. Then $|x|\ge|y|\ge ay$ and hence $$ |x|-ay =\big||x|-ay\big| =\big|a^2|x|-ay\big| =|a|\big|a|x|-y\big| =\big|a|x|-y\big| =|x-y| =|x|-|y|. $$ Therefore $|y|=ay$ or equivalently, $y=a|y|$. Thus we have $|x|\ge|y|,\,x=a|x|$ and $y=a|y|$. Hence $x\ge y\ge0$ (when $a=1$) or $x\le y\le0$ (when $a=-1$). Conversely, the equality $|x-y|=|x|-|y|$ obviously holds in these two circumstances.

user1551
  • 139,064
-1

Which is obviously true if $xy\geq 0$.

It's not so, if $x=1$ and $y=2$ then $|x-y|=1$ but $|x|-|y|=-1$.

However, if I set $x=0$, this equality does not hold.

If you set any value of $x$ less than $y$ then $|x-y|=y-x$, and then $y-x$ may or may not be equal to $|x|-|y|$. For example if you set $x=-1, y=1$ then $|x-y|=2$ but $|x|-|y|=0$, but if $x=-1, y=0$ then $|x-y|=1$ and $|x|-|y|=1$.

Suzu Hirose
  • 11,660