Circle-Line Intersection

DOWNLOAD Mathematica Notebook CircleLineIntersection

An (infinite) line determined by two points (x_1,y_1) and (x_2,y_2) may intersect a circle of radius r and center (0, 0) in two imaginary points (left figure), a degenerate single point (corresponding to the line being tangent to the circle; middle figure), or two real points (right figure).

In geometry, a line meeting a circle in exactly one point is known as a tangent line, while a line meeting a circle in exactly two points in known as a secant line (Rhoad et al. 1984, p. 429).

Defining

d_x=x_2-x_1
(1)
d_y=y_2-y_1
(2)
d_r=sqrt(d_x^2+d_y^2)
(3)
D=|x_1 x_2; y_1 y_2|=x_1y_2-x_2y_1
(4)

gives the points of intersection as

x=(Dd_y+/-sgn^*(d_y)d_xsqrt(r^2d_r^2-D^2))/(d_r^2)
(5)
y=(-Dd_x+/-|d_y|sqrt(r^2d_r^2-D^2))/(d_r^2),
(6)

where the function sgn^*(x) is defined as

 sgn^*(x)={-1   for x<0; 1   otherwise.
(7)

The discriminant

 Delta=r^2d_r^2-D^2
(8)

therefore determines the incidence of the line and circle, as summarized in the following table.

Deltaincidence
Delta<0no intersection
Delta=0tangent
Delta>0intersection

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.