How to show that $$ \max(f,g) = \frac{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? – Oct 18 '12 at 02: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 02:44
2 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<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.
....
- 3
- 616,228
-
-
-
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$$ ? – Jan 02 '13 at 12:21
-
@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. – Brian M. Scott Jan 02 '13 at 15:32
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.
- 1,380