Monge's Circle Theorem

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]




Search WWW


As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.


Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 


We receive a few cents from each purchase.  Thanks


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa 365 Puzzlers  Calendar 2017

Mensa 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)


Feedback:  Send an e-mail with your comments about this program (or anything else).

Search only




Problem Description

Illustrate Monge's Circle Theorem:  If the possible 3 pairs of common exterior tangents to 3 circles exist and intersect then the intersection points are collinear  (lie on the same straight line). 

Background & Techniques

I ran across this in Ivan Moscovich's excellent 2004 puzzle book Leonardo's Mirror & Other Puzzles, which contains about 90 puzzles that I haven't seen elsewhere.  The  link lists several used copies available for under $5.00 and new copies for less than $8.00 both including shipping.  

For the tangent lines to exist, no circle can be entirely contained within another.  For the 3 pairs of circle-to-circle tangent lines to intersect, no 2 circles can have the same radius.   The program available here doesn't prove the theorem, but every apparent counter example i have found so far was the result of a program bug.  Most of those seem to have been squashed by now.

The program will define 3 random circles that meet the above conditions (unique sizes and not completely overlapped) plus meeting the added requirement that the intersections occur within the visible image area.     You may also use click and drag processing to define three circles.  The tangent lines are automatically drawn as circles are defined. 

Once the circles are drawn by either method, they may be moved and resized as desired to try to disprove the theorem (or break the program J). 

Non-programmers are welcome to read on, but may want to skip to the bottom of this page to download executable version of the program.

A preparatory update to our UGeometry unit added routines to solve the toughest math parts of the problem (rotating and translating lines,  circle-circle intersections, point-circle tangents, and circle-circle external tangents).

Using those routines, mainly circle-circle tangents, left the image drawing as the primary problem for this program to solve.  I decided to use a TPaintbox, control for  drawing efficiency.  The Paint procedure redraws the figure each time it is invoked.  Setting the form doublebuffered property eliminates flicker as the figures are being redrawn.  The figures to be drawn are

bulletThe circles (Circles:array[1..3] of TCircle;)
bulletThe tangent lines, Tangents;array[1..6] of TLine;
bulletThe line connecting the intersection points of each of the 3 pairs of tangents, actually drawn as two lines, MongeLine1, and MongeLine2, from each of the two most distant intersection points to the 3rd point.  

The "Create random circles" button creates a random valid set of figures with tangents intersecting within the paint box borders.  The user may also use click and drag mouse operations to define the three circles. 

Circles created by either method may be moved or resized using the mouse.  Left mouse presses on or near the center of a circle start a move operation. Presses near the circle edge and within the circle start a resize operation.  A "Mouse down" event exit determines if the mouse is within an existing circle (to be moved or resized) or in an empty area (defining a new circle).  Every mouse move operation with the left button pressed draws the all existing circles and tangents and the line connecting the intersection points if they exist.

Two variables help the mouse exits determine actions to be taken.  Variable WorkingOn  identifies which circle is being moved or resized. Variable Working specifies which operation (moving or sixing) is being carried out.

The program uses functions in our DFF Library UGeometry unit.  To  recompile the program requires a one-time download of our library file or later. . 

Running/Exploring the Program 

bullet Download  executable
bullet Download source
bullet Download current DFF Library source (DFFLibV15)

Suggestions for Further Explorations



Original Date: December 26, 2008 

Modified: May 15, 2018


  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2018, Gary Darby    All rights reserved.