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…

Developing a culture of creativity: Research news

Developing a culture of creativity: Research news

Danah Henriksen and I were featured in a recent news story on the MLFTC News titled: Developing a culture of creativity, instead of compliance, in educators. The article provides an overview of our work over the past few years. Given the nature of a news article, it...

The gift that keeps on giving, or Why I love the web

I recently received this email: Dear Mr. Mishra, I am currently working on a poetry research project for school, and one of the requirements is researching five different poets. While looking for people who wrote palindromic poetry, I found your website and decided to...

Designing for anticipation, Teaching for anticipation

In a couple of previous posts I had talked about the idea of postdiction (see the posts here and here). The argument being that good teaching (among a long list of other good things) is postdictable, i.e. it walks the line between predictability and chaos, and most...

Going back home

Amita Chudgar, friend and colleague, just sent me this really nice article in today's NYTimes, titled "India Calling" about the second generation of Indian Americans who are now going back to India. These are kids born and brought up in the US, whose parents had...

Teachers ARE designers (in many different ways)

Teachers ARE designers (in many different ways)

One of the pleasures of academia is working with awesome graduate students. This paper is an example of such a collaboration. Melissa Warr, for some reason or the other, decided to do a network analysis of some of the top-cited papers related to teaching and design....

The value of school: Part 1

The value of school: Part 1

Note 1: This is the first of two posts on the value of school by Punya Mishra & Kevin Close. Read the second post: Revisiting Accountability. Note 2: These two blog posts became the basis of an article. Full citation and link below: Mishra, P., & Close, K....

Money for nothing, and your clicks for free!

I knew that website developers would go to great lengths to rise in Google rankings. What I didn't know was just how far people were willing to go, till I received this email. Note: I have deleted all the links and names, since that would be giving free publicity to...

TPACKed and ready to go

I am off to the Netherlands, specifically to Twente University to talk and discuss TPACK and other interesting stuff. I have been invited by Dr. Joke Voogt, Associate Professor at the Department of Curriculum Design and Educational Innovation from the Faculty of...

Social Networking & Education @ AACTE

The Innovation & Technology Committee of the AACTE organized a symposium titled: Digital-Age Learners in a Socially Networked World at the Annual meeting at Chicago. As co-chair of the committee I had the privilege of introducing the session and the individual...

0 Comments

Submit a Comment

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