# Find angle(s) of intersection between circle and line segment on circle

I have a circle (given a center and radius) and a line segment (given a coordinate for both points). The line segment passes through the circle and intersects with the circle in one or two points (one if the segment is tangential or if it ends inside the circle).

How can I find the angle or the two angles where the line segment intersects the circle, relative to the top of the circle?

Please provide an example. Unrelated to the diagram below, a set of points to use in an example are as follows: circle radius $1.5$ with center $(3, 4)$. Line segment from $(3, 3)$ to $(6, 7)$.

If it's easier, it's acceptable to find both points by treating the line segment as a line and ignoring a tangential intersection

I am trying to find the angle shown as ?° in the diagram below. The answer in this case is 57°

• What is the other point that you're using to define this angle? Yes, the angle in the image may be 57 degrees, but what is the significance of the other point that you're measuring from? What I'm saying is: the point seems arbitrary. So I could pick any point on the circle and have any angle that I want. – foobar1209 Mar 16 '14 at 23:40
• The point is just the top of the circle. It could be anything, but the top makes the most sense. – Keavon Mar 16 '14 at 23:41

Set the center of the circle to be $\left(0,0\right)$. Then the set of points on the circle are those such that $x^2+y^2=r^2$ and the set of points on the line segment are solutions to $y=mx+b$ from some $m$ and $b$ (these are easily found given the two endpoints of the line segment). Substituting, we have $$x^2+(mx+b)^2=r^2\Longleftrightarrow (m^2+1)x^2+2mbx+(b^2-r^2)=0$$ Then this is just a quadratic you can solve with the quadratic formula giving you $x$, and you can get $y$ by $y=mx+b$. However, this gives you two solutions; you must pick the right one (find which is between the two endpoint). Fortunately finding the angle after this is pretty easy: it's just simple trigonometry. If $(x,y)$ is the solution, $\tan^{-1}\left(\frac{y}{x}\right)$ gives you the angles measure counterclockwise from the $x$-axis. You asked for the angle from the $y$-axis, which is then $\frac{\pi}{2}-\tan^{-1}\left(\frac{y}{x}\right).$

A worked example

I'll work out the example you have given. We have radius $r=\frac{3}{2}$, center $\left(3,4\right)$ and a line segment from $(3,3)$ to $(6,7)$. First we'll move the center to $(0,0)$. We do this by subtracting $(3,4)$ from each point. This gives us the center (as desired) of $(0,0)$, and a line segment from $(0,-1)$ to $(3,3)$. Then the line between the two points is $y=\frac{4}{3}x-1$. The equation for the circle is $x^2+y^2=\frac{9}{4}$. Substituting the equation for the line in, we have $$x^2+\left(\frac{4}{3}x-1\right)^2=\frac{25}{9}x^2-\frac{8}{3}x+1=\frac{9}{4}$$ which gives the quadratic $$\frac{25}{9}x^2-\frac{8}{3}x-\frac{5}{4}=100x^2-96x-45=0$$ Then the quadratic equation gives $x=\frac{96\pm \sqrt{96^2+4\cdot 100\cdot 45}}{200}=-0.345,1.305$. We're going to want the solution with positive $x$, so $x=1.305$. Then $y=\frac{4}{3}(1.305)-1=0.740$. To find the desired angles, we merely take $90-\tan^{-1}\left(\frac{0.740}{1.305}\right)=90-29.56=60.44$. I'm not sure what the discrepancy between my answer and the one you provided is; it could be rounding errors, but it is more likely I just made a calculation error somewhere (please do point it out if you see it).

I know it seems like a lot, but the technique is relatively straight forward, the calculation is just some hard work. I hope this answer has shed some light on the process for you.

• You made no error. The example I provided is different from the diagram provided in the question. Since this is a detailed and easy to understand answer I will mark it as accepted, but wait a few days before awarding you the bounty. – Keavon Mar 17 '14 at 2:03
• Sounds good. Glad i could help :) – cderwin Mar 17 '14 at 2:26

Hint: First, for convenience - transform the circle's to $(0,0)$ and normalize (so the radius of the given circle is now 1). The circle's equation is $x^2+y^2=1$

Now, we are given $(x_1, y_1)$, $(x_2,y_2)$. Denote $f(x)=mx+n$, the line that accepts those two points.

Assuming intersection, $x^2+(mx+n)^2=1\Leftrightarrow x^2+m^2x^2+2mnx+n^2=1$

• Please provide an example with circle radius $1.5$ with center $(3,4)$ and line segment from $(3,3)$ to $(6,7)$. – Keavon Mar 17 '14 at 0:37
• First, transform to (0,0) and normalize, by the transofrmation T(x,y)=(x-3,y-4)/(1.5). Transform all the points with T and you'll get a new problem with the same answer you're looking for. After transforming, find the line and circle equations and continue from there. – Astro Nauft Mar 17 '14 at 7:45

Hint:

1. Find the equation of the circle and line. The circle should be easy, use the line slope and a point to find the equation.

2. Find the intersection. This is solving for either variable and then plugging it in to get coordinates.

3. Draw a right triangle using a diagonal radius to the intersection and a horizontal line. Based on what you know about slope and tangents, this should help you find an angle that is complementary to your angle.