Always a work in progress
I often find that the mundane and seemingly simple things can, when explored, lead to rather unexpected outcomes. This is a tale of my journey into the world of dots, and it all started, as many things do, with the antidote to boredom: curiosity.Â
A riveting math class had led me to stare at my notepad, doodling in between the dots, when I pondered the question:Â
How many dots can you have on a unit grid so that the gradient between any two dots is unique?Â
Repeated gradients: invalid
Unique gradients: Valid solutionÂ
It soon became clear that there is a strict theoretical limit. Because any two dots in the same row produce a gradient of zero, you can never place three dots in a single row, and you can only ever afford one row and one column with a pair of dots. Across an N x N grid, that limits you to at most two dots in one row and one dot in each of the remaining N - 1 rows, giving a maximum of N + 1 dots. By the same logic, a rectangular N x M grid is limited by its shorter side:Â
Now it was on to the task of finding the solutions with the theoretical maximum number of dots. Grids of size 2 and 3 were simple, but 4 took a considerable amount of time. 5 took over 20 minutes - but 6 felt seemingly impossible.
Please try to solve the puzzle yourself for any size grid. (There are multiple solutions.)
For many hours - days, in fact - I tried to deduce the logic behind this deceptively simple game on paper to little success. Picking the project back up years later, I finally had the coding skills (and foolishness) to attack it computationally.
Initially, random search was used: pick coordinates at random, reject any point that duplicates an existing gradient, and restart if the algorithm gets stuck after a set number of attempts. This worked up to a 6 x 6 grid, where it successfully placed 7 dots. On a 7 x 7 grid, however, it could never get past 7. The best results found for larger grids are shown in Figure 1.
Proving if 8 dots on a 7 x 7 grid was actually impossible or just too rare for random luck to find required an exhaustive search. Unfortunately, an N x N grid has N-squared possible dot positions, meaning the naive search space explodes as 2 to the power of N-squared. The waiting game began. To make it tractable, I precomputed all pairwise gradients into lookup tables and implemented branch-and-bound pruning, immediately abandoning any search branch the moment its remaining available spots couldn't possibly beat the current best score.
Figure 1: Number of solutions for higher-order grids. Shown are grids with high certainty of being maximised.
After much development and optimisation, exhaustive search was finally running, and all valid configurations could be mapped out, confirming that placing 8 dots on a 7 x 7 grid is genuinely impossible. A 6 x 6 grid is the largest square board on which you can ever achieve the theoretical N + 1 maximum, as shown in Figure 2.Â
Next came counting how many truly distinct solutions exist. Two grids that are simply rotated or flipped versions of one another are the same solution in disguise. For a square grid, eight symmetry transformations (rotations and reflections) are needed to compare every layout and strip out duplicates, by far the most computationally expensive process.
Figure 2: Number of unique solutions for maximised grids.
The 3 unique solutions for placing 7 dots on a 6 by 6:
Even with the solutions found, the underlying reason why the 7 x 7 grid fails remained a mystery. For further analysis, I wrote a script to count how many distinct gradients an N x N grid actually contains as N grows.
Figure 3 reveals why the problem is so erratic. Every time the grid grows by one unit, new gradients appear as fractions that couldn't be formed on smaller grids. When N - 1 is a prime number, almost none of those new fractions simplify, creating massive spikes in available directions. Conversely, when N - 1 has lots of factors, such as 6 on a 7 x 7 grid, most fractions reduce down to gradients already used on smaller grids. Right when 8 dots demand 28 distinct pairs of gradients, the 7 x 7 grid suffers a drought of new directions. Because this behaviour is tied to the irregular distribution of prime numbers, predicting the exact tipping point purely by hand quickly turns difficult.
Upon reading available literature, I discovered this puzzle has actually wandered past some proper mathematicians, including Paul Erdős:
Erdős, P., Graham, R. L., Ruzsa, I. Z. and Taylor, H. (1992) "Bounds for arrays of dots with distinct slopes or lengths"
Peile, R. E. and Taylor, H. (2000) "Sets of points with pairwise distinct slopes"
As Peile and Taylor noted:
Clearly, there is still plenty improvements left in this problem. For large grids where exhaustive search is impossible, random sampling only gives us a lower bound, if a cleverer search finds even one extra dot, the curve shifts upward. Fitting my empirical data (Figure 4) gives:Â
Figure 3: New gradients generated as grid size increases
Figure 4: Approximate fit of data for maximising square grids.
Figure 5: 8 dots on a 7 x 8 grid
Generalising the game to rectangular N x M grids adds a fresh twist. The theoretical cap stays at the shorter side plus one, and because rectangles only have four symmetries instead of eight, the number of unique solutions climbs dramatically (Figures 6 and 7). Most notably, stretching a 7 x 7 board by just a single column to 7 x 8 breaks the drought, unlocking 8 dots across 25 unique solutions (Figure 5).Â
Figure 6: Maximum number of points for an N x M grid. Green reaches the theoretical maximum.
Figure 7: Number of different unique solutions of maximum possible points on an N x M grid.
Figure 8: The only solution to constraining a 7 x 8 grid with 4 dots.
Flipping the puzzle on its head asks an equally intriguing question: What is the minimum number of dots required to completely lock down a grid so that no further dot can be added? In combinatorics, these are known as saturated configurations.
Figures 9 and 10 map out these minimal bottleneck solutions across rectangular grids, with blank cells indicating grids where the volume of valid configurations exceeded computational wait time. The standout anomaly sits once again at 7 x 8: there is only one unique way on the entire grid to shut down every remaining square using just 4 dots (Figure 8).
Figure 9: The minimum number of dots to constrain an N x M grid
Figure 10: Number of unique solutions
Figure 11: The single unique solution for 8 dots on a 3 grid in 3D.
Taking the game into three dimensions swaps 2D gradients for 3D direction vectors. Interestingly, the same logic from 2D extends cleanly into a higher ceiling: an N x N x N cube has N-squared vertical grid columns, and since at most one column can hold two dots without repeating a vertical vector, the theoretical maximum jumps to N-squared + 1.
For a 3 x 3 x 3 cube, that sets a ceiling of 10 dots, and exhaustive search reveals that 8 dots is the true maximum, achieved by just one unique configuration (Figure 11). Visualising solutions in 3D without a computer is nearly impossible, and checking for duplicates requires testing all 48 symmetry operations of a cube, compounding the computational cost even further.
Figure 12: The 14 Bravais lattices in 3D, showing symmetry to the 14 unique solutions for a 4-grid in 2D. Image: Kittel, Intro to solid state physics
There is a notable comparison between the number of unique solutions for a 2, 3, and 4 grid in 2D: 1, 5, and 14, respectively. This is the number of Bravais lattices in 1D, 2D and 3D in the field of condensed matter physics, as shown in Figure 12. This is most probably a coincidence, as unfortunately, this breaks for 4D. But considering the crystal nature of lattices and the symmetry rules governing crystal systems, it does lead one to ponder, and at the very least distract one from the rest of the lecture.Â
Because this puzzle ignores distances and cares only about direction, practical uses are slim, yet there is a neat engineering parallel. Whenever any two active points on this grid fire simultaneously, the vector connecting them uniquely identifies which pair triggered, without any ambiguity. That is the exact principle behind Costas arrays and sparse sensor geometries used in radar, sonar, and interferometry to pinpoint signal pairs without ghosting.Â
It has been many years since I began this project, and I have learned more than I could ever have initially imagined, more about my own condition. What was initially a test of my logical thought challenged me to ponder what I wish to do with this life, and sent me into spirals questioning why.
I presented my project to my academic supervisor, summarising what is outlined above. I got the following response.Â
' I would be happy to work with you, but I can't work on things that are solely beautiful... I only address them during my holidays when I feel I can be extravagant. My physics has to be useful and beautiful.'
I know somewhere in this world, this problem has been solved, and for someone, it was likely a Tuesday afternoon's work. Why should I spend my time searching for a path that has probably been walked before? As time ticks on, how many paths are left undiscovered? Is it arrogance or bravery that leads one to want to find a new path rather than to extend the ones that come before?Â
Well, I shall conclude that this project has taught me, and shall continue to teach me, to pursue what I love and find passion in what sparks my curiosity, even if the same curiosity has been explored by many. For whatever path we take, the sun always sets in the west.
[(0, 0), (1, 0), (0, 1)]Â
[(0, 0), (1, 0), (0, 1), (2, 2)]
[(0, 0), (1, 0), (2, 1), (0, 2)]
[(0, 0), (1, 0), (2, 1), (1, 2)]
[(0, 0), (2, 0), (1, 1), (1, 2)]
[(0, 0), (1, 1), (2, 1), (1, 2)]
14 unique solutions for the 4 grid
[(0, 0), (1, 0), (3, 1), (1, 2), (2, 3)]
[(0, 0), (1, 0), (3, 1), (2, 2), (0, 3)]
[(0, 0), (1, 0), (3, 1), (2, 2), (2, 3)]
[(0, 0), (1, 0), (3, 1), (3, 2), (2, 3)]
[(0, 0), (2, 0), (1, 1), (3, 2), (0, 3)]
[(0, 0), (2, 0), (1, 1), (3, 2), (1, 3)]
[(0, 0), (2, 0), (2, 1), (3, 2), (1, 3)]
[(0, 0), (2, 0), (3, 1), (1, 2), (0, 3)]
[(0, 0), (2, 0), (3, 1), (1, 2), (1, 3)]
[(0, 0), (2, 0), (3, 1), (3, 2), (1, 3)]
[(0, 0), (1, 1), (3, 1), (3, 2), (2, 3)]
[(0, 0), (2, 1), (3, 1), (1, 2), (2, 3)]
[(0, 0), (2, 1), (3, 1), (3, 2), (1, 3)]
[(0, 0), (2, 1), (3, 2), (1, 3), (2, 3)]
6 unique solutions for the 5 grid:
[(0, 0), (1, 0), (4, 1), (0, 2), (2, 3), (3, 4)]
[(0, 0), (1, 0), (4, 1), (3, 2), (0, 3), (2, 4)]
[(0, 0), (1, 0), (4, 1), (4, 2), (2, 3), (3, 4)]
[(0, 0), (2, 0), (4, 1), (1, 2), (0, 3), (3, 4)]
[(0, 0), (2, 0), (4, 1), (1, 2), (4, 3), (3, 4)]
[(0, 0), (3, 1), (4, 2), (2, 3), (4, 3), (1, 4)]
3 unique solutions for the 6 grid
[(0, 0), (2, 0), (3, 1), (5, 2), (4, 3), (1, 4), (1, 5)]
[(0, 0), (4, 1), (3, 2), (5, 3), (5, 4), (1, 5), (2, 5)]
[(0, 0), (4, 1), (5, 2), (2, 3), (5, 4), (1, 5), (3, 5)]