I have encountered a system of linear equations that involves absolute values:

\begin{align} |x + y| &= 1 \\ |x| + |y| &= 1 \end{align}

I am having trouble finding resources or methods to solve systems of equations involving absolute values. My initial approach is to consider all possible combinations of the equations without absolute values, such as:

1.   x + y = 1 
2.   x + y = -1 
3.   x - y = 1 
4.   x - y = -1 
5.   -x + y = 1 
6.   -x + y = -1 
7.   -x - y = 1 
8.   -x - y = -1 

Is this approach correct, or is there a more efficient method to solve these types of equations? Additionally, I would appreciate any resources or references on solving systems of equations with absolute values.

Thank you!

  • 5
    $\begingroup$ A possible way to solve this is to graph the functions (which can be done by hand) , then solutions are immediately obvious... $\endgroup$
    – J.D
    Commented May 23 at 21:46
  • $\begingroup$ One direct way of doing this is making a big branching tree with different possibilities for each choice of sign for each of the absolute values. For example, one choice would be the system $x+y=1$ and $x-y=1$. What you wrote there is not ok, since the different choices do not need to simultaneously hold. Your specific system would lead to $8$ possible systems without absolute values, which are independent of each other. Meaning that the solution set for the absolute value system is the union of the solution sets for the individual 8 branching systems. $\endgroup$
    – AnCar
    Commented May 23 at 21:48
  • $\begingroup$ Also, remember that if you make a specific choice for the absolute values in one of the branches, that limits the potential solution ranges. For example, if I get the system $x+y=1$ and $x-y=1$ from your absolute value system, i am only interested in a solution $(x,y)$ if $x\geq 0$, $y\leq 0$ and $x+y\geq 0$ since otherwise this particular choice of the meaning of the absolute values would not make sense. $\endgroup$
    – AnCar
    Commented May 23 at 21:52
  • 2
    $\begingroup$ The systematic method is indeed to subdivise into cases where you can drop all the absolute value, with or without putting a minus sign instead. Here the cases are: 1) $x,y\ge0$ (hence $x+y\ge0$) 2) $x,y\le0$ (hence $x+y\le0$) 3) $x\ge0,y\le0,x+y\ge0$ 4) $x\ge0,y\le0,x+y\le0$ 5) $x\le0,y\ge0,x+y\ge0$ 6) $x\le0,y\ge0,x+y\le0$. $\endgroup$ Commented May 23 at 21:55
  • 2
    $\begingroup$ @J.D posted that graph asa CW answer $\endgroup$
    – Will Jagy
    Commented May 23 at 23:51

6 Answers 6


I second J.D. approach in this case as the simplest one.

First plot the set

$$ |x+y|=1. $$

This clearly corresponds to two straight lines at -45 degrees with the $X$ axis. One passing through $(1,0)$ the other through $(0,-1)$.

Next you plot the set

$$ |x|+|y|=1. $$

This is slightly more complicated but after a little thinking you realize it's the square with vertices at $(1,0),\ (0,1),\ (-1,0),\ (0,-1)$.

At this point the solution should be obvious.

A nice exercise is to plot the set

$$ |x|^a+|y|^a=1, $$

for $a>0$ using small and large values of $a$. Clearly $a=2$ corresponds to the circle.


The suggestion of J.D. The blue square is $|x|+|y| = 1$ The red lines, including part where the red is covered by the blue, is $|x+y|= 1 $

enter image description here

  • 1
    $\begingroup$ +1 : nice visualization. $\endgroup$ Commented May 24 at 1:20
  • 1
    $\begingroup$ @user2661923 done with GeoGebra. $\endgroup$ Commented May 24 at 10:39

I have a strong feeling that the purpose with this exercise is to avoid branching (like the initial method in the OP), but to notice instead some particular structure of this particular equation. For example, that for all $x,y$ we have in general $$ |x+y|\le|x|+|y|. $$ Here, it is equality $|x+y|=|x|+|y|$ as both sides are equal to one, and this can happen if and only if $x$ and $y$ have the same sign.

Another (somehow naive) way to start is to square both equations, which leads to the (in this case equivalent) system $$ \begin{cases} x^2+2xy+y^2=1,\\ x^2+2|xy|+y^2=1, \end{cases} $$ with the same conclusion that $xy=|xy|$.

Next, if some non-negative $x,y$ solves the system, then same values negative are a solution as well (due to sign symmetry of the absolute value). It is, thus, enough to solve it for non-negative values.

  • $\begingroup$ +1 : "I have a strong feeling that the purpose with this exercise is to avoid branching (like the initial method in the OP),..." : nice if speculative analysis. Personally, not knowing the problem composer's intent, I would have gone simpler, with the case work based on the idea that $~|x| + |y| = 1 \implies x,y \in [-1,1].~$ However, there is certainly merit in your idea that the problem composer may well have intended the problem to be an application of recently proven results around absolute values. $\endgroup$ Commented May 24 at 1:25

You can solve such problems via mixed integer linear programming. Explicitly, for each absolute value $|f|$, where $f$ is a bounded linear expression ($L \le f \le U$), introduce a continuous decision variable $g$, a binary decision variable $z$, and linear constraints: \begin{align} g &\ge f \tag1\label1 \\ g &\ge -f \tag2\label2 \\ g - f &\le (U-L)z \tag3\label3 \\ g + f &\le 2U(1-z) \tag4\label4 \end{align} Constraints \eqref{1} and \eqref{2} enforce $g \ge |f|$. Constraint \eqref{3} enforces the logical implication $z = 0 \implies g \le f$. Constraint \eqref{4} enforces the logical implication $z = 1 \implies g \le -f$.


For this problem in particular you can proceed faster by noting that $xy\geq0$. Indeed for the second equation $|x|\leq1$ and $|y|\leq1$, hence if $xy<0\Rightarrow |x+y|<1$ which contradicts the first one. So the only possibilities are:

1)$x+y=1$ and they are both positive, so the second equation becomes $x+y=1$

2)$x+y=-1$ and they are both negative, so the second equation becomes $x+y=-1$


An equivalent set of equations is

$$ |x+y| = |x| + |y| \\ |x + y| = 1 $$

Squaring the (new) first equation gives

$$ |x+y|^2 = (|x| + |y|)^2\\ x^2 + 2xy + y^2 = x^2 + 2|xy| + y^2\\ xy = |xy| \\ xy \geq 0$$

i.e. $x$ and $y$ do not have opposite signs (one positive, one negative).

The (new) second equation directly gives

$$ |x + y| = 1 \\ x + y = \pm 1 \\y = -x \pm 1 $$

This gives us two possible $y$ values for each $x$, but we can use the earlier restriction to cut some of them away. In particular, when $x$ is positive, $-x-1$ is negative; similarly, when $x$ is negative $-x+1$ is positive.

On the other hand, when $x$ is non-negative, $-x + 1$ is non-negative implies that $x \leq 1$; similarly, when $x$ is non-positive, $-x-1$ is non-positive implies that $x \geq -1$.

Thus, we identify the solution as the union of two sets, $A\cup B$, where

$$ A = \{ (x,-x+1) \ | \ x\in[0,1]\} \\ B = \{ (x,-x-1) \ | \ x\in[-1,0]\}$$

Note that the overlap at zero prevents us from writing this solution as a piecewise function.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .