# How to find the minimum/maximum distance of a point from elipse

I have the point $(1,-1)$

and the ellipse $$x^2/9 + y^2/5 = 1$$

How to find the minimum and maximum distance of the point from the ellipse ?

from exploring the ellipse I know that $$a = 3$$ , $$b =\sqrt{5}$$ $$c = \sqrt{a^2-b^2} =\sqrt{9-5} = \sqrt{4}=2$$

the eccentricity of the ellipse is $$e=c/a = 2/3$$ the center is $(0,0)$ and the guides are $$x=3,~~x=-3,~~y=\sqrt{5},~~y=-\sqrt{5}$$

the focus points are : $(2,0)$ and $(-2,0)$

how from all of that do I find the requested in the question?

-

Using $Mathematica$, I have plotted the solution, which corresponds to roots of a quartic equation, which is why I am only going to show you a picture and a numerical approximation of the coordinates, which are $(1.38065, -1.98519)$, and $(-2.84987, 0.698515)$.

-
I cross-referenced your values with the zeros of my equation above. Everything checks out. Cool cool cool. – Kaj Hansen Jun 10 '14 at 6:06
@heropup so the question requests me to find the lengths of the red and green lines ? – Lena Bru Jun 10 '14 at 7:57
The minimum and maximum distances are given by the square roots of the two distinct real roots of the quartic $$4 x^4-136 x^3+1465 x^2-5778 x+4805.$$ These are approximately $1.0561749624077723904$ and $4.2079002058083894257$. – heropup Jun 10 '14 at 8:12
I actually wanted to know how you got to that equation – Lena Bru Jun 10 '14 at 10:11

The ellipse can be parametrized as follows: $\alpha(t) = \langle 3\cos(t), \sqrt{5}\sin(t)\rangle$ such that $0 \leq t \leq 2\pi$.

From here, note that finding the points that minimize and maximize the distance will be the same points that minimize/maximize the square of the distance. With this trick, we can eliminate some yucky square roots. Applying the Pythagorean theorem, we can define a function $f$ that represents the square of the distance from $(1, -1)$ to an arbitrary point on the ellipse:

$$f(t) = \Big(1 - 3\cos(t)\Big)^2 + \Big(-1 - \sqrt{5}\sin(t)\Big)^2$$

Computing the derivative of this function, we get:

$$f'(t) = 2\cos(t)\Big(\sqrt{5} - 4\sin(t)\Big) + 6\sin(t)$$

The derivative has $2$ zeros on the interval $[0, 2\pi]$. Those should be the $t$-values that minimize and maximize the distance from your point.

-
To find the lengths of the red/green lines in heropup's graphics, simply plug your zeros back into $f(t)$ and take the square root of the values. – Kaj Hansen Jun 10 '14 at 8:26

One way to do it (the most straightforward way) is to use conditional maxima and minima of a function in two variables using Lagrange multipliers.

i.e do this, take a general point on the ellipse as P(x,y) and given point as A(-1,1) f(x,y) = (square of distance between P and A) Obviously when f is maximum, so is the distance and the same with the minimum. Now write a condition (i.e the equation of the ellipse in implicit form)

Now construct this new function F(x,y,L)=(square of distance)+L(implicit equation of ellipse) Now take 3 partial derivatives with respect to x, y and L, equate them to zero and solve for x and y (L being a parameter now) Then using those, substitute for x and y in your distance function and you're done.

(A slightly better way to do this is to find out the normal to the ellipse passing through (-1,1) but finding the maximum with geometric methods isn't easy.)

-

The lack of symmetry in the geometric arrangement doesn't work in our favor, but fortunately the coefficients in the equations are only unpleasant to work with near the very end. As indicated by Padmanabha P Simha, we can use the Lagrange-multiplier method to aid in starting our work. We can extremize the "distance-squared" function, as Kaj Hansen observes, since the distance from $\ (1, \ 1) \$ to a point $\ (X, \ Y) \$ on the ellipse can only be non-negative. We will derive the constraint function from the equation for the ellipse as

$$\frac{x^2}{9} \ + \ \frac{y^2}{5} \ = \ 1 \ \ \rightarrow \ \ g(x,y) \ = \ 5x^2 \ + \ 9y^2 \ - \ 45 \ \ .$$

For the distance-squared function $\ f(x,y) \ = \ (x - 1)^2 \ + \ (y + 1)^2 \$ , the Lagrange equations are

$$\frac{\partial f}{\partial x} \ = \ \lambda \ \cdot \ \frac{\partial g}{\partial x} \ \ \Rightarrow \ \ 2 \ (x - 1) \ = \ \lambda \ \cdot \ 10x \ \ ,$$ $$\frac{\partial f}{\partial y} \ = \ \lambda \ \cdot \ \frac{\partial g}{\partial y} \ \ \Rightarrow \ \ 2 \ (y + 1) \ = \ \lambda \ \cdot \ 18y \ \ .$$

The result for the multiplier is $\ \lambda \ = \ \frac{1}{5} \ \frac{x - 1}{x} \ = \ \frac{1}{9} \ \frac{y + 1}{y} \$ . (We will make use of this relation shortly.)

Alternatively, we can show (for instance, by applying Lagrange multipliers) that the segments from a point external to a curve to an extremal point of the curve are perpendicular (normal) to the curve. If we differentiate the equation for the ellipse implicitly with respect to $\ x \$ , we obtain

$$\frac{d}{dx} \ [ \ 5x^2 \ + \ 9y^2 \ ] \ = \ \frac{d}{dx} \ [45] \ \ \Rightarrow \ \ \frac{dy}{dx} \ = \ - \frac{5}{9} \ \frac{x}{y} \ \ ,$$

giving us the slope of a tangent line to a point on the ellipse. The slope of a normal line at that point is then $\ \frac{9}{5} \ \frac{y}{x} \$ . The line segment from $\ ( 1, \ 1) \$ to that point has a slope of $\ \frac{y - (-1)}{x - 1} \$ , so we find $\ \frac{y + 1}{x - 1} \ = \ \frac{9}{5} \ \frac{y}{x} \$ , which is equivalent to our Lagrange result (since this is what the method locates for us, as nicely illustrated by heropup's tangent circles).

We can re-arrange this equation as $\ y \ = \ \frac{5x}{4x - 9} \$ , which is a hyperbola. Upon graphing this along with our ellipse, we see that the two curves intersect where the local normals correspond to the lines also passing through $\ ( 1, \ 1) \$; the added rays indicate those normal lines.

We need to locate those intersections, so we may insert our expression for $\ y \$ into the ellipse equation to produce

$$5x^2 \ + \ 9 \ \left( \ \frac{5x}{4x - 9} \ \right)^2 \ - \ 45 \ = \ 0 \ \ \Rightarrow \ \ x^2 \ - \ 9 \ + \ \frac{9 \cdot 5x^2}{(4x - 9)^2} \ = \ 0$$

$$\Rightarrow \ \ \frac{(x^2 - 9)(4x - 9)^2 \ + \ 45x^2}{(4x - 9)^2} \ = \ 0 \ \ .$$

Since $\ 4x - 9 \ = \ 0 \$ is not in the domain of the rational function for $\ y \$ , we can simply solve for the values of $\ x \$ at which the numerator of the left-hand-side ratio is zero. Multiplying out the factors and simplifying leaves us to solve the quartic equation $\ 16x^4 \ - \ 72x^3 \ - \ 18x^2 \ + \ 648x \ - \ 729 \ = \ 0 \$ , which I left to WolframAlpha (the exact values for the two real and two complex conjugate solutions are rather horrifying). The closest and most distant points on the ellipse to $\ (1, \ -1) \$ and the minimal and maximal distances are then as given in heropup's answer and comment.

-

Nice visualization is given by heropup's post.

Find equation to a circle with known center and with red line length as a yet unknown radius $u$.

To find tangent points, solve for either x or y ( only half solution required) between ellipse and red line circle.

Equate discriminant to zero as the two roots coincide. Resulting condition is adequate to find both the tangent points.

-