Today, as requested by Oscar Smith (@F15hb0wl) on twitter, we’re going to have a look at Tupper’s self-referential formula: what is it, how does it work, and is it really as amazing as it seems?

Let’s just start by saying what the formula is. It was devised by Jeff Tupper, and goes as follows:

And when this is plotted as a graph starting with N on the Y axis (N is a very large number printed below!), it produces the following graph.

N = 9609393799189588849716729621278527547150043396601293066515055192717028023952664246896428421743 507181212671537827706233559932372808741443078913259639413377234878577357498239266297155171737 1699516523289053822161240323885586618401323558513604882869333790249145422928866708109
6184496091705183454067827731551705405381627380967602565625016981482083418783163849115590225610 003652351370343874461848378737238198224849
863465033159410054974700593138339226497249461751545728366702369745461014655997933798537483143 786841806593422227898388722980000748404719 (a 543-digit number).

Yes, that’s right. It seems incredible at first. The graph actually becomes a picture of the formula that produced it. Seeing this feels like witnessing a magic trick: you know there must be some logical explanation to it, but it seems so unfathomable at first that it is difficult to begin to explain why. If we are to try and figure it out though, then the place to start is with the first bits of information we get given. Let’s have a look into the actual formula again.

It may be helpful just to clear up what a few of the symbols mean. The things that look like square brackets with the top line missing are “floor” signs. This is an instruction to round down the value inside it to the nearest integer. For example ⌊2.4⌋=2, and ⌊19.9⌋=19, etc. Also, mod(a,b) is simply code for the remainder when a is divided by b, so mod(5,3), would be 2, and mod(9,4,)=1. This still seems complicated, but you soon realise that the number of floor symbols mean that every value on the right hand side of the inequality will be an integer. Furthermore, as you are determining the remainder when the first half of the right hand side of the inequality is divided by 2, there are only two possible values: 0, if it is even, and 1, if it is odd. If it is 0 then the inequality is not true, and no point is made on the graph, and if it is 1 then the inequality holds and a point is made.

It is also worth noting that x and y both only ever appear inside floor symbols, which means that only integer values for x and y are considered, which is what gives the graph that distinct “pixel” look. The repeated appearance of 17 also has a significance: this is the height of the images it produces. Essentially, for each value of x and y within an image with a height of 17 pixels, the formula is an algorithm for providing an (almost) random way of deciding whether a pixel should be coloured in or not. So this graph doesn’t just contain the image above, but every possible image with a height of 17 pixels. This then turns our attention to N as the reason behind the amazing graph.

The fact that the graph turns up with a number as large as N is actually not that surprising. The graph appears to be a random collection of black and white squares, but just like if enough monkeys have enough time they will stumble upon Othello, with a number large enough you will stumble across Tupper’s formula again. To put the enormity of N into your minds, let me tell you that N is greater than the number of atoms in the universe. And not just a bit greater. Over 4.5 googol times (10463 times) bigger. This is a hugely massive number. Essentially, N encodes a particular image, and the formula is just a method of decoding it.

Some people have said that Tupper’s self-referential formula is a “Quine,” a program capable of printing all its source code with no other input. However, this would not quite be correct, as the value for N is not included in the image of the graph. Jakub Travnic then took it upon himself to create a “true” mathematical quine, and succeeded. The formula is a bit more complicated, and N is now over 12000 digits rather than over 500, but here is the graph it prints.

This image includes all the information needed to actually plot it, so is in some ways a more impressive feat than Tupper’s! However, I find the hidden simplicity of Tupper to be what is so interesting about it: it has the qualities of a magic trick: seeming totally bemusing at first, and then giving you a knowing smile as you learn the secret behind it.

At this point though, I think it is worth making a distinction between semantics and meaning. The image produced in the Tupper graph does not carry any meaning on its own; we just interpret that image as being representative of the formula. If the mod function happened to be called the “dom” function, then it would lose its meaning, and it would magically print the word “dom” instead of mod in the formula! This is part of what adds to the effect of it as a magic trick: you recognise instantly that the two things that appear similar actually have very little to do with each other! In this case it is by coincidence: we are in a particularly obscure part of the graph, but the nature of the formula means that that coincidence will always have happened somewhere: we could choose to notate the formula in any way we like that only uses 17 pixels of height and it could be found on the graph somewhere!

I hope you’ve enjoyed trying to dissect this magic trick! If you did then please check out our last two posts:

Your Questions: “What is Quantum Physics?”, jumping on an escalator and “Is time travel possible?” – We asked you guys for questions you had for us to answer, these are only a few!

Maths of the Medals Table: Will the London Olympics “Inspire a Generation”? - We have heard the words “Inspiring a generation” a lot during the olympics. But is that really likely?

We have now nearly reached the climax of our Physics of Sport series with the arrival of the Olympics and Paralympics, so have a look at the posts in the series here.