Seydlitz
- 262
- 4
Homework Statement
The function max will return which number is the largest between the two parameters x and y. The function min will return the smallest number between the two. If the numbers are the same they will give out that same value.
Prove that
<br /> max(x,y) = \frac{x+y+|y-x|}{2}<br /> \\<br /> min(x,y) =\frac{x+y-|y-x|}{2}<br />
Homework Equations
None
The Attempt at a Solution
Suppose ##x=y=0##
<br /> max(0,0) = <br /> \\<br /> \frac{0+0+|0-0|}{2} = 0<br /> <br />
Suppose ##x = a+1## and ##y = a##
<br /> \begin{align*}<br /> max((a+1),a) &= \frac{(a+1)+a+|a-(a+1)|}{2}\\<br /> &=\frac{a+1+a+1}{2}\\<br /> &=\frac{2a+2}{2} \\<br /> &=(a+1) \\<br /> \end{align*}<br />
Where ##x>y##
The similar reasoning can be applied to the case where ##y>x## and to ##min(x,y)## function.
Is this done or enough? I'm not sure if this is already enough for the purpose, to prove a formula. To what extent should we go so that it's correct?
Thank You