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.

GPT3 is a large language model that just strings words together based on its training on lots and lots of text.
Image created by Stable Diffusion (courtsey Lexica.art)

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

Not too bad!

A few randomly selected blog posts…

Learning Games & TPACK @ Drexel: Video now online

Back in January I was invited to speak at the Drexel Learning Games Network (DGLN) seminar series. As I had written in my original post (TPACK & Games @ Drexel), DLGN is the brainchild of  Aroutis Foster, former graduate student, now rising star academic and...

Undo & the the progress of technology

I have wondered what it would be like if life had an undo button, and what we would do without all this cool technology we have? I guess this is what happens when we use technology for too many hours a day. I was reminded of this when I Stumbled-Upon this online comic...

The search for pattern, beauty & intelligent life…

Connecting birds nests to "crop circles under the ocean" leading to some thoughts on perception, beauty and finding intelligent life in the universe (or maybe even on this planet). The other day I found a bird's nest on my front lawn. Most probably it had fallen down...

EduPunk: The logo

I had written about the EduPunk program and my natural affinity to it here. What I forgot to add in that posting was an EduPunk logo I had created. This logo was made using photos of letterforms from Flickr. There is a handy-dandy tool created by Erik Kastner called...

Plugin’ into superpowers

Plugin’ into superpowers

I have been playing with couple of the newly released ChatGPT plugins (you have to have the paid version to use them) and want to share some of my early experiments. The two I am going to talk about are the ChatWithPDF and the Wolfram plugins. Short answer, they are...

Happy New Year

For the past couple of years now, our family has been creating new year's greetings using stop-motion video. This year was no exception. Here it is (on Vimeo) http://vimeo.com/moogaloop.swf?clip_id=18164777 A very wonderful holidays and a very happy new year to all of...

Ganapati 08, Photos

As un-official photographer for the Marathi Group, I took a bunch of pictures of this year's Ganapati celebrations. These are now (finally) on Flickr. Enjoy.

Ambigrams animated: 3 new designs

I love creating ambigrams, words written in such a manner that they can be read from multiple perspective - rotated, reflected and so on. These designs are much easier to "grasp" when printed on paper since you can actually turn the paper around, hold it against a...

Palindromic poetry in prison, introducing Sandra Gould Ford

Those who follow this blog know that I love visual wordplay. This is most commonly seen in my ambigram work but another area where I have spent some time is in writing palindromic poetry. I wrote a whole series of poems when I was in graduate school at Illinois and...

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *