Show $\max{\{a,b\}}=\frac1{2}(a+b+|a-b|)$
I am tasked with showing that
If $a,b\in \mathbb{R}$, show that $\max{\{a,b\}}=\frac1{2}(a+b+|a-b|)$
I think I can say "without loss of generality, let $a<b$." Then $b-a>0$ But also, $$\max{\{a,b\}}=b=\frac1{2}a+\frac1{2}b-\frac1{2}a+\frac1{2}b$$ $$=\frac1{2}(a+b-a+b)$$ $$=\frac1{2}(a+b+(-a+b))$$ $$=\frac1{2}(a+b+|b-a|)$$ $$=\frac1{2}(a+b+|a-b|)$$
Is this valid? Does the proof (if valid) work the same way for the $\min$ function?
Solution 1:
Here is another approach:
$\max(x,y)+\min(x,y) = x+y$, and $\max(x,y)-\min(x,y) = |x-y|$.
Adding/subtracting gives $\max(x,y) = {1 \over 2}(x+y+|x-y|)$, $\min(x,y) = {1 \over 2}(x+y-|x-y|)$
Solution 2:
There are $3$ separate cases you must cover.
$a \lt b$
$a = b$ and
$a \gt b$
You've covered (1). But this is just one possibility. You must also show that the equality holds for $a = b$. Again, would not be too difficult. And you can argue that case (3) can be shown pretty much the same way as the first one.
The fallacy in the logic is this: "Not all real numbers are such that $a \lt b$ and you are required to prove the identity for every real number"