# Intersection of two circles

## Introduction

In this article it will be explained how to calculate the coordinates of the points ($P=\left({x}_{p},{y}_{p}\right)$) 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

Let ${M}_{1}=\left({x}_{1},{y}_{1}\right)$ and ${M}_{2}=\left({x}_{2},{y}_{2}\right)$ be the two circle centers and let ${r}_{1}$ and ${r}_{2}$ be the two circle radii (see the two figures above). Let $P=\left({x}_{p},{y}_{p}\right)$ be an intersection point of the two circles.

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

$d=\sqrt{{\left({x}_{2}-{x}_{1}\right)}^{2}+{\left({y}_{2}-{y}_{1}\right)}^{2}}$

Pythagoras again:

$\begin{array}{lll}△⁣{M}_{1}⁣M⁣P& \text{:}& {a}^{2}+{h}^{2}={{r}_{1}}^{2}\\ △⁣{M}_{2}⁣M⁣P& \text{:}& {b}^{2}+{h}^{2}={{r}_{2}}^{2}\end{array}$ 

Subtract both equations displayed in expression :

$\begin{array}{rcl}{a}^{2}-{b}^{2}& =& {{r}_{1}}^{2}-{{r}_{2}}^{2}\\ {a}^{2}-{\left(d-a\right)}^{2}& =& {{r}_{1}}^{2}-{{r}_{2}}^{2}\\ {a}^{2}-{d}^{2}+2da-{a}^{2}& =& {{r}_{1}}^{2}-{{r}_{2}}^{2}\\ -{d}^{2}+2da& =& {{r}_{1}}^{2}-{{r}_{2}}^{2}\end{array}$

Hence:

$a=\frac{{{r}_{1}}^{2}-{{r}_{2}}^{2}+{d}^{2}}{2d}$

Then substituting a in  yields:

$h=\sqrt{{{r}_{1}}^{2}-{a}^{2}}$

Now we construct some similar triangles in order to be able to derive the xy-coordinates $\left({x}_{p},{y}_{p}\right)$:

$△WM1M2 ~ △UMP$ :

$\frac{{x}_{m}-{x}_{p}}{{y}_{2}-{y}_{1}}=\frac{h}{d}$

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

$\frac{{x}_{p}-{x}_{m}}{{y}_{2}-{y}_{1}}=\frac{h}{d}$

Hence:

${x}_{p}={x}_{m}±\frac{h}{d}\left({y}_{2}-{y}_{1}\right)$

$△⁣W⁣{M}_{1}⁣{M}_{2}\sim △⁣V⁣{M}_{1}⁣M$ :

$\frac{{x}_{m}-{x}_{1}}{a}=\frac{{x}_{2}-{x}_{1}}{d}$

Hence:

${x}_{m}=\frac{a}{d}\left({x}_{2}-{x}_{1}\right)+{x}_{1}$

And substituting ${x}_{m}$ in the previous equation for ${x}_{p}$ results in:

${x}_{p}=\frac{a}{d}\left({x}_{2}-{x}_{1}\right)+{x}_{1}±\frac{h}{d}\left({y}_{2}-{y}_{1}\right)$

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

${y}_{p}=\frac{a}{d}\left({y}_{2}-{y}_{1}\right)+{y}_{1}\mp \frac{h}{d}\left({x}_{2}-{x}_{1}\right)$

## Summary

Let ${M}_{1}=\left({x}_{1},{y}_{1}\right)$ and ${M}_{2}=\left({x}_{2},{y}_{2}\right)$ be the two circle centers and let ${r}_{1}$ and ${r}_{2}$ be the two circle radii. Let $P=\left({x}_{p},{y}_{p}\right)$ be an intersection point of the two circles. Then:

${x}_{p}=\frac{a}{d}\left({x}_{2}-{x}_{1}\right)+{x}_{1}±\frac{h}{d}\left({y}_{2}-{y}_{1}\right)$ ${y}_{p}=\frac{a}{d}\left({y}_{2}-{y}_{1}\right)+{y}_{1}\mp \frac{h}{d}\left({x}_{2}-{x}_{1}\right)$ With: $d=\sqrt{{\left({x}_{2}-{x}_{1}\right)}^{2}+{\left({y}_{2}-{y}_{1}\right)}^{2}}$ $a=\frac{{{r}_{1}}^{2}-{{r}_{2}}^{2}+{d}^{2}}{2d}$ $h=\sqrt{{{r}_{1}}^{2}-{a}^{2}}$

• If $d>{r}_{1}+{r}_{2}$, then no solutions; one circle completely outside the other.
• If $d<\left|{r}_{1}-{r}_{2}\right|$, then no solutions; one circle completely inside the other.
• If $d={r}_{1}+{r}_{2}$ or $d=\left|{r}_{1}-{r}_{2}\right|$, then $a={r}_{1}$ and $h=0$, then one solution; circles are kissing 😘 each other in one point, i.e., ${\left({x}_{p},{y}_{p}\right)}_{1}={\left({x}_{p},{y}_{p}\right)}_{2}$.
• If $d=0$ and ${r}_{1}={r}_{2}$, then an infinite number of solutions; circles are coincident.
• In any other instance the two circles are truly intersecting, at two points.

• Prove that $a={r}_{1}$ if $d={r}_{1}+{r}_{2}$.
• What happens with the given formulas if $d>{r}_{1}+{r}_{2}$? Why are there no solutions in that case?