Absolute value and max/min function: why $a + b + |a - b|=2\max(a,b)$? [duplicate]
I am being told that $a + b + |a - b|$ is equal to $2\max(a,b)$.
What is the reasoning behind this?
By considering cases $a>b$ and $a\le b$, it's easy to see that $$ |a-b| = \max(a,b) - \min(a,b), \tag{$note\colon |a-b| = |b-a|$} $$ and $$ a+b = \max(a,b) + \min(a,b). $$ Now add them.
Intuitively, notice that $\frac{a + b}{2}$ is the midway point between $a$ and $b$, and $\frac{|a - b|}{2}$ is half the distance between the two numbers, so $$\frac{a + b}{2} + \frac{|a - b|}{2}$$ is the mid way point between the two points plus half of the distance between them, which brings you to the larger of the two numbers, thus $$\frac{a+b + |a-b|}{2} = \max(a,b).$$
Adding $|a-b|$ to the smaller of the numbers makes it equal to the larger; then adding the original larger number yields twice that.
$$a+b+|a-b|=\begin{cases}a+b+a-b =2a & \text{when} \:a\ge b\\ a+b+b-a = 2b & \text{when} \:b>a\end{cases}$$
Hence we can say that $$a+b+|a-b|=2 \max(a,b)$$