This article explores the basic properties of inversive geometry from a computational point of view. Topics included in this part are involutions, generalized circles, and the inversion of segments, arcs, triangles, and quadrilaterals. The applications are to Nicomachus’s theorem, the inversion of tilings made by regular polygons, and an inversive spirograph.
Introduction
Geoff Smith, the author of [1], describes the technique of inversion as a “dark art.” A suitable interpretation of this description is offered by [2] as “an advanced technique, which can offer considerable advantage in solving certain problems.” This article examines the basic properties of inversive geometry, starting from the introduction of involutions and the family of generalized circles, the inversion of segments, arcs, triangles, and quadrilaterals with applications to Nicomachus’s theorem, the inversion of tilings made by regular polygons, and an inversive spirograph. This work extends and complements the material in [3, 4, 5].
Involutions
A transformation  that is not the identity with the property that
 that is not the identity with the property that  is called an involution (or an involutory transformation, self-inverse, or of period two). Familiar examples of involutions are multiplication by
 is called an involution (or an involutory transformation, self-inverse, or of period two). Familiar examples of involutions are multiplication by  and taking a reciprocal in arithmetic, taking a complement in set theory, taking the conjugate of a complex number (i.e.,
 and taking a reciprocal in arithmetic, taking a complement in set theory, taking the conjugate of a complex number (i.e.,  , if
, if  and
 and  are real), geometrical reflection in a line, the matrix transpose and matrix inverse, and the mapping of a number
 are real), geometrical reflection in a line, the matrix transpose and matrix inverse, and the mapping of a number  into
 into  , with
, with  an arbitrary number.
 an arbitrary number. 
An important example of an involution involves permutations. A permutation under the operation of group composition is an involution if it is of order 2; that is, if it can be written as a product of disjoint transpositions (cycles of length 2). For example, the 7-permutation  maps
 maps  ,
,  ,
,  ,
,  ,
,  ,
,  ,
,  ; it factors into cycles as
; it factors into cycles as  or, leaving out the fixed points 2, 3, 4, as
 or, leaving out the fixed points 2, 3, 4, as  .
.


The number of involutory  -permutations grows quickly with
-permutations grows quickly with  .
.


These numbers can also be readily obtained by solving a recurrence equation [6].


Consider reversion,  , an involution that maps a nonzero complex number to its reciprocal. Let
, an involution that maps a nonzero complex number to its reciprocal. Let  be the unit circle given by the equation
 be the unit circle given by the equation  or
 or  , with
, with  . It is easy to see that
. It is easy to see that  maps the interior of
 maps the interior of  to its exterior and vice versa; that is,
 to its exterior and vice versa; that is,  iff
 iff  . Moreover,
. Moreover,  iff
 iff  . Reversion maps the number
. Reversion maps the number  into the number
 into the number  , where
, where  is the conjugate of
 is the conjugate of  . Considering a complex number as a point in the complex plane, if a point is close to the origin, its reversion is far away, and vice versa.
. Considering a complex number as a point in the complex plane, if a point is close to the origin, its reversion is far away, and vice versa. 
Here is the reversion of a complex number.


Inversion,  , is an involution similar to reversion. For inversion,
, is an involution similar to reversion. For inversion,  and
 and  are collinear for nonzero
 are collinear for nonzero  . The point
. The point  inverts to the point
 inverts to the point  .
.


The following Manipulate compares reversion, inversion, and some similar transformations. Drag the point  ; the arrow starts at
; the arrow starts at  and ends at
 and ends at  for the chosen transformation
 for the chosen transformation  ; the interior of
; the interior of  is colored blue.
 is colored blue.


Generalized Circles and Ellipses
A linear transformation maps the family of lines to itself. The following theorem suggests a family that may be preserved by inversion.
Theorem 1
 that satisfy the equation
 that satisfy the equation  , with
, with  ,
,  ,
,  ,
,  real numbers, invert into points that satisfy the equation
 real numbers, invert into points that satisfy the equation  .
.To verify this, apply the transformation corresponding to inversion of Cartesian points.


Let  be the set of points that satisfy the first equation in theorem 1. This four-parameter family includes points (for instance, when
 be the set of points that satisfy the first equation in theorem 1. This four-parameter family includes points (for instance, when  and
 and  ), lines (when
), lines (when  ), circles (when
), circles (when  ), the whole plane (when
), the whole plane (when  ), and the empty set (when
), and the empty set (when  ).
). 
Define a generalized circle to be a line or circle. (The function generalizedCircle defined below constructs the graphics objects to draw the line or circle.) Under inversion, the generalized circle  transforms into the generalized circle
 transforms into the generalized circle  . If
. If  , (and
, (and  ,
,  are not simultaneously 0), then
 are not simultaneously 0), then  is a line. If
 is a line. If  , the equation
, the equation  corresponds to a circle with center
 corresponds to a circle with center  and radius
 and radius  , provided that
, provided that  . If
. If  ,
,  passes through the origin. For any nonzero
 passes through the origin. For any nonzero  ,
,  is the same as
 is the same as  .
.
Other families of polynomials in two variables that include generalized circles do not transform their members into members of the same family; that is, they are not closed under inversion. For instance, the six-parameter family of equations  includes conic sections, but some invert into quartics.
 includes conic sections, but some invert into quartics.


Theorem 2
The parameters needed to describe such a line are obtained by solving the following equation.


Theorem 3
This result is readily obtained by expanding the Cartesian equation of such a circle.


From a structural point of view, if a generalized circle is mapped to itself, it is said to be preserved by inversion. (Warning: that is not the same as saying that a point on a generalized circle is mapped to itself; for instance, a rotation about the center of a circle preserves the circle but moves each point of the circle.) In that case,  . If
. If  , the line passes through the origin and each point is inverted into its negative. If
, the line passes through the origin and each point is inverted into its negative. If  , and
, and  , the circle
, the circle  is preserved. Assume its center is at a point of the form
 is preserved. Assume its center is at a point of the form  . Then, in particular, the point
. Then, in particular, the point  is inverted into the point
 is inverted into the point  .
.


Hence  ; that is, the origin, center, and either of the two intersection points of the circle and the unit circle
; that is, the origin, center, and either of the two intersection points of the circle and the unit circle  form a right triangle; hence the circle is orthogonal to
 form a right triangle; hence the circle is orthogonal to  . This condition turns out to be necessary and sufficient for a generalized circle to be preserved. Theorem 1 implies the following results, which also apply conversely.
. This condition turns out to be necessary and sufficient for a generalized circle to be preserved. Theorem 1 implies the following results, which also apply conversely.
- Any circle not passing through the origin inverts into a circle not passing through the origin (in fact passing through its intersection points with the unit circle  , if any). , if any).
- Any circle passing through the origin inverts into a line not passing through the origin (in fact passing through its intersection points with  , if any; in general, this line is parallel to the tangent of the circle at the origin). , if any; in general, this line is parallel to the tangent of the circle at the origin).
- Any line passing through the origin is preserved by inversion (any point is mapped into its negative).
- Any line not passing through the origin inverts into a circle passing through the origin (and its intersection points with  , if any). , if any).
To make inversion continuous, define the inversion of the origin to be a legal point, the “point at infinite,”  , making the phrase “nonzero” unnecessary when talking about inversion. Inversion is thus a one-to-one map of the extended plane.
, making the phrase “nonzero” unnecessary when talking about inversion. Inversion is thus a one-to-one map of the extended plane. 
Conversions of generalized circles to and from graphics primitives are handled by the following functions.








For example, the following Manipulate shows how a line and a circle behave under inversion. To vary their positions, drag the two small disks. For a line, the disks are points on the line; for a circle, one disk is the center and the other is on the circumference. You can also choose a family of parallel lines or a family of concentric circles. The arrows show the action of the inversion on the two control points.


Concentric circles do not invert into concentric circles, and the center of a circle does not invert into the center of its inversion (although the two centers are collinear with the origin). The center of the inverted circle can even be outside the original circle! (This particularly applies to  ; its interior gets mapped into its exterior and its center gets mapped to
; its interior gets mapped into its exterior and its center gets mapped to  .) The next section shows how to locate the center of the inversion of a given circle.
.) The next section shows how to locate the center of the inversion of a given circle.
As a circle is a particular kind of ellipse, it is interesting to see the inversion of a general ellipse. The following Manipulate shows such an inversion; you can drag the center of the ellipse with a locator and vary the lengths of its axes with a pair of sliders. Contour lines showing concentric ellipses are optional; increase the zoom slider if the display is all one color.


Inversion in an Arbitrary Circle
Up to now, inversion has been in the unit circle; it can be generalized to use any circle  . Assume
. Assume  , which means
, which means  has center
 has center  and radius
 and radius  . The generalization takes three steps: first transform
. The generalization takes three steps: first transform  into
 into  by translating
 by translating  to the origin and scaling by
 to the origin and scaling by  . Second, invert in
. Second, invert in  . Third, scale back by
. Third, scale back by  and translate back by
 and translate back by  . As these operations are rigid motions, all the properties of inversion apply to the generalized inversion.
. As these operations are rigid motions, all the properties of inversion apply to the generalized inversion. 
The function squareDistance computes the square of the Euclidean distance between two given points. (It is more convenient to use the following definition than the built-in Mathematica function SquaredEuclideanDistance.)

Thus, operating with Cartesian coordinates, the function inver inverts a given point  in
 in  .
.



An interesting property of inversion is adopted by many authors as an alternative way of defining inversion. Let  be the inversion of the point
 be the inversion of the point  in the circle
 in the circle  . It is easy to verify that the product of the distance of
. It is easy to verify that the product of the distance of  to
 to  and the distance of
 and the distance of  to
 to  is a constant equal to
 is a constant equal to  .
.


Therefore, define the point  as the inverse of
 as the inverse of  if
 if  is that unique point such that its distance to
 is that unique point such that its distance to  times the distance of
 times the distance of  to
 to  is
 is  [7].
 [7].
When the points  ,
,  , and
, and  are collinear (which includes the case of two or all of them being equal), the function
 are collinear (which includes the case of two or all of them being equal), the function  applies a small random displacement to them to give three new noncollinear points.
 applies a small random displacement to them to give three new noncollinear points.

The function circleABC computes the circle passing through three given points a, b, c.

Before obtaining the Cartesian coordinates corresponding to inverting circles and lines, first consider the following problem. What is the center of the circle through three different noncollinear points ,
,  ,
,  ?
?
For example, here are explicit formulas for the center and radius of such a circle through  ,
,  , and
, and  .
.


The denominators of the expressions for the center and radius contain a factor that is zero only when  ,
,  , and
, and  are collinear.
 are collinear.


Now consider an arbitrary circle  that does not pass through the center
 that does not pass through the center  of
 of  . Invert
. Invert  in
 in  to
 to  and then invert
 and then invert  in
 in  to
 to  . Then the inversion of
. Then the inversion of  in
 in  is a circle with center
 is a circle with center  . The equality of the following two results verifies this property.
. The equality of the following two results verifies this property.




Theorem 4
The vertical bars in the last expression have two different meanings: the modulus of a vector and the absolute value of a number. Theorem 4 arises from using the property mentioned in the previous paragraph. First we obtain the square of the radius of  .
.



Match the center of  with
 with  to get the following.
 to get the following.


So a circle  is inverted into a concentric circle if
 is inverted into a concentric circle if  is outside the circle of inversion
 is outside the circle of inversion  and
 and  . This implies that
. This implies that  and
 and  are orthogonal. Therefore, a circle inverts into a concentric circle (and necessarily of the same radius, i.e. itself) iff it is orthogonal to
 are orthogonal. Therefore, a circle inverts into a concentric circle (and necessarily of the same radius, i.e. itself) iff it is orthogonal to  . To visualize these ideas, consider the following Manipulate that inverts a pattern of tangent circles.
. To visualize these ideas, consider the following Manipulate that inverts a pattern of tangent circles.



Inverting Segments and Arcs
The inversion of a polygon is a closed sequence of arcs of circles that go through the center of inversion. Consider the problem of finding an arc through three noncollinear points  ,
,  , and
, and  . As stated, this problem has many solutions; by assuming one of the points is not an endpoint of the arc, there is a unique answer. The function arcABC constructs such an arc and includes an argument to control whether the arc passes through the point
. As stated, this problem has many solutions; by assuming one of the points is not an endpoint of the arc, there is a unique answer. The function arcABC constructs such an arc and includes an argument to control whether the arc passes through the point  .
.

The following Manipulate applies the function arcABC to any three noncollinear points, optionally passing through one of them.


Let the inversion of the point  be
 be  and the point
 and the point  be
 be  . There are four cases for the inversion of the finite line segment
. There are four cases for the inversion of the finite line segment  in the circle
 in the circle  .
. 
-  If  , the segment is a point and inverts into the point , the segment is a point and inverts into the point . .
- If  and and , the segment , the segment inverts into a ray starting at inverts into a ray starting at , going away from , going away from . .
- If  , , , and , and are collinear, there are two subcases: are collinear, there are two subcases:
- If  and and are not collinear with are not collinear with , consider the circle passing through , consider the circle passing through , , , and , and . The inversion of . The inversion of is the arc joining is the arc joining and and that does not pass through that does not pass through . .
 is in between
 is in between  and
 and  , the inverse is the union of two rays, one starting at
, the inverse is the union of two rays, one starting at  , the other starting at
, the other starting at  , and both going away from
, and both going away from  .
. and
 and  are on the same side of
 are on the same side of  , and the inverse of
, and the inverse of  is a line segment joining
 is a line segment joining  and
 and  on the same side of
 on the same side of  as
 as  and
 and  , but now switched around.
, but now switched around.Similar results apply to the inversion of an arc. The following Manipulate shows all these cases as they apply to line segments and arcs. The initial segments or arcs are shown in red and their inversions in blue. Control locators are drawn in red. When a segment/arc is such that its corresponding line/circle passes through  , say that it does so directly if
, say that it does so directly if  is part of the segment/arc and indirectly otherwise.
 is part of the segment/arc and indirectly otherwise.


Inverting a Triangle and a Quadrilateral
The function invSeg encapsulates the four cases appearing in the inversion of a segment mentioned in the previous section.






The function invert is extended here to invert a general triangle and a general quadrilateral. As mentioned before, the inversion of a polygon is a figure made by adjoining arcs of circles that pass through  . (The geometry of coincident arcs is the same as the geometry of polygons. Just invert them!) However, the interior of a polygon does not invert to the interior of its inverse. The function fill fills this interior for aesthetics.
. (The geometry of coincident arcs is the same as the geometry of polygons. Just invert them!) However, the interior of a polygon does not invert to the interior of its inverse. The function fill fills this interior for aesthetics.


The following Manipulate shows a triangle or quadrilateral and the corresponding filled inversion. You can zoom by changing the radius of the circle of inversion  . For what positions of
. For what positions of  do the sides of a given triangle invert into three congruent circles? Hint: it has something to do with its incircle. What about a quadrilateral?
 do the sides of a given triangle invert into three congruent circles? Hint: it has something to do with its incircle. What about a quadrilateral?


Inverting the Visual Proof of Nicomachus’s Theorem
Nicomachus’s theorem [8, 9] states that  . This section inverts a well-known pattern showing a proof without words of this identity.
. This section inverts a well-known pattern showing a proof without words of this identity.
To justify the identity, consider the pattern made by half-squares and squares of increasing integer side lengths. The area of the big square is the square of the sum of the side lengths on the base  . On the other hand, this area is the sum of the individual areas of the interior squares, taking into account that two half-squares make a whole square:
. On the other hand, this area is the sum of the individual areas of the interior squares, taking into account that two half-squares make a whole square:  . Logically these quantities are the same; hence Nicomachus’s theorem.
. Logically these quantities are the same; hence Nicomachus’s theorem.


In order to get a symmetrical version, promote the half-squares into squares.


Add replicas around the lower-left vertex of the unit square made by rotating this pattern 90, 180, and 270 degrees to obtain a symmetrical pattern. Then eliminate repeated squares; moreover, eliminate repeated segments from adjacent squares using filter.

The function NicomachusSegments computes the segments needed to form the next pattern shown, which gives a visual proof of Nicomachus’s theorem [9].



The function NicomachusSegments computes the minimum number of segments necessary to produce the pattern. This is the number of segments up to  .
. 


The  pattern has
 pattern has  segments and
 segments and  squares. Not removing unnecessary segments would give
 squares. Not removing unnecessary segments would give  segments, so for large
 segments, so for large  , removing unnecessary segments is more than four times better. The following Manipulate shows Nicomachus’s pattern in gray along with its inversion in red. You can change
, removing unnecessary segments is more than four times better. The following Manipulate shows Nicomachus’s pattern in gray along with its inversion in red. You can change  and thus
 and thus  by dragging the locator, and you can vary
 by dragging the locator, and you can vary  with the slider.
 with the slider.


Inversive Tiling with Equilateral Triangles, Squares, and Hexagons
There are only three ways to tile the plane with a regular polygon: using an equilateral triangle, a square, or a regular hexagon. The goal of this section is to show the patterns arising from inverting these tilings. To that end, the functions ring3, ring4, and ring6 generate the corresponding set of pieces in a ring surrounding the circle of inversion (in red).
Here is the triangular case for the first level of complexity  .
.





The corresponding function invert, with an extra argument with possible values 3, 4 or 5, inverts each of the segments forming the tiling. For instance, here is the pattern for the triangular case.



Although the interiors of triangles are not preserved by inversion, they are filled to show the interference patterns they produce. The idea is shown in the next figure; to avoid clutter, only the first four members of  are drawn. Lines join the vertices of the triangles to their inversions.
 are drawn. Lines join the vertices of the triangles to their inversions.


Although the triangles do not overlap, the interiors of their inverses do. In fact, the inversion of the central triangle contains the interiors of all the rest. The next level of complexity renders the following pattern.


Finally, a detail showing the sixth level.


Similarly, in the case of tiling with squares, here are the corresponding functions.





Here is a detail corresponding to the first four squares of the arrangement  .
.


And here is a detail of the sixth level. (The color assignment has to be made explicit and does not rely only on overlapping as it did before.)


The tiling using regular hexagons cannot be colored with two colors, and there are too many segments to place the center of  . So here is a line pattern.
. So here is a line pattern.





The second level of complexity corresponding to the above pattern is the following.


This detail shows the sixth level of complexity, made with shapes formed with six arcs, all passing indirectly through  .
.


An Inversive Spirograph
Finally, the following Manipulate shows an animated circle (orange) rotating inside a circle (pale brown) and the patterns generated by a point at the end of a line at a variable distance from the center of the circle. By varying the center and radius of the inversive circle, you can zoom in; the rotating radial line inverts into an arc orthogonal to the inversive path. You can enlarge the inversion by dragging the center of the inversive circle (light blue).


References
| [1] | G. Smith, A Mathematical Olympiad Primer, London: United Kingdom Mathematics Trust, 2008. | 
| [2] | A. Goucher. “Complex Projective 4-Space.” (Jun 24, 2013). cp4space.wordpress.com/2012/11/04/final-chapter-of-moda. | 
| [3] | J. Rangel-Mondragon, “Inversive Patterns, Part I: Complex Inversion,” Mathematica in Education and Research, 12(2), 2007 pp. 162–183. | 
| [4] | J. Rangel-Mondragon, “Inversive Patterns, Part II: Fundamental Properties of Inversion,” Mathematica in Education and Research, 12(4), 2007 pp. 330–354. | 
| [5] | J. Rangel-Mondragon, “Inversive Patterns, Part III: Common Tangents, Mandalas and Gothic Windows,” Mathematica in Education and Research, 12(4), 2007 pp. 355–376. | 
| [6] | N. J. A. Sloane. seq. A001189 in The On-Line Encyclopedia of Integer Sequences. oeis.org. | 
| [7] | H. S. M. Coxeter and S. L. Greitzer, Geometry Revisited, New York: Random House, 1967. | 
| [8] | E. W. Weisstein. “Nicomachus’s Theorem” from Wolfram MathWorld—A Wolfram Web Resource. mathworld.wolfram.com/NicomachussTheorem.html. | 
| [9] | M Schreiber. “A Visual Proof of Nicomachus’s Theorem” from the Wolfram Demonstrations Project—A Wolfram Web Resource. demonstrations.wolfram.com/AVisualProofOfNicomachussTheorem. | 
| J. Rangel-Mondragon, “Inversive Geometry: Part 1,” The Mathematica Journal, 2013. dx.doi.org/doi:10.3888/tmj.15-7. | |
About the Author
Jaime Rangel-Mondragón received M.Sc. and Ph.D. degrees in Applied Mathematics and Computation from the School of Mathematics and Computer Science at the University College of North Wales in Bangor, UK. He was a visiting scholar at Wolfram Research, Inc. and held positions in the Faculty of Informatics at UCNW, the Center of Literary and Linguistic Studies at the College of Mexico, the Department of Electrical Engineering at the Center of Research and Advanced Studies, the Center of Computational Engineering (of which he was director) at the Monterrey Institute of Technology, the Department of Mechatronics at the Queretaro Institute of Technology and the Autonomous University of Queretaro in Mexico, where he was a member of the Department of Informatics and in charge of the Academic Body of Algorithms, Computation, and Networks. His research included combinatorics, the theory of computing, computational geometry, and recreational mathematics. Jaime Rangel-Mondragón died in 2015.

 NB
NB and
 and  corresponds to the generalized circle
 corresponds to the generalized circle  if
 if  and
 and  otherwise.
 otherwise. and radius
 and radius  corresponds to the generalized circle
 corresponds to the generalized circle  .
. inverts in
 inverts in  into the circle
 into the circle  , then the center of
, then the center of  is
 is  and its radius is
 and its radius is  .
.