# Minimize the sum of distances between two point and a circle

Let's $A$,$B$ and $O$ be random point in a plane, such that they are not colinear. Let's $c$ be a circle centered on $O$, such that points $A$ and $B$ are outside of it. Find a point $X$ that lies on the circle $c$ and the sum $AX + BX$ is minimal.

First I tried to minimize the function:

$$f(x,y) = \sqrt{(A.x - x)^2 + (A.y - y)^2} + \sqrt{(B.x - x)^2 + (B.y - y)^2}$$ with constraint $$g(x,y) = x^2 + y^2 - r^2 = 0$$

By moving $O$ to $(0,0)$ and do the same with $A$,$B$ so the relative distance will not change.

But these works when we know the coordinates of $A$,$B$ and the radius of the circle. Yet this isn't the right way because the problem is to construct that point.

Later I tried to approach using geometry.

The smallest distance from the point $A$ to the circle is the intersection of the circle $c$ and the ray $OA$, this is the same for $B$. Then we construct circles centered on $A$ and $B$ that are tangent to $c$. If the two circle intersect we'll get a common point for the both $A$ and $B$ and the distance will be minimal. Using computer I find the point X should be somewhere around the intercetion of the circle $c$ and the ray from $O$ to the new point.

Sometimes the optimal point differs just a bit and also this method fails when the two circles do not intersect each other

Consider a family of nested ellipses with foci at points A and B. Each such ellipse represents a set of locations on the plane such that the sum of distances to the foci is constant. As we increase the size of the ellipse it will eventually touch the circle; this is the solution we are looking for. It makes sense to choose the coordinates such that the two foci are at points (a,0) and (-a,0) where $a=|AB|/2$. Let the family of nested ellipses be represented by parameter h which is the length of its shorter semi-axis. Then the equation of such an ellipse is

$\frac{x^2}{l^2} + \frac{y^2}{h^2} = 1$

Here $l=l(h)$ is the longer semi-axis, which is found from the condition $2 \sqrt{a^2+h^2} = (l-a)+(l+a)$, so $l=\sqrt{h^2+a^2}$ and the ellipse equation is

$\frac{x^2}{h^2+a^2} + \frac{y^2}{h^2} = 1$

The circle is of course represented by

$(x-x_o)^2 + (y-y_o)^2 = c^2$

Now we have a system of two algebraic equations and the problem boils down to determining when they have a single solution which is the touch point. Note that there are two cases of touching - touching on the near side of the circle, and touching on the far side when the circle is inside of the ellipse. One can eliminate one of the variables from the equations which will convert the problem to a quartic equation in one variable; so a closed form solution can be found by a known formula. A certain value of parameter h will coalesce the two real roots into one, that's the condition of touching.

From the above considerations one can re-formulate the problem in purely geometrical terms: The point on the circle X minimizing the sum of distances |AX|+|BX| satisfies the condition that the line (OX) is the bisector of angle AXB. This formulation leads to an alternative approach to solving the problem which can be pursued algebraically, using trigonometric relations; but perhaps there is some clever geometric shortcut. An approximate solution can be found using geometric optics: Assume the circle is a convex mirror and find an image A' of point A. The image will be virtual (inside the circle), and the line A'B will intersect the circle at point X satisfying the reflection conditions and minimizing the sum of distances |AX|+|BX|. However this geometric optic solution will work only as long as the circle can be approximated by a parabola (paraxial approximation) which is satisfied in the limit of $\angle$AOB $\ll$ 1.

P.S. It looks like a general geometric optics solution (without approximations) is worked out in www.geometrictools.com/Documentation/SphereReflections.pdf‎ and it leads to a quartic equation.

• Good idea, but I don't need to find the point of tangency, I need to construct it. How can I construct ellipse that is tangent to circle $c$ and has foci at point $A$ and $B$? Aug 10 '13 at 10:46
• Also this calulcation doesn't work when segment $AB$ goes through the circle $c$ then the the optimal solution is when one arc of the ellipse touches the circle and the other goes through it. (The bigger semiaxe divides it in these two arcs) and I doubt that using this calculation we'll get that ellipse. Aug 10 '13 at 10:54
• Algebraic operations can be carried out geometrically, with a compass and straight edge. This would be a way to find the roots of the quartic equation. Aug 10 '13 at 14:44
• I found out that the ray $OX$ should bisects the angle $AXB$, but how can I construct that? Aug 11 '13 at 0:09
• Yes, I also thought about this, and I wrote a system of trigonometric relations expressing this condition. But as far as I can see this does not lead to anything short and simple. Maybe there is some theorem about bisectors that can provide a shortcut, not sure. Aug 11 '13 at 6:29