# How to prove this simple statement: $\max\{a,b\}=\frac{1}{2}(a+b+|a-b|)$ [duplicate]

I am trying to prove this statement.

for any $a,b \in \mathbb{R}$, $$\max\{a,b\}=\frac{1}{2}\big(a+b+|a-b|\big)$$ and $$\min\{a,b\}=\frac{1}{2}\big(a+b-|a-b|\big)$$

I am eating myself not knowing where and how to start. For any guidance Iwill be thankful in tons

-

## marked as duplicate by Martin Sleziak, Claude Leibovici, Sami Ben Romdhane, TooTone, Git GudMar 10 '14 at 12:50

Hint: $\max(a,b) + \min(a,b)=a+b$ and $\max(a,b)-\min(a,b)=|a-b|$. Now solve for $\max(a,b)$ and $\min(a,b)$ – Thomas Andrews Dec 14 '12 at 22:17

Without loss of generality, we can assume that $a = \max(a, b)$ and $b=\min(a, b)$, as both of the expressions are symmetric.

So since $a \geq b$ we have $a-b \geq 0$, thus $a-b=|a-b|$, and so $\dfrac{a+b+|a-b|}{2} = \dfrac{a+b+a-b}{2}=a=\max(a, b)$.

Similarly, we have $\dfrac{a+b-|a-b|}{2}=\dfrac{a+b-(a-b)}{2} = b=\min(a, b)$.

-
great, thanks a lot – doniyor Dec 14 '12 at 22:17
@doniyor: As you say, $\frac12(a+b)$ is the arithmetic mean of $a$ and $b$, so it’s the point midway between them. $\frac12|a-b|$ is half the distance between $a$ and $b$. If you start right in the middle, at $\frac12(a+b)$, and add half the distance between $a$ and $b$, you reach the right endpoint of the interval with $a$ and $b$ as endpoints; if you subtract half the distance between them, you reach the left endpoint. – Brian M. Scott Dec 14 '12 at 22:24
@BrianM.Scott oh okay, so i am reaching the min or max thru this right? – doniyor Dec 14 '12 at 22:29
@doniyor: Yes: the interval with $a$ and $b$ as endpoints is $$\big[\min\{a,b\},\max\{a,b\}\big]\;,$$ so if you start at the middle of the interval and move half the length of the interval to the right, you reach $\max\{a,b\}$. – Brian M. Scott Dec 14 '12 at 22:32
@BrianM.Scott great, Brian, thank you so much! you are better than my prof in the lecture :D – doniyor Dec 14 '12 at 22:33

What is the definition of $\max\{a,b\}$? Hint: it involves two possible cases.

For each of these cases, check that the right hand side gives the same answer. Job done.

Repeat for $\min\{a,b\}$.

-
thanks, i will try now – doniyor Dec 14 '12 at 22:13