Does $-\min(a,b) = \max(-a,-b)$?

616 Views Asked by At

Disclaimer: I'm not a mathematician. I'm a developer (with physics degree).

By trial and error I've found that: $$-\min(a,b)=\max(-a,-b)$$ $$-\max(a,b)=\min(-a,-b)$$

  1. Is it true?
  2. Is there a proof of it so I can read it? (Ideally explained so simple as other max/min properties in EWD1240a by Edsger Wybe Dijkstra)

Thank you

3

There are 3 best solutions below

0
On BEST ANSWER

The easiest way to prove your equality is to split the two possible cases. In both cases, we will use the fact that multiplying an inequality by $-1$ reverses the direction of the inequality, i.e. if $x<y$, then $-x>-y$.

  1. If $a<b$, then $\min(a,b)=a$, which means $-\min(a,b)=-a$. Also, because $a<b$, we know that $-a>-b$, which means $\max(-a,-b)=-a$.
  2. If $a\geq b$, then $\min(a,b)=b$, which means $-\min(a,b)=-b$. Also, because $a\geq b$, we know that $-a\leq -b$, which means that $\max(-a,-b)=-b$.

In both cases, $-\min(a,b)=\max(-a,-b)$, so the equality holds in general.

0
On

It's true, yes. And it's a mere consequence of $$a\leq b\iff -a\geq-b$$ so that if this is true then $$-\min(a,b)=-a = \max(-a,-b),$$ and a symmetric argument solves the case $b\leq a$

0
On

Alternatively, use $\min(x,\,y)=\frac{x+y-|x-y|}{2},\,\max(x,\,y)=\frac{x+y+|x-y|}{2}$, so the first equation reduces to $-\frac{a+b-|a-b|}{2}=\frac{-a-b+|-a+b|}{2}$, which is trivial. The second equation follows similarly.

Or even simpler, since both claims are symmetric in $a,\,b$, without loss of generality $a\le b$ so $-b\le a$. Then the claims respectively reduce to $-a=-a,\,-b=-b$.