# Proofs of max and min formulas for 2 numbers

1. Jun 8, 2009

### nike5

1. The problem statement, all variables and given/known data
The maximum of 2 numbers x and y is denoted by max(x,y) and the minimum of 2 numbers
x and y is denoted by min(x,y). Prove that max(x,y) = (x + y + l y - x l) / 2
and min(x,y) = (x + y - ly - xl ) / 2.

2. Relevant equations

3. The attempt at a solution
Theorem. max(x,y) = (x + y + l y - x l) / 2
Proof. Let x and y be arbitrary real numbers. Then the midpoint between x and y is represented by (a + b) / 2. Therefore, (a + b ) / 2 is l y - x l / 2 numbers less than
max(x, y). Then adding l y - x l / 2 to (a + b ) / 2 yields ( x + y + l y - x l / 2 = max(x, y).

Theorem. min( x, y) = (x + y - l y - x l) / 2
Proof. Let x and y be arbitrary real numbers. Then the midpoint between x and y is represented by (a + b ) /2 . Therefore, (a + b) /2 is l y - x l) / 2 greater than min(x, y). Then subtracting l y - x l) / 2 from (a + b ) / 2 yields (x + y - l y - x l) / 2 = min( x,y).

Is the reasoning in these proofs too informal? Should I instead use the trichotomy law and prove the formulas by the three cases

2. Jun 8, 2009

### tiny-tim

Hi nike5!

(you should be able to find a | on your keyboard somewhere near the " )

3. Jun 8, 2009

### Staff: Mentor

And you should get rid of the a and b. You're given x and y, so use them instead.

4. Jun 8, 2009

### nike5

Proof take 2
Theorem. max (x, y) = (x + y + |y - x|) / 2
Proof. Let x and y be arbitrary real numbers. We will consider three cases.
Case 1. x = y. Then max ( x, y) = x = y = ( x + y) / 2 = [(x + y) / 2] + 0
= [(x + y) / 2] + ( 0 = y-x) = [(x + y) / 2] + ( |y - x|) = [(x + y) / 2] + ( |y - x|/ 2)
= (x + y + |y - x |) / 2.
Case 2. x < y. Adding (-x) to both sides of x < y we get (y-x) > 0.
Then max (x, y) = y = (2y) / 2 = (y + y) / 2 = ( y + y + x + (-x) / 2 = (x + y + y - x) / 2
Hence, since y- x > 0, ( x + y + |y - x|) / 2.
Case 3. x > y. Then max (x, y) = x = (2x) / 2 = (x + x) /2 = ( x + x + y + (-y)) / 2
= ( x + y + (-y) + x) / 2. Adding (- x) to both sides of x > y we get ( y - x) < 0. Then, by the
definition of absolute value, |y - x| = (- y) + x. Substituting |y - x| for ( -y) + x in
( x + y + (-y) + x) / 2 we get max ( x,y) = x = ( x + y + |y - x|) / 2.
Thus, since this covers all cases for every pair of real numbers x and y, we can conclude that max (x,y) = (x + y + |y - x|) / 2. QED

Better?

5. Jun 8, 2009

### tiny-tim

Yes!

But you can cut out a lot of it …

for example:

Case 1. x = y. Then max ( x, y) = x

and (x + y + |y - x |) / 2 = (x + x + 0)/2 = x

(and similarly for Cases 2 and 3)

6. Jun 8, 2009

### nike5

Thanks for the help Tim