Finding the point on $6x^2+y^2=262090$ that is nearest to the point $(1045,0)$

I know that to find the point on $6x^2+y^2=262090$ that is nearest to the point $(1045,0)$, we can try to minimize the squared distance $S=(x-1045)^2+262090-6x^2$. However, calculus tells us that this function does not have a minimum point (instead only a maximum point exists).

But if we try to minimize the distance function (without squaring) then we can find the minimum.

So, When exactly can we actually square the distance function to find the max/min point for distance problems?

• It does not have a minimum on $\Bbb R$, but it does in the relevant range of $x$ - specifically, the set $\{x\in\Bbb R\,:\, -\sqrt{262090}\le x\le\sqrt{262090}\}$. – user228113 Mar 28 '18 at 11:22
• Thanks a lot for that, that is exactly what I thought. But it is widely thought that to find the minimum distance, it suffices to just consider the squared distance function. This example, however, shows that it is in fact NOT SUFFICIENT. – Probability is wonderful Mar 28 '18 at 11:26
• It is sufficient. The problem is that you must apply calculus correctly. – user228113 Mar 28 '18 at 11:27
• So is it true that whenever we consider the squared distance function, we need to explicitly specify the range of every variable? – Probability is wonderful Mar 28 '18 at 11:29
• Just of the variable you are considering (in this case $x$). And of course, looking for zeros of the derivative is not sufficient. You need to evaluate the appropriate extremal points of the subintervals where the derivative is $> 0$ (which may include the boundary of the domain). – user228113 Mar 28 '18 at 11:30

There is nothing wrong with using the squared distance.

You converted the problem into a one-parameter minimization problem. You are looking for the minimum of a smooth function on the interval $[-\sqrt{262090/6},\sqrt{262090/6}]$. The minimum value is obtained at a zero of the derivative (a critical point) or at one of the endpoints. The function is a downward opening parabola, so you know that any critical point is a local maximum. Therefore you have to look at the endpoints.

Alternatively, you could have converted the problem into minimization over $y$. You can solve that $x=\pm\sqrt{(262090-y^2)/6}$. If you draw a picture, it becomes clear that the closest point must be in the right half of the ellipse. (If you don't believe in pictures, you can treat the two halves separately.) In this half $x>0$.

This leads to the squared distance being $$\begin{split} &(x-1045)^2+(y-0)^2 \\=& \frac16(262090-y^2)-2090\sqrt{(262090-y^2)/6}+1045^2+y^2 \\=& \frac56y^2-2090\sqrt{(262090-y^2)/6}+1045+262090/6. \end{split}$$ Now each term is at its smallest when $y=0$, so the minimum is at $y=0$. The corresponding value of $x$ is $\sqrt{262090/6}$ — the endpoint of the $x$-interval!

• I'm afraid the result you gave $x=\sqrt{262090}$ does not satisfy the equation given: $6x^2+y^2 = 6\cdot(\sqrt{262090})^2+0^2 = 1572540$ which does not equal the RHS... – CiaPan Mar 28 '18 at 11:53
• @CiaPan Good catch, thanks! I forgot to divide by some sixes. Does it make more sense now? – Joonas Ilmavirta Mar 28 '18 at 11:55
• Perfect answer! I just wonder why in so many textbooks when they calculate the min/max distances by considering the squared distance, they do not check the boundary points? – Probability is wonderful Mar 28 '18 at 12:25
• @Probabilityiswonderful Thanks! Why many sources are as sloppy as they are, focusing on computation instead of understanding, is beyond my understanding. Too many things are left implicit. (Did you know you have the privilege to vote up any questions and answers you like?) – Joonas Ilmavirta Mar 28 '18 at 12:28
• @Probabilityiswonderful Probably because in most textbooks' problems the domain is an open interval, bounded or not, hence no edge-cases exist to be tested. – CiaPan Mar 28 '18 at 12:29