Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following representation: enter image description here - line pass through the centers of the circles

I have to find the coordinates of the points of intersection of the line with circles (4 points). From these 4 points I have to choose 2 points , so that the distance between them to be minimal .

If I denote the coordinates of the center of the circle with $x_a,y_a$ (respectively ,$x_b,y_b$) and radius with $r_a$ , $(r_b)$ I have the following:

$(x+x_a)^2+(y+y_a)^2=r_a^2$ (circle A)

$(x+x_b)^2+(y+y_b)^2=r_b^2$(circle B)

$(x-x_a)/(x_b-x_a)=(y-y_a)/(y_b-y_a) $(line)

Computing the system with WolframAlpha I got some bulky answers.

Is there any trick to ease the solving of the system ? Thanks in advance.

share|cite|improve this question
I'm not sure I understand your question; there seem to be only 2 points of intersection between the circles and the line. – recursive recursion Mar 10 '14 at 19:25
up vote 1 down vote accepted

You can approach this I think quite simply using just vectors. You are given $x_a$, $y_a$, and $r_a$, as well as $x_b$, $y_b$ and $r_b$. Let $a = \begin{bmatrix} x_a \\ y_a \end{bmatrix}$, and similarly $b = \begin{bmatrix} x_b \\ y_b \end{bmatrix}$. The unit vector from $A$ toward $B$ is given by $$ v_{ab} = \frac{b-a}{|b-a|} $$ Then your four points are simply $$ a \pm r_a v_{ab} $$ and $$ b \pm r_b v_{ab} $$

share|cite|improve this answer
Brilliant solution , thank you very much ! – Liviu Solcovenco Mar 10 '14 at 20:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.