Mathematical Programming

Minimum and Maximum

So, let's say you are writing a mathematical program, and you reason that

xyxy>1.x\ne y\Rightarrow\frac{x}{y}>1.

Right? The ratio must be more than one if they are not equal. But then, someone tells you, it's only true if

x>y.x>y.

Argh! There goes your wonderful conjecture. You could write that

xymax(x,y)min(x,y)>1.x\ne y\Rightarrow\frac{\max\left(x,y\right)}{\min\left(x,y\right)}>1.

But, those are non-standard functions!

Let's try to make a max\max function using only standard functions.

What we'll do is figure out whether xyx-y is positive or negative. Then, we'll return xx if it is positive and yy if it is negative.  To figure out whether it is positive or negative, we compute

isPositive(xy)=xyxy+12{+1,0}\text{isPositive}\left(x-y\right) = \frac{\frac{\left|x-y\right|}{x-y}+1}{2}\Rightarrow\left\{+\rightarrow1, -\rightarrow 0 \right\}

Okay, cool. Now, when the function returns positive, we want to return x.x. We can do that by multiplying by x:x:

max(x,y)=xxyxy+12{xx, y0}\max\left(x,y\right) = x\cdot\frac{\frac{\left|x-y\right|}{x-y}+1}{2}\Rightarrow\left\{x\rightarrow x,\ y\rightarrow0\right\}

Oh, but now we get 00 when the maximum is y!y! We can add the same function, but comparing against y:y:

max(x,y)=xxyxy+12+yxyyx+12{xx,yy}\max\left(x,y\right) = x\cdot\frac{\frac{\left|x-y\right|}{x-y}+1}{2}+y\cdot\frac{\frac{\left|x-y\right|}{y-x}+1}{2}\Rightarrow\left\{x\rightarrow x, y\rightarrow y\right\}

Great! Now we just need a minimum function. All we need to do is switch the outputs:

min(x,y)=yxyxy+12+xxyyx+12{xx, yy}\min\left(x,y\right) = y\cdot\frac{\frac{\left|x-y\right|}{x-y}+1}{2}+x\cdot\frac{\frac{\left|x-y\right|}{y-x}+1}{2}\Rightarrow\left\{x\rightarrow x,\ y\rightarrow y\right\}

Can you fix my conjecture for me now? Thanks!  

© 2022 YMath.io owned and operated by Saumya Singhal