Intersection of a circle and a line

We look at how many times a line meets the circle x2+y2=25x^2 + y^2 = 25, which has its center at the origin and radius 55. There are three cases: the line crosses at 2 points, touches at 1 point (tangent), or does not meet the circle at all.

There are two ways to tell them apart. One is to substitute the line into the circle equation and count the real solutions of the equation that results. The other is to compare the distance from the center to the line with the radius: if the distance is smaller than the radius there are 2 points, if it is exactly equal the line is tangent, and if it is larger there is no intersection.

Three horizontal lines are drawn on the graph. Putting y=3y = 3 into the circle gives x2+32=25x^2 + 3^2 = 25, that is x2=16x^2 = 16, so x=4,4x = 4, -4. The intersection points are therefore (4,3)(4, 3) and (4,3)(-4, 3). The distance from the center (0,0)(0, 0) to the line y=3y = 3 is 33, which is less than the radius 55, so the line cuts through the circle.

Next, y=5y = 5 gives x2+52=25x^2 + 5^2 = 25, that is x2=0x^2 = 0, whose only solution is x=0x = 0. The two intersection points have merged into one, which we call the line being tangent to the circle, and the point (0,5)(0, 5) is the point of tangency. The distance from the center is 55, exactly equal to the radius.

Finally, y=7y = 7 gives x2+72=25x^2 + 7^2 = 25, that is x2=24x^2 = -24. No real number squares to a negative value, so there is no real solution and no intersection. The distance from the center is 77, larger than the radius 55, so the line lies away from the circle.

If you slide a horizontal line upward, these three cases appear in turn: while the line passes through the inside of the circle there are two crossings, as it moves up the two crossings come closer, at the edge of the circle they merge into a single point where the line is tangent, and higher still the line leaves the circle and there is no crossing. You can also see it as the distance from the center growing until, past the radius 55, the crossings disappear.

In summary, writing dd for the distance from the center to the line and rr for the radius: d<rd < r gives 2 points, d=rd = r gives a tangent, and d>rd > r gives no intersection. The number of real solutions found by substitution matches these three cases. The large dots on the graph mark the points of intersection and tangency.