# Find the Minimum Value of |x|-|y|

#### anemone

##### MHB POTW Director
Staff member
If $$\displaystyle \log_4(x+2y)+\log_4(x-2y)=1$$, find the minimum value of $|x|-|y|$.

#### MarkFL

Staff member
My solution:

We are given the objective function:

$$\displaystyle f(x,y)=|x|-|y|$$

subject to the constraint:

$$\displaystyle \log_4(x+2y)+\log_4(x-2y)=1$$

which can be written as:

$$\displaystyle g(x,y)=x^2-4y^2-4=0$$

Using Lagrange multipliers, we obtain:

$$\displaystyle \frac{x}{|x|}=\lambda(2x)$$

$$\displaystyle -\frac{y}{|y|}=\lambda(-8y)$$

Observing that the critical point (0,0) is outside the domain of the constraint, we are left with:

$$\displaystyle \lambda=\frac{1}{2|x|}=\frac{1}{8|y|}\implies|x|=4|y|\implies x^2=16y^2$$

Substituting this into the constraint, we find:

$$\displaystyle 16y^2-4y^2=4$$

$$\displaystyle y^2=\frac{1}{3}$$

$$\displaystyle y=\pm\frac{1}{\sqrt{3}}\,\therefore\,x=\pm\frac{4}{\sqrt{3}}$$

Testing other point satisfying the constraint shows we have a minimum, hence:

$$\displaystyle f_{\min}=f\left(\pm\frac{4}{\sqrt{3}},\pm\frac{1}{\sqrt{3}} \right)=\frac{4}{\sqrt{3}}-\frac{1}{\sqrt{3}}=\frac{3}{\sqrt{3}}=\sqrt{3}$$

#### Opalg

##### MHB Oldtimer
Staff member
Geometric solution:
[GRAPH]lfj4gia57w[/GRAPH]​

We want to find the closest that the hyperbola $x^2-4y^2=4$ comes to one of the lines $y = \pm x$. This will occur at points on the hyperbola where the gradient is $\pm 1$ (as in the green line in the picture above). Differentiate the hyperbola equation to get $2x - 8yy' = 0$, and put $y'=\pm1$ to find that $x=\pm4y$. Substitute that into the hyperbola equation, getting $12y^2=4$, or $y = \pm1/\sqrt3$, $x = \pm4/\sqrt3$. Thus $|x| - |y| = 3/\sqrt3 = \sqrt3$.