Point $A$ is located outside of a circle centered at $C$ and with radius $r$. Point $B$ is given point inside the circle. How to calculate $d$, the length of line segment between $B$ and circumference on the line $\overline{AB}$. Would there be a solution regardless of where $B$ is inside the circle?

Update: given to the problem is coordinates $A$, $B$ and $r$. I will need to extend the same problem to 3D geometry with a sphere and 3D coordinates. I would appreciate any help. example

  • $\begingroup$ What do you mean by "calculate", what is given in the problem? Why couldn't you just draw AB, take the intersection with the circle and calculate the distance? $\endgroup$
    – radekzak
    Commented Jan 29, 2021 at 21:08
  • 1
    $\begingroup$ Are you looking for a formula in terms of the coordinates of A, B, C, and the radius r? $\endgroup$
    – user694818
    Commented Jan 29, 2021 at 21:09
  • $\begingroup$ @MatthewDaly Yes I am trying to find a closed form solution (formula) in terms of given coordinates $A(x,y)$, $B(x,y)$ and $r$. I next need to extend the same solution to sphere and 3D coordinates. $\endgroup$
    – fhm
    Commented Jan 29, 2021 at 21:36

1 Answer 1


A method for you to use.

Yes there is always a solution. To find it you can do the following, where the centre of the circle is taken as the origin.

You can find the equation of the line $AB$ in the form $y=mx+c$.

Then the point $P(x,y)$ where the line crosses the circle satisfies the equation $$ x^2+(mx+c)^2=r^2.$$

Solve this equation for $x$ and then find $y$ from $y=mx+c$. There will be two points, choose the one on the same side of the circle as $A$.

Finally calculate the distance $BP$.

  • $\begingroup$ Thanks, would it be exactly the same if the 2D line and circle equations get converted to 3D coordinate ? I mean does the logic hold on a line go through a sphere ? $\endgroup$
    – fhm
    Commented Jan 31, 2021 at 18:18
  • $\begingroup$ The logic is the same. If you use the form of the equation of the line which has a parameter, t say, e.g. $x=4t+5,y=6t-8,z=9t$, then the $r^2$ equation can be solved for $t$ etc. $\endgroup$
    – user502266
    Commented Jan 31, 2021 at 18:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .