## Circle Intersection Solver

#### by Stephen R. Schmitt

 Circle 1: x2 + y2 + x + y + = 0, Circle 2: x2 + y2 + x + y + = 0.

### Contents

This is a Java Script calculator that computes the intersection points of two circles in a plane.

To operate the calculator, enter the parameters for the circle in general form. Press the Compute button to calculate the point(s). The result will be displayed in a new window. The Test button inserts a test case into the coefficient windows.

On invalid entries, the Message windows will display an error message.

#### 2. The source code

You may use or modify this source code in any way you find useful, provided that you agree that the author has no warranty, obligations or liability. You must determine the suitability of this source code for your use.

#### 3. Discussion

A general form for the equation of a circle is:

 x² + y² + Dx + Ey + F = 0.

The center and radius can be obtained by completing the squares:

 æè x² + Dx + D² öø + æè y² + Ey + E² öø = −F + D² + E² 4 4 4 4

or

 æè x + D öø ² + æè y + E öø ² = D² + E² − 4F · 2 2 2

Since the sum of the squares of two real numbers is positive or zero, the left-hand member is positive or zero if x, y, D, E are real numbers. Hence the equation can be satisfied by real coordinates x, y only if D² + E² − 4F is a positive number or zero.

If D² + E² − 4F is positive, the equation represents a circle with center

 C = (−D/2, −E/2)

 r = 1⁄2 √ D² + E² − 4F

If D² + E² − 4F is zero, the equation represents the point (−D/2, −E/2).

If D² + E² − 4F is negative, the equation represents no real locus.

The calculator computes the center and radius for both circles in order to compute the points of intersection of two circles.

The centers of the two circles and the points of intersection (when there are two) form a geometric figure called a convex kite. In geometry, a kite is a quadrilateral with two pairs of congruent adjacent sides. Equivalently, a kite is a quadrilateral with an axis of symmetry along one of its diagonals. A kite may be either convex or concave. The following properties of convex kites allow us to compute the location of the intersection:

(1) The two diagonals of a kite are perpendicular;

(2) One diagonal divides a convex kite into two isosceles triangles; the other (the axis of symmetry) divides the kite into two congruent triangles.

The distance between the centers of the circles is given by:

 d = √ (x1 − x2)² + (y1 − y2)²

If d is greater than the sum of the circles' radii, r1 + r2,  then there are no solutions because the circles are too far apart; if d is less than the difference of the circles' radii |r1r2|,  then there are no solutions because one circle is entirely within the other; if d = r1 + r2,  then there is one solution because the circles touch at one point; otherwise there are two solutions.

The intersection points are found by applying the Pythagorean Theorem.

Another method for finding the points of intersection is to subtract one circle equation from the other to obtain a linear equation in x and y. Then the points are found in the same manner as finding the intersections of a circle and a straight line.