# Intersection of two circles

The following note describes how to find the intersection point(s) between two circles on a plane, the following notation is used. The aim is to find the two points P_{3} = (x_{3}, y_{3}) if they exist.

First calculate the distance d between the center of the circles. d = ||P_{1} – P_{0}||.

- If d > r
_{0}+ r_{1}then there are no solutions, the circles are separate. - If d < |r
_{0}– r_{1}| then there are no solutions because one circle is contained within the other. - If d = 0 and r
_{0}= r_{1}then the circles are coincident and there are an infinite number of solutions.

Considering the two triangles P_{0}P_{2}P_{3} and P_{1}P_{2}P_{3}we can write

a^{2} + h^{2} = r_{0}^{2} and b^{2} + h^{2} = r_{1}^{2}Using d = a + b we can solve for a,

a = (r_{0}^{2} – r_{1}^{2} + d^{2}) / (2 d)

It can be readily shown that this reduces to r_{0} when the two circles touch at one point, ie: d = r_{0} + r_{1}

Solve for h by substituting a into the first equation, h^{2} = r_{0}^{2} – a^{2}

So

P_{2} = P_{0} + a ( P_{1} – P_{0} ) / dAnd finally, P_{3} = (x_{3},y_{3}) in terms of P_{0} = (x_{0},y_{0}), P_{1} = (x_{1},y_{1}) and P_{2} = (x_{2},y_{2}), is

x_{3} = x_{2} +- h ( y_{1} – y_{0}) / d

y_{3} = y_{2} -+ h ( x_{1} – x_{0} ) / d

**Reference**

http://paulbourke.net/geometry/2circle/