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}$$

-
Hint: it is enough to do this for $f,g$ numbers (well, I assumed they were functions) (why?). Have you tried then assuming that $f\geq g$ and see what happens to both sides? – Jason Polak Oct 18 '12 at 2:44
Just check that it works for any two numbers x and y. Assume the three possibilities x<y, x=y, x>y and calculate the value of the definition (with x and y insteas of f and g). If the thing is supposed to refer to functions f and g I would assume they take on values in the reals, or some simple thing in which < is defined (so also |x|). – coffeemath Oct 18 '12 at 2:44

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.

-
Thank you all and especially Brian. – Klara Oct 18 '12 at 2:50
@Klara: You should accept his answer by clicking on the tick icon. – wj32 Oct 18 '12 at 2:57
@Klara: You’re welcome. – Brian M. Scott Oct 18 '12 at 2:58
@wj32 Thank you! – Klara Oct 18 '12 at 4:00
I am a bit confused. Assume $a \leq b$. Then $max(a,b) = b$. Further $|a-b| = - (a-b)$ such that $$\frac 12 (a+b-|a-b|) = \frac 12 (a+b+a-b) = \frac 12 2a = a$$ ? – Epsilon Jan 2 '13 at 12:21