# Can a hexagonal grid embed rectangular coordinates?

I'm trying to figure out if a hexagonal grid can embed rectangular coordinates in whole numbers of "Y-steps". In the image below, one "Y-step" is the spacing between red hexagon centers in the Y dimension.

For some arbitrary hexagonal grid size, how many hexagons do I need to produce some whole-valued number of "Y-steps" in the X dimension?

Another way to ask this might be:

Select four hexagons whose centers create the corners of a square. In the hexagon grid orientation shown below, how many horizontal hexagons are needed to create such a square, and then how many vertical "steps" are needed in the Y dimension? Both X and Y values need to be whole integers.

In case it helps, this site provides great info in hexagonal coordinates, but I've not figured out how to pin down a way to solve this. We are using the "pointy top" orientation. Tragically, you will never get a square.

If the side length of a hexagon is $$1$$ unit, then the centers of two horizontally adjacent hexagons are $$\sqrt 3$$ units apart. However, the distance from the center of a hexagon to the center of the next hexagon directly above it is $$3$$ units. If we take $$a$$ horizontal steps and $$b$$ vertical steps, we will get an $$a \sqrt3$$ by $$3b$$ rectangle, and we can never have $$a \sqrt3 = 3b$$, because it would give us $$\frac ab = \sqrt3$$, but $$\sqrt3$$ is irrational.

The best thing we can do is find close approximations; for example, $$\frac{19}{11} = 1.72727\dots$$ is not far from $$\sqrt3 \approx 1.73205$$, so a rectangle formed by $$19$$ horizontal steps and $$11$$ vertical steps is quite close to a square.

• If the hexagons have to be normal, this is true. But can't we just squish the vertical dimension by a factor of $\sqrt3$? 2 days ago
• The asker of the question used the words "Hexagonal Grid", and linked to a game-development page about spaces with six adjacent spaces each. You've translated that into a hexagonal lattice, where it's not the faces and adjacencies that matter, but rather the symmetry. That's totally fine, but I want to make readers aware of that subtle change. A $\sqrt3$ squish preserves the faces-and-adjacency logic, which may be what someone is actually interested in. 2 days ago
• @JounceCracklePop A hexagonal grid is a grid formed by a tessellation of regular hexagons This is Math SE, basic definitions abound without having to be articulated every time. I'm sure there's a different term for what you are talking about - dicing up 2D space with a repeating pattern of irregular (squished) hexagons that fall on a square lattice, but it would be called something different than a "hexagonal grid" at that point. "hexagonal" is the symmetry, not the side-number.
– uhoh
2 days ago
• Incidentally, $\frac{26}{15} = 1.7333...$ gets significantly closer to $\sqrt{3}$ without increasing the terms by much. (Related to $26^2 - 3 \cdot 15^2 = 1$ giving a solution to the Pell equation $m^2 - 3 n^2 = \pm 1$ whereas $19^2 - 3 \cdot 11^2 = -2$.) 2 days ago
• Regarding approximations, it's also worth noting that in the context of computers, the limitations of pixels may already force the hexagonal grid to be an approximation. (In that case, we can just measure the number of pixels vertically and horizontally between two square centers, and use that to get values of $a$ and $b$ that will exactly create a square.) 2 days ago

There is a neat visual proof by contradiction that a perfect square is impossible. Note that the lattice of hexagon centers has six-fold rotational symmetry about every point. That means if you rotate any lattice point 60 degrees about another lattice point, you'll get a third lattice point. Assuming we had a square $$ABCD$$ consisting of lattice points, we could rotate each vertex around the next and end up with a smaller square $$A'B'C'D'$$: By repeating this procedure enough times, we would end up with a square smaller than the distance between neighboring hexagons, which is impossible! $$\square$$

I learned of this proof from Joel David Hamkins' blog.

• (+1) This also proves a stronger statement than my answer: it proves that there are also no squares that are tilted in a different direction from the horizontal-vertical rectangles I was looking at. 2 days ago