Fact-checked by Grok 2 weeks ago

Square packing

Square packing is a classic problem in and packing theory, concerned with the arrangement of non-overlapping squares—either of equal or varying sizes—into a bounded region such as a larger square, , or infinite strip, with the goal of minimizing the container's dimensions, maximizing the number of squares fitted, or achieving the highest possible without gaps or overlaps beyond boundaries. A central variant, known as square packing in a square, focuses on determining the smallest side length of a containing square that can hold n unit squares (side length 1), typically axis-aligned without rotations, though configurations allowing arbitrary orientations are also studied. For perfect packings where n = k2 for integer k, the minimal side length is exactly k, but for other n, suboptimal arrangements leave gaps, and the optimal side length s(n) satisfies √ns(n) ≤ √n + 1. Optimal solutions have been rigorously proven for small n such as 2, 3, 5–8, 10, 13, 14, 15, 24, 34, 35, 46–48, with more values proven in recent years; known packings and bounds are available up to n=324 as of 2025, often involving intricate tilted layouts. Other notable variants include packing unequal squares into a bin (relevant to bin packing algorithms), online square packing where squares arrive sequentially without foreknowledge of sizes, and multidimensional extensions like cube packing in . These problems, dating back to the with the problem formally posed by Erdős and Graham in 1975, are NP-hard in general, connecting to applications in , VLSI chip design, and .

Fundamentals

Definitions and Objectives

Square packing refers to the arrangement of non-overlapping squares—either of equal or varying sizes (with equal-sized squares often taken as unit squares for convenience)—without overlap or protrusion into a larger shape, such as a , , or other , with the aim of either maximizing the number of squares accommodated or minimizing the 's size for a given number of squares. This geometric emphasizes efficient space utilization while adhering to non-overlapping constraints, where interiors of the squares remain disjoint and fully contained within the boundary of the host shape. The core objectives are typically framed in dual ways: for a fixed integer n, determine the smallest side length s(n) of a square that can enclose n unit squares; alternatively, for a container of fixed dimensions, identify the maximum n that can be packed inside it. Packings may be restricted to axis-aligned orientations, with all squares parallel to the container's axes for simplicity, or permit rotations, allowing arbitrary angles that frequently yield denser configurations by better filling interstitial spaces. Historically, square packing emerged in early 20th-century , gaining formal rigor through problems posed by in the 1930s for Hungarian high school students and subsequent analysis by Erdős and Ronald L. Graham in the 1970s. In asymptotic settings for large containers, packings achieve densities approaching 1, though quantifying the minimal wasted space remains a key challenge.

Types of Packings

Square packing problems can be categorized based on the sizes of the squares, their orientations, and additional constraints imposed on the arrangement. The most fundamental variant involves packing equal-sized squares, where all squares are identical unit squares, and the goal is to arrange them without overlaps or gaps within a to maximize or minimize the container size. This type forms the primary focus of research in square packing, as it simplifies analysis while capturing core geometric challenges. In contrast, unequal square packing allows squares of varying sizes, often aiming for a perfect or of a larger square without any wasted space. A notable example is the squared square, which is a square tiled by smaller squares of different sizes, all distinct. The first simple perfect squared square, using 21 unequal squares, was constructed by A. J. W. Duijvestijn in 1978, marking a milestone in the field after decades of manual and computational efforts. Another key distinction lies in the of the squares: axis-aligned packings require all squares to have sides to the container's boundaries, promoting simplicity in computation and implementation. Rotated packings, however, permit squares to be oriented at arbitrary , such as 45 degrees, which can achieve higher densities in certain non-rectangular containers by allowing more flexible nesting. Common constraints across these variants include prohibitions on overlaps between squares and requirements that no square protrudes beyond the container's boundaries, ensuring a valid enclosure. Specialized subproblems introduce further restrictions, such as online packing, where squares arrive sequentially and must be placed irrevocably without knowledge of future items, or packings tolerant of defects like small gaps for practical manufacturing. These variants find brief applications in areas like bin packing algorithms and VLSI , where efficient space utilization is critical.

Packing into a Square

Finite Configurations

The function s(n) denotes the side length of the smallest square that can contain n non-overlapping unit squares, allowing rotations but no overlaps or extensions beyond the boundary. For numbers n = k^2, the optimal packing is a k \times k with s(n) = k, achieving zero wasted space. This trivial configuration extends to nearby values, such as n = k^2 - 1, by removing one square from the , though more efficient rotated placements often reduce s(n) for non-square n. Exact or proven optimal values of s(n) are known for small n, with constructions relying on axis-aligned grids for many cases and rotated squares for others to minimize the enclosing side. For instance, the optimal packing of 5 unit squares uses a configuration where four squares form a 2x2 block and the fifth is rotated 45 degrees and placed in the corner, yielding s(5) = 2 + \frac{1}{\sqrt{2}} \approx 2.707, proven optimal by a simple area and positioning argument. Similarly, for 10 squares, a symmetric extension incorporates additional rotated squares, achieving s(10) = 3 + \frac{1}{\sqrt{2}} \approx 3.707, also proven optimal. The following table summarizes known optimal or best-known values of s(n) for selected small n, where exact values are integers for grid-based packings and approximations indicate upper bounds from constructions (lower bounds match in proven cases):
ns(n)Notes
11Trivial single square.
2–422x2 grid (optimal).
5$2 + \frac{1}{\sqrt{2}} \approx 2.707Rotated placement (proven).
6–93Near-grid (optimal for 6–9).
10$3 + \frac{1}{\sqrt{2}} \approx 3.707Rotated extension (proven).
13–154Near 4x4 grid (optimal for 14–15).
245Proven optimal construction.
34–356Near 6x6 grid (optimal for 35).
46–487Near 7x7 grid.
These values are compiled from exhaustive searches and constructions, with proofs for cases like n=24 and n=35 relying on impossibility arguments for smaller enclosures. For moderate n where grid packings leave significant gaps, tilted arrangements improve efficiency. A notable example is n=17, where the best-known packing achieves s(17) \approx 4.676 using squares rotated at three distinct angles (0°, approximately 15.5°, and 45°), filling space more densely than axis-aligned or single-angle tilts; this construction, found by John Bidwell in 1998, remains unimproved despite extensive computational searches. Another challenging case is n=11, with the best-known s(11) \approx 3.877 from Walter Trump's 1979 configuration, featuring most squares axis-aligned but two tilted at approximately 40.2° to nestle into tight gaps around a central cluster—visualized as a near-3x3 grid with protrusions accommodated by precise angular adjustments, though optimality remains unproven due to the rigid interlocking that resists further compression. Ongoing research has yielded improved upper bounds for s(n) up to n=324 through computational optimization and novel strip-based constructions, as documented by (2009), with extensions to larger n computed by David Ellsworth as of January 2025, often reducing wasted space by 1–5% over prior grids via localized rotations. As of January 2025, David Ellsworth has computed and visualized best-known packings up to n=324, often using polynomial expressions for exact side lengths where possible. The wasted space in these finite packings is quantified by W(s) = s^2 - \max\{n \mid s(n) \leq s\}, representing the unoccupied area in the optimal filling of an s \times s square with unit squares. For example, W(3) = 9 - 9 = 0 for the perfect 3x3 grid, while W(4) = 16 - 15 = 1 reflects the single gap in the best 15-square packing. This metric highlights inefficiencies in non-perfect cases, with constructions for n=24 and n=35 achieving W(5)=1 and W(6)=1, respectively, via careful gap minimization.

Asymptotic Bounds

The asymptotic density of packings of unit squares into a large square of side length s approaches 1 as s \to \infty, meaning the wasted area W(s) = s^2 - \max\{n : s(n) \leq s\} satisfies W(s) = o(s^2), where s(n) denotes the side length of the smallest square that can contain n unit squares. However, more precise bounds reveal that W(s) grows sublinearly but non-trivially. A seminal upper bound of W(s) = O(s^{7/11}) was established by Erdős and Graham through explicit constructions. This was improved by Chung and Graham to W(s) = O(s^{3/5}) using a strategy that divides the large square into regions packed with aligned and rotated squares. On the lower bound, Roth and Vaughan proved that W(s) = \Omega(\sqrt{s} \cdot (s - \lfloor s \rfloor)) under certain conditions on the fractional part, implying in particular that W(s) \neq o(\sqrt{s}) and establishing a non-trivial inefficiency for infinitely many s. This result shows that the wasted area cannot be bounded by any function growing slower than \sqrt{s}. Post-2000 developments, including the 2009 refinement by Chung and Graham, have narrowed the gap between upper and lower bounds, but the optimal exponent remains open, with a conjecture that W(s) = O(\sqrt{s}). For side lengths s that are half-integers (i.e., s = k + 1/2 for integer k), the minimal wasted space is conjectured to grow more slowly than the general case, potentially bounded by a constant or logarithmic term, though the precise growth rate is an unresolved open problem. This conjecture arises because half-integer sides allow for more symmetric dissections, potentially minimizing gaps near the boundaries. Regarding the asymptotic form of s(n), it is known that \sqrt{n} \leq s(n) \leq \sqrt{n} + 1, but finer expansions are of interest. The Roth-Vaughan lower bound implies s(n) = \sqrt{n} + \Omega(n^{1/4}) for infinitely many n, reflecting periodic fluctuations due to the fractional part of \sqrt{n}. A heuristic suggests s(n) \sim \sqrt{n} + \Theta(n^{1/4}), capturing the scale of these oscillations, though the upper bound matching this order remains unproven, with only weaker envelopes like O(n^{1/3}) or better from constructions available in the literature.

Packing into a Circle

Known Packings for Small n

The known packings of unit squares into the smallest enclosing for small values of n have been determined through computational searches, with only a few cases rigorously proven optimal. These results provide exact or near-exact minimal radii r(n), where the squares may be rotated and translated but not overlapped. The configurations often exploit for smaller n, transitioning to more complex arrangements as n increases. The following table summarizes the minimal known radii r(n) for n = 1 to $12, including exact expressions where available and numerical approximations. Only the cases for n=1 and n=2 are proven optimal, while n=3 was rigorously verified as optimal in 2018 using computer-assisted optimization. Higher values represent best-known packings from exhaustive searches.
nExact r(n)Approximation
1\sqrt{2}/20.707
2\sqrt{5}/21.118
3$5\sqrt{17}/161.288
4\sqrt{2}1.414
5\sqrt{10}/21.581
6\sqrt{(19706163 + 13275064\sqrt{2} - 40\sqrt{(443374242065 + 313512226176\sqrt{2})})/534}1.688
7\sqrt{13}/21.803
8-1.978
9\sqrt{1105}/162.077
10$3\sqrt{2}/22.121
11-2.214
12\sqrt{5}2.236
For n=1, the configuration is a single centered square with no rotation required. For n=2 to $4, the squares are arranged in compact linear or grid-like formations, often axis-aligned or with minimal rotation to minimize the enclosing radius. Configurations for n=5 to $9 typically employ ring-like arrangements, with squares positioned symmetrically around a central square or empty space to achieve tight packing. For n=11 and $12, the optimal layouts become irregular, requiring non-symmetric placements and rotations to fit within the minimal circle. A notable example is the packing for n=7, where a slight rotation of certain squares yields the radius \sqrt{13}/2 \approx 1.803. These results stem from pioneering computational work by Erich Friedman in 1997, with improvements by David W. Cantrell in 2002 and others through numerical optimization techniques, including an exact value for n=6 found by Lew Baxter in 2025. Friedman's collection includes diagrams illustrating these configurations, highlighting the role of rotations in achieving near-optimality for larger small n. Such circular packings offer intuition for density compared to analogous packings into squares, where side lengths rather than radii are minimized.

Bounds and Challenges

The minimal radius r(n) required to pack n unit squares into a circle satisfies the lower bound r(n) \geq \sqrt{n / \pi}, obtained from the fact that the circle's area must accommodate the total area n of the squares. Asymptotically, r(n) \sim \sqrt{n / \pi} + o(\sqrt{n}), reflecting that squares can achieve planar packing approaching 1, though square-specific inefficiencies arise from angular constraints near the circular boundary, leading to wasted space proportional to the perimeter. Upper bounds on r(n) are established through explicit constructions, such as layouts inspired by hexagonal arrangements adapted for squares via rotations to better approximate the curved boundary and reduce gaps. These methods yield radii slightly larger than the asymptotic lower bound for moderate n, with ongoing improvements tightening the gap for larger values. Significant challenges persist in determining exact optimal packings, as configurations remain unresolved for all n > 12, and computational efforts rely on reductions and exhaustive searches, but scalability limits rigorous proofs beyond small n. Key open problems include computing the exact r(13), which would resolve the next unresolved case after proven optima for smaller n, and quantifying density gaps between axis-aligned packings (which enforce orthogonal orientations and yield lower densities) and those permitting arbitrary rotations (which allow denser boundary filling).

Packing into Other Containers

Rectangles and Strips

Packing unit squares into rectangles seeks to arrange n congruent 1×1 squares within a rectangular container of minimal area or favorable , with no overlaps and axis-aligned placements. The minimal area is n, achieved through perfect tilings when the rectangle dimensions a × b satisfy a × b = n with a, b integers; such tilings are possible using simple grid arrangements. The , defined as the ratio of longer to shorter side, is minimized by selecting factors of n closest to √n, yielding configurations closer to square-like efficiency compared to the fixed of 1 in square containers. For instance, n = 10 admits a 2 × 5 with 2.5, while n = 11 requires a 1 × 11 with 11, highlighting how non-square rectangles enable waste-free packings for any n. For rectangles with non-integer dimensions, packing density is less than 1 due to boundary waste. A tight upper bound on the maximum number of unit squares packable into an a × b is ab − (a + 1 − ⌈a⌉) − (b + 1 − ⌈b⌉), which accounts for fractional parts of the sides and aids in determining minimal dimensions for a target n when aspect ratios are constrained or optimized. This bound is sharp in many cases and extends classical results on square packings to rectangular containers. Shelf packing algorithms provide an effective for constructing these arrangements by dividing the into horizontal "shelves" of 1, filling each from left to right with unit squares until the shelf width is exhausted, then advancing to a new shelf. The Next-Fit Shelf algorithm processes squares in input order, while variants like First-Fit Shelf attempt placement in earlier shelves if space allows. For identical unit squares, these reduce to optimal row-by-row filling, achieving perfect packings when possible and minimizing the number of shelves (). These methods are particularly useful for long thin , where shelf widths near √n enable near-square ratios with approximately √n, improving over 1 × n configurations. Guillotine packings offer another structured approach, where the rectangle is recursively partitioned by straight cuts parallel to the sides, forming a binary tree of subrectangles each containing a unit square or further subdivided. Grid-based perfect tilings of unit squares are inherently guillotine, as they result from alternating horizontal and vertical cuts. For imperfect or constrained packings, guillotine constraints enable exact branch-and-bound algorithms to solve for optimal arrangements in rectangular containers, with applications in cutting stock problems derived from square packing scenarios. Infinite strip packing extends the rectangular case to a container of fixed width W and infinite length, aiming to minimize the used length L (or height if rotated) for n unit squares. The optimal L is n / k, where k = floor(W), achieved by filling complete rows of k squares each, with a partial row if needed. For small n, exact values are known: L(1) = 1 (single square fills the strip), and configurations scale linearly for larger n under integer W. Level-oriented algorithms, such as First-Fit Decreasing Height (FFDH), sort squares by height (all 1, so order-irrelevant) and pack into levels of height 1, placing each in the first level with sufficient remaining width or starting a new level; for unit squares, this yields optimal L. In the broader context of rectangle packing, FFDH guarantees used height at most 2 times optimal minus 1 for fixed width, though unit squares attain equality. Unlike square containers, rectangular and strip geometries permit arbitrary aspect ratios, allowing zero-waste packings and algorithmic simplicity for identical items.

Polygons and Complexity

Packing unit squares into arbitrary introduces significant computational challenges, particularly due to the irregular boundaries and potential concavities of the container. Deciding whether a given number n of axis-aligned unit squares can fit into a simple without holes is NP-hard, even when the is orthogonal and orthogonally with coordinates. This result, established via a reduction from Planar-3-SAT, resolves a long-standing by showing that no polynomial-time algorithm exists unless P=. Special cases, such as packing into triangles, have received attention for their geometric simplicity and relevance to denser configurations. For equilateral triangles, explicit packings of n unit squares into the smallest known such triangle are documented for n \leq 36, with side lengths ranging from approximately 2.154 for n=1 to 9.773 for n=36; these configurations often achieve densities approaching 1 for large n. In parallel packings—where square sides align with the triangle base—the maximum density \varrho for an equilateral triangle (height \sqrt{3}/2) is $2\sqrt{3} - 3 \approx 0.464, derived from optimal layer arrangements that minimize wasted triangular regions near the apex. Approximation algorithms provide practical solutions for larger instances. A polynomial-time approximation scheme (PTAS) exists for packing the maximum number of fixed-size unit squares into a simple polygon, achieving a (1 - \epsilon)-approximation of the optimal packing in time polynomial in the input size and $1/\epsilon. For convex polygons and small n, exact solutions can be computed efficiently using dynamic programming or integer linear programming formulations tailored to the boundary constraints. Non-convex polygons, such as L-shapes, exemplify how indentations lead to inefficiencies, with wasted space arising from unfillable corners or narrow protrusions that cannot accommodate full squares. In -based L-shaped regions within polygons, packing 2×2 squares (equivalent to unit squares on a halved ) often leaves isolated holes, reducing the overall by up to O(n^2) unit areas in worst-case configurations, as analyzed in reductions. Rectangular containers serve as simpler benchmarks, where such is minimized through cuts, contrasting the fragmentation in polygonal cases.

References

  1. [1]
    Square Packing -- from Wolfram MathWorld
    Find the minimum size square capable of bounding n equal squares arranged in any configuration. The first few cases are illustrated above.
  2. [2]
    Joseph Malkevitch: Tidbit: Geometric Packing - CUNY
    Geometric Packing Problems (10/19/2001) · 1. Pack squares into a square · 2. Pack squares into a rectangle · 3. Pack rectangles into a rectangle · 4. Pack ...
  3. [3]
    Packing Unit Squares in Squares - Erich Friedman
    Let s(n) be the side of the smallest square into which we can pack n unit squares. It is clear that √n ≤ s(n) ≤ √n , the first inequality coming from area ...
  4. [4]
    [PDF] Packing equal squares into a large square - UCSD Math
    The problem of finding dense packings of equal squares into a square has devel- oped a fairly substantial literature since it was first introduced some 35 ...
  5. [5]
  6. [6]
    [2105.08763] Online bin packing of squares and cubes - arXiv
    May 18, 2021 · In this work, we provide improved upper bounds on the asymptotic competitive ratio for square and cube bin packing problems.
  7. [7]
    Packing squares into a square - New Jersey Institute of Technology
    In this paper we show that the problem of deciding whether a set of squares can be packed into a larger square is strongly NP-complete, answering an open ...
  8. [8]
    Let s(n) be the side of the smallest square into which we can pack n ...
    This is accomplished by placing a b × b square of squares at a 45o angle in the center. This gives the best known packings for 28, 40, 65, and 89 squares (see ...<|control11|><|separator|>
  9. [9]
    [PDF] Note On Packing Squares with Equal Squares - UCSD Math
    As far as we know, this was first published by P. Erdos and appeared as a problem in a mathematical paper for high shool students in. Hungary. Beck and Bleicher ...
  10. [10]
    [PDF] Packing Unit Squares in Squares: A Survey and New Results
    Let s(n) be the side of the smallest square into which we can pack n unit squares. We survey the best known packings for n ≤ 100. We also improve the best known ...
  11. [11]
    Note Packing equal squares into a large square - ScienceDirect.com
    Packing equal squares into a large square. Author links open overlay panel ... Erdős, R.L. Graham. On packing squares with equal squares. J. Combin ...
  12. [12]
    Inefficiency in packing squares with unit squares - ScienceDirect
    It is shown that, in packing a square of side with unit squares, the wasted space always has area. This answers a question of Erdös and Graham.Missing: s) | Show results with:s)
  13. [13]
    Squares in Circles - Erich Friedman
    The following pictures show n unit squares packed inside the smallest known circle (of radius r). Only the cases n=1 and n=2 have been proved optimal. 1 ...
  14. [14]
  15. [15]
    Research Problems in Discrete Geometry - SpringerLink
    In stockIt is a collection of more than 500 attractive open problems in the field. The largely self-contained chapters provide a broad overview of discrete geometry.
  16. [16]
    Rigorous packing of unit squares into a circle - PMC - NIH
    This paper considers the task of finding the smallest circle into which one can pack a fixed number of non-overlapping unit squares that are free to rotate.
  17. [17]
    View of Packing Unit Squares in a Rectangle
    In particular, for two integers. a. b. 2, we see that an. a. b. rectangle is the smallest. rectangle with aspect ratio. a=b. into which. ab. −. 2 unit squares ...
  18. [18]
    Shelf Algorithms for Two-Dimensional Packing Problems - SIAM.org
    This paper studies two approximation algorithms for packing rectangles, using the two-dimensional packing model of Baker, Coffman and Rivest
  19. [19]
    Exact algorithms for the guillotine strip cutting/packing problem
    In this paper we present exact algorithms for strip cutting/packing problems. The proposed algorithms are based upon branch-and-bound procedures. In the first ...
  20. [20]
    A Strip-Packing Algorithm with Absolute Performance Bound 2
    We analyze several “level-oriented” algorithms for packing rectangles into a unit-width, infinite-height bin so as to minimize the total height of the packing.
  21. [21]
    Hardness of Packing, Covering and Partitioning Simple Polygons ...
    Apr 15, 2024 · We show that packing axis-aligned unit squares into a simple polygon P is NP-hard, even when P is an orthogonal and orthogonally convex polygon ...
  22. [22]
    Squares in Triangles - Erich Friedman
    The following pictures show n unit squares packed inside the smallest known equilateral triangles (of side length s). 1. 2. 3. s = 1 + 2 ...
  23. [23]
    Parallel Packing Squares into a Triangle | Results in Mathematics
    Jan 3, 2022 · A packing is called parallel if a side of each packed square is parallel to the base of P. The goal is to pack the squares into P with high density.
  24. [24]
    [PDF] Packing 2 × 2 unit squares into grid polygons is NP-complete
    Aug 19, 2009 · We call any packing of P with max(P) axis-aligned. 2 × 2 squares maximum. The decision version of the. 2×2 packing problem is given P and a ...<|control11|><|separator|>