2

Is there an idea that resolves nested value expressions into several separate expressions each using a single absolute value? Something similar like resolving the max function using the absolute value.

More concretely, I am looking for a way to rewrite the expression $$||x-y|-z|$$ in a way that does not use expressions of nested absolutes.

I already did a case study, and this is what I've got so far

  • For $x<y$ and $(y-x) < z$, we have: $||x-y|-z| = x - y + z$
  • For $x<y$ and $(y-x) > z$, we have: $||x-y|-z| = -x + y - z$
  • For $x>y$ and $(x-y) < z$, we have: $||x-y|-z| = -x + y + z$
  • For $x>y$ and $(x-y) > z$, we have: $||x-y|-z| = x - y - z$

But I can't seem to find a pattern to rewrite it.

If it helps, we can assume that all variables $x$, $y$ and $z$ are non-negative.

Blue
  • 75,673

1 Answers1

2

This is not possible, if the variables are allowed to be negative.

Let $u=x-y$ and $v=-z$. Suppose there are some linear forms $a_iu+b_iv$ and signs $\sigma_i\in\{1,-1\}$ such that

$$\big||u|+v\big|=(a_0u+b_0v)+\sum_{i\geq1}\sigma_i|a_iu+b_iv|$$

for all $u,v\in\mathbb R$. Negating the inputs,

$$\big||u|-v\big|=-(a_0u+b_0v)+\sum_{i\geq1}\sigma_i|a_iu+b_iv|,$$

and subtracting, we get

$$\big||u|+v\big|-\big||u|-v\big|=2(a_0u+b_0v)$$

for all $u,v$. Setting $v=0$ and $u=1/2$ gives $a_0=0$, and setting $u=0$ and $v=1/2$ gives $b_0=0$. Finally, setting $u=v=1/2$ gives $1=0$, a contradiction.


Now let's restrict the variables to be positive.

After playing with CalcPlot3D for a while, visualizing these functions (write 'abs(x)' for $|x|$), I found a solution. The key is that

$$\big||u|-|v|\big|=|u+v|+|u-v|-|u|-|v|$$

for all $u,v\in\mathbb R$. Setting $u=x-y$ and $v=z\geq0$, we get

$$\big||x-y|-z\big|=|x-y+z|+|x-y-z|-|x-y|-z$$

for all $x,y,z\geq0$.

mr_e_man
  • 5,364