Find new theorems in elementary geometry by observing distances between intersections of diagonals of a regular polygon
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Find new theorems in elementary plane geometry by observing distances between intersections of diagonals of a regular polygon.

Given a regular polygon and four diagonals d, e, f and g of it. Let the points R and S be the intersections of d and e, and f and g, respectively.

By using algebraic geometry and elimination it is possible to set up an equation to express the distance RS by using the length of the side of the polygon.

This tool uses your web browser to find interesting setups when RS is a rational number, or a root of a quadratic polynomial (that is, a quadratic surd). This can be optionally changed.

The computations are performed by the WebAssembly version of the Giac computer algebra system. Therefore you need a recent web browser, and also a modern web server.

During processing, a GeoGebra file will be created in your browser that contains all positive outputs of the run.


Put the files in this folder in a directory which is accessible on the internet by a web browser. Then point your browser to the index.html file by adding parameters n and s where n is the number of sides of the regular polygon and s is the setup number to start, in most cases 0. You can use the parameter e to set the last case to investigate. If it is not set, the tool assumes that all cases need to be checked for the given n.


The output will be shown like this:

Welcome to RegularNGons (
Starting with n=5, s=460
Assuming r=0 ('rationals only' is off), please append &r=1 to the URL to override
Assuming mindegree=1, please append &m=... to the URL to override
Assuming maxdegree=2, please append &M=... to the URL to override
Not ignoring symmetry, please append &S=0 to the URL to ignore (this speeds up computation)
Not ignoring already found lengths, please append &f=1 to override
s can be incremented until 990
Computation will stop at 470
Waiting for the CAS...
Elapsed time: 0h 0m 8s
...CAS is up and running
Setting up GeoGebra applet
n=5, s=460: A=0, B=2, C=1, D=2, E=2, F=3, G=3, H=4: {RS^2-1}, {{RS=1}}
n=5, s=461: A=0, B=2, C=1, D=2, E=2, F=4, G=3, H=4: {RS^4-3*RS^2+1}, {{RS=(1/2*(√5+1))},{RS=(1/2*(√5-1))}}
n=5, s=462: A=0, B=2, C=1, D=3, E=0, F=2, G=1, H=4: {RS^4-7*RS^2+1}, {{RS=(1/2*(√5+3))},{RS=(1/2*(-√5+3))}}
n=5, s=463: A=0, B=2, C=1, D=3, E=0, F=2, G=2, H=3: {RS^4-3*RS^2+1}, {{RS=(1/2*(√5+1))},{RS=(1/2*(√5-1))}}
n=5, s=464: A=0, B=2, C=1, D=3, E=0, F=2, G=2, H=4: {RS^4-3*RS^2+1}, {{RS=(1/2*(√5+1))},{RS=(1/2*(√5-1))}}
n=5, s=466: A=0, B=2, C=1, D=3, E=0, F=3, G=0, H=4: {RS^2-1}, {{RS=1}}
n=5, s=468: A=0, B=2, C=1, D=3, E=0, F=3, G=1, H=3: {RS^2-1}, {{RS=1}}
n=5, s=469: A=0, B=2, C=1, D=3, E=0, F=3, G=1, H=4: {RS^4-3*RS^2+1}, {{RS=(1/2*(√5+1))},{RS=(1/2*(√5-1))}}Elapsed time: 0h 0m 11s
Finished after finding 8 solutions
0 cases were not checked to ignore symmetry

This means, that in a regular pentagon 990 cases will be observed. For example, case #462 describes the setup when the diagonals are as follows:

  • d joins the 0th and 2nd vertices,
  • e joins the 1st and 3rd vertices,
  • f joins the 0th and 2nd vertices,
  • g joins the 1st and 4th vertices.

Now by considering the intersection of d and e (that is, point R), and f and g (that is, point S), the distance of R and S can be expressed by the equation d^4-3*d^2+1=0. Since only the positive roots have a geometric meaning, RS must be one of the following numbers:

  • (3-√5)/2
  • (3+√5)/2

Both results are possible geometrically. The first one occurs in the standard case, and the second one for a regular star-pentagon: a regular pentagon a regular star-pentagon

Other parameters

The parameter u will force searching for results given as parameters. For example, u=2 considers only the outputs that are of RS=2.

By adding m=... or M=... the minimal and maximal degree of outputs can be controlled. By default m=1 and M=2.

The option S=0 tries to avoid checking cases that were already checked in an symmetrically equivalent position. When this is set, only the A=0, Bn/2 cases will be checked.

When using f=1, once a length is found, no more results will be printed that have the same length.

The option a=... allows searching for an approximate value of the given parameter. By combining this with the option E=... the output can be somewhat filtered to have only the non-star-regular cases reported if the numerical difference is below E. (By default E=Infinity.)

The option z=... allows saving and retreiving results later by using an additional script. See the file server.php for more details.


The following theorems have been found by using RegularNGons:

Known issues and workarounds

  • Note that for bigger n the computations may be slow, or some computation steps may be timed out or the application can crash. This can be avoided partly by using the z=... option.
  • You may use the console of your browser by pressing F12 on the startup to get more information on the progress.
  • Some checked cases are duplicated because intersecting different diagonals may result in the same point.
  • The tool is not working properly in some browsers.