The intersection area of two circles

Posted by Diego Assencio on 2017.07.12 under Mathematics (Geometry)

Let $C_1$ and $C_2$ be two circles of radii $r_1$ and $r_2$ respectively whose centers are at a distance $d$ from each other. Assume, without loss of generality, that $r_1 \geq r_2$. What is the intersection area of these two circles?

If $d \geq r_1 + r_2$, the circles intersect at most up to a point (when $d = r_1 + r_2$) and therefore the intersection area is zero. On the other extreme, if $d + r_2 \leq r_1$, circle $C_2$ is entirely contained within $C_1$ and the intersection area is the area of $C_2$ itself: $\pi r_2^2$. The challenging case happens when both $d \lt r_1 + r_2$ and $d + r_2 \gt r_1$ are satisfied, i.e., when the the circles intersect only partially but the intersection area is more than simply a point. Rearranging the second inequality, we obtain $r_1 - r_2 \lt d \lt r_1 + r_2$, so we will assume this to be the case from now on.

To solve this problem, we will make use of a Cartesian coordinate system with origin at the center of circle $C_1$ such that the center of $C_2$ is at $(d,0)$ as shown on figure 1.

Fig. 1: Two intersecting circles $C_1$ (blue) and $C_2$ (red) of radii $r_1$ and $r_2$ respectively. The distance between the centers of the circles is $d = d_1 + d_2$, where $d_1$ is the $x$ coordinate of the intersection points and $d_2 = d - d_1$. Notice that $d_1 \geq 0$ since these points are always located to the right of the center of $C_1$, but $d_2$ may be negative when $r_2 \lt r_1$ since, in this case, the intersection points will eventually fall to the right of the center of $C_2$ as we move $C_2$ to the left, making $d \lt d_1$ and therefore $d_2 \lt 0$.

The circles $C_1$ and $C_2$ are described by the following equations respectively: $$ \begin{eqnarray} x^2 + y^2 &=& r_1^2 \label{post_8d6ca3d82151bad815f78addf9b5c1c6_c1}\\[5pt] (x - d)^2 + y^2 &=& r_2^2 \\[5pt] \end{eqnarray} $$ At the intersection points, we have $x = d_1$. To determine $d_1$, we can replace $x$ with $d_1$ and isolate $y^2$ on both equations above to get: $$ r_1^2 - d_1^2 = r_2^2 - (d_1 - d)^2 $$ Solving for $d_1$ is a simple task: $$ r_1^2 - d_1^2 = r_2^2 - d_1^2 + 2d_1d - d^2 \Longrightarrow d_1 = \displaystyle\frac{r_1^2 - r_2^2 + d^2}{2d} \label{post_8d6ca3d82151bad815f78addf9b5c1c6_eq_d1} $$ From equation \eqref{post_8d6ca3d82151bad815f78addf9b5c1c6_eq_d1}, we can see that $d_1 \geq 0$ since $r_1 \geq r_2$. The intersection area is the sum of the blue and red areas shown on figure 1, which we refer to as $A_1$ and $A_2$ respectively. We then have that: $$ \begin{eqnarray} A_1 &=& 2\int_{d_1}^{r_1} \sqrt{r_1^2 - x^2}dx \label{%INDEX_eq_A1_def} \\[5pt] A_2 &=& 2\int_{d - r_2}^{d_1} \sqrt{r_2^2 - (x - d)^2}dx \end{eqnarray} $$ where the factors of $2$ come from the fact that each integral above accounts for only half of the area of the associated region (only points on and above the $x$ axis are taken into account); the results must then be multiplied by two so that the areas below the $x$ axis are taken into account as well.

The computation of these integrals is straightforward. Before we proceed, notice first that: $$ \begin{eqnarray} A_2 &=& 2\int_{d - r_2}^{d_1} \sqrt{r_2^2 - (x - d)^2}dx \nonumber \\[5pt] &=& 2\int_{- r_2}^{d_1 - d} \sqrt{r_2^2 - x^2}dx \nonumber \\[5pt] &=& 2\int_{d - d_1}^{r_2} \sqrt{r_2^2 - x^2}dx \nonumber \\[5pt] &=& 2\int_{d_2}^{r_2} \sqrt{r_2^2 - x^2}dx \label{%INDEX_eq_A2} \end{eqnarray} $$ where above we used the fact that $d_2 = d - d_1$. This is the same as equation \eqref{%INDEX_eq_A1_def} if we apply the substitutions $d_1 \rightarrow d_2$ and $r_1 \rightarrow r_2$. Therefore, by computing $A_1$, we will immediately obtain $A_2$ as well. Let's then compute $A_1$ first: $$ \begin{eqnarray} A_1 &=& 2\int_{d_1}^{r_1} \sqrt{r_1^2 - x^2}dx \nonumber\\[5pt] &=& 2r_1 \int_{d_1}^{r_1} \sqrt{1 - \left(\frac{x}{r_1}\right)^2}dx \nonumber\\[5pt] &=& 2r_1^2 \int_{d_1/r_1}^{1} \sqrt{1 - x^2}dx \label{%INDEX_eq_A1} \end{eqnarray} $$ All we need to do now is to integrate $\sqrt{1 - x^2}$. The process is straightforward if we use integration by parts: $$ \begin{eqnarray} \int \sqrt{1 - x^2}dx &=& x \sqrt{1 - x^2} - \int x \left(\frac{-x}{\sqrt{1 - x^2}}\right) dx \nonumber\\[5pt] &=& x \sqrt{1 - x^2} + \int \frac{x^2 - 1}{\sqrt{1 - x^2}} dx + \int \frac{1}{\sqrt{1 - x^2}} dx \nonumber\\[5pt] &=& x \sqrt{1 - x^2} - \int \sqrt{1 - x^2} dx + \sin^{-1}(x) \end{eqnarray} $$ Therefore: $$ \int \sqrt{1 - x^2}dx = \frac{1}{2}\left( x \sqrt{1 - x^2} + \sin^{-1}(x) \right) \label{post_8d6ca3d82151bad815f78addf9b5c1c6_int_for_A1_A2} $$ Using equation \eqref{post_8d6ca3d82151bad815f78addf9b5c1c6_int_for_A1_A2} on equation \eqref{%INDEX_eq_A1} yields: $$ \begin{eqnarray} A_1 &=& r_1^2 \left( \frac{\pi}{2} - \frac{d_1}{r_1}\sqrt{1 - \left(\frac{d_1}{r_1}\right)^2} - \sin^{-1}\left(\frac{d_1}{r_1}\right) \right) \nonumber\\[5pt] &=& r_1^2 \left( \cos^{-1}\left(\frac{d_1}{r_1}\right) - \frac{d_1}{r_1}\sqrt{1 - \left(\frac{d_1}{r_1}\right)^2} \right) \nonumber\\[5pt] &=& r_1^2 \cos^{-1}\left(\frac{d_1}{r_1}\right) - d_1 \sqrt{r_1^2 - d_1^2} \label{post_8d6ca3d82151bad815f78addf9b5c1c6_eq_A1_final} \end{eqnarray} $$ where above we used the fact that $\pi/2 - \sin^{-1}(\alpha) = \cos^{-1}(\alpha)$ for any $\alpha$ in $[-1,1]$. This fact is easy to prove: $$ \cos\left(\frac{\pi}{2} - \sin^{-1}(\alpha)\right) = \cos\left(\frac{\pi}{2}\right)\cos(\sin^{-1}(\alpha)) + \sin\left(\frac{\pi}{2}\right)\sin(\sin^{-1}(\alpha)) = \alpha $$ and therefore $\pi/2 - \sin^{-1}(\alpha) = \cos^{-1}(\alpha)$. As discussed above, we can now obtain $A_2$ directly by doing the substitutions $d_1 \rightarrow d_2$ and $r_1 \rightarrow r_2$ on the expression for $A_1$ on equation \eqref{post_8d6ca3d82151bad815f78addf9b5c1c6_eq_A1_final}: $$ A_2 = r_2^2 \cos^{-1}\left(\frac{d_2}{r_2}\right) - d_2 \sqrt{r_2^2 - d_2^2} $$ The sum of $A_1$ and $A_2$ is the intersection area of the circles: $$ \boxed{ \begin{eqnarray} A_{\textrm{intersection}} &=& r_1^2 \cos^{-1}\left(\frac{d_1}{r_1}\right) - d_1\sqrt{r_1^2 - d_1^2} \nonumber \\[5pt] &+& r_2^2\cos^{-1}\left(\frac{d_2}{r_2}\right) - d_2\sqrt{r_2^2 - d_2^2} \nonumber \end{eqnarray} } \label{post_8d6ca3d82151bad815f78addf9b5c1c6_A_intersection} $$ where: $$ \boxed{ d_1 = \displaystyle\frac{r_1^2 - r_2^2 + d^2}{2d} } \quad \textrm{ and } \quad \boxed{ d_2 = d - d_1 = \displaystyle\frac{r_2^2 - r_1^2 + d^2}{2d} } \label{post_8d6ca3d82151bad815f78addf9b5c1c6_eq_d1_final} $$


Given two circles $C_1$ and $C_2$ of radii $r_1$ and $r_2$ respectively (with $r_1 \geq r_2$) whose center points are at a distance $d$ from each other, the intersection area of the circles is:, if $d \geq r_1 + r_2$, since in this case the circles intersect at most up to a point.
2.$\pi r_2^2$, if $d \leq r_1 - r_2$, since in this case $C_2$ is entirely contained within $C_1$.
3.given by equation \eqref{post_8d6ca3d82151bad815f78addf9b5c1c6_A_intersection} in all other cases.


Livio B on May 15, 2019:
Thank you for the efort. It was really helpful.
Best regards
Jure Skraba on Aug 01, 2019:
How do you calculate intersection area of two circles, when d < min (r1; r2), i.e. when smaller circle lies inside the bigger circle, therefore the intersection area is not sum of two circle segments but their subtract.
Thanks in advance.
Diego Assencio on Aug 01, 2019:
@Jure: The smaller circle lies completely inside the bigger one only when $d \leq r_1 - r_2$, in which case the intersection area is simply the area of the smaller circle itself: $\pi r_2^2$ (see case #2 on the summary at the end of the article).
Jure Skraba on Aug 01, 2019:
To refer to the sketch above I would like to calculate the area, where d < r1 and d > r1 - r2, i.e. when circle C2 lies partly (not completely) inside the circle C1.
Diego Assencio on Aug 01, 2019:
@Jure: In this case, the intersection area can be computed through equations (14) and (15).

If the article is hard to follow, I suggest you read only the summary at the end as it tells you how to compute the intersection area in every possible scenario.
Oisin on Aug 19, 2019:
Hi Diego, I am also confused about the particular case Jure was mentioning. Specifically the case when the centre of the small circle lies within the larger one yet is not fully inside it. d1/r1 can be larger than one here making acos undefined
Diego Assencio on Aug 19, 2019:
@Oisin: $d_1 \gt r_1$ is impossible since $d_1$ is the $x$ coordinate of the points at which $C_1$ and $C_2$ intersect. Setting up the $x$ and $y$ axes as in figure 1, $d_1 \leq r_1$ always holds, even if the center of $C_2$ falls inside $C_1$ in such a way that the intersection between the circles is only partial.

Please notice that the derivation above did not assume that the center of $C_2$ was either inside or outside of $C_1$, so it works in both situations.
Dhamnekar Winod on May 08, 2020:
Your work for computation of the intersection area of two circles when $r_1 \geq r_2$ is self-explanatory. But I want to know what changes are to be made in your above proof when $r_1 \leq r_2$. Looking forward to your reply.
Diego Assencio on May 08, 2020:
@Dhamnekar: In the derivation above, I explicitly defined circle $C_1$ as the one with radius $r_1 \geq r_2$, so $r_1 \leq r_2$ is only possible in the special case where $r_1 = r_2$, and $r_1 \lt r_2$ is, by definition, impossible.

Notice that there is no loss of generality in this assumption because the particular label assigned to each circle plays no role in the derivation.
Dhamnekar Winod on May 08, 2020:
You mean to say if $r_1\leq r_2$, the equation (14) and (15) will remain same. There would not be any changes therein.
Diego Assencio on May 08, 2020:
@Dhamnekar: What I meant is that equations (14) and (15) were derived under the explicit assumption that $r_1 \geq r_2$. Therefore, if you wish to compute the intersection area of two circles with different radii using the results above, you must have $r_1$ be the radius of the larger circle and $r_2$ be the radius of the smaller one (if the circles have equal radii, $r_1$ and $r_2$ can be assigned arbitrarily).

It is actually possible that equations (14) and (15) are valid even when $r_1 \leq r_2$, but this is not an obvious fact on the derivation above.
Stef on May 22, 2020:
Hi, I am wondering how you substituted the limits of the integration in equation 8. Can you give me a hint?
Thanks in advance!
Diego Assencio on May 22, 2020:
@Stefan: I used the substitution $u = x / r_1$ (so $x = r_1 u$ and $dx = r_1 du$):

$\displaystyle \int_{x \,=\, d_1}^{x \,=\, r_1} \sqrt{1 - \left(\frac{x}{r_1}\right)^2}dx
= \int_{u \, = \, d_1/r_1}^{u \, = \, 1} \sqrt{1 - u^2}\,r_1 du

After that, I simply replaced $u$ with $x$ again.
Hen on Jun 10, 2020:
Hi Diego,
I also enjoyed reading your concisely written and well designed post. Would you, by chance, know if there's a formula/algorithm for determining the intersection area when you have only slices/wedges of two circles?
Diego Assencio on Jun 11, 2020:
@Hen: The problem you described is significantly harder than the one I solved here. An exact solution would likely be very complicated, but there is an excellent numerical algorithm called "Level Set method" which can be used to compute the intersection area you are interested in. In case you want to learn more, a good reference on the topic is the book "Level Set Methods and Dynamic Implicit Surfaces", from Stanley Osher and Ronald Fedkiw.
Richard Miles on Jul 01, 2020:
Hi Diego,
I would like to use your derivation to model the spherically symmetrical expansion of an eruption cloud on the surface of a spherical comet nucleus. In this case the source of the eruption is at the centre of C2, which lies inside C1 (hence d<r1). After the eruption, the value of r2 increases linearly with time. You say your derivation is valid up until r2 equals r1, but what about the condition where r2 > r1? Do the two circles interchange so that C2 becomes C1 and vice versa and so a solution is possible?
Diego Assencio on Jul 01, 2020:
@Richard: What you said is correct.

As I mentioned on a previous comment, it is possible that equations (14) and (15) are valid even when $r_1 \lt r_2$, but the derivation above does not make it obvious whether that is true or not.
Richard Miles on Jul 01, 2020:
Many thanks, Diego.
I was not sure about your earlier comment - thanks for your confirmation. I shall go ahead and model the total reflectance of the nucleus and an expanding dust cloud of different reflectivity. We have observations from 2019 of such an eruption on a comet and comparing the model with the data we have should set constraints on the location of the eruption relative to the centre of the nucleus. Of course, I shall acknowledge your contribution in the paper.
Kappa-Tau on Jul 07, 2020:
Thank you very much for the effort. This is an elusive problem because its so difficult to settle your mind to the "without any loss of generality" parts of the problem. You did well to make me accept the layout. How can we cite this?
Diego Assencio on Jul 07, 2020:
@Kappa-Tau: It is indeed! While writing this article, it also took me a while to convince myself that the argument is correct. As for the citation: referring to my name, the title of the article and its URL should be enough.
Kappa-Tau on Jul 13, 2020:
Hi again Diego

Do you think it would be possible to approach this problem in a similar manner to how you did above by considering an n-gon approximation for each circle? I'm working on a problem where I have to integrate a function f(x,y) over the intersection of two circles. I'm trying to avoid the radical signs.
Joseph on Jul 13, 2020:
Hi Diego,

I was wondering how you would go about this when the smaller circle also has some y component to it (i.e. the centerpoints are not directly horizontal to one another).
Diego Assencio on Jul 13, 2020:
@Kappa-Tau: I would know how to do what you proposed using a numerical algorithm based on the Level Set method. By embedding the circles in a Cartesian grid and approximating both their level sets as well as $f(x,y)$ on this grid using bilinear functions, it would be possible to compute the integral of $f(x,y)$ over the intersection area (which, in this approximation, is a polygonal surface, just like the circles themselves).

The details are unfortunately too complicated to be explained here, but feel free to reach me via e-mail ( if you wish to get additional pointers.
Diego Assencio on Jul 13, 2020:
@Joseph: In the derivation above, I defined the $x$ axis as the one going through the centers of the circles and with origin at the center of circle $C_1$ because that simplifies the computation of the intersection area. Notice, however, that this particular choice of coordinate system has no effect on the final result: the intersection area is always the same regardless of how you compute it.

The results above are therefore correct in all situations, provided that you define $C_1$ and $C_2$ such that $r_1 \geq r_2$.
Kappa-Tau on Jul 13, 2020:
@Diego Thanks I will.

@Joseph : Are you dealing with FSO laser beam misalignment problems?

Diego is right about the setup as per the objective. However, if you are trying to integrate over the intensity of a Gaussian beam which has non-uniform intensity over the large circle, a y-translation for misalignment IS indeed better. My advice is to forget it because it makes life harder than it already is.
mohammad on Aug 30, 2020:
Greetings and Regards
Please let me know the source of this post so that I can refer to it in my article.
Thanks a lot
Diego Assencio on Aug 30, 2020:
@Mohammad: Everything in this article is my own work. In case you want to cite it: referring to my name, the title of the article and its URL should be enough. Thanks!
Shiping Zhang on Oct 20, 2020:
Thanks for the nice work. This problem had been in mind for a while because of a related real life problem and thought it'd be simple to solve it with trigonometry. But when I finally tried to solve it with trigonometry, I found it's not that simple at all. So I thought of integrals, but this time I decided to google first before I tried, and ended up here. BTW the related real life problem is to find the distance of the centers of two circles given the radii of the circles and the size of their overlapping area.
Jerome de Leon on Jul 07, 2021:
Equation 14 breaks down when r1>d>r2; that is, C2 is almost fully inscribed in C1.

For example, using r1=1, r2=0.5, and d=0.6, yields A_int=1.3 which is larger than the area of C2 (=pi/4).
Diego Assencio on Jul 07, 2021:
@Jerome: Thank you for your comment! I plugged in the numbers you mentioned and got the following:

A_{\textrm{intersection}} = 0.7314 \lt \pi/4 = 0.7854
Jerome de Leon on Jul 13, 2021:
Hi Diego, I found there was a bug in my code and that I got the expected results. Thanks for your help!
Milly on Nov 05, 2021:
Hi Diego! What would the formula be for finding the circle centers if I knew the intersecting circles area and radii of both circles?
Diego Assencio on Nov 05, 2021:
@Milly: You will not be able to obtain a simple expression which will directly give you what you want based on $r_1$, $r_2$ and $A_{\textrm{intersection}}$ alone.

However, assuming that the circles are placed as in figure 1 ($C_1$ with its center at the origin, $C_2$ with its center at $(d, 0)$ with $d \geq 0$), you could use a numerical method to obtain $d$ and therefore know where the center of $C_2$ is at. One way to do that is by using equation (15) on equation (14) to make $d$ the only unknown variable, then use a root finding algorithm to determine its value.
Bryant on Feb 23, 2022:
Figured you'd might like a simple application of this problem/solution: generating areas of Venn Diagrams that correspond to survey responses!

You can then arbitrary assign $r_1$ and $r_2$ and then determine $d$ such that the areas are proportional to counts for an $A$, $B$, $A \cap B$ -type Venn Diagram. Cheers!
tjw on Apr 19, 2022:
Hey @Diego, a little late to the game here but I think there's a simpler way to get to your result without integrals.

Drawing a triangle between the centres of the circles and the top point of intersection, the area of the top half of the intersection should be

$A = \mathrm{sec}_1 + \mathrm{sec}_2 - A_\mathrm{triangle}$

where the area of each sector is $\mathrm{sec}_i = \frac{1}{2} \theta_i r_i^2$ ($\theta_i$ is the angle between $d$ and $r_i$, found using cosine rule).

$A_\mathrm{triangle}$ can be found using Heron's formula such that $A_\mathrm{triangle} = \sqrt{s(s-d)(s-r_1)(s-r_2)}$ and $s = \frac{1}{2} (d + r_1 + r_2)$.

This ends up coming to the same thing as your Eq.14 :D fyi this is a useful formula for modelling transiting exoplanets!
Michael Zgut on Jun 16, 2022:
Hi Diego - this is really great, almost what I was looking for, but the other way around:
Given, C1, C2 and the intersection A, what will be the equation for the circles centers on the X axis?
KappaTau on Jun 16, 2022:
Great work!

A bit off topic. What do you use for scrollable equations? Ive been tryin to do that on my website and I cant find a solution.
Athman ismail on Jul 06, 2022:
Nice mathematical equation but put it such way that one can ask questions