Minimizing distance between an ellipse and a point

calculusconic sectionsoptimizationquadratics

Problem

An ellipse has the formula:

$$\frac{x^2}{9} + \frac{y^2}{4} = 1$$

What is the shortest distance from the ellipse to the point $P = (a,0)?$

Attempted solution:

I have previously solved the same problem with P = (1,0) and P = (2,0). For P = (1,0), the minimum where x = 1.8 and y = 1.6 and a distance of $\frac{4\sqrt{5}}{5}$.

For P = (2,0), the local minimum was larger than the distance between P and the ellipse at y = 0., which was equal to 1. So there is some threshold for $a$ for which the local minimum is not truly the smallest distance.

Basic strategy:

1) Solve the ellipse formula for y and put that into the distance formula for the distance between the ellipse and the point (Pythagorean theorem).

2) Take the derivative.

3) Set the derivative to 0 and solve for x.

4) Use the ellipse formula to solve for y.

5) Put in x and y in the distance formula and get the distance.

However, at some threshold the distance between the point and the ellipse where y = 0 is even shorter. So the shortest distance will have one of two cases, one between 0 and just below the threshold and one for the threshold value and above.

I figured that I could apply the same method I did for the previous cases of P = (1,0) and P = (2,0) and see if I can find some way to find this threshold.

Use the ellipse formula and solve for y:

$$\frac{x^2}{9} + \frac{y^2}{4} = 1 \Rightarrow y = \sqrt{4\Big(1-\frac{x^2}{9}\Big)}$$

Write down distance formula

$$D = \sqrt{(x-a)^2 + y^2}$$

Put in y from the ellipse formula

$$D = \sqrt{(x-a)^2 + \Big(\sqrt{4\Big(1-\frac{x^2}{9}\Big)}\Big)^2}$$

Simplify:

$$D = \sqrt{\frac{5}{9} \cdot x^2 – 2ax +4}$$

Take the derivative:

$$D' = \frac{\frac{10}{9}x-2a}{2\sqrt{\frac{5}{9}x^2 – 2ax +4}}$$

Set the derivative to zero and solve for x:

$$\frac{10}{18}x -a = 0 \Rightarrow x = 1.8a$$

Use ellipse function and solve for y:

$$y = \sqrt{4\Big(1-\frac{(1.8a)^2}{9}\Big)} = a\sqrt{0.76}$$

Putting in x and y to the distance formula

$$D = \sqrt{(1.8a-a)^2 + (a\sqrt{0.76})^2} = \sqrt{0.64a^2 + 0.76a^2} = \sqrt{1.4a^2} = a\sqrt{1.4}$$

…but I feel like I am not getting anywhere. This is not the correct distance and the threshold is nowhere to be seen.

Expected answer is:

$$\sqrt{4-\frac{4}{5}a^2}$$

for $0 < a < \frac{5}{3}$ and

$$|a-3|$$

if $a \geq \frac{5}{3}$

Best Answer

The key is to remember $-3\leq x\leq 3.$

It is much easier, without even using calculus, to minimize $D^2$ than the minimize $D.$

We have that the distance $D$ satisfying:

$$\begin{align}D^2&=(x-a)^2+y^2\\ &=x^2-2ax+a^2+4\left(1-\frac{x^2}{9}\right)\\ &=\frac{5}{9}x^2-2ax+a^2+4\\ &=\frac{5}{9}\left(x-\frac{9}{5}a\right)^2-\frac{9}{5}a^2+a^2+4\tag{1} \\ &=\frac{5}{9}\left(x-\frac{9}{5}a\right)^2+4-\frac{4a^2}{5} \end{align}$$

the line (1) by completing the square.

We want the minimum value of $D^2$ for $x\in[-3,3].$

Now, the right side is is minimized when $x=\frac{9}{5}a,$ but $\frac{9}{5}a\in[-3,3]$ if and only if $|a|\leq \frac{5}{3}.$

If $|a|>\frac{5}{3}$ then minimum is when $x=\pm 3$, and $y=0$ so the minimum $D=|3-|a||.$

Otherwise, if $|a|\leq \frac{5}{3},$ then $x=\frac{9}{5}a$ gives the minimum $D^2=4-\frac{4a^2}{5}$ or $$D=2\sqrt{1-\frac{a^2}{5}}$$


Another approach

If $(x,y)$ is a local minimum-maximum distance point to $(a,0)$ then the tangent angle the curve must be perpendicular to $(x-a,y).$

But the tangent at $(x,y)$ is $(x',y')=(9y,-4x).$ So:

$$0=(x',y')\cdot (x-a,y)=9y(x-a)-4xy = y(5x-9a)$$

So either $y=0,$ then $x=\pm 3.$ Or $5x-9a=0.$ But that is only possible if $\frac{9a}{5}\in[-3,3].$

The maximum $D$ is given when $x=\pm 3$ with the opposite sign of $a.$

The rest is the same. If $\frac{9}{5}a\in[-3,3],$ you get $x=\frac{9}{5}a$ yields the minimum, otherwise $x=\operatorname{sgn}(a)\cdot 3$ yields the minimum.


More generally, if we use the curve $x^2+Cy^2=B^2$ for any $B,C$, $B>0,$ then the potential points nearest to $(a,0)$ when $y=0,x=\pm B$ and when $(C-1)x-Ca=0.$

(In your case, $B=2,C=\frac{9}{4}.)$

If $C=1,$ you have a circle, and if $a\neq 0,$ you get $(\pm B,0)$ as your potential points. If $C=1,a=0,$ then $(a,0)$ is the center of the circle and the distance is constant for all $(x,y)$ on the circle.

If $C=0$ then your "curve" is $x\pm B,$ and we get $(C-1)x-Ca=0$ when $x=0,$ which is not in the valid domain for $x.$

If $C\neq 0,1,$ you get the additional (optional) case $x=\frac{C}{C-1}a.$

If $0<C<1,$ the case $x=\frac{C}{C-1}a$ is the opposite sign of $a,$ so $(x,y)$ is further from $(a,0)$ than $(-x,y),$ so that cases in not a minimum. [This case is one of an ellipse oblong in the $y$ direction, so this value is a local maximum.

If $C<0,$ then we include the optional case when $|a|\geq B\frac{C-1}{C}.$

If $C>1$, you include the optional case when $|a|\leq B\frac{C-1}{C}.$


For example, if $B=1,C=-1,$ then the closest point to $(a,0)$ in $x^2-y^2=1$ has distance:

$$D=\begin{cases}||a|-1|&|a|\leq 2\\ \frac{1}{2}\sqrt{2a^2-4}&|a|>2\end{cases}$$ When $|a|>2,$ you have $x=\frac{a}{2},y=\pm\frac{1}{2}\sqrt{a^2-4}.$