..7. And I've got some more numbers, let's do those. 19 and let's do 13... So what I've got here is a honeycomb, right, of hexagons. But, have a look,
it's a magic hexagon; so if we add up the rows, they all add up to the same
number - 38. So let's do that if; I say 9 plus 11 is 20 plus 18 is 38. Or if I add up a longer one, let's do a row of four like this one
here, I could have 12 plus 2 is 14,
plus 7 is 21, plus 17 is 38. Or I do a big one here, it's got five right down the middle; 18 plus one is 19, plus five is 24, plus 4 again is 28, plus 10 again is 38. So it's called a magic hexagon, every row adds up to 38, it's like a magic square where the rows and the columns and the diagonals all add up to the same number. Which is, you know,
nice that's kind of nice. Now, the thing is, this is the magic hexagon. This is the only magic hexagon. Okay, so magic squares, there are many types of magic squares but this is the only magic hexagon. You can rotate it and reflect it but apart from that it is unique. So we could do a bigger size; this has size three. So so we've got three layers; we've got one in the middle, then we've got a layer around it and then a third layer. We could have a magic hexagon- or we could try and get, a magic hexagon of size 4, size 5 or something else - they don't exist. This is the only magic hexagon, it is unique,
it is special, and I hope to show you why. So what I want to do first is I want to have a look at magic squares just for a second, Brady, if you want to sort of edit and cut to point-
So, you could have a magic square like that, it's 3x3. So every row and every column should add up to the same number - 15. Let's do this one here, 7 plus 8 yeah, so this is equal to 15. If I did this column, 15.
If I did this column - 15. And so should
the rows and the diagonals too. You can do different sizes, so
let's do a quick look at on a different magic square. This time all the rows and columns and diagonals add up to 34, all of them...yeah, equal to 34. Let's do a 5x5; and again I think the magic number is 65 for this one. So all the columns and rows should add up to 65, all right. How do you work out the magic number? What we're going to do is add up all the numbers in the square, all right? So it's gonna be 1 plus 2 plus 3 plus 4, right. So we get 1 plus 2 plus 3 plus- and so on. And that will go up to- well the biggest num- if it was nxn it goes up to n squared.
So we're going to add up all these numbers together; so they go all the way up to n squared, so n squared would be 9 here. It would be 16 here and it's 25 here. So we're going to
add them all together; there's a nice little trick to do that which is very simple to explain. If you add the first number and the last number together what do I get? I get n squared plus 1. If I add the second number and the second to last you get the same thing, n squared plus 1. You can actually add them up in pairs, you always get the same value. How many pairs are there? It's n squared divided by 2 pairs. So that's how much we get. But if we look at this in a different way, we're going to come at this from a different angle, what about this? We know each row is equal to the magic number, right, we'll call it M. So this is equal to M. The second row is equal to M, the third row is equal to M; every row is equal to the magic number. How many rows are there? Well there's n of them. So if you add all this together, another way of thinking about that is it's n lots of the magic number. And that means we can work out what the magic number is; if I do that using this that must mean the magic number is - we just divide
look - it's going to be n divided by 2 times n squared plus 1. So we learn how to do the magic number, look let's do it! And let's have this one, n equals 3, the magic
number is: 9, 3 squared equals 9, plus 1 is 10 and times by 3 is 30, divided by 2 is 15 - that's how you work out the magic number, yeah. So a
kind of nice little thing about maths there is looking at the same problem in two different ways to come up with an
answer, that's kind of nice. Now the reason I wanted to show that is that's what we're going to
do with the magic hexagon, it's going to
help us a lot, right. So with the magic hexagon we're going to add up all the numbers. So it's going to be 1 plus 2 plus 3 plus...now what's the last one here? It's not as simple as n squared, it's actually three n, n minus 1, plus 1. That's kind of come out of nowhere; I can actually show you why that's true, there's a nice way to show you why that's true, which is why I got the prop here. So I'm going to use the colours on this to show you why that's true. I'm going to destroy this now, let's do this. So if I rearrange- So I've rearranged the colours
and I've made the honeycomb again, but notice we've got like three rectangles here and each rectangle is going to be n long and n minus 1 on the short side. So long side is n, the short side is n minus 1. So each rectangle is n times n minus 1; there's three of them so it's three lots of that and then there's one in the middle, that's what you get when you make a
honeycomb. So here that's why the final number, that's how many hexagons there are in a honeycomb: 3 lots of n(n minus 1) plus 1 in the centre; alright. So we can do- we can do this, we can add this together, there's a good trick for that. It's the same thing, you do it pair by pair. So if we add 1 to the last one it's 3n(n minus 1) plus 2 because I've added those together. And how many pairs do I have? It's this thing plus 1 divided by 2. Which is not so nice, it's not as nice as the one I did with the magic squares, that's why I wanted to show you the magic squares first. But it's the same idea, completely the same thing. On the other hand, with the magic hexagon we know that each row is equal to the magic number. So how many rows do we have? We have 2n minus 1 rows and they're all equal to the magic
number, M. All right, so we solved that, we can work out what the magic number is. I'll skip to the end and I'll tell you what it is. 32 lots times the magic number is equal to something not particularly nice but don't worry about it too much, it's not a very nice formula. 72 n cubed, minus 108 n squared, plus 90 n, minus 27. Here's the important bit: plus at the end, a little fraction, it's 5 divided by 2 n minus 1. Right. (Brady: That's a beast!)
-It's a nasty looking thing; actually most of it you don't have to worry about. This is the important thing to notice: the left-hand side is a whole number. All this nasty stuff here is going to be a whole number as well. So the important observation is this thing here at the very end has to be a whole number, otherwise it won't work, so this has to be a whole number. When is that last thing there a whole number? It has to be n equals 1, or n equals 3. when n equals 1 you've got 5 divided by 1, which is a whole number. And when n equals 3 you've got 5 divided by 6 minus 1 so 5 divided by 5, is equal to 1. And that's the only size magic hexagon you can have. So n equals 1; I didn't mention that, I kind of was a bit sneaky about that. So if you want to know the magic hexagon of size 1, there it is. Let's do a- let's just check.
So if we add up all the rows we get 1; if we add up the columns it's 1; and just check the diagonals it's 1, yeah. So that works, so that's our magic hexagon. Ignoring that one we've got a magic hexagon of size 3. What is the magic number, by the way?
If you put it into this formula, if you had n equals 3, you got the magic number I told you at the start, it was 38. A magic hexagon, if it exists, has to be of size 3. So it's three layers: you've got the one in
the centre, you've got your second layer, and your third layer. We could fill it- maybe we could fill it in different ways, so that we could get different magic hexagons? And it turns out you can't. There is only one way to fill it; and let me show you how to work out. So first of all, if we add up all the numbers together - so that's adding up 1 to 19 - it's 190. Or, and I'm going to use the colours here, I could add all the pinks together; all the pink hexagons. So it's going to be this one here on the corners, all these pinks together, we're going to call that P for pink. By the way, that centre one we'll not call that pink, I think that's lilac, so that's not a pink one. Let's add up all the blues together as well; so we add all the blues together we'll call that B for blue. We'll add up all the yellows together, there's all the yellows. We'll call that Y for yellows. And then we add in the centre one; what d'you want to call it? L for lilac or?
- (C for centre?) C for centre, yeah, I'm happy with that. C for centre.
We add them all together, that's 190.
I hope you agree. Right, here's another way of looking at it; this time I'm going to add all the rows of three hexagons. So like this row together, and I add this row together, and this row together; there's actually six of those. And if I add them together a row a three is equal to the magic number 38, I know that. So let's do that. But notice, by the way, if I add this together and I add this row, this is actually getting counted twice. So let's do that. If I add all the rows of three, let's write that down, rows of three. All the blues get added together, but do notice that pinks get added twice. So we've got two lots of the
pinks plus the blues. There's six of them so it's six lots of the magic number, 38. If we do the same thing for the rows of four and the rows of five, and then we're nearly done. Let's do the rows of four; okay this is a row of four.
So we are adding the blues together, we've got some yellows here; and that's going to be equal to 38. There's actually six of those as well, rows of four, there's
six of those. And I think for this, yeah, each blue is going to get counted twice and each yellow gets counted twice.
So we've got two lots of the blues and two lots of the yellows- and there's six of these rows,
so six lots the magic number 38. And for the rows of five, they go straight through the centre like that, 1- actually three of them: 1, 2 and 3. So only three of those. The pinks get added once each time; the yellows get added once; the centre one actually gets added three times, because you go through the centre three times over. So you're going to get pinks plus the yellows plus 3 times the centre; and that's three lots of the magic number 38. We've got a few equations there. This is where I say 'and skip to the end'. I won't go through all the working but you've got enough information there now to work out that the numbers that you have to put in the magic hexagon have to be in this order. There is still some work to do, it's not completely obvious. You do have to try a few options and you'll notice that there's only a few options, and then in the end you realise there can be only one option. And then that's the magic hexagon. That is The magic hexagon. Numberphile is only possible because of support from the Mathematical Sciences Research Institute. However if you'd like to contribute, our new Patreon page offers opportunities to earn extra treats and secret videos from behind the scenes. Any money we raise will be used to create more animations, travel to famous mathematicians all around the world, and pull off some of our crazier plans. There's a link in the video description.