# ChatGPT3 writes a Mathematical Proof (in verse)

by | Saturday, February 25, 2023

Many years ago I got interested in writing poetry about mathematics (all archived on my Math-Poetry page). Just to be clear, I am not a good poet (far from it) and I am even less of a mathematician—but it was a fun exercise to engage in. That said, a couple of my poems did get published: one about imaginary numbers (The Mathematical “i”) in At Right Angles, a Math education magazine; and another, on the Fibonacci series (Fibonacci’s Poem), in a math textbook.

Not too bad for a dabbler 🙂

While playing around in this somewhat weird mini-genre I set up a small challenge for myself—to see if I could write a mathematical proof in the form of a poem. I chose Euclid’s proof of the infinity of primes, which led to a poem titled The Infinity of Primes: Proof as Poem. And there matters stayed for years (13 years to be precise).

And then ChatGPT3 popped into our world.

Much has been written about how amazing ChatGPT3 is in terms of creating poems and other forms of writing with just a simple prompt. That said, ChatGPT3 is a large language model and can be pretty bad at mathematics. For instance I had experimented with asking ChatGPT3 to write mathematical puzzles in the style of Lewis Carroll – and though it was good at capturing certain elements of Lewis Carroll’s style it failed miserably in the math part. In fact, it was kind of stunning just how basic its mathematical errors were. Moreover, when I would point out the error, it would apologize and then give me another, stylistically on point, but mathematically inaccurate puzzle!

I had a slightly better experience when I tried using ChatGPT3 as a math tutor but having it explain some mathematical ideas to me. For instance, over multiple questions / prompts and responses, ChatGPT3 gave a pretty good explanation of why negative numbers when multiplied with each other result in a positive number. It took a while but it actually gave me an explanation that showed that multiplying by a negative number is the same as rotating the number on number line by 180 degrees, so two such rotations (when two negative numbers are multiplied to each other) will lead you back to the positive side of the number line. Not too bad.

With these somewhat mixed results in mind, I got to wondering, just how would ChatGPT3 do if asked to write a proof as a poem. So I gave it the same task I had given myself years ago, namely to write a poem that would essentially be Euclid’s proof of the infinity of primes.

Below are three creations by ChatGPT3. A few points to note before I get to the actual poems.

The first poem that ChatGPT3 wrote actually isn’t correct mathematically. It has a line there “For it’s a product of just two, at a time” that makes no sense. When I asked it to correct correct it, it misunderstood me and just gave me a poem about the concept but it was not a proof. On further nudging it did come up with a one that seemed right, but the rhymes were kind of dumb and lazy (I mean who rhymes “proof” with “proof”). But what was fun was that it incorporated my request in the first line of the poem itself (which was kind of cool).

Second, on looking over ChatGPT3’s creations and comparing it to the one I had written back in 2010, I do believe that my version is better, a bit more quirky, with better rhymes and, most importantly, does a better job of explaining the steps in the proof.

Finally, I also experimented with collaborating with ChatGPT3 – on another math poetry task. The results of that experiment are at the end of this blog post.

Now onto the proofs as poems (or should it be poems as proofs?). What do you think of ChatGPT3’s output? I do believe my poem is better (along multiple dimensions), but again, I may be biased. Moreover, you don’t have to take my word for it. You can see for yourself. Here is a link to my poem: The Infinity of Primes (Proof as Poem) and below are the three creations of ChatGPT3.

## Infinity of Primes: Attempt #1 (by ChatGPT3)

Euclid, a man of great mind and might
Proved a theorem, so simple and bright
That the primes, they do go on forever
An endless supply, we’ll never surrender

Suppose, for a moment, that this is not so
And that primes, they do have a limit, you know
Let’s call that limit, the greatest of all
A prime so big, it towers above them all.

Now, consider the number we’ll call “P”
Multiplied by itself, it’s easy to see
The result is a number, larger than “P”
This number, we’ll call it “N”

“N” plus one, must also be prime
For it’s a product of just two, at a time
But wait, this is a contradiction we see
For “N” plus one, is larger than “P”
Therefore, our assumption, it must be false
And primes, they do go on, forevermore
This proof, so simple, yet elegant and grand
Shows the infinity of primes, in our hand.

## Infinity of Primes: Attempt #2 (by ChatGPT3)

In ancient Greece, a man named Euclid stood
With a theorem that still holds good
He showed the world, with ease and grace
The primes go on, in an infinite space

Consider any number, no matter how big
Factor it down, as small as you can dig
You’ll find a prime, that can’t be divided more
For every number, there must be at least one in store
And if we list all the primes we can find
The list goes on, it’s never confined
No matter how far we go, we’ll always see
Another prime number, waiting for thee

So let us embrace this infinite delight
Of primes that go on, day and night
For Euclid’s proof, stands tall and grand
Showing the world, an endless supply of primes at hand.

## Infinity of Primes: Attempt #3 (by ChatGPT3)

After reading my previous attempt, I wrote the following:
That’s not a proof, I want the proof in verse form

Oh, I see! A proof in verse form you say,
I’ll try to make it elegant in every way.
Let p1, p2, p3, …, pn be our list of primes,
Of which there are infinitely many, it’s no crime.
Suppose, for the sake of contradiction, not true,
That our list of primes has only a finite few.

Let P be the product of all primes we have seen,
And add one to P, call it our number N, quite keen.
Since N is not divisible by any of the primes,
It must be divisible by a prime that surpasses our finds.
This contradicts our assumption, that the list of primes is finite,
So we must conclude, the list goes on, and will never diminish.
Thus we have shown, in this poetic proof,
That the primes go on, it’s a mathematical proof.

### Postscript

Finally, instead of having ChatGPT3 write a poem entirely on its own, we wrote one together. I started by asking it to write a haiku, on the imaginary number i (the square root of negative 1). I didn’t really like what it came up with so asked it to write another and we went back and forth a few times. Finally, I took some of the lines that seemed to work, tweaked them a bit, to create a haiku that I really liked. So in a sense we wrote a poem collaboratively. Here it is:

The imaginary i

i am the strange one,
With me equations bloom
Complex world revealed

A few randomly selected blog posts…

## Design related videos

Just a link to online videos related to design. Check it out by clicking here Relevant to CEP817 and CEP917 (and maybe even CEP818)

## Happy 2010! Stop motion movie

I have had a lot of fun this year playing with video. Most of these experiments were done with my kids (nothing like combining work with pleasure). One of the things we had done last year was a stop motion new year's card. So we just HAD to create one this year as...

## Mobile Technology in Teacher Education

I was recently invited to keynote The First International Conference on Mobile Technology in Teacher Education (MiTE 2015). The conference was organized by the School of Education, National University of Ireland, Galway. Kudos to the organizers (main point of contact...

## New forms of doctorate

The Institute of Education, University of London is organizing a series of seminars on New forms of doctorate i.e. the manner in which multimodality and e-learning are influencing the nature and format of doctoral theses in Education and the social sciences. This is a...

## SITE2013 New Orleans

All my photos from the recently concluded SITE2013 conference at New Orleans. These include photographs from multiple sessions (chronicled here, here, and here) as well as from all the fun we had (at the MSU dinner, just hanging around in Burbon St., as we as other...

## Recreating D-Day…

... on a shoe-string budget. Three designers and a big empty beach, see the results! http://www.youtube.com/v/WRS9cpOMYv0