3

Show that: $$ \max\{x,y\}=\frac{1}{2} \left(x+y+|x-y|\right) $$

I have no idea how to prove this; most likely it is trivial.

kurkowski
  • 639

5 Answers5

12

Geometrically, $\frac{x+y}{2}$ is the midpoint between $x$ and $y$, and $\frac{|x-y|}{2}$ is half the distance between $x$ and $y$.

So if you start at the midpoint and go half the distance in the positive direction, you end up at the right endpoint (or max).

paw88789
  • 40,402
4

If $y>x \implies |x-y|=y-x$ hence $\max\{x,y\}=y$.

If $x>y \implies |x-y|=x-y$ hence $\max\{x,y\}=x$.

For $x=y$, it's trivial

Marcus M
  • 11,229
mandez
  • 750
  • 1
    You could actually use only two cases; your first holds when $y\geq x$ and your second holds when $x\geq y$. The fact that the cases overlap isn't a problem. – Milo Brandt Feb 14 '15 at 18:21
  • thats true true if i consider the equality of x,y! but i didnt consider it in the first two cases! anyways thanks – mandez Feb 14 '15 at 18:25
3

Consider two possibilities: $x<y$ or $x\ge y$.

3

$\max(x, y)+\min(x, y) = x+y$ and $\max(x, y)-\min(x, y) = |x-y|$ thus $2\max(x, y) = x+y+|x-y|$. Therefore $\max(x, y) = \frac{1}{2}(x+y+|x-y|).$

1

If $x\geq y$ then $|x-y|=x-y$ and the RHS above becomes $\frac{2x}{2}=x$. If $x\leq y$ then $|x-y|=y-x$ and the RHS above becomes $\frac{2y}{2}=y$. In both cases it is $\operatorname{max}(x,y)$

marwalix
  • 16,773