(A) A general two-dimensional lattice is parameterized by two vectors u and v and a periodicity parameter λi. Take u to be a unit vector, so that the spacing between peaks along the u direction is λi, and denote the two components of v by , v⊥. The blue-bordered region is a fundamental domain of the lattice, the largest spatial region that can be unambiguously represented. (B) The two-dimensional analog of the ambiguity in Figure 1C,E for the winner-take-all decoder. If the grid fields in scale i are too close to each other relative to the size of the grid field of scale i − 1 (i.e., li − 1), the animal might be in one of several locations. (C) The optimal ratio r between adjacent scales in a hierarchical grid system in two dimensions for a winner-take-all decoding model (blue curve, WTA) and a probabilistic decoder (red curve). Nr is the number of neurons required to represent space with resolution R given a scaling ratio r, and Nmin is the number of neurons required at the optimum. In both decoding models, the ratio Nr/Nmin is independent of resolution, R. For the winner-take-all model, Nr is derived analytically, while the curve for the probabilistic model is derived numerically (details in Optimizing the grid system: winner-take-all decoder and Optimizing the grid system: probabilistic decoder, ‘Materials and methods’). The winner-take-all model predicts , while the probabilistic decoder predicts r ≈ 1.44. The minima of the two curves lie within each others' shallow basins, predicting that some variability of adjacent scale ratios is tolerable within and between animals. The green and blue bars represent a standard deviation of the scale ratios of the period ratios between modules measured in Barry et al. (2007); Stensola et al. (2012). (D) Contour plot of normalized neuron number N/Nmin in the probabilistic decoder, as a function of the grid geometry parameters after minimizing over the scale factors for fixed resolution R. As in Figure 3C, the normalized neuron number is independent of R. The spacing between contours is 0.01, and the asterisk labels the minimum at ; this corresponds to the triangular lattice.