# The Maths Behind the Rubik’s Cube

My parents gave me a Rubik’s Cube for my tenth birthday along with a very friendly-looking guide on solving it. Not too soon afterwards, I decided to learn how to solve it. It turned out that my motivation was far below the requirements.

As with any tutorial on how to solve the cube, the book listed several sets of moves that I had to learn and apply in different ways depending on what configuration the cube was in. Granted, the book was sufficiently easy to understand, but nothing could have prepared me for the sheer volume of algorithms that were thrown at me.

This little book must have given me at least fifty algorithms, averaging around 15 moves in length. My ten-year old self simply wasn’t ready for a commitment of this magnitude; I was out of my depth in a similar sort of way that a snake is on a bicycle, or a Magcargo is against a Swampert.

I managed to solve it a couple of times, but not without at least an hour of constantly consulting the book, struggling to hold the book open while using my hands to perform the moves and getting frustrated when I was unable to multitask effectively. Eventually I deemed it best to leave this chapter of my life behind me.

Six years later one of my friends brought his own cube into school, and I was baffled at how easily he had managed to memorise all of the algorithms. Unexpectedly, he wondered how I had been unable to memorise them; he appeared to have had little to no trouble.

I showed him the book the next day, and he couldn’t comprehend why someone would make solving the cube so long-winded. I searched for a foreword or author’s note for an explanation of some sort, and it was then that I discovered the book had been published in 1981 – only months after the cube was internationally released. Since then, I realised, methods of solving the cube have been heavily refined and made simpler, faster and generally more efficient. That same day, I found this guide to the Beginner’s Method and began to learn. To my surprise, it was astoundingly simple and I was able to solve the cube completely from memory within an hour. If you can’t solve the cube as of yet, I strongly urge you to learn how – it’s relatively easy, yet people are still amazed at one’s ability to solve a cube.

That anecdote stretched out far longer than I ever intended it to. However, it is still relevant somewhat.

A few other friends all became interested in cubing after this, and while they were moving on to faster, more complex methods of solving the cube, I found myself much more interested in the mathematics of the cube.

Firstly, as the cube has 26 pieces (or cubies, as they’re informally known) and 9 slices (as pictured below) that can all be moved independently of one another, it has a vast number of possible configurations. I began by asking the inevitable: how many possibilities are there?

This is actually a rather easy question to answer in principle, but it requires a little explanation. We just have to consider all the possible positions of each cubie (where it is on the cube), and all the possible rotations of each cubie (which way its colours are facing, regardless of its position).

Let’s start with the positions of the corner cubies. There are 8 corner cubies, so we can say that there are 8! (8 x 7 x 6 x 5 x 4 x 3 x 2 x 1) ways to arrange the corner cubies.

Next, let’s look at the rotations of the corner cubies. There are 3 possible ways to rotate each corner cubie, as I’ve shown below. However, 7 cubies can be rotated freely, while 1 depends on the rotations of the rest. We can say that there are 37 possible corner rotations.

We’ll move on to the edge cubies. There are 12 edge cubies, so we’d assume that there are 12! ways to arrange the edge cubies. However, we have an even permutation for the corner cubies (meaning an even number of position swaps), which means that there must be an even permutation for the edge cubies too. This sounds complicated, but it’s just a limitation of the laws of the cube. We have to divide this number by 2, leaving us with 12!/2 possible ways to arrange the edge cubies.

Finally, we’ll consider the rotations of the edge cubies. Each edge cubie can be rotated in 2 possible ways, as you can see below. Like the corner cubies, the rotation of 1 edge piece is determined by the other 11, which can rotate freely. This leaves us with 211 possible edge rotations.

Now we multiply everything together:

8! x 37 x (12!/2) x 211

= 43,252,003,274,489,856,000 possible configurations.

That’s 43.25 quintillion. To put that in perspective, if you were to cover the ground in the same number of 1mm3 cubes, like in the picture below, you could almost cover the entire continent of Asia.

If we want to find out how many possibilities there are if the cube is disassembled and reassembled in every possible way, we just need to remove the limitations of the cube that we took into account before.

8! x 38 x 12! x 212

= 519,024,039,293,878,272,000

With 519 quintillion 1mm3 cubes, we could cover the Earth once and almost the whole of the USA a second time.

Keep in mind that these combinations are only for the 3x3x3 cube. The world’s largest cube to date is 17x17x17, and it looks like this.

If we go through similar steps to reach the number of possible configurations on this cube, we arrive at approximately 6.69 x 101054. I can’t really put this number in perspective, seeing as the estimated number of atoms in the observable universe is 1082 at most.

A short while later I was fiddling around with the cube, and noticed that when I repeated a set of moves over and over, the cube returned to the state it was in when I started. This is true for any repeating set of moves that you can think of – the cube will always return to how it was when you began performing the moves. You can try it now if you have a cube.

The reason this works is because you can always return to a cube’s previous state by doing the inverse of the move you just did. For example, if you turn the top slice 90° to the left, you can get back to how it was by turning the same slice 90° to the right. For this reason, if you repeat one set of moves, you can’t get enter a loop other than the one you’re already in. Paul Taylor illustrates this well in his post:

If you had the cube at the top of the loop, you do the inverse of the set of moves you just performed. But which state does the cube return to? When repeating a single set of moves, a certain state can only be reached in one way. Therefore, a loop within a loop is not possible.

In a moment, I’m going to use standard Rubik’s Cube notation to describe certain moves. Each letter refers to one slice. The letters I’m going to use are F, B, L, R, U, D, E, M and S. Whenever I use a letter, it means I am turning that slice 90° clockwise. If there’s an apostrophe after a letter, such as F’, it means the slice is turned counter-clockwise.

The picture below will show you. If you’re still confused, look at this visual guide.

I soon noticed that the number of times I needed to repeat different sets of moves to return the cube to its original state varied greatly. A two-move set, consisting of L U, has to be repeated 105 times to return to its original state. However, an eight-move set, which is U R U’ L’ U R’ U’ L, only needs to be repeated 3 times. This led to my main question:

How do I determine how many times I need to repeat a move set to return the cube to its original state?

I looked online for any information surrounding this phenomenon, but the search was pretty fruitless. The only related article I found was the one I mentioned earlier: Paul Taylor’s ‘How to solve a Rubik’s cube in one easy step’. It tackles the problem of the maximum number of times you would need to repeat a move set to get to the cube’s original state. I found it very interesting; I certainly recommend you read it. He tackled the problem in an elaborate way, however, having to include some simple programming in order to reach a solution. I wanted to be able to find the required number of repetitions by only having to look at the cube.

Having found nothing to answer my particular query, I set out to look for an answer myself. I first reasoned that the solution was likely to include lowest common multiples, seeing as each cubie has its own individual cycle and it was only a matter of aligning all of the cycles. Secondly, I noticed that with every repeating set of moves, the cube would reach one of three states before it returned to its initial solved state:

‘Cross’ pattern

‘X’ pattern

‘Circle’ pattern

Armed with these two observations, and a little free time, I eventually came up with a method for determining how many times a set of moves needs to be repeated in order for the cube to return to its original state. I’ll show you in a step-by-step guide, as this is the easiest way to explain it. The main instructions are in bold, with explanations written normally.

Step 1

Pick any set of moves to repeat.

Remember the set of moves – if you forget midway, you won’t be able to complete the process.

Step 2

Starting with a solved cube, perform the set of moves repeatedly.

Count how many repetitions you have done.

Keep repeating the set until your cube reaches one of the three states I pictured above: Cross, X, or Circle.

It’s possible that you’ll get back to the solved cube before you reach any of these states. This only happens with a few move sets, when the number of repetitions required is very low.

Step 3

When you get to one of the three states, you’ll notice that only one of the three types of cubies are out of place.

• With the Cross pattern, only the corner cubies will be out of place.
• With the X pattern, only the edge cubies will be out of place.
• With the Circle pattern, only the centre cubies will be out of place.

Now you’ll need to find the lengths of all the cycles within the cubies that are out of place. What I mean by this is that one cubie is in the place of another cubie, which is in the place of another cubie, etc. If you trace back through where each cubie is supposed to go, you’ll reach the cubie you started at.

Here’s an example:

You can start at cubie 1, and see that it should go where cubie 2 is. You can then see that cubie 2 should go where cubie 3 is. Finally, you can see that cubie 3 should go where cubie 1 is, thus completing the cycle. This cycle would have a length of 3.

Once you’ve found the length of one cycle, you need to look at a cubie that wasn’t included in the cycle you just found. Start finding another cycle from that cubie, and find the length of that cycle. Continue this process until every cubie has been included in one cycle.

If a cubie is in the correct position but the wrong rotation, it still counts as a cycle. This problem only occurs with corner and edge cubies, not centres.

If a corner cubie is rotated within itself, it counts as a cycle of 3.

If an edge cubie is rotated within itself, it counts as a cycle of 2.

You should now have all the lengths of the cycles.

Step 4

Find the lowest common multiple (LCM) of all of the cycle lengths.

In case you’re not sure how, first you must split each number into its prime factors. For example:

6   = 2 x 3

8   = 23

10 = 2 x 5

Then select the highest powers of each different prime.

6   = 2 x 3

8   = 23

10 = 2 x 5

Finally, multiply all of the highest powers together.

LCM of 6, 8 and 10 = 23 x 3 x 5 = 120

Step 5

Multiply the LCM of the cycles by the number of repetitions you have made so far.

In Step 2, you will have counted how many times you repeated the set of moves to get to one of the three states. Simply multiply this by the LCM of the cycles you calculated in Step 4, and you’ll get the total number of repetitions required to return the cube to its original state.

Summary

For any repeating set of moves:

R = cn

Where

R = number of repetitions required to return cube to original state

c = lowest common multiple of cycle lengths

n = number of repetitions performed to reach one of the states

Note: There is one type of scenario where this algorithm does not work. If the cross pattern is reached first, number of cycles is even and all cycles are 3, assume the lowest common multiple of the cycle lengths (c) is 9.

In any instance where the algorithm doesn’t work, when the predicted number of repetitions is reached, all corner pieces are in the correct position, but the wrong rotation. The predicted number of repetitions must be repeated twice more to reach the correct rotations for all of the corner pieces.

If you have any ideas or comments on this algorithm, please don’t hesitate to contact me.

~

Finally, one more interesting feature of repeating move sets is that if you have a move set of length 2, you can double the length of the move set to 4, invert the repeated moves, and the resulting move set will, when repeated, return he cube to its original state in fewer repetitions than the first move set of length 2. In simpler terms, it is a move set in the form A B A’ B’. These move sets are called commutators, and the reason they can complete a cycle in fewer moves is because they return most cubies to their original position with each repetition. Only a few cubies are moved out of place.

This property is particularly useful for towards the end of the solving process, as only a few cubies may be out of place, and you don’t want to mess the rest of the cube up. In fact, the final algorithm for the Beginner’s method is R’ D R D’, which rotates the corner cubies within themselves. It is repeated until all of the corner cubies are in the correct rotation, at which point the cube is solved.

You can also merge commutators for interesting effects. Another common algorithm is U R U’ L’ U R’ U’ L, a combination of U R U’ R’ and U’ L’ U L, which swaps the positions of three corner cubies and keeps the fourth in place. The two separate move sets each need 6 repetitions to return the cube to its original state, while the combined move set requires 3 repetitions. The total number of individual moves is equal in all three cases.

Thank you for reading.

-Ollie James

Advertisements

# The Prime Number Theorem explained

People have asked me to explain how Gauss’ Prime Number Theorem actually works. I mentioned it in my “How to Find Prime Numbers” post, but never explained it, so here is a short and (relatively) simple guide.

To begin with, let’s take a look at the trends in the density of primes up to a certain integer. We can find the density of primes by calculating p / x, where x is the number of integers and p is the number of primes from 1 to x. If we make a table of the density to each power of 10, it will look like this:

 x p Density 10 4 40% 100 25 25% 1,000 168 16.8% 10,000 1,229 12.29% 100,000 9,592 9.592% 1,000,000 78,498 7.8498% 10,000,000 664,579 6.64579% 100,000,000 5,761,455 5.761455%

You can see that the density is always decreasing, but the rate is also decreasing. This is very similar to a logarithmic pattern. In fact, if we plot the graph of y = ln(x), mirror it along the horizontal axis so that it becomes y = 1 / ln(x), and compare it to the graph of the density of prime numbers, there is a striking similarity.

Green: y = 1 / ln(x)
Blue: Density of primes

You’ll find that as the value of x increases, the correlation between the two graphs becomes stronger and stronger. The density of primes follows an almost instinctive natural curve.

This link makes it possible for us to predict the density of primes up to any value of x with the formula 1 / ln(x). The higher the value of x, the higher the accuracy of the prediction. To find the expected number of primes, you only need to find the area under the graph of the density, which can be found using integration. Gauss refined this a little to create the logarithmic integral Li(x), which gives a slightly more accurate estimate for the lower values of x. I ought to give Adrien-Marie Legendre some credit here as well, because he and Gauss both independently conjectured Li(x) at around the same time. Gauss is generally more associated with this, however, mainly because of his legacy.

l talk about how this links into the Riemann hypothesis (and more) in my previous post, which you can read here.

Thank you for reading.

-Ollie James

# How To Find Prime Numbers

The concept of a prime number is very simple. It’s one we’ve all been taught quite early on. If a number has only two factors, those factors being 1 and itself, it is a prime number. Simple enough. However, you will probably also know as far as we are aware, prime numbers do not have a pattern of regular occurrence as, say, even numbers do. This is what makes them so captivating. Even after we have known about prime numbers for millennia, we haven’t found an exact formula for finding primes. I’ll be taking you through the progress humanity has made so far on what is one of the most sought-after problems ever to arise in mathematics.

Prime numbers have been a source of academic anguish almost since the birth of human understanding of mathematics. So many millions of (arguably, mostly fruitless) hours have been poured into trying to further our understanding of these mysterious numbers. The first evidence of our knowledge of primes is in the Rhind Papyrus, an Ancient Egyptian document dating back to c. 1600BC.

The Rhind Papyrus, which is currently located at the British Museum

The papyrus demonstrates various ancient Egyptian fractions, and shows that they have different forms for prime numbers and composite (non-prime) numbers. After this, we have little evidence of progress with primes until we reach the Ancient Greeks, c. 300BC.

~

We first meet Euclid, an Ancient Greek mathematician. Often referred to as the ‘father of Geometry’, the majority of his work was based around geometric principles, but his collection of works, called Elements, included some number theory. Most notably, he proved that there were an infinite number of primes. His proof is as follows.

Suppose there are a finite number of primes – specifically, n primes. When we list them, they create the list p1, p2, p3, … , p.

Let’s now create a new number called p, where p = p1 x p2 x p3 x … x pn + 1. This is larger than any of the primes in the list, so it can’t equal any of them. Also, since the list of p1, p2, p3, … , pn contains all primes, p cannot be prime. Therefore p must be divisible by at least one prime.

However, if we divide p by any one of our primes, we will always get a remainder of 1. This contradiction tells us that our assumption of there being a finite number of primes cannot be true, and that there must be an infinite number of primes.

This may seem like common sense to some of us, but had Euclid not constructed this proof when he did, our understanding of primes could have been far less developed than it is today.

Euclid was also responsible for a theorem that one would likely not expect from a mathematician of his time. In the final pages of the number theory section of his Elements, he proved that 2p-1(2p-1) is a perfect number, where (2p-1) is prime. If you’re unaware, a perfect number is a positive integer with factors that add up to the number. Six is the first perfect number, as its factors, 1, 2 and 3, add up to 6. In the same way as primes, we are currently unaware of a formula that dictates when the next perfect number will occur.

We will revisit Euclid’s theorem later.

~

Shortly after Euclid’s work, in 276BC, another Greek mathematician by the name of Eratosthenes devised a method of finding all primes up to a certain integer. You have probably been taught this method, called the Sieve of Eratosthenes, as a way of easily determining which numbers are prime and which are not.

To begin, create a number grid of the numbers 2 to N (where N is the integer you want to find primes up to).

Next, starting at 2, mark off all the multiples of 2 (excluding 2 itself).

Once they are all marked off, move to the next number that has not been marked off, and mark off all the multiples of that number (excluding the number itself).

Continue the process until you cannot mark any more numbers off. All of the remaining numbers are primes.

A completed sieve, where N = 99.

Once again, this may seem very simple to us in the modern world, as our understanding has developed far, far beyond that of the Ancient Greeks, but the Sieve was a fundamental foundation for the search for primes. It is also still widely used in programming when generating small quantities of primes due to its simplicity. However, it is an inefficient algorithm compared to many of the ones created for the purpose of discovering new primes, which we will cover later.

By the way, if you’re wondering why we exclude 1 from the number grid, it’s because 1 is not prime. The definition of a prime number is “a number whose only two integer factors are 1 and itself”. Seeing as 1 only has one factor, it is not considered prime.

~

We must now travel rather far forward on the timeline to the 17th Century, where we are introduced to Pierre de Fermat, a French lawyer and mathematician. Though he is renowned for his many developments in various areas of mathematics, he is also known for coming up with ideas and not proving them. Fermat’s Last Theorem (probably his most famous), which proposes that no three positive integers a, b and c can satisfy the equation an + bn = cn where n is an integer greater than 2, is an example of this. In a note he wrote in a book, he teased that he had proof, but there was not enough space to write it. The note was discovered after his death. Whether he had proof or not we shall never know, but in 1994 Sir Andrew Wiles finally proved the theorem.

Pierre de Fermat, apparently in his later years.

Earlier in his life, Fermat came up with another theorem of similar circumstances. He stated that 2(2^n) + 1 is prime where n is any positive integer. He also demonstrated that this theorem was true up to n = 4.

It turns out that his theorem was, unfortunately, not true, as we will soon see. However, his theorem was slightly altered by an acquaintance of his, namely Marin Mersenne, who was also a French mathematician as well as a theologian and philosopher. Mersenne took inspiration from Fermat and from Euclid’s theorem on perfect numbers, and compiled a list of all values of p for which 2p – 1 was prime.

2, 3, 5, 7, 13, 17, 19, 31, 67, 127, 257

His list was actually rather flawed. It was later proven that 267 – 1 and 2257 – 1 are in fact composite. Mersenne also missed a few values of p that are prime: 61, 89 and 107. Nevertheless, it is impressive that he managed to create a list with only a few errors by hand. In fact, the largest prime calculated by hand is still 2127 – 1. Primes of the form 2p – 1 are called Mersenne primes in his honour.

Marin Mersenne, the man to which primes of the form 2^p – 1 are attributed.

Now Mersenne primes might not seem that remarkable, as 2p – 1 doesn’t provide us with any sort of pattern in which primes appear. While this is true, a wonderful rule is tied to these primes.

If 2p – 1 is prime, then p is prime.

It is the first glimpse we see of solid, uninterrupted proof of certain primes. Even today, almost all equations, expressions, conjectures, theorems etc. to do with primes are not true in every instance. It means that whenever a new Mersenne prime is discovered (which, by the way, are denoted as Mp), we can say without a doubt that p is also prime. As a little bonus, because 2p – 1 is taken directly from Euclid’s theorem that we saw earlier, a new perfect number is discovered every time a Mersenne prime is discovered. Unfortunately, the rule does not work the other way around; we can’t say that if p is prime, then 2p – 1 is prime. Substituting p with the first prime that is not in Mersenne’s list, which is 11, easily proves this.

211 – 1 = 2047

2047 = 23 x 89

If the rule did work both ways, we would have an infallible method of generating primes. Of course, mathematics won’t let us win that easily.

In the modern search for primes, we aren’t looking through every single positive integer in the hopes that we find a new prime. While primes bigger than any other are still rarely found, we search for Mersenne primes. We do this because we know that we only need to check Mersenne primes for which p is prime, giving us a much higher discovery rate than checking every integer, and making the search as efficient as is currently possible.

~

Around a century later, a new figure arose in the field of mathematics. His name was Leonhard Euler (pronounced oi-ler), a Swiss mathematician born in 1707. In summary, Euler tied up all the loose ends of what had already been discovered about primes, and contributed his own developments.

Firstly, Euler refuted Fermat’s theorem that 2(2^n) + 1 is always prime, simply by showing that when n = 5, the result is composite.

22^5 + 1 = 4292967297

4292967297 = 641 x 6700417

Next, Euler added his own proof to Euclid’s ancient theorem on perfect numbers (remember it?). Euler acknowledged Euclid’s proof, and thereafter proved that every even perfect number is of the form 2p-1(2p-1). The theorem is named the Euclid-Euler theorem in recognition of each of their contributions. It is still unknown whether any odd perfect numbers exist or not, but we are sure that none with less than 1500 digits exist.

Euler then moved on to his own ideas on how primes could be generated. He began looking into polynomials, and eventually came up with the first known prime generating polynomial.

f(n) = n2 + n + 41

For the first 39 integer values of n, f(n) is prime, and is also for most values shortly beyond n = 39. While this is evidently not a solid pattern, it was of great interest to many because of the density of the primes. It is certainly now seen as a step forward, not specifically in the search for primes, but in prime theory and the ‘regular irregularity’ of primes.

Leonhard Euler, who is the only mathematician so far to have two numbers named after him.

If you’re interested in mathematics and have delved even slightly into other areas, it is very likely you have already heard of Euler; if not, you will certainly come across him again. His works span across almost every area of mathematics, and cover an array of physics problems as well. He was a monumental mathematical exemplar, and few come close to equalling the volume of his contributions to the academic world.

I’ve allowed myself one paragraph to devote to my favourite mathematician, so I hope it convinces you to read a little more about his work (perhaps start with Euler’s identity). Let’s get back on track.

~

Further towards the end of the 18th Century, it became clear that if an exact formula for primes existed, it was well beyond their reach at the current time. A number of mathematicians found themselves taking a step back and searching for notable patterns in the distribution of prime numbers. The first significant step forward in this area was made in 1798 by yet another French mathematician by the name of Adrien-Marie Legendre.

I’m just going to take a second to explain briefly about logarithms, which are rather heavily involved in the next section. A logarithm is the reverse function of the exponent, or power, as you may know it.

If y = ax

Then loga(y) = x

For example, as 25 = 32, log2(32) = 5.

If a logarithm is written without a base (which is the number written in subscript), it means the logarithm is in base 10.

log(x) = log10(x)

Similarly, if a logarithm is written as ln, it means it has base e, which is approximately equal to 2.718. Among many other applications, on the graph of y = ex, the gradient is equal to the y-value at any point.

ln(x) = loge(x)

The graph of y = e^x .

Moving back to 1798, Legendre conjectured that the number of primes below a certain number, x, was approximately:

­­­­­

Coincidentally, a young German mathematician, Carl Friedrich Gauss, also conjectured this at around the same time. Fifteen-year-old Gauss, however, was not satisfied with the limited accuracy of this theorem. He set to work, and came up with an even more accurate formula for calculating the number of primes below x:

He called this formula Li(x), where the ‘Li’ stands for ‘Logarithmic integral’, which is exactly what it is. Now, sadly, there was no known way of telling exactly how accurate this formula was. It was more accurate than the original Legendre-Gauss conjecture with all the various values of x that Gauss tried, but mathematicians wanted to know just how inaccurate Li(x) could get compared to the actual number of primes below x.

A few decades later, in 1859, a German chap called Bernhard Riemann was fiddling about with a series that Euler had come up with, which is:

Which happens to be equal to:

Notice how all the bottom right numbers are the primes in order?

For most values of s, however, the sequence adds to infinity (provided it continues to infinity, which is what we’re assuming here). This isn’t considered interesting, and despite Euler’s best efforts, he was unable to make anything better.

Riemann decided he would continue from where Euler had left off, and try to make a sequence where any value of s would not total to infinity. He eventually came up with this, which is called the Riemann Zeta function.

This may look horrible, but don’t worry, you don’t need to understand it exactly (If you want to understand it, I suggest reading Thomas Wright’s ‘A Friendly Introduction to the Riemann Hypothesis’, which explains it well and is entertaining at the same time). What Riemann has done here is created a function where, for any value of s:

If Z(s) does not equal infinity, then ζ(s) will produce the same value.

If Z(s) does equal infinity, then ζ(s) will produce a non-infinite value.

This is only untrue for ζ(1), which is undefined.

Now, it so happens that for any negative even value of s, ζ(s) = 0. Riemann began looking at positive values of s for which ζ(s) also equals 0. He found several values, all of which were in the form of 0.5 + it, where i = √(-1) and t is any real number (that is, any number which is not the root of a negative number). He could not find any positive values of s that were not in that form. From this information, he formed the famous Riemann hypothesis:

If ζ(s) = 0 and s is not a negative even number, then s = 0.5 + it.

From what I’ve told you, it doesn’t look like the whole Riemann escapade links into prime numbers very much. Fear not, for this is where it all ties together.

Remember Li(x)? Well, it turns out that the Riemann hypothesis and Li go hand in hand. The following sentence is why Li and the Riemann hypothesis are considered to be so important.

If the Riemann hypothesis is true, then Li(x) never differs from the number of primes below x by more than (√x)ln(x).

Therefore, if the Riemann hypothesis is proven, we will always be able to tell (within a considerably small degree of accuracy) how many prime numbers there are below any number, and our understanding of primes will become incredibly more developed. It’s no wonder that the Riemann hypothesis has been placed on the list of Millennium Prize Problems, and anyone who can prove it will be awarded a prize of \$1,000,000.

~

I appreciate that the last section was rather confusing, so let’s move toward the end of our journey to something I imagine to be a little more pleasing. In 1963, a bored Stanislaw Ulam was sitting in a scientific meeting when he began to absent-mindedly draw all the natural numbers (1, 2, 3, 4, …) in a square spiral. He then circled all of the primes, and noticed that the majority of them seemed to line up in diagonals.

You can begin to see the diagonal ‘spokes’. Ulam took his discovery to the Los Alamos Scientific Laboratory, where he took advantage in recent developments in computing to use MANIAC II, a first-generation computer, to generate the same spiral he drew at a much larger scale.

There’s no doubt that Ulam must have been astounded at what he had discovered while doodling. Mathematicians had known that there was some regularity in primes, but to have visual proof is a step forward from having to trudge through equations to see the patterns.

Ulam published his findings soon afterwards, and other mathematicians began to analyse Ulam’s spiral. It wasn’t long before it was discovered that Euler’s prime generating polynomial function, n2 + n + 41, was represented by one of the lines. As computational capabilities were rapidly increasing, mathematicians were able to find more and more obscure polynomial functions, each of which represented a line on the spiral. Like Euler’s, none of the functions generated a prime for every value of n. Many of the functions did, however, produce a higher number of consecutive primes than Euler’s. The function with the largest number of consecutive primes to date is:

which gives 56 consecutive primes from n = 0 to n = 55.

~

This whole post I’ve been nattering on about primes and how these discoveries are so important. To mathematicians, yes, but how are prime numbers actually useful?

Until very recently, prime numbers were just a concept – a fascinating one, but ultimately rather useless in the real world. This would explain why up until the 18th Century, when recreational mathematics was on the rise, very few people devoted lots of their time to prime numbers. However, that all changed with the development of computers. In the 1970s a series of cryptographers theorised and eventually created an encryption system that didn’t require the entire process of encryption to be secret. This is now known as public-key cryptography. Prime numbers are at the heart of this encryption system, and with larger prime numbers comes greater security. The hunt for primes is on now more than it ever has been.

~

Before I finish, I’d briefly like to introduce a project called GIMPS, which stands for the Great Internet Mersenne Prime Search. The project began in 1995, and has since found 13 Mersenne primes out of the known 48. From the time the first prime was found by GIMPS, every Mersenne prime has also been found by GIMPS.

What makes this project so effective is that it utilises everyone who is willing to participate. By downloading and running a small program, a participant can ‘lend’ a fraction of their processing power to the overall search for primes. If you’d like to be a part of a search that has been going on since 1600BC, you can learn more about GIMPS here(There are cash prizes if you find a prime.)

Thank you for reading.

-Ollie James

# Trigonometry and Life

We’re all familiar with the concept of trigonometry. It’s most commonly used, of course, to determine the angles and lengths in right-angled triangles. Provided you know any three side lengths or angles (including the right angle) in a right-angled triangle, you can easily use sin, cos and tan to work out the sides and angles you don’t know.

You’ll remember these basic trigonometric formulae from school.

You can also work out all the sides and angles in any triangle using the sine rule

Diagram of what each unknown corresponds to.

and the cosine rule.

Alternatively, you can simply dissect any triangle into two right-angled triangles and use SOHCAHTOA from there.

Examples of one triangle dissected into two right-angled triangles.

However, the amount of people whose knowledge of trigonometry stops there surprises me. To many people, sin, cos and tan are just buttons on a calculator. The nature of simply plugging in values and receiving an irrational number is somewhat menial, particularly if you have little of an idea of what is happening. Sadly, this is what a lot of people have experienced to be trigonometry.

~

The reality is that the functions of sine, cosine and tangent are embedded in the foundations of modern mathematics and, as you’ll discover, the world around us. First, you must understand that each of these functions has its own graph.

Sine

Cosine

Tangent

These graphs act as a reference every time you use a trigonometric function. Whenever you type ‘sin(90)’ into your calculator, for example, the calculator will find 90° on the x-axis and return whatever y value the sine graph has at that point; hence why sin(90) = 1.

Now, that’s all very nice, but where exactly do these graphs come from? The answer may be a surprise to some people, considering that the trigonometric experiences of many focus around triangles. In fact, all of the trigonometric functions are created from circles.

The sine graph is created by plotting the angle of the radius of a circle against the y-coordinate. The cosine graph is created in exactly the same way, except the angle is plotted against the x-coordinate. If you’re confused, it makes a lot more sense visually.

Sine is the horizontal graph, cosine is the vertical one.

You may have noticed that the cosine graph is exactly the same shape as the sine graph, except in the GIF it is rotated 90°. This is exactly the reason why, when the graphs are plotted on grids as above, the cosine graph is equivalent to the sine graph, omitting the fact that it is shifted, or translated, 90° to the left. Additionally, this is how the name ‘cosine’ appeared; the two coincide, they cohere, they coexist.

Tangent, however, is a different story. It is called tangent because the graph is created by drawing a circle adjacent to the y-axis, so that the axis is a tangent to the circle, and then plotting the points where the extended radius of the circle would touch the tangent. Once again, this is much more easily explained visually.

The characteristic that sets the tangent graph apart the most is that it includes asymptotes. An asymptote is the singularity on a graph that cannot possibly contain any values. On either side however, lines become exponentially closer to it but never actually touch it. This happens because as you can see in the GIF, when the radius is at 90° from its initial position (vertical, in other words), it is parallel to the tangent. If you were to scroll up and try to find the point of intersection between the tangent and the radius, you would be scrolling for a very long time; there is no point of intersection, hence why there are no values exactly on the asymptotes.

I understand that I’m not exactly a master of clarity, so I’ll try to explain in a more logical way why there is no tan(90).

Let’s go back to SOHCAHTOA. The last of the three formulae, you’ll recall, is:

To try out tan(90), we’ll have to make θ equal to 90°. That’s easy enough.

A triangle in which two angles equal 90°.

Now we’ll need to make this back into a triangle. The only thing we can do to do that is to make the adjacent side length equal 0.

This is now what our triangle looks like. Isn’t it wonderful?

Next, we need to input the values back into the SOHCAHTOA formula.

Oh dear. Dividing by zero never ends well, so let’s not attempt it. It appears that a value for tan(90) simply doesn’t exist.

You can see from the tangent graph that it’s not only at 90° that an asymptote appears. Each of the graphs is a repeating pattern, and the length of one cycle on a tangent graph is 180°. In other words, you have to travel 180° along the x-axis to get from a certain point in one pattern to the same point in the next.

A ‘zoomed out’ tangent graph showing 180° between x values for any y value.

This is why the asymptotes appear at ±90°, ±270°, ±540°, etc. The difference between each one is 180°.

~

So we’ve talked about the main three trigonometric functions and their respective graphs. You may have seen the graphs before, or you may not have. However, you’re less likely to know that these graphs are actually scattered around us in various aspects of everyday life.

Let’s start with a spring. Springs can be found in all manner of items, particularly in physical mechanisms. However, if you look at a spring directly from the side, this is what it will look like.

Oh look, a sine graph! What happens if we rotate our view 90° about the spring so that we’re looking at it from above?

A cosine graph appears. Not only is this a real-world visual representation of both graphs, but it also demonstrates that a cosine graph is simply a sine graph at a displacement of 90°. You can try it yourself.

As you’d expect, this can be observed in any helical object (meaning any object pertaining to the form of a helix). Common examples include drill bits, spiral staircases, and any object with a screw mechanism, such as a water bottle.

If you’re interested, the mathematical equations of the helix are as follows:

x = A cos t

This means that when a helix is observed from the x direction, it is simply a cosine graph that is vertically enlarged by A and horizontally enlarged by the reciprocal of t.

y = A sin t

This means that when the same helix is observed from the y direction, it is a sine graph enlarged to exactly the same scale as the cosine graph from the x direction.

z = b t

This just means that the helix has b length in the z direction. When viewed from the z direction, all you will see is a circle when radius of length A.

You can also map tides using a sine graph very simply. I’ve created one to show you now.

An example of a graph of tides on a beach.

In this instance, we can say that the x-axis represents time of day in hours, and the y-axis represents height of tide in metres. Tides work on a 12-hour cycle, which you can see from the graph. In fact (disregarding any outliers which might affect the sea levels temporarily, such as a storm), tides will follow the exact pattern of a sine wave when plotted on a height-time graph.

~

Tangent graphs are also embedded in much of the real world, although they can’t exactly be observed in the same way that sine and cosine graphs can due to their asymptotes. However, their properties are often present.

Let’s revisit the spring. When a force is applied to the spring on one end, it is compressed, provided the force is in the direction of the spring. The more force is applied, the more compressed the spring becomes.

What happens if we draw a graph of the length of the spring against the force applied?

In this instance, the x-axis represents length of the spring in centimetres, and the y-axis represents force applied in Newtons.

On the graph, we get an asymptote, because you’d need an infinite amount of force to compress the spring so much that it had 0 length. It’s very similar to a tangent graph. In fact, the graph you’re seeing actually is a transformed tangent graph, with the equation y = tan(-x +90). The –x mirrors the graph horizontally (over the y-axis), while the +90 translates the graph 90° to the left so that the asymptote occurs when x = 0. It’ll become clearer when I show a wider perspective of the graph.

Another application of tangent graphs is to do with the motion of pendulums. Imagine a small ball hanging from the end of a string, which is attached to the roof of the interior of a car.

Once the car starts accelerating, the pendulum will swing in the opposite direction of motion. The equation that determines the angle between the pendulum and the vertical axis is:

Does this equation look familiar? That’s right, it’s the tangent formula from SOHCAHTOA! We’ve simply replaced ‘opposite’ with ‘ma’ and ‘adjacent’ with ‘mg’.

This equation also shows us why it’s impossible for the pendulum to be parallel to the roof (ignoring the fact that the ball is in the way). If the pendulum were parallel to the roof, then θ would be equal to 90°. As we know, there is no value for tan(90). To make it possible, either a would have to equal ∞, or m would have to equal either 0 or ∞, all of which are beyond the laws of physics. (Quantum theory may disagree, but we won’t get into that right now.)

Of course, you could just go into space, where g would equal 0, but then the formula wouldn’t apply there. You can’t cheat maths.

~

To finish, I’ll just leave this link here. It’s a brilliant interactive resource that lets you visualise the three basic trigonometric graphs (plus their hyperbolic counterparts) and how they are related to the circle. If you didn’t understand something in my explanations, then hopefully this will clear things up.

By the way, the scale is in radians as opposed to degrees. If you don’t know, radians are a way of expressing angles in a circle relative to π. If you delve further into them they become thoroughly interesting, but to understand the graph all you need to know is that π radians = 180°.

Thank you for reading.

-Ollie James

# Welcome

Hello readers!

I’m Ollie, a Maths student from the UK. This blog is in principle a place for me to write about areas of mathematics that I find fascinating. The posts here will range from simple explanations of abstract theorems to surprising applications of maths in everyday life. Although inevitably not every reader will be interested, I try to keep these posts as readable as possible for everyone.

No matter how open your eyes already are to mathematics, I hope this blog opens them a little wider.

-Ollie James