# Prove the formula for the maximum of two numbers

1. Sep 16, 2009

### nietzsche

1. The problem statement, all variables and given/known data

The maximum of two numbers x and y is denoted by max(x,y). Thus max(-1,3) = max (3,3) = 3. Prove that:

$$\mathrm{max}(x,y) = \frac{x+y+|y-x|}{2}$$

2. Relevant equations

N/A

3. The attempt at a solution

I have no idea where to begin. I've thought about it for a long time, I swear! Any hints on how to get started?

2. Sep 16, 2009

### Brian-san

You'll need to consider two cases: x>y and y>x. Then use that with the definition of absolute value. That should show the right results.

3. Sep 16, 2009

### nietzsche

Here's an attempt:

Assume x > y .

\begin{align*} \mathrm{max}(x,y) &= \frac{x+y+x-y}{2}\\ \mathrm{max}(x,y) &= \frac{x+y+|x-y|}{2}\\ \mathrm{max}(x,y) &= \frac{x+y+|y-x|}{2} \end{align*}

But I haven't proved it yet...

4. Sep 16, 2009

### nietzsche

Okay, so I'm on the right track with that last post.

Assume y > x .
\begin{align*} \mathrm{max}(x,y) &= \frac{x+y-x+y}{2}\\ &= \frac{x+y+|y-x|}{2} \end{align*}

5. Sep 16, 2009

### nietzsche

So is that a sufficient proof? Because it could just as well be

$$\mathrm{max}(x,y) = \frac{x+y+|x-y|}{2}$$

couldn't it?

6. Sep 16, 2009

### Brian-san

With each case, you can show that the formula leaves you with one value x, or y, that should be enough for the proof.

7. Sep 16, 2009

### nietzsche

Ah, thank you very much.

8. Sep 16, 2009

### nietzsche

(1) Assume x > y .

\begin{align*} \mathrm{max}(x,y) &= \frac{x+y+|y-x|}{2}\\ &= \frac{x+y+(x-y)}{2}\\ &= \frac{2x}{2}\\ &= x \end{align*}

(2) Now assume y > x .

\begin{align*} \mathrm{max}(x,y) &= \frac{x+y+|y-x|}{2}\\ &= \frac{x+y+(y-x)}{2}\\ &= \frac{2y}{2}\\ &= y \end{align*}

Therefore:
$$\mathrm{max}(x,y) &= \frac{x+y+|y-x|}{2}$$

is true for all values of x,y provided x,y are real numbers.

(Although I'm still not thoroughly convinced that it's sufficient...)

9. Sep 16, 2009

### Brian-san

Since x and y are arbitrary real numbers, I don't see why it wouldn't be considered a strong enough proof. You can make an argument about how you come to that particular formula, but I don't think it's necessary.

10. Sep 16, 2009

### ehild

There is the third possibility that y=x. Include and your proof is complete.

ehild

11. Sep 17, 2009

### nietzsche

Thanks very much.

12. Sep 18, 2009

### emyt

you're reading from the spivak textbook are you? your post on x^2 + xy + y^2 > 0 was also an exercise from the textbook

13. Sep 18, 2009

### nietzsche

yes i am. it's such an awful textbook, it gives practically no examples.

or maybe i should say that it's a textbook that require a bit more thinking...