# Solving absolute value equations with two variables

I have an absolute value term in equation, which looks like this $$||x| - |y||\text{.}$$

If I remember correct, this term will have 4 variations, depending on values of $x$ and $y$.

1. $x > 0\wedge y > 0$

In this case $|x| = x$ and $|y| = y$. Because both of them are positive, the term will look like $$x - y\text{.}$$

1. $x > 0 \wedge y < 0$ In this case $|x| = x$ and $|y| = -y$. Because one of them is positive and one negative, the term will look like $$-(x + y) = -x - y\text{.}$$

And so on.

I am doing this right?

• If $x, y > 0$ then $||x| - |y|| = |x - y|$, but this is $x - y$ or $y - x$, depending on whether $x$ or $y$ is larger. – Travis Oct 7 '15 at 18:18
• @Travis and concerning the second point on my list? Do values of |x| and |y| affect the value in determining ||x| - |y||? – Accelerate to the Infinity Oct 7 '15 at 18:21
• @Travis thank you, I guess I got it. – Accelerate to the Infinity Oct 7 '15 at 18:27
• You're welcome, I hope you found my comment useful. – Travis Oct 7 '15 at 18:41

There's eight possible cases but four outcomes.

Case 1: x and y both non-negative; x >= y: ||x| - |y|| = |x - y| = x - y

Case 1a: x, y both non-negative; y< x:||x| - |y|| = |x - y| = y - x

Case 2: x< 0; y non-negative; y <= |x|:||x| - |y|| = ||x| - y| = |x| - y = -x - y

Case 2a: x< 0; y non-negative; y > |x|:||x| - |y|| = ||x| - y| = y - |x| = y + x

Case 3: x non-negative: y < 0; |y| <= x: ||x| - |y|| = |x - |y|| = x - |y| = x + y

Case 3a: x non-negative; y < 0; |y| > x:||x| - |y|| = |x - |y|| = |y| - x = -y - x

Case 4: x<0; y<0: x <= y: ||x| - |y|| = |y - x| = y - x

Case 4a: x<0; y<0: x > y: ||x| - |y|| = |y - x| = x - y

===

In other words:

It's $x - y$ or $y - x$ if both are the same sign. It's $x - y$ if x>= y and $y-x$ if y< x.

It's $x + y$ or $-x - y$ if they are different signs.