## Shortest Distance to Ellipse from Point,

## Shortest Distance to Ellipse from Point,

(OP)

Shortest Distance to Ellipse from Point,

Or: What is the Line Perpendicular to the Ellipse?

What is a good method to determine the shortest distance from a point to an Ellipse? This is similar to finding the line through a given point that is perpendicular to an ellipse.

To make it simple, I have the ellipse centered at the origin, (0,0), and the major axis along x. Also the point is always in quadrant I, and is always outside the ellipse.

Thanks for your help,

Harry

Or: What is the Line Perpendicular to the Ellipse?

What is a good method to determine the shortest distance from a point to an Ellipse? This is similar to finding the line through a given point that is perpendicular to an ellipse.

To make it simple, I have the ellipse centered at the origin, (0,0), and the major axis along x. Also the point is always in quadrant I, and is always outside the ellipse.

Thanks for your help,

Harry

## RE: Shortest Distance to Ellipse from Point,

I tried to calculate the distance by creating the equation for the distance between two points, where one point (outside of the ellipse) has known and constant x,y and the second one has coordinates taken from the equation of the ellipse. Then I calculated first derivative of that equation - and get lost, because the formula was too complicated (I wanted to set it = zero to get the minimum of that function and calculate the coordinate).

I mentioned the problem to my friend, a VERY good mathematician and he solved it (slightly different way).

His solution is rather long to show it here, but I have Word *.doc file with full description, which I can share with anybody who posts his e-mail here.

## RE: Shortest Distance to Ellipse from Point,

I tried doing the same technique you did and got bogged down trying to solve three equations with four unknowns. I wasn't sure if I had done the math incorrectly, or if I needed to try to find another equation to use, but I would be interested in seeing your friends analysis. I'm at Brian.S.Lewis(at)aero.org if you don't mind sending it.

Thanks,

Brian

Brian Lewis

The Aerospace Corporation

http://www.aero.org/

## RE: Shortest Distance to Ellipse from Point,

I too have bogged down trying to solve the fourth order polynomial equations. I would be interested in seeing your friends analysis. I'm at american_flyer(at)juno.com .

Thanks,

Harry

## RE: Shortest Distance to Ellipse from Point,

http://www.magic-software.com/Documentation/DistancePointToEllipse2.pdf

## RE: Shortest Distance to Ellipse from Point,

maybe it's late, as someone said before me, but, somebody can find my (possible) solution useful. it's a geometrical one - if you have a point A whose shortest distance from an ellipse you want to find, being inside or outside of the ellipse area, you can draw a circle with the centre in that point with the radio slightly bigger of the expected shortest distance. the two points of intersection, let's call them B anc C, between the circle and the ellipse are the first and end point of a line. then, you draw a line from the point A to the middle point of the line BC which intersects the ellipse in the point D. the distance AD can be considered the shortest one. there are just two things: 1. the smallest the lenght BC is the more accurate is the solution; 2. the points B and C should be searched by some method already developed (like those found on magic-software.com)

i hope you find it correct and useful,

bye

voya

## RE: Shortest Distance to Ellipse from Point,

x^2/a^2 + y^2/b^2 = 1, then the parametric form is:

x=asinU; y=bcosU ==> dx/dU=acosU; dy/dU=-bsinU

Then, the distance can be expressed as:

s^2 = (x-xp)^2 + (y-yp)^2

In order to have the shortest distance s, it is necessary to fulfil the condition:

ds/dU = 0

so: 2s*ds/dU = 0 = (x-xp)dx/dU + (y-yp)dy/dU

Substituting x, dx/dU, y, dy/dU we obtain an equation that is arranged and finally transformed to an equation of following form:

At^4 + Bt^3 + Ct^2 + Dt + E = 0 (t=sinU)

which leeds us to fur solutions of which only one corresponds to the real one. Then, it's easy to search:

t -> U -> x,y -> s

Bye

## RE: Shortest Distance to Ellipse from Point,

"s*ds/dU = 0 = (x-xp)dx/dU + (y-yp)dy/dU" (You missed out the 2's when differentiating the RHS). But just like everyone else, you end up having to solve a quartric, either numerically or closed form - which is essentially all that the problem amounts to.

## RE: Shortest Distance to Ellipse from Point,

http://mathforum.org/library/drmath/view/52082.html

Unfortunately, this "Dr. Rob" from Drexel seems to be just as chicken as the rest of us, although I don't know why he would say there

maybe a general formula. On the contrary, theremustbe a general formula, (ie a "closed form" solution), since there is a standard procedure for solving a quartic and it is just a matter of slogging through it. See for example the following :http://www.1728.com/quartic2.htm

http://www.sosmath.com/algebra/factor/fac12/fac12.html

Or even this from Dr. Rob himself (!) :

http://mathforum.org/library/drmath/view/52874.html

Of course, it may be that "Dr. Rob" is actually several different people, and "the left hand doesn't know what the right hand is doing".

Why an engineer in this computer era would actually need to do this - except of course for the fun of it - is beyond me . A numerical solution to any desired degree of precision is straightforward.