Can the sum of two max operators be simplified and written as a single max operator? I have the following forms: $$\max(a-b,0) + \max(b-a,0)$$ and $$\max(a-b,0) + \max(c-d,0)$$
Asked
Active
Viewed 216 times
-1
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Sep 19 '21 at 11:35
2 Answers
0
Assuming $a$ and $b$ are reals (including rationals and integers), it's easy to show by distinguishing the cases $a\ge b$ and $a<b$ that $$\begin{align} \max(a-b,0) + \max(b-a,0)&\ =\ \max(a-b,\,b-a)\\ &\ =\ \left\lvert\,a-b\,\right\rvert\\ &\ =\ \left\lvert\,b-a\,\right\rvert\\ \end{align}$$
I don't see much simplification possible for the other expression.
fgrieu
- 1,758
0
The first form can be simplified. If $a>b$, then $a-b>0$ and $b-a<0$. Then $$\max(a-b,0)+\max(b-a,0)=(a-b)+0=a-b$$ Otherwise when $a\le b$, then $a-b\le 0$ and $b-a\ge 0$. Then$$\max(a-b,0)+\max(b-a,0)=0+(b-a)=b-a$$ Hence we have $$\max(a-b,0)+\max(b-a,0)=|a-b|$$ The second form cannot be written as a single max operator in general.
5201314
- 2,227