Intersection of two circles

Introduction

In this article it will be explained how to calculate the coordinates of the points ( P = x p y p ) where two circles intersect each other. The required equations will be derived and an interactive application is provided to calculate the intersection points of two given circles. Two circles have no intersection points (one circle completely outside or inside the other), one intersection point (circles touch each other), two intersection points (circles truly intersect) or an infinite number of intersection points (circles are coincident). 🤔.

JavaScript application

Input mode:
Parameters circle 1:
Parameters circle 2:

P1 =

P2 =

Next an other interactive image of two circles intersecting. Drag either green center dot to move a circle.

Derivation of the formulas

The geometry of two circles intersecting. Geometry with 'd' being the distance between the two circle centers, 'a' being the distance between one circle center and the midpoint of the line segment between the two intersection points, and 'h' being the distance between this midpoint and one intersection point. h M a b d P M P = h M M 1 = a M M 2 = b M 1 M 2 = a + b = d M 1 M 2 r 1 r 2

Let M 1 = x 1 y 1 and M 2 = x 2 y 2 be the two circle centers and let r 1 and r 2 be the two circle radii (see the two figures above). Let P = x p y p be an intersection point of the two circles.

Let d be the distance between the two circle centers. According to Pythagoras:

d = x 2 − x 1 2 + y 2 − y 1 2

Pythagoras again:

â–³ M 1 M P : a 2 + h 2 = r 1 2 â–³ M 2 M P : b 2 + h 2 = r 2 2 [1]

Subtract both equations displayed in expression [1]:

a 2 − b 2 = r 1 2 − r 2 2 a 2 − d − a 2 = r 1 2 − r 2 2 a 2 − d 2 + 2 d a − a 2 = r 1 2 − r 2 2 − d 2 + 2 d a = r 1 2 − r 2 2

Hence:

a = r 1 2 − r 2 2 + d 2 2 d

Then substituting a in [1] yields:

h = r 1 2 − a 2

Now we construct some similar triangles in order to be able to derive the xy-coordinates x p y p :

Extended geometry of two circles intersecting. Construct more lines to create similar triangles from which we can derive xm,ym and xp,yp. r 1 x m − x p x p y 2 y 2 − y 1 M 1 M 2 h M a b d P U V W (0,0)

△ W M 1 M 2 ∼ △ U M P :

x m − x p y 2 − y 1 = h d

Or for the other intersection point (not visible in the figure above):

x p − x m y 2 − y 1 = h d

Hence:

x p = x m ± h d y 2 − y 1

△ W M 1 M 2 ∼ △ V M 1 M :

x m − x 1 a = x 2 − x 1 d

Hence:

x m = a d x 2 − x 1 + x 1

And substituting x m in the previous equation for x p results in:

x p = a d x 2 − x 1 + x 1 ± h d y 2 − y 1

We can follow a similar procedure for the y-coordinates y p , which yields:

y p = a d y 2 − y 1 + y 1 ∓ h d x 2 − x 1

Summary

Let M 1 = x 1 y 1 and M 2 = x 2 y 2 be the two circle centers and let r 1 and r 2 be the two circle radii. Let P = x p y p be an intersection point of the two circles. Then:

x p = a d x 2 − x 1 + x 1 ± h d y 2 − y 1 y p = a d y 2 − y 1 + y 1 ∓ h d x 2 − x 1 With: d = x 2 − x 1 2 + y 2 − y 1 2 a = r 1 2 − r 2 2 + d 2 2 d h = r 1 2 − a 2

Tasks

Tips

Look at the formula for h. The square root of a negative number has no (real) solutions.