Gauss' Java Trip
A Mathematical Travel Report

Admittedly, the title of this blog is slightly misleading. If you expect a story about the great mathematician Carl Friedrich Gauss (1777-1855) visiting a tropical island, you will be disappointed. The only island, Gauss set his step on during his 78-year long life, was the small Frisian Island of Wangerooge. While on duty with the survey of the kingdom of Hanover in 1825 Gauss entered the Westturm  to use it as vertex of a triangulation.

However, it should be clear that it's not the island  Java but the programming language, that is dealt with. And the trip  is rather the experience to see a theory of Gauss be materialized in Java code[1]. To be specific: a great part of the following pages will be dedicated to the development of a Java program that can perform the construction of regular polygons, especially of the 17-gon, the 257-gon and even the 65537-gon, using the theory Gauss discovered in 1796.

## Gauss' Theory of Cyclotomy

The story of the nineteen year old Gauss, who in the early morning of March, 29th 1796 (a tuesday) suddenly became aware, that the construction of the regular 17-gon should be possible with ruler and compass, belongs to mathematical folklore. Gauss tells about this in a letter to Gerling (quoted from [Biermann 1990]; English translation quoted from [Ziegler 2013]):

Der Tag war der 29. März 1796, und der Zufall hatte gar keinen Anteil daran. […] Durch angestrengtes Nachdenken über den Zusammenhang der Wurzeln untereinander nach arithmetischen Gründen glückte es mir, bei einem Ferienaufenthalt in Braunschweig am Morgen (ehe ich aus dem Bette aufgestanden war), diesen Zusammenhang auf das klarste anzuschauen, so dass ich die spezielle Anwendung auf das 17-Eck und die numerische Bestätigung auf der Stelle machen konnte.
The day was the 29th of March 1796, and chance had no part in it. […] On the morning of the said day during a vacation trip in Braunschweig (before I had risen from my bed), thinking strenuously about the relationship of all the roots among each other according to arithmetic criteria, I succeeded in being able to view these relationships most clearly, so that I could see the special application to the 17-sided polygon, and I could make the numerical confirmation of the result on the spot.

It is said that this discovery gave the decisive impetus to Gauss' further studies, namely to concentrate on mathematics and to abandon the study of classical languages, which he had considered as an alternative.

Gauss' method, known as cyclotomy, can immediately be applied to all regular polygons with a prime numer of vertices, if the prime number is of the form $p = 2^k + 1$. Prime numbers of this form are called Fermat primes  and it can be shown, that they can be prime only if the exponent $k$ itself is a power of two (details will follow). Thus the number $p$ has to be of the form $2^{2^n}+1$. Up to now Fermat primes are known for $n=0,1,2,3,4$, these are $3,5,17,257$ and $65537.$ For $n=5$ and all values till $n=32$ the numbers $2^{2^n}+1$ are composite, not prime. Whether there exist only finally many Fermat primes, is an unsolved problem.

Following Gauss, a regular polygon with a prime number of vertices can be constructed with ruler an compass if its number of vertices is $3, 5, 17, 257$ or $65537$. We won't worry about polygons with more than $2^{2^{32}}+1$ vertices, which might exist, if there are Fermat primes other than the five given above. By the way, Gauss himself did not  prove the fact, that these polygons are the only  ones with a prime number of vertices that can be constructed in this way[1]. This proof of the converse of Gauss' theorem was given in 1837 by the French mathematician Pierre-Laurent Wantzel (1814-1848) [Wantzel 1837].

Starting with a polygon with a prime number of vertices one can construct a lot of other regular polygons, e.g. by successively bisecting the central angles and thus doubling the number of vertices. This is not very interesting for mathematicians, so we will mostly restrict ourselves to polygons with a prime number of vertices.

Now you may ask, what's so interesting about the construction of regular polygons that blogs or even books are written about it. Indeed, Gauss' discovery caused a sensation among the mathematicians almost immediately after its publication. Surely, a moment of surprise played a role in this hype. In ordinary mathematics the solution of a problem is in the air. Several mathematicians work hard for years and present partial solutions from time to time. When someone finally comes up with the complete solution, a gasp of relief will run through the mathematical community, but there will be no standing ovations. There may be exceptions from this rule, when a problem is solved, which had almost been given up by the mathematical mainstream, like the proof of Fermats last theorem in 1993/95.

In contrast, Gauss cyclotomy came like a bolt out of the blue. Since the time of Euclid (325 BCE) it was known that regular triangles, squares and pentagons can be constructed with ruler and compass – and, of course, all regular polygons created from these by successively bisecting the central angles. It was known as well that by skilled combination the regular 15-gon can be constructed out of the triangle and the pentagon (details will follow soon). For more than 2000 years there had been no progress on this field and so the mathematicians of that time felt like lazybones caught asleep at work, when the teenage Gauss published his results.

But that's only one reason for the publicity Gauss gained with his cyclotomy. Another reason was the way, how  the problem had been tackled by him. For the unaided eye the problem seemed to be purely geometrical. But Gauss used only algebraical  methods for his solution. Gauss himself even called them arithmetical, because he could reduce facts about the constructability of polygons to facts about the relationships among whole numbers [2]. Doing so, he got such a deep insight into this web of relations, that he could not only (as a side-effect) answer the question of the constructibility of polygons but create the foundation for several large mathematical theories, which keep mathematicians occupied up to now.

Gauss' discovery thus is an impressive example of the beauty, mathematicians see in their subject, namely the sudden and unexpected appearance of relations between theories that seemed to be far apart from each other – like geometry and arithmetic. To sniff out such relations makes mathematics a fascinating journey into unknown territories.

To be honest, many of these mathematical journeys (like the aforesaid proof of Fermats last theorem) cannot even be started unless you join a professional expedition with trained members. This is not the case for Gauss' theory of cyclotomy. The subtitle of this blog points out my opinion, that the journey described by this mathematical travel report can be successfully completed without years of training.

## Richelot and Hermes

Without going into details about the exact definition of constructibility with ruler and compass, it must be remarked that Gauss himself gave only the construction of the 17-gon, and he did it not  by writing down step-by-step instructions for the handling of the tools. In fact, he just published a certain arithmetical expression for the coordinates of one vertex of the 17-gon. The special kind of this expression guaranteed the constructibility. It is easily seen that the construction of the 257-gon or even more of the 65537-gon can hardly be performed in physical reality  with ruler, compass and paper[3]. A rough estimate shows that even with a circumcircle of 5 meters radius the length of each side of a 65537-gon would be less than a millimeter. So the best approximation when drawing a 65537-gon would in fact be a circle. To give a construction for these polygons does always mean to give a special kind of description  how such a construction can be performed in principle. Exactly that is the purpose of the Java program, we are going to develop on the following pages, namely to generate and print out such a kind of description mechanically. Because this description is given in form of a (sometimes huge) number of square roots, we will use the term roots  as a synonym for this description.

The construction of the 257-gon in the said manner was performed in 1832 by Friedrich Julius Richelot (1808-1875) [Richelot 1832] and the construction of the 65537-gon occupied the high school teacher and later professor Johann Gustav Hermes (1846-1912) [Hermes 1894] a solid ten years from 1879 to 1889. His notes in form of tables, check lists etc. fill up a whole suitcase, the so called Hermeskoffer, which is still kept in the library of the Mathematical Institute in Göttingen (see Ch.10 Remarks about J.G.Hermes).

When I was a student in Göttingen, I could assure myself by personal inspection that it would be very  difficult, to say the least, to reproduce the construction of a 65537-gon using the material from the Hermeskoffer. So, it is one purpose of these pages to fill this gap and to provide a construction of the 65537-gon which can be reviewed by anybody feeling inclined.

If by now you are curious about the mysterious description of the construction of the 65537-gon, you may have a look into this PDF. But if you want to know, what's it all about those many roots, you cannot avoid reading the following chapters of this blog.

## What Can be Expected and What Cannot

Because this blog is not written for the professional mathematician but for teachers, senior high-school students and undergraduates, we will start almost from scratch and the first chapters may be boring for some of you. In university courses the constructability of regular polygons is dealt with as a marginal note within lessons about Galois theory. If you already heard such a lesson, Ch.9 of this blog may provide you with the connection between the abstract theory and the practical job of the Java program and you may omit the elementary  stuff.

Of course, every interested person is invited to read the following travel report. Some previous knowledge could be helpful to avoid dropping out of the trip untimely. So, you should have made short excursions into the areas $\mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{R}$ and possibly $\mathbb{C},$ of the natural numbers, the integers, the rational , real and complex numbers. To solve equations, especially quadratic equations should be no unfamiliar job and the trigonometric functions sine and cosine should not be all Greek to you. If you know a bit about polynomials and remember to have heard about modular arithmetic, groups and fields[4] nothing can go wrong. To understand every detail of the Java code it would be fine, if you wrote some Java programs by yourself, but a superficial knowledge of programming languages like C#, C++, C or JavaScript is sufficient, if you want only to follow the algorithms.

We start in the first chapter with a discussion about the proper definition of constructability with ruler and compass. It follows a short survey about the complex plane in general and the complex roots of unity in particular. That leads immediately to the special properties of the $p$-th roots of unity if $p$ is a Fermat prime, those properties discovered by the 19 year old Gauss, which lead to the construction of the 17-gon. Generalizing from the 17-gon one can develop the algorithm that is implemented in Java and presented in chap.6. In chap.7 you find the output of the Java program, namely the description how to construct a pentagon, a 17-gon and a 257-gon. For the 65537-gon only a small excerpt of the construction description is printed in chap.8, the complete description fills the aforesaid PDF. Links to the source and the jar-file of the program are also provided in this chapter. The blog ends with the said chapter about Galois theory and with some remarks about J.G. Hermes and his Hermeskoffer.

## Final Remarks

The topics of this blog are classic, so they are dealt with in a lot of books and on a lot of websites from elementary level to highly sophisticated level. Several of these books and websites are presented in chap.11 Literature and Links. The question, why this treatise has been added to the already existing ones, is legitimate and will be answered below:

When anything is new with this site, it may be the realization of Gauss' cyclotomic method by a Java program and the complete listing of the roots for the construction of the 65537-gon in the supplementary PDF. I could find only one other website [Brakke 2011] containing a complete set of roots for the 65537-gon. Unfortunately Brakke does not publish the source of his C-program. Another unique feature of this blog may be the claim to write a presentation that can be grasped with knowledge of higschool mathematics and – as a consequence – the development of the theory from scratch.

The motivation to write this blog came by an article of Michael Trott published in the journal Mathematica in education and research[Trott 2000], that is regrettably no longer on the market. In this article Trott implements an algorithm similar to our one, but he uses Mathematica® not Java. It is a very dense article, so that the mathematical basics are rarely comprehensible by high-school students. Also the Mathematica code is very dense and not as easy to follow as Java code (my personal opinion, of course). Finally, the explicit construction description is given only for the 17-gon, because even the roots for the 257-gon blow up the limits of a journal article. I found Trott's article, because it was reviewed in [Nahin 2006] and one remark of Nahin gave the decisive kick:

The corresponding numbers for $\cos(2\pi/65537)$ would be simply astronomical.

What is a little bit exaggerated as you may see looking into the PDF.

Let me make some remarks about the style of the presentation. If you read sentences like Now we inspect… or We assume that… you may think of an arrogant mathematician using the pluralis majestatis. Nothing could be farther from the truth! However, mathematics requires to follow an argument in every detail and the use of the pronoun we intends to involve the reader into those chains of arguments. This may also be a reason for the detailedness of my writing, some will even call it gabby. Another reason is of course, that old guys like me, generally tend to be garrulous.

With this in mind you will forgive me for telling the following story: In the sixties of the past century mathematics was taught to us (in a German high school or secondary school) using textbooks of the Bayerischer Schulbuchverlag. In the textbook about geometry  by Kratz and Wörle [Kratz, Wörle 1968] there was an entertaining column called Sonderbare Geometrie  (Weird Geometry ) at the end of most chapters. At the end of the chapter about the construction of the regular pentagon this column presented Gauss' flash of genius together with the painstaking work of Richelot and Hermes. One sentence of this column should influence my whole life (quoted analogously):

Zum Verständnis der Gaußschen Untersuchungen zur Kreisteilung ist ein mehrjähriges gründliches Mathematikstudium erforderlich.
For the comprehension of Gauss' investigation of cyclotomy several years of in-depth university studies of mathematics are required.

Reading this, I made the decision to study mathematics, if only to grasp Gauss' theory. To study in Göttingen, where the great Gauss did most of his work, was only a matter of congruity and the fact that the mysterious Hermeskoffer  was archived at the Mathematical Institute in Göttingen was a quaint bonus. However, the myth that you have to graduate in mathematics in order to grasp Gauss' construction will hopefully be disproved by this blog.