Tilted square geometry: turning the grid inside a square tray

When the cells of a tray puzzle are turned inside a square tray: the angles at which the grid repeats, which cells stay whole and where they are, how many fit, and why a tiny allowance at the edge changes the count

22 November 2026

In short

1. The question

A tray puzzle is a flat square tray filled with pieces made of unit squares. Normally the cells line up with the tray, and a 6 × 6 tray holds 36 of them. Turn the cells a little, keep them the same size, and some cells along the edge no longer fit: the wall of the tray cuts through them. A set of drawings that started this page found turns at which the cells still sit "nicely" in the tray. The first is 45°, a pattern of 1 down and 1 over. Then come 1 down and 2 over, 1 down and 3 over, and so on, each turned a little less than the last.

This page answers three questions about those turns. Can the angles be predicted? Why do they look regular? And how many whole cells does a tray of a given size hold, and where are they?

1 down, 1 over · 45.00° 50 whole cells at best, 40 at worst 1 down, 2 over · 26.57° 45 whole cells at best, 39 at worst 1 down, 3 over · 18.43° 49 whole cells at best, 44 at worst 1 down, 4 over · 14.04° 48 whole cells at best, 41 at worst 1 down, 5 over · 11.31° 48 whole cells at best, 43 at worst 1 down, 6 over · 9.46° 48 whole cells at best, 45 at worst
Figure 1. An 8 × 8 tray with the grid turned to each of the first six angles, each placed where it keeps the most whole cells. Blue and green cells are whole. Gray cells are cut by the edge and can hold no piece. The worst placement of the grid at the same angle keeps the smaller number below each tray.

2. The angles

"1 down, n over" describes the grid lines: walk n cells along a row of the tray and the row has dropped by one cell. The lines have slope 1/n, so the grid is turned by

θ = arctan(1/n)

For large n this is close to 1/n radians, about 57.3°/n. The angles shrink toward the straight grid without reaching it, so the series has no end.

SlopeAngle θRepeat s = √(n²+1)Cells per repeat squareBox wInset w/2
1 down, 1 over45.000°1.41421.4140.707
1 down, 2 over26.565°2.23651.3420.671
1 down, 3 over18.435°3.162101.2650.632
1 down, 4 over14.036°4.123171.2130.606
1 down, 5 over11.310°5.099261.1770.588
1 down, 6 over9.462°6.083371.1510.575
1 down, 7 over8.130°7.071501.1310.566
1 down, 8 over7.125°8.062651.1160.558
straight0°1110.5

3. Why these angles look regular

Start at a corner of a cell, take n steps along its row and then one step across, down the column. The point reached is exactly level with the start, √(n²+1) away. (The two legs, n and 1, are at right angles, so this is Pythagoras.) Do the same turned a quarter turn and you go straight up by the same distance. So the turned grid has a repeat square whose sides run along the tray's own edges. Its side is s = √(n²+1) and its area is n²+1 cells.

1 down, 2 over: repeats every √5 = 2.236 each shaded square holds exactly 5 cells' worth of area 1 down, 3 over: repeats every √10 = 3.162 each shaded square holds exactly 10 cells' worth of area
Figure 2. The orange staircase: n steps along a row and one step down end level with the start (dashed). Every shaded square is a copy of the same piece of the grid. A tray edge running along the shaded squares cuts the cells in a pattern that repeats every s.

This is the familiar "tilted square" of a pegboard. A square drawn with side 1 down and n over has area n²+1, the picture often used to prove Pythagoras's theorem. In the language of Gaussian integers, the repeat square is the grid multiplied by n − i.

So along each edge of the tray, the cells are cut in the same way every s cell widths. Within one repeat the edge crosses n + 1 cells. That repetition is the regular look of the drawings. At an angle whose slope is not a fraction, the edge never cuts two cells in the same way.

Other angles with the same property

Any slope that is a fraction q/p (in lowest terms) works the same way. The repeat is √(p²+q²) and holds p²+q² cells. The "1 down, n over" series is the case q = 1. When p²+q² is a perfect square, as for the Pythagorean slopes 3/4, 5/12 and 8/15, the repeat is a whole number of cells. Then, with one corner placed on a corner of the straight grid, other corners of the turned cells also land exactly on corners of the straight grid: one in every five at slope 3/4, √5 apart. That never happens in the 1/n series, because n²+1 falls strictly between n² and (n+1)² and so is never a square.

Slope q/pAngleRepeat √(p²+q²)Cells per repeat squareRepeat a whole number?8 × 8 best
1/145.000°1.4142no50
1/226.565°2.2365no45
2/333.690°3.60613no45
3/436.870°5.00025yes, 548
1/318.435°3.16210no49
2/521.801°5.38529no49
5/1222.620°13.000169yes, 1347
8/1528.072°17.000289yes, 1745

4. Which cells are whole, and where they are

A unit cell turned by θ needs an upright box of side

w = cos θ + sin θ = (n+1) / √(n²+1)

It lies inside the tray exactly when that box does, which means exactly when its center is at least w/2 from every edge. So the whole cells of any layout are the cells whose centers fall inside an inner square of side a = L − w, set in by w/2 from each side. The inset is 0.707 at 45°, 0.671 at 1:2, 0.632 at 1:3, and it approaches 0.5 as the grid straightens. Everything outside the inner square is a ring of cut cells.

Animation: the 8 by 8 tray at 1:2 with the turned grid sliding one step along a row and one along a column; filled dots are centers inside the dashed square, the count of whole cells goes between 45 and 39 and back w = cos θ + sin θ = 1.342 The turned cell needs an upright box of side w. It is inside the tray exactly when its center is at least w/2 from every edge. s = √5 = 2.236 1/s shift n/s Centers lie in rows
Figure 3. Left: the 8 × 8 tray at 1:2, with the grid sliding under it (about 20 seconds, then it starts again). Filled dots are centers inside the dashed square: those cells are whole. Open dots belong to cut cells. The count changes only when a center crosses the dashed line. Right: the turned cell's upright box, and the rows the centers lie in.

5. How many fit

The centers of the turned grid lie in level rows. For slope 1/n:

Counting the centers inside the inner square therefore gives the exact count. Row m's first center past the inner square's left edge is φm in from it, so

N = Σrows inside ( ⌊(a − φm) / s⌋ + 1 ),   φm = (φ0 + m n/s) mod s

Every row holds either ⌊a/s⌋ or one more center, depending on its shift. The tray holds ⌊a s⌋ or ⌊a s⌋+1 rows, depending on where the grid sits. Averaged over every placement the count is exactly

Naverage = (L − w)²

because every cell has an equal chance of having its center in any spot, and the centers are one per unit of area. Turning costs about 2wL cells against the straight tray: roughly one row and one column on each side, a little more at 45°, where w is largest.

The best placement does better than the average, and how much better depends on the fractions a s and a/s. When both are just above a whole number, the tray can take its largest number of rows with the largest number of centers in each, and the simple bound "most rows times most per row" is reached. For 8 × 8 that happens at 45° and at 1:2. For the later members of the series the rows hold 2 or 3 centers in turn, the bound is loose, and only the sum above gives the answer.

8 × 8Average (L − w)²BestWorstMost rows × most per row
1:143.4504010 × 5 = 50
1:244.3453915 × 3 = 45
1:345.4494422 × 3 = 66
1:446.1484128 × 2 = 56
1:546.6484335 × 2 = 70
1:646.9484542 × 2 = 84

The best and worst counts below are exact. They were found by treating every cell as the rectangle of grid placements that keep it whole and sweeping over all those rectangles at once. The worst count is in brackets.

Traystraight1:11:21:31:41:51:6
4 × 4168 (4)8 (5)9 (6)9 (6)9 (6)9 (6)
5 × 52518 (12)17 (12)15 (12)16 (13)16 (13)16 (13)
6 × 63625 (18)25 (20)24 (19)24 (21)25 (22)25 (22)
7 × 74932 (24)34 (28)37 (32)35 (30)35 (32)36 (33)
8 × 86450 (40)45 (39)49 (44)48 (41)48 (43)48 (45)
9 × 98161 (50)65 (57)64 (57)65 (60)63 (56)63 (58)
10 × 1010085 (72)80 (72)79 (72)81 (76)80 (73)80 (73)
11 × 1112198 (84)97 (88)97 (90)100 (93)101 (96)99 (92)
12 × 12144113 (98)116 (105)116 (108)121 (112)121 (116)120 (113)

No angle beats the straight tray. A turned tray keeps roughly (L − 1)² cells, sometimes a few more and sometimes fewer. In small trays the loss is large: a 4 × 4 tray at 45° keeps only 8 of its 16 cells. Among the turned trays the counts do not fall in a steady order. The best angle for a given tray depends on how L − w lines up with the row spacing, as section 6 shows.

6. A tiny allowance at the edge

At these angles many cells reach the edge at the same moment, because of the repeat in section 3. In an 8 × 8 tray at 1:2:

With every corner strictly inside, each row keeps 3 cells and the tray keeps 45. Let a corner poke past the wall by 0.025 of a cell and every row can take a fourth. The best count jumps to 52, more than the 50 at 45°.

Strict: 45 whole cells best placement, every corner inside Corners may poke out 0.05 of a cell: 52 orange cells are cut by the edge, by at most 0.05 of a cell width
Figure 4. The 8 × 8 tray at 1:2. Left: strict, 45 whole cells. Right: with corners allowed to poke out by up to 0.05 of a cell, 52. The orange cells are the ones the allowance lets in. The grid sits in a slightly different place in each, the best for each rule.

An overhang of d at a corner cuts off only a tiny triangle, of area d² / sin 2θ. At 45° and d = 0.05 that is a quarter of one percent of the cell. It is less than a drawing's line width, and less than the slack a real tray needs so the pieces can go in. So whether a design counts "strict" or "allowing a little" changes its count by whole rows. The allowance should be chosen on purpose and stated.

44 46 48 50 52 54 Whole cells, best placement 0 0.05 0.1 0.15 0.2 Overhang allowed, in cell widths 1:4 (14.0°) 1:2 (26.6°) 1:1 (45.0°) Overhang 0: 1:1 50, 1:2 45, 1:4 48 Overhang 0.0025: 1:1 50, 1:2 45, 1:4 50 Overhang 0.005: 1:1 50, 1:2 45, 1:4 50 Overhang 0.0075: 1:1 50, 1:2 45, 1:4 50 Overhang 0.01: 1:1 50, 1:2 45, 1:4 50 Overhang 0.0125: 1:1 50, 1:2 45, 1:4 50 Overhang 0.015: 1:1 50, 1:2 45, 1:4 50 Overhang 0.0175: 1:1 50, 1:2 45, 1:4 50 Overhang 0.02: 1:1 50, 1:2 45, 1:4 50 Overhang 0.0225: 1:1 50, 1:2 45, 1:4 50 Overhang 0.025: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0275: 1:1 50, 1:2 52, 1:4 50 Overhang 0.03: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0325: 1:1 50, 1:2 52, 1:4 50 Overhang 0.035: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0375: 1:1 50, 1:2 52, 1:4 50 Overhang 0.04: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0425: 1:1 50, 1:2 52, 1:4 50 Overhang 0.045: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0475: 1:1 50, 1:2 52, 1:4 50 Overhang 0.05: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0525: 1:1 50, 1:2 52, 1:4 50 Overhang 0.055: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0575: 1:1 50, 1:2 52, 1:4 50 Overhang 0.06: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0625: 1:1 50, 1:2 52, 1:4 50 Overhang 0.065: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0675: 1:1 50, 1:2 52, 1:4 50 Overhang 0.07: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0725: 1:1 50, 1:2 52, 1:4 50 Overhang 0.075: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0775: 1:1 50, 1:2 52, 1:4 50 Overhang 0.08: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0825: 1:1 50, 1:2 52, 1:4 50 Overhang 0.085: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0875: 1:1 50, 1:2 52, 1:4 50 Overhang 0.09: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0925: 1:1 50, 1:2 52, 1:4 50 Overhang 0.095: 1:1 50, 1:2 52, 1:4 50 Overhang 0.0975: 1:1 50, 1:2 52, 1:4 50 Overhang 0.1: 1:1 50, 1:2 52, 1:4 50 Overhang 0.1025: 1:1 50, 1:2 52, 1:4 50 Overhang 0.105: 1:1 50, 1:2 52, 1:4 50 Overhang 0.1075: 1:1 50, 1:2 52, 1:4 50 Overhang 0.11: 1:1 50, 1:2 52, 1:4 50 Overhang 0.1125: 1:1 50, 1:2 52, 1:4 50 Overhang 0.115: 1:1 50, 1:2 52, 1:4 50 Overhang 0.1175: 1:1 50, 1:2 52, 1:4 50 Overhang 0.12: 1:1 50, 1:2 52, 1:4 50 Overhang 0.1225: 1:1 50, 1:2 52, 1:4 50 Overhang 0.125: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1275: 1:1 50, 1:2 52, 1:4 53 Overhang 0.13: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1325: 1:1 50, 1:2 52, 1:4 53 Overhang 0.135: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1375: 1:1 50, 1:2 52, 1:4 53 Overhang 0.14: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1425: 1:1 50, 1:2 52, 1:4 53 Overhang 0.145: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1475: 1:1 50, 1:2 52, 1:4 53 Overhang 0.15: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1525: 1:1 50, 1:2 52, 1:4 53 Overhang 0.155: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1575: 1:1 50, 1:2 52, 1:4 53 Overhang 0.16: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1625: 1:1 50, 1:2 52, 1:4 53 Overhang 0.165: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1675: 1:1 50, 1:2 52, 1:4 53 Overhang 0.17: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1725: 1:1 50, 1:2 52, 1:4 53 Overhang 0.175: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1775: 1:1 50, 1:2 52, 1:4 53 Overhang 0.18: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1825: 1:1 50, 1:2 52, 1:4 53 Overhang 0.185: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1875: 1:1 50, 1:2 52, 1:4 53 Overhang 0.19: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1925: 1:1 50, 1:2 52, 1:4 53 Overhang 0.195: 1:1 50, 1:2 52, 1:4 53 Overhang 0.1975: 1:1 50, 1:2 52, 1:4 53 Overhang 0.2: 1:1 50, 1:2 52, 1:4 53
Figure 5. The best count in an 8 × 8 tray as the allowed overhang grows from 0 to 0.2 of a cell, at three angles. The count rises in steps, at the overhangs where a new row or a new cell in each row comes in. Hover for the numbers.
6 × 600.010.020.050.1
1:12525252525
1:22525252525
1:32426262626
1:42424242626
8 × 800.010.020.050.1
1:15050505050
1:24545455252
1:34949494949
1:44850505050
1:54848485050
1:64848485050

The drawings that started this page

The hand drawings behind this page were measured: their 8 × 8 trays are about 8.06 cells wide, and a few cells there touch or cross the line. Six of their ten counts are more than a strict fit allows, and all ten are within what a 0.05 overhang allows. The angles in the drawings match arctan(1/n) to within about half a degree.

TraySlopeDrawnStrict bestBest with 0.05 overhang
6 × 61:1252525
6 × 61:2252525
6 × 61:3262426
6 × 61:4252426
8 × 81:1505050
8 × 81:2504552
8 × 81:3494949
8 × 81:4494850
8 × 81:5494850
8 × 81:6504850

7. Recipe

  1. Pick the slope: 1 down and n over, θ = arctan(1/n). Or any fraction q/p.
  2. Work out w = cos θ + sin θ, and decide the allowance t (0 for strict).
  3. The whole cells are those with their center in the square set in by w/2 − t from every edge.
  4. Expect about (L − w + 2t)² of them. Slide the grid to find the best placement. Shifts within one cell are enough, because the grid repeats under its own steps.

Sources

← Back to Research