Alternative ways of finding the least possible value of $|x+y+z|$

59 Views Asked by At

Assume

$$ 6 \leq |x| \leq 8 $$

$$1 \leq |y| \leq 2 $$

$$ 3 \leq |z| \leq 4$$

The trick is to consider the negative values the three unknowns can take.

If $x,y,z$, satisfy the equalities shown, what is the least possible value of $|x+y+z|$?

I can solve this problem via brute force, trying all cases, and I obtain the answer of zero.

Is there a geometric or more slick or intuitive way of solving this problem that is faster than the brute force method?

4

There are 4 best solutions below

3
On BEST ANSWER

I would note first that the "width" of the system is $2+1+1=4$, so for any particular choice of signs (and there are eight such) the values of $|\pm x\pm y\pm z|$ lie in an interval of width $4$ - the constraints are inclusive, so the intervals are closed.

The central values are $7, 1.5, 3.5$ and you want to get as close to zero as possible. A greedy algorithm (largest value first and choose the sign which gets you closest to zero for in size order) seems to do the job.

$7-3.5-1.5=2$

This is a central value of an interval of width $4$, so you can achieve $2-\frac 42=0$

I don't suggest learning such a method - I am sure the use would infrequent. I would suggest noting potential computational efficiencies. Brute force can sometimes be quicker than taking the time to think.

4
On

Start by checking endpoints. This means a total of $4^n$ triples to check where $n$ is the number of constraints of the type you've specified. This isn't too bad for a small number of constraints. Perhaps just by good luck, but I did this quickly in my head. $x=6$, $y=-2$, and $z=-4$ implies $|x+y+z|=0$, which is the minimum that the absolute value of anything can be.

If the question is to generalize this to arbitrarily many constraints then the questions becomes more subtle.

0
On

It's quite simple: taking $x=-6, y=2, z=4$, you obtain $|x+y+z|=0$, and as an absolute value can't be negative…

0
On

You can solve the problem via integer linear programming as follows. Define binary variables $u$, $v$, $w$ to indicate whether $x$, $y$, and $z$ are negative or positive, respectively. Define variable $t$ to represent $x+y+z$. Then the problem is to minimize $t$ subject to linear constraints: \begin{align} t &\ge x+y+z \\ t &\ge -(x+y+z) \\ -8u+ 6(1-u) \le x &\le -6u+ 8(1-u) \\ -2v+ 1(1-v) \le y &\le -1v+ 2(1-v) \\ -4w+ 3(1-w) \le z &\le -3w+ 4(1-w) \\ u,v,w &\in \{0,1\} \end{align}