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…

For Sean & his students

Sean had this wonderful post on his blog (Is this a sluggish strategy?) about this whole scientific and mathematical poetry that is going around. He links to some excellent sci-po's written by his students (see Pushing Scientific Thought Into Art) and also provides a...

A (Wheatstone) bridge to the past

A (Wheatstone) bridge to the past

This is a story of serendipity. Of how an out-of-the-blue email request, about an article I had written over two decades ago, led me to rediscovering authors, books and ideas that I had first encountered back in my high-school days in India and have been deeply...

The futures of higher ed with Phoebe Wagner

The futures of higher ed with Phoebe Wagner

The Center for Science and the Imagination at ASU runs a series of short stories and virtual gatherings that explore issues related to transformative change. Essentially they solicit and publish a (super-short) short story that explores “themes of community,...

World’s cheapest car (ever)

Story in Reason Online about the Tata Nano, the cheapest car the world, or actually as the article seeks to prove, the cheapest car of all time (once you adjust for inflation). The Nano, produced by Indian company Tata, "is about 10 feet long, 5 feet wide. The...

Ambigrams & Mathematics at HYSA

Ambigrams & Mathematics at HYSA

The Gary K. Herberger Young Scholars Academy (HYSA) is a school designed for highly gifted students in grades 7-12 affiliated with the Mary Lou Fulton Teachers College and Arizona State University. Last Friday I had the pleasure and honor of working with all the...

Spore & learning about evolution

A NYTimes story about Spore, the new game / toy designed by Will Wright (Playing God, the Home Game) speaks about its connection to evolution. As the article says, Mr. Wright and his publishers at Electronic Arts deserve all the credit they have received from some...

Teacher as filmmaker: An update from down under

Back in 2007, I was second author on a paper titled Teacher as Filmmaker, in which we described an approach to teacher professional development that involved teachers creating short, evocative movies, which we called iVideos. You can read the paper and abstract...

Fractals, ambigrams & more

Fractals, ambigrams & more

Photo & and design © Punya Mishra.The photo of bubbles was taken with cell phone camera (equipped with a macro lens).  Fractals are mathematical/geometrical structures that exhibit self-similarity at increasingly small (or large) scales. Fractals were...

Why I love the web…

I don't know if anyone has been following the back and forth following my posting about the Periodic Table of Typefaces (see Yet another periodic table...). In brief, I was quite critical of the design of this table and made that point in no uncertain terms. Imagine...

0 Comments

Submit a Comment

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