How to show that $\max(f,g) =(f+g+|f-g|)/2$? How to show that
$$
\max(f,g) = \frac{f+g+|f-g|}{2}
$$
 A: Although you’re proving a fact about functions, you can do it by looking at individual function values: you need to show that for each $x$ in the domain of $f$ and $g$,
$$\max\{f(x),g(x)\}=\frac12\Big(f(x)+g(x)+|f(x)-g(x)|\Big)\;.$$
It suffices to show that if $a$ and $b$ are any real numbers, then
$$\max\{a,b\}=\frac12\Big(a+b-|a-b|\Big)\;.\tag{1}$$
To see what’s going on, start by drawing pictures, one for $a<b$ and one for $a>b$. In each case $\frac12(a+b)$, the arithmetic mean of $a$ and $b$, is the midpoint of the interval between $a$ and $b$, $|a-b|$ is the length of that interval, and $\frac12|a-b|$ is the distance from the midpoint to each end. Once you’ve seen that, it should at least be intuitively clear why $(1)$ is true, even if you still have to work a bit to prove it.
The most straightforward way to prove it is to break the result into two cases, $a\le b$ and $a>b$. In each case you can say exactly what $\max\{a,b\}$ is, and in each case you can simplify the expression $\frac12\big(a+b-|a-b|\big)$ greatly by getting rid of the absolute value; when you do all this, you’ll find that in each of the two cases the lefthand and righthand sides of $(1)$ are indeed equal.
A: You can compute the arithmetic average "Av" of two numbers a < b in both ways:

*

*$Av = (a + b)/2$ the direct sum and dividing by the total

*$Av = a + (b-a)/2$ as the least element plus half the distance between them: $\rightarrow a-(b-a)/2 = a +b/2 -a/2 = (a+b)/2$, so are equivalent.

Now in using point (2) in your formula gives:
$$max(f,g) = (f+g+|f-g|)/2 = (f+g)/2 + |f-g|/2$$,
Here without losing generality I will assume that $f>g$ (other case is symmetrical since $|f-g|=|g-f|$):
$$max(f,g) = g + (f-g)/2 +|f-g|/2 = g + |f-g|/2\cdot(sign(f-g)+1)$$
Here since always the lesser number will be outside the fraction, and because you always will be adding the length difference between them, you will be keeping the highest number, or in the formula, $(sign(f-g)+1)=2$ for $f>g$.
Here your formula works as
$$\text{MAX}\{\min,\max\} = \min+|\max -\min|/2\cdot(1+sign(\max-\min))=\min+(\max -\min) = \max$$
Seeing that point (1) and (2) are equivalent solves your question. Best regards.
