# How do I find the points of intersection of two circles?

I have a specific situation in which I need to find the points of intersection of two circles, $k_1$ and $k_2$.

The first circle, $W$, has coordinates $(0,R)$ and is of radius $R$.

The second circle, $L$, has coordinates $(0,b \cdot r)$ and is of radius $r$. (The circles will only intersect if $-1 \le b \le 1$.)

Both of the circles have $x=0$.

The origin, $(0,0)$, is on the circumference of $W$.

$k_1$ and $k_2$ should have coordinates of the form $(\pm x,y)$.

Image to explain situation

Answers in JavaScript are preferable but any algorithm will suffice. Thank you very much for any help.

• Is $r$ meant to be $R$? – Jaideep Khare May 28 '17 at 19:34
• No, the two circles have different radii, – snazzybouche May 28 '17 at 19:36
• a programming answer belongs on stack overflow, whereas, it is acceptable to ask the math related part here. You most likely will be expected to translate the answer (steps to solve the problem) into javascript code yourself. Also I assume you meant $-1 \le b \le 1$? – Dando18 May 28 '17 at 19:37
• @snazzybouche Then why will the circles intersect only if $-1 \le b \le 1$? – Jaideep Khare May 28 '17 at 19:38
• @JaideepKhare I have added an image to explain the situation diagrammatically. – snazzybouche May 28 '17 at 19:42

$x^2+(y-R)^2=R^2$ and $x^2+(y-br)^2=r^2$.
Thus, $-2Ry=-2bry+b^2r^2-r^2$ or $y=\frac{r^2-b^2r^2}{2(R-br)}$