How to minimize $(x-a)^2+(y-b)^2$ subject to $ \sqrt{a}+\sqrt{b}=\sqrt{2}$? Let $x,y$ be positive real numbers satisfying $xy \le \frac{1}{4}$.

I am trying to find
$$ \min_{\sqrt{a}+\sqrt{b}=\sqrt{2}}(x-a)^2+(y-b)^2$$

as a function of $x$ and $y$.

Is there any way to do that analytically?

Edit:

Is there a way to use a computer for this? I tried running Mathematica, but it never finishes the computation...

Lagrange’s multipliers method gives

$$
(a-x)=\frac{\lambda}{\sqrt a}\\ (b-y)=\frac{\lambda}{\sqrt b}.
$$

In particular,
$$ (a-x)=\sqrt{\frac{b}{a}}\cdot(y-b).$$

I tried various ways to proceed but got stuck.
With $a:=2(\frac12+t)^2,b:=2(\frac12-t)^2$ we minimize

$$(x-2(\tfrac12+t)^2)^2+(y-2(\tfrac12-t)^2)^2.$$

By differentiating on $t$ we get (after simplification)

$$8t^3+2(3-x-y)t+y-x=0.$$

This is a general (depressed) cubic equation, and there is no hope for a nice solution.



Note that $\sqrt a+\sqrt b=1$ describes an arc of parabola (the axis is the first bissector), and you are looking for the shortest distance between the point $(x,y)$ and this arc.
So we want to minimize $\left(\frac1{ a}+\frac1{ b}\right)\lambda^2$.
If $ab\le \frac14$, we can of course take $\lambda=0$, i.e., $x=a$, $y=b$ and achieve the minimum value $0$.
So assume $ab&gt;\frac14$.
From
$$ \frac14\ge xy=\left(a-\frac\lambda{\sqrt a}\right)\left(b-\frac\lambda{\sqrt b}\right)=ab-\left(\sqrt{\frac ab}+\sqrt{\frac ba}\right)\lambda+\frac{\lambda^2}{\sqrt{ab}},$$
we read off that we shold take the smaller of the two (necessarily positive) roots of the quadratic
$$ X^2-\left(a+b\right)X+\left(ab-\frac14\right)\sqrt {ab},$$
i.e.,
$$\lambda=\frac{a+b-\sqrt{a^2+b^2+2ab-4ab\sqrt{ab}+\sqrt{ab}}}2=\frac{a+b-\sqrt{(a-b)^2+(2\sqrt {ab}-\sqrt[4]{ab})^2}}2 $$