Question paraphrased: Prove that the maximum between two numbers $x$ and $y$ is given by:
$$\max(x,y)=\frac{x+y+|y-x|}{2}$$ Proof: Let $x$ and $y$ be two arbitrary numbers. Then, one and only one holds true: $x \ge y$ or $x \le y$
If $x \ge y$, $x=x+(y-y)=(x-y)+y=|x-y|+y$
Also, $$x=\frac {x+x}{2}=\frac{|x-y|+y+x}{2}=\frac{|x-y|+x+y}{2}$$

If $y \ge x$, $y=y+(x-x)=(y-x)+y=|y-x|+y$
Also, $$y=\frac {y+y}{2}=\frac{|y-x|+x+y}{2}=\frac{|x-y|+x+y}{2}$$
Thus, $$\max(x,y)=\frac{x+y+|y-x|}{2}$$
How can I improve this proof? I am not very convinced with $y=\frac {y+y}{2}$ and $x=\frac {x+x}{2}$ technique because it feels as if I have done this to satisfy the answer.

  • 1
    $\begingroup$ This is correct and it is usually the case that we do things to satisfy the answer, and many discoveries were done that way. Nothing to be ashamed of. $\endgroup$ – Bcpicao Jun 3 at 9:12
  • 2
    $\begingroup$ It's fine that you were detailed, but one way to shorten the proof is to just note that the equation is symmetric in $x$ and $y$, so proving just one case (say, $x \geq y$) is sufficient. Another remark: to be nit-picky, it is not true that "one and only one holds", since we could have $x = y$. Anyways, in this case, you didn't need to use the fact that one and only one holds, but only that one or the other (or both) holds. In general, so long as you cover all cases, it's ok if they overlap. $\endgroup$ – twosigma Jun 3 at 9:16
  • $\begingroup$ @twosigma, you mentioned that I could invoke the fact that the equation in symmetrical in $x$ and $y$. But how would I know it beforehand without deriving the second case? Isn't it possible that the second identity that I derive is a different one from first one?? $\endgroup$ – Richard Jun 3 at 15:37
  • $\begingroup$ I mean, you see that you can exchange $x$ and $y$. One way to look at it is: The function $\text{max}(x,y)$ outputs $x$ if $x\geq y$ and outputs $y$ if $y \geq x$, so max($x,y$) = max($y,x$). Now if $x\geq y$ (i.e. the 1st coordinate is $\geq$ the 2nd coordinate), we've shown that max($x,y$) = $x$ = RHS ("RHS" means the right hand side of the formula). If $y \geq x$, then max($x,y$) = max($y,x$) = $\frac{y+x+|x-y|}{2}$ = RHS, where the 2nd equality holds because the argument just involves switching the roles of $x$ and $y$, and the 3rd equality holds since the RHS is symmetric in $x$ and $y$. $\endgroup$ – twosigma Jun 3 at 20:59
  • $\begingroup$ But you raise a good point. In general, it may not be obvious why a symmetry argument really holds. In which case it is probably better to just check. $\endgroup$ – twosigma Jun 3 at 21:00

Geometrically, suppose that $p$ and $q$ lie on real $x$ axis then,
max$(p, q)$= middle point + half the distance between $(p, 0)$ and $(q, 0)$
$= \frac{p+q} {2} + \frac{|p-q|} {2}$

| cite | improve this answer | |

A quicker way to the proof would be to show LHS=RHS. If $x\geq y,$ then LHS$=x$ and $|y-x|=-(y-x)=x-y$ which gives $$\text{RHS }=\frac{x+y+(x-y)}{2}=\frac{x+x}{2}=x.$$

The case $y> x$ is similar.

| cite | improve this answer | |

Your proof is ok.


1) Let $y\ge x$:

Then $\max(x,y)=y$ and

$\dfrac{y+x+|y-x|}{2}=2y/2=y$, since $|y-x|=y-x$.

2) Let $y<x$ :

Then $\max(x,y)=x$ and

$\dfrac{y+x+|y-x|}{2}=x$ since $|y-x|=x-y$.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.