# How to calculate the intersection of 2 circles? [duplicate]

This question already has an answer here:

I am working on making inverse kinematics for a game I am making so I decided that the best way to start would be to do it in 2D.

After asking some people how to do it, they said you need to calculate the intersection of 2 circles.

How would I go about doing this without using any trigonometric formula? I searched online, however the answers and solutions to get the answer are not very well worded and easy to understand.

If you know the two positions of the circles, the distance between them and the radius of the circles, how would you calculate the intersection? And if you are answering can you clearly explain each step and what each thing means please and it would help me very much, e.g if you are using $x_1^2$, $x_2^2$, $y_1^2$, $y_2^2$, $r_1$, $r_2$ etc as such they do not show much meaning to me as I do not understand what they are showing? If you could explain this in the very best way possible for me to understand that would be great! thank you very much!

## I have searched far and wide, but anywhere I found the wording is too hard to understand and follow - I am asking for someone to answer in a way that is understandable.

https://i.stack.imgur.com/EN6nS.png

## marked as duplicate by Ethan Bolker, Misha Lavrov, Xander Henderson, user284331, Claude LeiboviciMar 29 '18 at 6:07

• Are you looking for the area? Equations for the curves that bound the area of intersection? Perimeter? – Mauve Mar 28 '18 at 17:18
• the point of intersection, as circled in the picture posted, and how to calculate it. – PC.Meme Mar 28 '18 at 17:19
• @PC.Meme do you know coordinate geometry? If yes then follow the link above – kayush Mar 28 '18 at 17:29

You must plot your circles on an $xy$-coordinate plane. Since you already have the known radii and distances of both centers from each other, you can easily find their equivalent coordinates in the $xy$-plane.

If I were you, it's best that I position one circle on the origin (i.e. one circle's center must be at $(0,0)$), so that it would be a lot easier.

You can just use the general formula for a circle: $$(x-h)^2+(y-k)^2=r^2 \quad{\text{where (h,k) is the center of the circle}}$$ Solving for $y$ to make things easier, you get: $$y=k\pm\sqrt{-h^2+2 h x+r^2-x^2}$$

For your two circles, you'll get: $$(x-x_1)^2+(y-y_1)^2=r^2$$ $$(x-x_2)^2+(y-y_2)^2=r^2$$ You can just solve for $y$ for both equations, set them equal to each other and solve for $x$. After getting $x$, you then find $y$.

Notice that you have to solve for both cases $\pm$ of $(x,y)$ since two circles intersect at two points.

• How do you "solve for $x$" ? – Yves Daoust Mar 28 '18 at 17:43
• It's there, you get $y=k\pm\sqrt{-h^2+2 h x+r^2-x^2}$ generally. You already have two equations for a circle, solve for $y$, i.e. rewrite the equation with $y$ in the LHS. – John Glenn Mar 28 '18 at 17:45
• I know but that leads to an equation that is more difficult than the original one. – Yves Daoust Mar 28 '18 at 17:47
• Why? It's simpler if one circle is centered at $(0,0)$. On the contrary, It makes the equations more elegant and simple since you only have to set both equations equal to each other in order to solve for $x$. There are a plethora of ways to solve any problem, isn't that the beauty of maths? But to each his own, I guess. – John Glenn Mar 28 '18 at 17:48

WLOG, $x_1=y_1=0$ (if not, you translate the two circles so that the first goes to the origin).

By subtracting the two implicit equations,

$$\begin{cases}x^2+y^2=r_1^2,\\(x-x_2)^2+(y-y_2)^2=r_2^2\end{cases}$$ you get $$\begin{cases}(x-x_2)x_2+(y-y_2)y_2=r_2^2-r_1^2\\x^2+y^2=r_1^2\end{cases},$$

which combines the equation of a straight line and a circle.

You can draw $y$ from the first equation and plug into the second, to obtain a quadratic equation in $x$.

Generally: For finding intersections of two circles, one should first know about the possibilities.... Two circle can intersect at most at two points. Now for finding them here is a small algorithm:

1. First be ready with the equations of circles, for this knowledge about derivation of different forms (from the given info ) of eqs of circle is required.
2. Now after being done with equations, find the value of one variable (say x) in terms of another (y here) and substitute the same in the second equation.
3. Now it's solution time. If the equation so obtained has no solution then circles will not intersect, intersecting at one point or two depending on the no. of solution(s) respectively.
4. Use this value (of x here) to find value of second variable by substitution.

It's just an algorithm to find intersections between any two curves.it may be not a complete solution to your problem but I hope it certainly helps