# Stop 3: Multi-dimensional World

Continuing our journey into the mathematical unknown, we land on a very strange, yet colourful planet. It appears as though the colours hold some sort of information… We find patterns that repeat themselves and gradients that get darker and darker. So, we go ahead and ask about the one and only interesting thing about a civilization: their maths. And it turns out that it is even stranger to us than what we have seen before, but definitely no less fascinating…

The aliens explain that their numbers are all four-dimensional. Three of these dimensions denote space and the fourth one is defined by colour. If we stop to think for a second, it makes total sense for a three dimensional world to be represented by three dimensional numbers with the ‘colour dimension’ providing additional information. If our ancestors had first needed to describe the positions of objects instead of their quantity, we might have learned about 3D numbers in school. We even have a way to represent four dimensional numbers through a system called quaternions, where every number is made up of four components. One important property of this system is that the basic axiom of commutativity (see the real number axioms explainer for a reminder if needed) doesn’t hold. This would mean for our aliens, that if they multiplied some number x with another number y, they would get a different result to when they multiply y by x.

In terms of the planet we currently find ourselves on, we may ask why the fourth dimension is defined through colour and not using numbers like every other dimension? Well, as it turns out, colour is a great way of extending  functions into an additional dimension. A simple way to accomplish this is by colouring a function such that small values appear lighter and large values darker. This is perhaps best visualised with the 2D sine function, which we can display as a 1D colour gradient as shown below.

This is not only a very logical system, it also comes with some mathematical advantages. We can expect these aliens to be much better at understanding objects and their relations in 3D space. Transformations such as rotations, which are often hard for us to describe simply, would pose no problem to them. As such we might expect to see incredible architecture utilising complex structures beyond our wildest imagination…

### Quaternions

Most of the time when we use numbers they will be natural numbers, or sometimes fractions. I’m sure many of you will also be aware of irrational numbers like pi, but perhaps not too much more. And in most everyday situations that is completely fine. But, as is often the case, once you dig deeper into the mathematics that surround them, there is in fact a whole world to explore…

As you are reading this, you have likely heard of complex numbers, but don’t worry if not as here’s a reminder: complex numbers are numbers that extend the real number line into a second ‘imaginary’ dimension. We can think of the complex numbers as a 2-D coordinate system. On the x axis are the real numbers and on the y axis are the imaginary numbers. These are based around the number i, which is defined as the square root of -1. This may seem peculiar, but think of it like this. We know that multiplying any number by itself always gives a positive result, since a minus times a minus gives you a plus. This means that we can’t find i anywhere on the real number line, and so adding the new imaginary dimension doesn’t interfere with any previous mathematics, and thus we consider it a valid extension.

Let us pick a point in our coordinate system that has the x value 5 and the y value 3. Normally we would write that point as (5,3). If we think of it as a complex number, however, we can use the notation 5+3i. We can describe any point in 2D space in this way.

Now you might be wondering why do we need complex numbers at all, if we can just use a coordinate system instead? In fact, mathematicians did so for centuries. But, as it turns out, complex numbers provide a very nice tool for describing rotations on a 2D plane which makes them very useful in fields like fluid dynamics, quantum mechanics, geometry, electrical engineering to name just a few examples.

Since complex numbers turned out to be so useful, people naturally wondered whether they could be expanded into more dimensions. One of these people was the Irish mathematician William Rowan Hamilton. He was trying to figure out a 3D number system similar to complex numbers which would allow him to describe spatial rotations in three dimensions. The problem was that he couldn’t find a way to divide his 3D numbers properly. Then, one day as he was taking a walk, a revelation came to him. He needed to add not one, but two more dimensions – and right there quaternions were born. Hamilton couldn’t hide the excitement at his discovery and so he carved the formula he had come up with into the bridge he was crossing. Whilst the story might be a little bit over-dramatized, the stone on which he carved his formula remains the destination of a ‘mathematical pilgrimage’ that takes place every year in honour of his discovery.

a + b i + c j + d k

This is the form of a general quaternion. As you may have noticed, it looks very similar to the complex numbers, just with some extra letters, and this is precisely because we are simply extending the complex number system. In fact, if we set c and d to be zero, we get back the complex number system. The variable a is what we call the real component which can be any real number along the usual number line. i, j and k are imaginary components, which form the basis of the new dimensions. We can imagine them as being a distance one away from the origin (the point where all coordinate axes meet) with each having their own axis. We also call b i + c j + d k the vector component. We can technically also represent quaternions as four dimensional vectors, but this development came later so we’ll stick with i, j, and k for now.

Calculating with quaternions is actually surprisingly easy. For example, suppose we want to add the quaternions Q1 = -3 + 2i + 8j + k and Q2 = 4.5 + 5i -2j + 6k. All we have to do is add each coordinate individually, so we end up with Q1 + Q2 = (-3 + 4.5) + (2 + 5) i + (8 – 2) j + (1 + 6) k = 1.5 + 7i + 6j + 7k

Multiplication is a little more complicated, but nothing that can’t be done. One interesting property of quaternion multiplication is that it is non-commutative. This means that multiplying some number Q1 by another number Q2 will actually give a different result than multiplying Q2 by Q1

This ‘non-commutativity’ comes from the relationships between the basis vectors i, j and k. Keep in mind that when we we write i, we actually mean 0 + 1i + 0j + 0k. The same goes for j and k. Using the quaternion multiplication formulae shown in the image above we find that

i*j = k, but j*i = -k

This behaviour is not exclusive to quaternions. Matrices are another example where multiplying A times B is different to B times A. This is not really a problem most of the time, but rather an interesting property that we need to keep in mind when performing calculations within these systems.

Now I’m sure you’re wondering why do we even need quaternions, if we could instead use matrices and vectors? And this is a very valid question. Most of the things that we use quaternions for, could also be done by other systems and methods. However, quaternions have proven to be very computationally efficient without having some of the problems other methods face. This is why many devices that need to work with positions and rotations in space will be programmed to perform calculations using quaternions. If you have a mobile phone that has a gyro – the sensor that knows how much it is tilted – it will most probably use quaternions. Or if you have ever looked at an animation of a three dimensional object, it too will probably be calculated through the use of quaternions.

Now that we have established their usefulness, there is just one last question left to answer. Why couldn’t Hamilton find a three dimensional number system as he had originally wanted? The answer is that such a system is impossible to exist, at least if we want it to have certain ‘nice’ properties. Hamilton couldn’t find a way to divide his 3D numbers and it was later proven that this is exactly the point where a possible three dimensional extension of the complex numbers breaks down. The actual proof of this is rather complicated, but the relevant thing is that in a 3D number system we can’t guarantee that division (except by zero) is always possible. This unfortunately makes it almost useless for any application.

Fortunately for us, Hamilton managed to find a way around this problem by extending to four dimensions. So, next time you’re near Dublin, Ireland, you might want to take a trip to Broom Bridge. Who knows what revelation might come to you there…