How to show that $$ \max(f,g) = \frac{f+g+|f-g|}{2} $$
How to show that $\max(f,g) =(f+g+|f-g|)/2$?
-
1Hint: 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? – 2012-10-18
-
0Just check that it works for any two numbers x and y. Assume the three possibilities 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|). – 2012-10-18
1 Answers
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 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.
-
0Thank you all and especially Brian. – 2012-10-18
-
0@Klara: You’re welcome. – 2012-10-18
-
0I 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$$ ? – 2013-01-02
-
0@André: That’s exactly as it should be: if you subtract half the distance between $a$ and $b$ from their midpoint, you will of course get the smaller of the two. – 2013-01-02