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…

Guest blogging for Nashworld: TPACK video

Sean Nash over at Nashworld asked me to guest blog for this week while he is out with his students doing some really cool stuff. Here is a link to my posting: A TPACK video mashup!. I end the post with a couple of videos, one a commercial and the other my mashup...

Of Art and algorithms: New article

The latest in our series Rethinking Technology and Creativity in the 21st Century is now available. The article was co-authored with Aman Yadav of Purdue University (and the Deep-Play Research Group) and focuses on the art and science of computational thinking. We...

And the winner is…

The Oscars got one thing right tonight: Glen Hansard and Marketa Irglova for the song, Falling Slowly from the movie Once. I saw this movie a couple of weeks ago, during my trip to New Orleans, and loved every moment of it. I heard that they had been nominated for...

Working with constraints: Creativity through repurposing

Working with constraints: Creativity through repurposing

Teaching is an inherently creative act, requiring educators to navigate constraints and find innovative ways to engage students. In our recently published chapter, Danah Henriksen, Lauren Woo and I explore the notion of "repurposing" as a vital skill for fostering...

Introducing Matt ‘n Punya

Joel Colbert is coordinating the AACTE special forum on TPCK and will be introducing all the speakers and leading the discussion after the presentations. He asked each of the speakers to send him a short introductory blurb that he could use to introduce us. This is...

TPACK Newsletter #40, March 2019

TPACK Newsletter #40, March 2019

Here is the Special Spring 2019 Conference Issue of the TPACK Newsletter (#40, March 2019), as curated and shared by Judi Harris and her team. (Previous issues are archived here.) This special issue include all the TPACK-related papers/sessions that...

The futility of existence, Part II: What now?

So there's this guy who wants to get into a balloon. Don't ask why but he does. So he inflates these large balloons and tries to squeeze into them. And he fails for the most part. And of course all of this is documented on YouTube. For instance you can see his second...

SITE 2008, Google & Creativity

At SITE 2008 Mike DeSchryver and I presented a paper titled Pre-Service teachers and the web: Does access to the Web enhance creative thinking about teaching. Abstract: This study examined teacher creativity and its relationship with emerging technologies. Eight...

Online vs. face to face: On asking the wrong question

The NYTimes has a story today about how higher prices of gas are driving up the demand for online learning. This is a great example of "synergistic" effects between seemingly disparate events that could not have been easily anticipated - but seem to make perfect sense...

0 Comments

Submit a Comment

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