Saturday, November 17, 2018

Rose V: Square Wrap-Up and Isometric!


We’ve made a lot of progress on the Rose problems! Last time, we proved that given a rule of the form “N colored points in a row is not allowed”, we have optimal colorings for all square-grid spaces for as many dimensions as we want! That may sound pretty specific, but let’s take a broader look at just how many cases that covers.

I’m imagining sorting all possible rules into three different categories. They are: rules that prohibit only colored points, like “Three colored points in a row are not allowed”, rules that prohibit only uncolored points, like “Three uncolored points in a row are not allowed”, and rules that have some combination of those rules, like “an uncolored point between two colored points is not allowed”. Sidenote: If you remember from the Rose II definition, I decided to phrase all rules as negative, as “XYZ is not allowed”, because positive rules, like “you must have a colored point between two uncolored points” vanish as we go to infinity, or can be rephrased as negative rules.

If you think about these three categories, you’ll realize that we just solved the first one, for square grids of N dimensions, and the latter two are trivial: color the whole space and you’ll get an optimal coloring that won’t ever need an uncolored point for the rules to apply to.


What I’m saying is, give me a square grid of any dimension and any single 1D rule you can think of, and I can find and prove what the optimal coloring is!

But before we get to the more complicated “multiple rule” cases, let’s look at some alternatives to regular integer spaces. Namely, the isometric space!


This is a beautiful, interesting space. The purple triangles represent the points, and each point has six neighbors! The 2D square grid has two “directions” in which rules can be broken and adds a direction whenever you add a dimension. The 2D isometric grid has three directions from the get-go: one depicted horizontally here, and two on the 60° and 120° diagonals. And it’s even more interesting in other dimensions – I can sort of visualize a 3D isometric space, but it’s not clear to me if it’s well-defined or even exists in higher dimensions!

Let’s jump right in, as usual. For square grids, the easiest, quickest rule has been “Two colored points in a row are not allowed”. Let’s try our techniques on this new space.


And somehow, alternating colored points on the first row sort of… doesn’t work. Doing it means the entire next row must be uncolored. We can repeat this process on the next few rows to get a total of ¼ of the space colored. We can tell that it’s ¼ because of the trick we used for the square grids – find a tile that repeats. The red outlined parallelogram can be used to tile the whole pattern, and it’s ¼ colored, so the space is ¼ colored.


Then, I tried spacing them out more evenly, to get this configuration. It gets us 1/3 of the space colored, using the red outlined parallelogram.

After I found that one, I tried and tried and couldn’t find one that worked better. Maybe this is the best we can do in the isometric space. So then I went about trying to prove it when I hit upon this tile.


A simple, triangular tile, which you can alternate to cover every point in the space. But under our rules, the most colored that this tile can be is 1/3. If we color two points, that means there are two adjacent colored points, and that’s not allowed. And because this tile can tile the entire space, that means that the most colored the space can be is 1/3 colored!

So, we’ve proven that the 1/3 colored space above is the best you can do. We’ve done this by coming up with a space that is 1/3 colored, making 1/3 the lower bound, and using the pigeonhole principle to show that there can’t be anything better. If someone tells me they have a better fraction, I can break the space into these triangles with three points in them, and show that their coloring must have at least one triangle that has more than one colored point!

Next time we’ll look at some other rules for the isometric space, which is already looking much more complex than the square grids we’ve solved! With the rule we solved for today, we got ½ of the square grid colored easily!

Saturday, October 20, 2018

Interlude: Pokemon Hexagons

Happy Celebration of Mind Day! In the spirit of Martin Gardner, let's do some mathematics that's as approachable and intuitive as possible.

Let's take a little break from the Rose problems and talk about Pokemon. Love the games to this day, especially all the self-imposed challenges you can do. So, I was very excited to see graphics of Pokémon stat spreads as hexagons in an article recently, and of course it immediately got me thinking of a math problem.

For those of you who don’t know much about Pokémon, all species of Pokémon have “base stats”, which are measures of their competency in various areas. Each Pokémon has a stat for HP (Hit Points), Attack, Defense, Special Attack, Special Defense, and Speed. Base stats don’t seem to necessarily have an upper limit, but the highest existing base stat is Blissey’s 255 Base HP. There are a lot of other factors that determine a Pokémon’s actual stats, but we’re only concerned about their base stats for this problem.

The question that immediately came to my mind was, which Pokémon has the stat hexagon with the most area? Which Pokémon have a lot of area despite poor stats?


Here’s some example Pokémon hexagons. The first three are Abra, Kadabra, and Alakazam – an evolutionary line of Pokémon focused on Speed and Special Attack. Below them are Rhyhorn and Rhydon, an evolutionary line focused on HP, Attack, and Defense. And on the right we see Mew and Mewtwo, the legendary Pokémon from Generation I.

The order of the stats around the hexagon are important: Rhydon has a sizeable chunk of area because its HP, Attack, and Defense are all high and they’re right next to each other. (The order was decided by the article, and I kept the same it to answer my original question.) Obviously Pokémon with higher stats, like fully evolved Pokémon and legendaries, will have hexagons of larger area. But how should we distribute stats to get the most possible area?

It was at this point that I made a guess. I don’t know many of the newer Pokémon nearly well enough to make a great guess, but my intuition told me that something with very unbalanced stats would be the best shot at getting a high area. I went with Rhyperior, Rhydon's evolution, as the non-Mega non-legendary Pokémon with the most area, because it has gargantuan Attack, Defense, and HP, but next to nothing in the other three stats.

Now that I have a guess, let’s get to solving the problem. Let’s start by expressing it mathematically: you have six nonnegative radial lengths defining a hexagon. You also have a limitation that the sum of these lengths must equal a given constant. What radial lengths can you choose to optimize the area of the final hexagon?

This particular kind of hexagon is easy to find the area of, luckily. You can break it into triangles along the radial lines, and add up the areas of the six triangles for the area of the hexagon. Even more conveniently, we can use the 1/2(ab sin(C)) equation for a triangle’s area, which spits out a very convenient formula for us to maximize: (1/2)(sin 60)(ab + bc + cd + de + ef + fa). We can ignore the constant, because 2x will always be greater than 2y if x > y, so that leaves us with (ab + bc + cd + de + ef + fa), or the sum of adjacent products of base stats. Attack x Defense, Defense x HP, HP x Special Attack, and so on.

Now, how do we maximize this? Let’s try some test cases. I’ll use 600 as the base stat total, both because it’s conveniently divisible by six and because it is the actual base stat total of several Pokémon.

Case 1: Straight 100s across the board. The area of the hexagon (before the constant) is 60,000.

Case 2: 150, 50, 150, 50, 150, 50. The area is only 45,000.

Case 3: 50, 50, 50, 150, 150, 150. The area is 65,000. We’re getting warmer!

Case 4: 0, 0, 0, 200, 200, 200. The area shoots up to 80,000!

Case 5: 0, 0, 0, 0, 300, 300. The area maxes out at 90,000!

Case 6: 0, 0, 0, 0, 200, 400. We’re back to 80,000, which means we have our answer.

It turns out that a Pokémon with only Attack and Defense would have a greater hexagon area than any other distribution of its stat total! The way to maximize the sum of adjacent products of a list of six is to make two of the numbers as large as possible, and equal! Does this work with an arbitrarily large or small set? What if you used products of three numbers, like (abc + bcd + cde + ...)? Most importantly, it means my intuition was right, kinda!

I crunched the numbers (and made a little Excel tool for viewing any Pokémon’s hexagon, as well as its total area), and I was close, if not exactly right. The first non-legendary of the list, is Slaking, with a base stat total greater than most legendaries. Then there’s Garchomp, Metagross, Goodra– Pokémon known for being solid all around with maybe one exceptional stat. A heap of legendaries later, Rhyperior, the 15th non-mega non-beast non-legendary on the list. Feels like I’m having to invent rules to be right, but I’m still gonna round that up to a win. J

Wednesday, October 3, 2018

Rose IV: 4 and N Dimensional Staircases



Yikes, four dimensions. As if visualizing a three-dimensional space of colored and uncolored points wasn’t complicated enough. In the last post, we showed that a 3D staircase coloring works as an optimal solution for the Rose Problems we were discussing, but now we have to try and extend that to higher dimensions. Luckily, we happen to live in a four-dimensional world: three spatial dimensions and one temporal dimension, and I find visualizations in this mixed space are actually not that bad.

Let me just start with a simple example to introduce the idea of thinking in this 4D space. I’m going to call it (3+1)space, because it’s three dimensions of one type and one dimension of another, as opposed to a true 4D space, with all four dimensions of the same type.

Imagine four blocks in a row horizontally across a table. Now imagine that you pick them up and lay them on the table so they’re oriented vertically along it. Or in a stack on top of each other. It doesn’t take much mental effort to view those changes as a “rotation”. They were along one axis, or dimension, and you aligned them with another axis, but kept the object itself very much the same. Now, imagine rotating the four blocks along the axis of time. You’d see one block, and then it would be replaced with the next one, and the next one, and the last one, and then there would be nothing.


These three shapes are the same, two along a spatial dimension, and one along a temporal dimension. There’s a lot of fun you can have with this, but perhaps we’ll talk about that another time. For now, let’s return to our transformation of the 3D staircases to 4D. We’re not rotating anything (yet), but you will need that (3+1)D visualization skill to picture the next part.

Let’s say we’re in four dimensions, and our rule is “two colored points in a row is not allowed”. The two dimensional solution to that is a 2D staircase that looks like this:
  


And the 3D solution is just layers of that solution, staggered so they don’t overlap. The (3+1)D solution will just be that 3D solution, swapping which dots are colored every unit of time!



We can easily verify this, too! We know that there will never be two in a row along any of the spatial directions, because that was point of the 3D staircase proof. Now, if we focus on a single point in time, there will never be two consecutive moments when it’s colored. And the wonderful thing about our (3+1)D system is that it’s completely equivalent to a 4D system. It’s a lot easier to visualize, but any rules or discoveries here apply there, too! Therefore, the 4D staircase works!

It’s pretty easy to show that 4D staircases work for other similar rules, too. Here’s animations of the “three-in-a-row” and “four-in-a-row” rules, if you’re still skeptical. I can’t show all four dimensions because of the limitations of computer screens, but you get the picture.





I find these mesmerizing. It’s “perfect”, in a way, how the length, width, and temporal height of the rows of colored points are all the same. Try staring at one point to see the temporal height, and you'll notice that it's the same pattern as the vertical and horizontal!

And now, the jump to N dimensions. The technique I’ll be using is based on the imagining 4D as (3+1)D discussion earlier, but it has a much wider scope. I can perform an easy-to-visualize inductive proof on the number of dimensions by using the following transformation: N dimensions à N dimensions + 1 temporal dimension à N+1 dimensions.

Let me break down the technique. Let’s say we have some N dimensional space on which something works, like our staircase configuration. I may not be able to visualize this space, but I can visualize a single point, line, or plane of this space varying in time. If I can verify that the rule works, I can say that the new space has N + 1 dimensions, and do the same thing again to inductively prove that it works for any number of dimensions. This technique isn’t exactly a revelation in terms of the simple induction behind it, but it is excellent for helping me (and hopefully you) visualize what’s going on. Math is at its best when we have that intuitive understanding of what’s happening, not just a surface level knowledge of what technique to use.

And there we have it. It doesn’t matter what dimension we start in; we can show that the temporal direction in any staircase will work if the space is staggered, so we have now shown, that for any rule of the form “X colored points in a row is not allowed” on any standard N-dimensional space, we have a solution for the greatest percentage of that space you can cover. The solution is given by the Staircase coloring specific to (X, N), and the percentage of the space covered is (X – 1) / X.

That’s… a big deal. There’s a lot more to figure out here, but we’ve conclusively knocked out a lot of cases of a huge problem. More on that next time.

Sunday, September 23, 2018

Rose III: 3-Dimensional Staircases


Phew, back to the good stuff. Let’s talk about higher dimensions – 3, 4, and eventually N dimensions – and how the Rose problem works with them. Right now we know that in our two-dimensional world, a rule of “four colored points in a row is not allowed” yields an optimal coloring that looks like a bunch of staircases, that I immediately named the Staircase Configuration. As a first step into higher dimensions, let’s see if the same problem (four colored points in a row is not allowed) in three dimensions can be solved by a staircase analogue.

Sidenote: the Fundamental Theorem of Geometry is in full effect for this post. For anyone who needs a refresher, the Fundamental Theorem of Geometry is that 3D things are hard to visualize. We’ll also be using the Strong Fundamental Theorem of Geometry, which is that difficulty of visualization scales with the number of dimensions, in the next post.

Okay, so we’re in three-dimensions and our rule is that four colored points in a row is not allowed. My best idea as to how to tackle three dimensions is somehow build up from the 2D solution we had before.


 Let’s say that this, our 2D solution, is one plane of the 3D solution. This might seem like a bit of a leap, but remember that the 1D solution is one line of the 2D solution. In fact, it’s all the lines, only a bit staggered. Will that method work with the 2D to 3D jump?


Turns out, yes it will! These four cross-sections should be visualized in a stack, the leftmost one on the bottom and the rightmost one on top. I’ve only drawn out sixteen points for each, but they represent an entire plane of points, extending infinitely in two directions. So, you can see that they’re identical; I’ve just “staggered” them, shifting the next plane over by one point.

Each plane by itself cannot break the rule of “four colored points in a row is not allowed”; they are the 2D solutions, after all. Now we only have to check the z-direction – the direction that crosses one point on each of these planes. For example, imagining this example as a 4x4x4 cube, we can check the top left point on each plane. The fifth plane up is identical to the first, so we can see the familiar pattern of colored, colored, colored, uncolored. And checking each and every point in this cube, we can see that they all work! In fact, if you slice the cube into four planes in any of the other ways, the planes will all be identical to our 2D solution!

So, 3D staircases work! At least for this case – let’s check the other simple rules: three-in-a-row is not allowed, and two-in-a-row is not allowed.

      

They may be a little harder to visualize, but they work too! Now, for a 3D space with a rule of “N-in-a-row is not allowed”, we want to prove that staircases work for them, too. And it’s not that difficult – we’ve proven that a staircase works for 2D, and by staggering those 2D cases so there’s a total of N incremental staggers before it loops back to the original staircase, we have a provably sufficient staircase. A “stagger” really just builds up a vertical tower of the row you’re staggering along, and because the row abides by the rule, every vertical tower built up by staggering a 2D space will abide by the rule as well.


We’ll tackle 4D and N Dimensions next time!

Sunday, July 22, 2018

Rose II: Signposts and Necessary Evil


The problem I discussed in the last post, the first of the inaptly named Rose problems, was just a small, very specific case of a big general problem. When I first discover a seemingly rich vein of problem ore, there appear to be hundreds of directions to dig in. Who knows which direction I have to dig in to get the best problem gems (the hardest ones, if you will); it’s only after you find some that you start to get an understanding of the layout of the deposit. So, I’m going to try digging in a bunch of directions, trying to see what I can find.

First, let me restate the problem, as generally as I can. You have some kind of discrete infinite space, and an infinite number of tokens to place on points, and there are rules about configurations of adjacent tokens that aren’t allowed, and your task is to cover the largest possible percentage of the space.

Now, I’ve solved this for the specific case of the discrete infinite space being an infinite 2D checkerboard, and for the rules being “you can have only 1 or 3 tokens in a row horizontally or vertically”. The solution to that case is that 75% of the space, and the proof is in Rose I

-----------------------------------------------------------------------------------------------------------------

The next thing to do is list a few promising directions to dig in, and then go explore them. Here goes.

Problem variable manipulations – we’ve solved it for a specific case, but let’s think about the heart of the problem so we can see how many specifics there really was.
  •        We could try solving the same problem in 3, 4, or N dimensions.
  •        We could change the rules (of what configurations aren’t allowed).
  •        We could add the concept of multi-dimensional rules (such as a two by two square of tokens are not allowed)
  •        We could change the layout of the grid to isometric / other more complicated tilings
  •        Etc. I’m sure we’ll think of more as we get deeper in.


Rule Obsolescence – Oddly enough, it looks like the rule “you’re not allowed to have exactly two tokens in a row” in Rose I didn’t matter at all. If we re-allow that, the end result doesn’t change. That means that given a set of rules, some of them may be made obsolete by the others – and that sounds like it’s worth exploring.

Alternate Coverings – There might be many equally efficient ways to cover a space; how many? Are they isomorphic to the original, or are they new and unique?

----------------------------------------------------------------------------------------------------------

Finally, a note on terminology before I conclude this post. Yeah, I know; this is the awful part, the fatal flaw that prevents a mainstream love for math. But I promise it’ll be quick. I’m sure you already know that it’s necessary.

A Rose Problem considers some discrete N-dimensional space, and asks what is the maximum percentage of that space that can be covered (colored, as you’ll see in a moment), subject to certain rules.

To make things more fundamental, let’s switch from the “tokens covering a chessboard” metaphor to one of points and colors. Discrete spaces are made of Points, and points can be Colored instead of covered with a token. So I might say that 75% of this space can be colored, given the rules. Also, this opens up the possibility of multiple colors used on a space, and that could lead to some interesting optimizations.

Finally, Rules are patterns of colors that are not allowed in the final coloring of the space. I’ve been thinking of rules as negative (as in, you’re not allowed to use this particular pattern) rather than positive (as in, you must use this pattern), and I think it makes sense to keep it that way. Positive rules won’t matter as we go to infinity, unless we impose some sort of regularity to it (such as, in every 10x10x10 cube, this pattern must exist once), and that feels horribly contrived.

Phew. That’s it. More good stuff and less necessary evil in the next post.

Monday, June 18, 2018

Three-In-A-Row (Rose I)


Imagine your garden-variety infinite chessboard, with an accompanying infinite number of tokens. Now, imagine your task is to cover as much of the board as possible with tokens, one token to a space, but there are two accompanying rules. You’re not allowed to have more than three tokens in a row horizontally or vertically, and you’re not allowed to have exactly two tokens in a row horizontally or vertically. That is, these configurations are allowed:


And these are not.


This is the form that this problem originally took for me. It happened when I was playing with the placement of apps on my phone’s home screen; I’d be willing to bet that 90% of these interesting problems I think of originate from some mundane task in my life.

In any case, let’s try to solve the problem. Given these placement rules, what is that maximum percent of the plane that you can cover?



Of course, there’s many many more problems waiting to be uncovered here. When I find a potentially rich vein of problem ore, I immediately give it a name that does not age well, and often ends up being completely irrelevant to the fully explored problem. So, let’s continue that tradition by naming this set of problems Rose problems, a corruption of “rows.” Three-in-a-row, rows, Rose. A terrible, annoyingly catchy name, which is an essential bit of character for a dry math problem set. I’m sure there’s much more to come on the Rose problems soon enough!

Tuesday, June 12, 2018

Hexprimes I

I was invited to attend Gathering 4 Gardner this year (FINALLY!) and had a blast. Every single person I met was utterly fascinating in their own right – I met an unlikely number of interesting people! And, I was lucky enough to be able to give a talk at Gathering 4 Gardner, which was (to my surprise) well-received. I was afraid my half-baked musings would be too simple for that caliber of mathematician, but it turns out that they place a lot of value on something being understandable for someone of all skill levels. So here’s a brief discussion of the talk I gave!

-----------------------------------------------------------------------------------------------------------------------


A prime number is a number whose only divisors are 1 and itself. I’ve been thinking about different ways to define prime numbers, and here’s another definition that is completely legitimate: A prime number is the area of an integer-sided rectangle whose length or width must be 1. In the picture below, we can see that 12 is not a prime, because it can be written as a 6x2 or a 4x3 rectangle. 13 is a prime, because it can only be in an 13x1 rectangle.


And voila! Our new definition gives us something to manipulate and explore. What happens if we change “rectangle” to “triangle” or “hexagon”? What kinds of things are triprimes, or hexprimes?

A few considerations about technique and assumptions first. The defining characteristic of a rectangle as opposed to other quadrilaterals is that rectangles are equiangular, so I kept the triangles and hexagons equiangular as well. Rectangles are also very easy to break down the area of – triangles and especially hexagons are not quite as easy to break down. So I use a circle-packing metric in the place of area: for squares I use circles packed in a square grid, and for triangles and hexagons I use an isometric grid.


So, triprimes turn out to be kinda boring. Equiangular triangles are equilateral, so the only numbers that can be expressed as a triangle at all are, of course, the triangle numbers (1,3,6,10,15,21,…). The concept of the triangle numbers literally arose from this fact. So there’s a bunch of very predictable tricomposites (composites because their expressions do not have sides of length 1) and not really any triprimes. Like I said, boring.

Hexprimes, on the other hand, are fascinating. The equiangular constraint leaves plenty of wiggle room for interesting hexagons to form for each possible area. Some of those hexagons are diagrammed below. Note, they all have at least one tiny side, meaning they’re all prime.


And then we get to 7, the first hexcomposite. This hexagon with area 7 has no sides of length 1, which means it’s a hexcomposite. No smaller number is a hexcomposite!


Now that we know that both hexprimes and hexcomposites exist, it’s only natural to ask what other numbers are hexprimes and hexcomposites. It turns out that finding new hexcomposites is a bit different than finding regular composites. With rectangles, you can just double a rectangle and put them together to create another rectangle that must be a composite. You can’t combine an arbitrary hexagon with itself to create another hexagon. No, you have to increase by rows, like shown below.




And it turns out you can do this in a lot of different ways.


So, expressions for hexcomposites converge very quickly. With these hexagons, I can show that any number > 17 must be a hexcomposite! And that means that there are a finite number of hexprimes, and we can find them easily by checking the cases below 18. And, drum roll please – there are exactly 10 hexprimes! 2, 3, 4, 5, 6, 8, 9, 11, 15, and 17!


A final note – triprimes are very restrictive, and imminently predictable. Hexprimes are less restrictive, but composite-finding techniques converge quickly, so they are predictable as well. Give me any positive number, and I can very quickly tell you if it’s a triprime or a hexprime. But the middle ground, “rectangular” primes, AKA regular old prime numbers, are still infrequent and infinite enough to be unpredictable!

Sunday, March 11, 2018

The Vertices of a Cube

I recently got a couple of tiny wooden cubes – and by a couple, I mean about 250. They’re wonderful for visualizing all sorts of interesting problems about cubes and discrete 3-space. So, with a bunch of cubes in hand, I set about imagining some problems. I came up with three problems, all about the vertices of cubes, and here they are.

Problem 1

In my initial “problem searching” wandering, I drew the numbers 1 through 6 on the cube, with pairs adding up to seven on opposite sides like a standard die. Then I noticed that each of the eight vertices had three adjacent numbers, and I started to think about the eight different sets of numbers represented by the vertices. What if I could choose a number for each face, but each of those eight sets had to have the same sum? What would my choices be limited to?



Problem 2

Then, of course, I asked myself the reverse question. What if each of the vertex sums had to have a different value? Moreover, what is the optimal cube that satisfies this property? My intuition told me that there were probably many cubes that fit the description, so I needed to find a “best” one. Maybe one whose sums were all consecutive numbers, or one whose total sum was the lowest possible. So I decided to limit myself to positive integers.



Problem 3

The final question of the three came from a completely different angle, almost literally. One of the cubes had an imperfection, a little chip off of a vertex. As I studied it, I thought about the triangle formed when slicing off a vertex of a cube. As I imagined all the ways you could cut a vertex, it occurred to me that there was something strange. None of these triangles were obtuse, and only the most extreme edge cases were right triangles! But there wasn’t much of a limitation – I tried to imagine a good way to phrase the problem without the context of a cube, and this is what I came up with. If you have a triangle with one point on the x-axis, one point on the y-axis, and the final point on the z-axis, can this triangle be obtuse?