☖ Home Units Converter Geometry Σ Math Physics Electricity

Two circles intersection calculator

Print two circle intersection calculator
Circles form:     (x-a)2 + (y-b)2 = r2
Circle 1: ( x + )2 + ( y + )2 = 2
Circle 2: ( x + )2 + ( y + )2 = 2
Circles form:     x2 + y2 + Ax + By + C = 0
Circle 1: x2 + y2 + x + y + = 0
Circle 2: x2 + y2 + x + y + = 0
Intersection coordinates (x , y):
Line passing through intersection points:
Distance between circles centers:
Equation of the line passing circles centers:
Common area between circles:
Circle 1 - x and y axis intercepts:
Circle 2 - x and y axis intercepts:
Notes:
             

Two circles intersection equations summary

Print two circle intersection summary

Two circles tangency conditions summary

Print two circle tangency conditions
Description                   Condition
Circles inside circle
Circles equations:
(x + x1)2 + (y + y1)2 = r12
(x + x2)2 + (y + y2)2 = r22
Distance between circles centers  d  is:
d=√((x_1-x_2 )^2+(y_1-y_2 )^2 )
d < |r1 − r2|
Circles inner tangent
Inner tangency
d = |r1 − r2|
Circles intersects
Intersecting circles
|r1 − r2| < d < r1 + r2
Circles outer tangent
Outer tangency
d = r1 + r2
Two seperated circles
Intersecting circles
d > r1 + r2

Intercepts of a circle and the  x  and  y  axis summary

Print intercepts of a circle
Circle equation:      (x − a)2 + (y − b)2 = r2
In order to find the circle intercept with the  y  axis substitute the value
x = 0  in the circle equation and solve for y.
a2 + (y − b)2 = r2
y22by + a2 + b2 − r2 = 0
We got a quadratic equation with the  y  unknown.
x1,2 = 0 circle y axis intercepts
When     r > a    then two y axis intercepts points exists.
When     r = a    then the circle is tangent to the y axis.
When     r < a    then the circle does not intercept with the y axis.
Apply the same steps to find the intercept with the  x  axis (where   y = 0)
y1,2 = 0 circle x axis intercepts
When     r > b    then two x axis intercepts points exists.
When     r = b    then the circle is tangent to the x axis.
When     r < b    then the circle does not intercepts with the x axis.
Circle equation:      x2 + y2 + Ax + By + C = r2
Substitute   x = 0   for intercept with the  y  axis:         y2 + By + C = 0
x1,2 = 0 circle y axis intercepts
Substitute   y = 0   for the intercepts with the x axis:         x2 + Ax + C = 0
y1,2 = 0 circle x axis intercepts

Example 1 - x and y axes intercepts

Print example 1
Find the x and y axis intercepts points of the circle:    x2 + y2 + 6x − 16 = 0.
For the  y  axis intercepts substitute   x = 0   into the circle equation:     y2 − 16 = 0.
And the  y  axis intercepts are:         y1 = 4         y2 = −4.
For the  x  axis intercepts substitute   y = 0   into the circle equation:     x2 + 6x − 16 = 0.
The solution of this quadratic equation are: x_1,2=(-6±√(36+64))/2=2,-8
And the x axis intercepts are:         x1 = 2         x2 = −8

Example 2 - x and y axes intercepts

Print example 2
Find the  x  and  y  axes intercepts points of the circle    (x − 4)2 + (y + 1)2 = 16.
Circle x y intercepts for the y axis intercepts insert the value:   x = 0   to get:
y2 + 2y + 1 = 0
The solution of this equation is: y_1,2=(-2±√(4-4))/2=-1
Because there is only one solution to this equation, the circle must be tangent to the y axis at point   (0 , −1).
For the  x  axis intercepts we insert the value:   y = 0   And get the quadratic equation:       x2 − 8x + 1 = 0.
The solution of this equation is:
x_1,2=(8±√(64-4))/2=7.873  ,   0.127
And the x axes intercepts are at:   (7.873 , 0)   and  (0.127 , 0).

Example 3 - Two circles overlapping area

Print example 3
Find the overlapping area between the two circles given by the equations:
(x + 3)2 + (y + 2)2 = 36     and    (x − 4)2 + (y + 2)2 = 16.
Two circles lapping area

First solution will be solved by geometric method.

The blue area is a circle segment of the left circle with cord equal to  2h  so the blue area is:

A(r,θ)=r^2/2 (θ-sin⁡θ)(1)

If the two circles are:    (x + a)2 + (y + b)2 = r12    and    (x + c)2 + (y + d)2 = r22

The distance between circles centers is: D=√((c-a)^2+(d-b)^2 )
D = A + B (2)
The heigh  h  can be found from the triangles: h2 = r12 − A2 (3)
h2 = r22 − B2 (4)
From equations (3) and (4) we have r12 − r22 = B2 − A2 (5)

Substitute A and B from equation (2) into equation (5) to get:

A=(〖r_1〗^2-〖r_2〗^2+D^2)/2D B=(〖r_2〗^2-〖r_1〗^2+D^2)/2D
From triangle r1, h, A angle #θ1 can be found: θ_1=2 cos^(-1)⁡〖A/r_1 〗=2 cos^(-1)⁡〖(〖r_1〗^2-〖r_2〗^2+D^2)/(2Dr_1 )〗
The same way angle θ2 is: θ_2=2 cos^(-1)⁡〖B/r_2 〗=2 cos^(-1)⁡〖(〖r_2〗^2-〖r_1〗^2+D^2)/(2Dr_2 )〗
The blue segment area is found according to equation (1) A_blue=〖r_1〗^2/2 (θ_1-sin⁡〖θ_1 〗 )

And the total common area of two circles is:

A_common=A_blue+A_green=〖r_1〗^2/2 (θ_1-sin⁡〖θ_1 〗 )+〖r_2〗^2/2 (θ_2-sin⁡〖θ_2 〗 )
From the given circles the distance between circles centers is: D=√((-4-3)^2+(2-2)^2 )=7
A=(36-16+49)/(2∙7)=4.929 B=(16-36+49)/(2∙7)=2.071

And the angles θ1   and   θ2 are:

2θ_1=2 cos^(-1)⁡〖A/r_1 〗=2 cos^(-1)⁡〖4.929/6〗=1.213

2θ_2=2 cos^(-1)⁡〖B/r_2 〗=2 cos^(-1)⁡〖2.071/4〗=2.053

Another way to find the common area is by integration

From the equation of a circle, we have: y=√(r^2-x^2 )
And the blue segment area is: A_blue=∫_(x_1)^(x_2)▒√(〖r_1〗^2-x^2 ) dx

From the sketch we see that the boundaries of the integration are x1 = A and x2 = r1

The solution is performed by trigonometric substitution method and is equal to:

A_blue=∫_(x_1)^(x_2)▒√(〖r_1〗^2-x^2 ) dx

JScript code to calculate two circles intersection points

Print JScript code
//Definition of a circle object
function circle(a, b, r) { this.a = a; this.b = b; this.r = r; }
// This values should be declared as global variables
// so their values can be used without return their values
var x1, y1, x2, y2;
function calculateIntersection() {
// Calling function
var circle1 = new circle(2, 4, 5);
var circle2 = new circle(-1, 0, 3);
if (twoCirclesIntersection(circle1, circle2)) {
// If true - then the circles intersect
// the intersection points are given by (x1, y1) and (x2, y2)
..... Continue with desirable code .....
}
}
function twoCirclesIntersection(c1, c2){
//**************************************************************
//Calculating intersection coordinates (x1, y1) and (x2, y2) of
//two circles of the form (x - c1.a)^2 + (y - c1.b)^2 = c1.r^2
//                        (x - c2.a)^2 + (y - c2.b)^2 = c2.r^2
//
// Return value:   true if the two circles intersect
//                 false if the two circles do not intersect
//**************************************************************
var val1, val2, test;
// Calculating distance between circles centers
var D = Math.sqrt((c1.a - c2.a) * (c1.a - c2.a) + (c1.b - c2.b) * (c1.b - c2.b));
if (((c1.r + c2.r) >= D) && (D >= Math.abs(c1.r - c2.r))) {
// Two circles intersects or tangent
// Area according to Heron's formula
//----------------------------------
var a1 = D + c1.r + c2.r;
var a2 = D + c1.r - c2.r;
var a3 = D - c1.r + c2.r;
var a4 = -D + c1.r + c2.r;
var area = Math.sqrt(a1 * a2 * a3 * a4) / 4;
// Calculating x axis intersection values
//---------------------------------------
val1 = (c1.a + c2.a) / 2 + (c2.a - c1.a) * (c1.r * c1.r - c2.r * c2.r) / (2 * D * D);
val2 = 2 * (c1.b - c2.b) * area / (D * D);
x1 = val1 + val2;
x2 = val1 - val2;
// Calculating y axis intersection values
//---------------------------------------
val1 = (c1.b + c2.b) / 2 + (c2.b - c1.b) * (c1.r * c1.r - c2.r * c2.r) / (2 * D * D);
val2 = 2 * (c1.a - c2.a) * area / (D * D);
y1 = val1 - val2;
y2 = val1 + val2;
// Intersection points are (x1, y1) and (x2, y2)
// Because for every x we have two values of y, and the same thing for y,
// we have to verify that the intersection points as chose are on the
// circle otherwise we have to swap between the points
test = Math.abs((x1 - c1.a) * (x1 - c1.a) + (y1 - c1.b) * (y1 - c1.b) - c1.r * c1.r);
if (test > 0.0000001) {
// point is not on the circle, swap between y1 and y2
// the value of 0.0000001 is arbitrary chose, smaller values are also OK
// do not use the value 0 because of computer rounding problems
var tmp = y1;
y1 = y2;
y2 = tmp;
}
return true;
}
else {
// circles are not intersecting each other
return false;
}
}

Example 4 - Two circles tangency coordinate

Print example 4
Find the points of intersections of the circles   (x + 1)2 + (y + 1)2 = 4   and   (x − 4)2 + (y + 1)2 = 9.
Example 4
The term (y + 1)2 is the same in the equations of both circles. From the first circle we have:
(y + 1)2 = 4 − (x + 1)2
substitute this value to the first circle:
(x + 1) + 9 − (x − 4) − 4 = 0
After solving the equation we receive   xt = 1
Now we can find the value of yt
And   yt = −1 or tangency at (1 , −1)

Example 5 - Two circles intersection

Print example 5
Find the common cord length of the two circles (x + h)2 + (y + k)2 = r2   and   (x + k)2 + (y + h)2 = r2

Find the numerical values of the cord length, when h = 3 k = -1 first circle center at (-3, 1) and r = 4

Draw example 5
Because both radii are the same we can write

(x + h)2 + (y + k)2 = (x + k)2 + (y + h)2

after manipulating this equation and eliminating same values we get the solution:

(h − k)(x − y) = 0

First solution is:   h = k

Substituting this value in both circles equation we see that both has same center at point   (−k , −k) and because the radii are the same, both circles are identical.

Second solution is when   y = x  and the circle equation becomes:

(x + h)2 + (x + k)2 = r2

2x2 + 2(h + k)x + h2 + k2 − r2 = 0
The solutions of this quadratic equation are:
x_(1,2)=(h-k±√((k-h)^2-2(h^2+k^2-r^2 ) ))/2

We know that  x = y  then  x1 = y1  and the intersection points of the two circles are at  (x1 , x1)  and  (x2 , x2).

And the length of the cord is:
D_cord=√((x_1-x_2 )^2+(x_1-x_2 )^2 )=√(2(x_1-x_2 )^2 )=√2 (x_1-x_2 )
The difference x1 − x2 is equal to:
x_1-x_2=√((k-h)^2-2(h^2+k^2-r^2 ) )
And the cord length is:
D_cord=√(4r^2-2(h+k)^2 )
(1)
When  Dcord = 0  or when  2r2 = (h + k)2  then the two circles are tangent to each other.
And the radius that will cause the tangency is:
r=|h-k|/√2
(2)
Substituting given values  h = 3  k = −1  and  r = 4  into equation  (1)  to get the common cord length:

D_cord=√(4∙4^2-2(3+1)^2 )=4√2

From equation (2) we find that if the radius is √2 then the two circles are tangent to each other.
Note:
  If the 2 solutions of a quadratic equation are:
    x_(1,2)=(-b±√(b^2-4ac))/2a
 
  then the difference between the solutions is:
    x_1-x_2=√(b^2-4ac)/a