# Is $y > 0$ enough of a condition to replace $\min (x-1/y)^2$ with $\min (xy - 1)^2$?

If we have a problem of choosing $x,y$ to minimize $(x-1/y)^2$ given some constraints, where one of those constraints is that $y > 0$, can we always solve this problem by instead minimizing $(xy - 1)^2$, with the constraints being the same?

My thinking is that if the goal is to pick $x,y$ so that $x \approx 1/y$, then that ought to be similar/same to picking $x,y$ so that $xy \approx 1$.

That's a very interesting question and the answer is no. The reason is that in the equation $$\left(x-\frac1y\right)^2=\frac1{y^2}\left(xy-1\right)^2$$ the factor $\frac1{y^2}$ can have a non-trivial effect.

For instance, if the constraints are that $\left(\matrix{x\\y}\right)$ has to lie in the set with two elements $$S=\left\lbrace v_1\left(\matrix{x=1000\\y=0.01}\right),v_2\left(\matrix{x=110\\y=0.1}\right)\right\rbrace$$

You will see that $(xy-1)^2$ is either $81$ or $100$, and the minimum is obtained for $v_1$.

But when you divide these values by $y^2$, $81$ becomes $810000$ whereas $100$ becomes only $10000$, so the minimum of $\left(x-\frac1y\right)^2$ is obtained for $v_2$.

Considering the change of variables

$$(x,y)\to(\eta,y)\ \ \mbox{with} \ \ \eta = xy$$

an with the contribution of a slack variable ($\epsilon$) we have the formulations

$$L_1(\eta,y,\lambda,\epsilon) = \frac{(\eta-1)^2}{y^2}+\lambda(y - \epsilon^2)\\ L_2(\eta,y,\lambda,\epsilon) = (\eta-1)^2+\lambda(y - \epsilon^2)$$

The stationary points conditions give

$$\nabla L_1 = \left\{\frac{2 (\eta -1)}{y^2},\lambda -\frac{2 (\eta -1)^2}{y^3},y-\epsilon ^2,-2 \epsilon \lambda \right\} = 0$$

and

$$\nabla L_2 = \left\{2 (\eta -1),\lambda ,y-\epsilon ^2,-2 \epsilon \lambda \right\} = 0$$

with the solutions

$$L_1 \to \left\{\eta = 1,\lambda = 0,\epsilon = \sqrt{y}\right\}$$

and

$$L_2\to \left\{\eta = 1,y= \epsilon ^2,\lambda = 0\right\}$$

The result for $L_1$ assures us that all the set of points $x y = 1, y > 0$ are solutions while the second result for $L_2$ assures us that the minimum point is also for $x y = 1, y > 0$ hence they are completely equivalent as far this example shows us.