## A five dimensional pain

We’re back and this time working in five dimensions! But wait, we’re not done, we’re going higher and I’m not thrilled about this at all. Working in higher dimensions is a pain especially when we’re stuck in a three dimensional world. So what am I doing in a five dimensional space? Well besides pulling my hair out, I’ve been trying to do some not so basic math to find some significance, in life, but mostly in my data.

This is sort of a follow up to this post where I explained that as a mere human we can only think in three dimensional spaces. There are no higher dimensions as far as we are concerned and no matter how hard we try to think or visualize, we’re stuck in a three dimensional space. In fact, I went as far as to say that if we were dropped in a 4,5,6,N dimensional world we would STILL only see in three dimensions. We don’t have the ability to perceive higher dimensions and as far as nature is concerned, why should be be able to? There would be no use for it in our three dimensional world. Then math had to come along and ruin everything, as math does.

I already went into the history behind higher dimensional space, if only briefly, and I discussed my love of higher dimensional Sci-Fi stories. Then I concluded in explaining how I try to make sense of a four dimensional space or higher. Really I’m squishing everything down to three dimensions, but it’s representative. Of course I only spoke on how I visualize it and I figure today I can draw it out a little and show you why it’s so frustratingly painful to work in higher dimensions even when we’re thinking about them in a lower dimensional space. The math just gets weird and non-intuitive.

Okay here’s how I think of higher dimensions in my data. Let’s start with the one dimensional case since that doesn’t even need an image.

1,2,3,4,5,6,7,8,9,10….N

That’s one dimension, we have a single string of numbers that can only move right or left. We have no other valid directions we can go! Okay, technically we could have one dimensional data go other directions, but we would only be able to travel forward or backward. In my head I imagine that data as a line, like so:

See one dimensional. But we can easily go higher, get ready for some bad drawings, because it’s going to get ugly really fast! I could’ve probably done this more elegantly in Solidworks or something, but I like using bad drawings. It feels more mystical and only slightly evil. In any case, if we had two dimensional data that would look like this written out

1,2,3,4,5,6,7,8,9,10….N

1,2,3,4,5,6,7,8,9,10….N

1,2,3,4,5,6,7,8,9,10….N

1,2,3,4,5,6,7,8,9,10….N

Now we can still move left and right, but now we can also move up and down. Two dimensions! Which, now that we have two dimensions we can represent it visually like this:

Note that I made this a solid black, but it’s just to make it clear that this is a two dimensional object. Now it gets tricky, because a computer screen is two dimensional, three dimensional things like a photo only look three dimensional because your brain translates changes in size as depth in the picture. It’s how a lot of optical illusions manage to trick you, because of something called forced perspective (more here). Which is really how we see the world anyway. Point being going from two dimensions to three dimensions here means I’m really forcing you to see a three dimensional object that is nothing more than a two dimensional representation. Confused? I don’t blame you, but it only gets worse from here. So I can’t actually type out a three dimensional object because, well we’re in a two dimensional computer world (let me out!). So imagine that I took that black square and stacked a bunch in front and behind the one you see. Looking at it straight on you wouldn’t notice a difference, but if I rotated the object slightly you would see something like this.

Notice I drew some lines to show that we had different layers here. Again, horrible drawing, should’ve done it in solidworks, quit yelling at me. I also just drew the outline because let’s face it seeing a all black object would look two dimensional because frankly it is! So that’s the limit to our abilities. Frankly we’ve already exceeded our ability to talk three dimensions in this two dimensional world we call the internet, so we’re done… right? Not exactly, see this is how I visualize three dimensional data. A little block of information that I can cut into different sections depending on the dimension I want to “peel’ the data away from.

The question is how do I work in higher dimensions then? The truth is I don’t visualize it in higher than a 3D space, I just compartmentalize the dimensions. So let’s say I now had a four dimensional data set. Well since my entire world is this little block of data, I can imagine that my fourth dimension let’s me stack data next to the block. Basically I’m building a lego world. It looks something like this

Welcome to my three dimensional representation of a four dimensional space, shown using only two dimensions. This is literally how my brain works in four dimensions. Now I can attempt to (with a lot of effort) imagine how averaging across the fourth dimension would look (it would squash my blocks into a single block averaging each block together, which doing the math this is a valid way, for me anyway, to think about it). So if I really wanted to be silly about this we could just zoom out and if we went far enough our data would look like this

Yep, a one dimensional representation of a four dimensional space, in a two dimensional space. Just because I like to be extra confusing when I work in higher dimensions. It’s not me though, higher dimensions are confusing on their own and if you’re confused then don’t worry, so is everyone else. If you’re not confused then maybe I’m not explaining this correctly… or your a higher dimensional being which, hey no judgement from my three dimensional self.

Okay, but this project has me working in five dimensional space and I need to write a computer program to do some math operations on data in that five dimensional space, so how do I keep track of what my code is doing visually? That would look like this

This is as “five dimensional” as I can get. But once more from the top this is a three dimensional representation of a five dimensional space shown here in two dimensions! Grab some legos and you can do a three dimensional version for yourself, but I think we can get the picture… from my picture… okay I need to word things better my brain feels like it’s going to explode.

Now I have a bad drawing of five dimensional space, but again since we can only imagine three dimensions it’s not REALLY five dimensions, it’s just how *I* think about five dimensions so I can do the math and make sense of what the heck the computer is doing. Because if I don’t understand what it’s supposed to be doing, I won’t be able to make sure that the data it’s giving me back makes sense.

For the project I’m working on now, I need to perform some data shuffling in five dimensions, then average the data across three of the dimensions to return a two dimensional matrix of data. The only way I don’t go completely mad doing this type of work is by imagining what I’m doing using this higher dimensional block method I’ve come up with. It’s like getting a glimpse of a higher dimensional world in a way that my puny human brain can invision without my brain melting into goo and somehow popping out of existence because I’ve discovered something that shouldn’t be known by humans.

At the end of the day, even working in this lower dimensional representation is challenging and I don’t like doing it. I have to check and recheck my work because it just doesn’t make sense and keeping up with what is going on is very difficult. I guess I could just trust the math, but that seems foolish since I’m only human and mistakes can be made very easily, the result would look somewhat expected (have the right dimensions and lengths), but the result wouldn’t be what we need.

So once again I’m tempting fate and braving into this higher dimensional world to make sure the things I’m doing are exactly what I want to happen. It’s not for the faint of heart and as usual if I unleash a higher dimensional being on the world… well oops.

## But enough about us, what about you?