Intuition about a simple equality involving min and max of some naturals

42 Views Asked by At

I am playing for fun with some (natural) numbers and noticing the following: For any $h = 0, ... , \max(a, b)$:

$$\min(a, h) - \min(b, h) = \max(0, h - b) - \max(0, h - a)$$

What is this called? Is there some immediate intuitive justification?

2

There are 2 best solutions below

2
On BEST ANSWER

The is true for all $h,$ not just $h$ in that range. I doubt the identity has a name.

It follows from two relatively intuitive identities:

$$\max(u+w,v+w)=\max(u,v)+w\tag1$$

And $$\max(u,v)=-\min(-u,-v)\tag2$$

From $(1)$ you get $\max(0,h-b)=\max(-h,-b)+h$ and $\max(0,h-a)=\max(-h,-b)+h.$

Then:

$$\begin{align}\max(0,h-b)-\max(0,h-a)&=\max\left((-h,-b)+h\right)-\left(\max(-h,a)+h\right)\\ &=(-\min(h,b))-(-\min(h,a))\\&=\min(h,a)-\min(h,b) \end{align} $$

1
On

Note that $max(x,y)+min(x,y) = x+y \Rightarrow max(x,y) = x+y - min(x,y)$.

$max(0,h-b) = 0 + h-b - min(0,h-b) = h-(b+min(0,h-b))=h-min(b,h)$.

Similarly, $max(0,h-a) =h-min(a,h)$. The rest is clear.