How many contacts can exist between oriented squares of various sizes?

A homothetic packing of squares is any set of various-size squares with the same orientation where no two squares have overlapping interiors. If all $n$ squares have the same size then we can have up to roughly $4n$ contacts by arranging the squares in a grid formation. The maximum possible number of contacts for a set of $n$ squares will drop drastically, however, if the size of each square is chosen more-or-less randomly. In the following paper we describe a necessary and sufficient condition for determining if a set of $n$ squares with fixed sizes can be arranged into a homothetic square packing with more than $2n-2$ contacts. Using this, we then prove that any (possibly not homothetic) packing of $n$ squares will have at most $2n-2$ face-to-face contacts if the various widths of the squares do not satisfy a finite set of linear equations.


Introduction
Throughout the paper we fix S := {(x, y) : −1 ≤ x, y ≤ 1} to be the standard square and [n] := {1, . . ., n} to be the first n positive integers.A homothetic copy of a set A ⊂ R d is any set rA + p := {rx + p : x ∈ A}, for some scalar r > 0 and some point p ∈ R d .With this, we define a homothetic packing of n squares, or homothetic square packing for short, to be any set P = {S 1 , . . ., S n } of homothetic copies of S where for each distinct pair i, j ∈ [n], the interiors S • i and S • j of the sets S i and S j respectively are disjoint.Given each square in P is of the form S i = r i S + p i , we can characterise P uniquely by two types of variables: the positive scalar radii r 1 , . . ., r n and the 2-dimensional real vector centres p 1 , . . ., p n .The contact graph G = ([n], E) of P is the (simple) graph where {i, j} ∈ E if and only if i = j and S i ∩ S j = ∅.See Figure 1 for an example of a homothetic square packing and its corresponding contact graph.
An immediate question one can ask is the following: what is the upper bound on the number of contacts for a homothetic packing of n squares?It is easy to see that roughly 4n − 6 √ n + 2 contacts Figure 1: A homothetic square packing with 11 contacts.The edges of its contact graph are represented by the coloured lines.can be achieved; given n = n 1 n 2 squares with the same radii, the homothetic square packing formed by arranging the squares in a n 1 × n 2 grid has 4n − 3(n 1 + n 2 ) + 2 contacts.However it is easy to see that this type of packing (or any similar packing formed by replacing square blocks of k 2 unit squares with a single square of radii k) forces the radii to satisfy some rational linear constraints.What, then, should the maximum number of contacts be for a homothetic square packing if the radii are picked more-or-less randomly?Although our previous construction proves that around 4n contacts are indeed possible, one very quickly notices that this is not the case if the radii of the squares are chosen at random.We encourage the reader now to construct n squares of various widths (whether from paper or other means) and try to arrange them in a way that maximises the amount of contacts while keeping the squares oriented in the same way.It becomes apparent very quickly that the most amount of contacts possible is never more than 2n − 2, no matter how the squares are arranged.
Our main result of this paper is that the maximum number of contacts achievable by a homothetic packing of n squares will exceed 2n − 2 if and only if the radii of the chosen squares satisfy some very basic linear constraints.Theorem 1.1.Let r 1 , . . ., r n be positive scalars.Then the following statements are equivalent: (i) Every homothetic packing of n squares with radii r 1 , . . ., r n has at most 2n − 2 contacts.
In [1], Connelly, Gortler and Theran proved an analogous result to Theorem 1.1 for disc packings (the definition of a disc packing being identical to that of a homothetic square packing except with the square S replaced by the closed unit disc).

Theorem 1.2 ([1]
).Let r 1 , . . ., r n be positive scalars that are mutually distinct and form an algebraically independent set.Then every packing of n discs with radii r 1 , . . ., r n has at most 2n − 3 contacts.
Although similar, Theorems 1.1 and 1.2 do differ in a few specific ways.Connelly, Gortler and Theran proved Theorem 1.2 by constructing a smooth manifold of disc packings with a given contact graph, and then showing that any disc packing with algebraically independent radii will be a regular point of a projection.Our method for homothetic square packings, however, only requires very simple concepts from geometry and combinatorics.Furthermore, Theorem 1.1 describes both a sufficient and necessary condition for a set of radii to generate packings with a low amount of contacts, while Theorem 1.2 only provides a sufficient condition.
Theorem 1.2 was in recent years also extended to homothetic packings of any convex body C ⊂ R 2 (a compact convex set with non-empty interior), so long as the convex body is also centrally symmetric (x ∈ C if and only if −x ∈ C), strictly convex (every point on the boundary of C is contained in a supporting hyperplane of C that intersects C at exactly one point) and smooth (every point on the boundary of C is contained in exactly one supporting hyperplane of C).Any such set is also known as a regular symmetric body.

Theorem 1.3 ([3]
).For every regular symmetric body C and every positive integer n ∈ N, there exists a conull1 set of vectors (r 1 , . . ., r n ) in R n >0 so that the following holds: every packing of n homothetic copies of C with radii r 1 , . . ., r n has at most 2n − 2 contacts.
Although a square is a convex body, it is neither strictly convex nor smooth, and hence is not covered by Theorem 1.3.In any case, Theorem 1.3 is a noticeably weaker result than both Theorems 1.1 and 1.2 as it does not describe either a necessary or a sufficient condition for a given set of radii to only generate packings with low numbers of contacts.
The paper is structured as follows.In Section 2 we introduce the various types of contacts a homothetic square packing can have, and use this to define red and blue edge colourings for a homothetic square packing's contact graph.In Section 3 we investigate the effect the weak generic condition (see Definition 3.1) has on the cycles in the induced red and blue subgraphs of the contact graph.These techniques are then applied to proving Theorem 1.1 in Section 4. In Section 5 we use Theorem 1.1 to obtain analogous results for square packings that allow for rotated squares (Corollary 5.2).We conclude the paper in Section 6 by proving that the natural analogue of Theorem 1.1 cannot be extended to homothetic cube packings Remark 1.4.A homothetic square packing can be considered to be a bar-and-joint framework in the normed space (R 2 , • ∞ ) by modelling the centres as points in R 2 , the edges as ℓ ∞ -norm distance equalities between points (to simulate squares in contact), and the non-edges as strict ℓ ∞ -norm distance inequalites (to simulate squares not intersecting).Whilst we will avoid using the language of bar-and-joint framework rigidity theory here, we do direct interested readers the work of Kitson and Power for more information about the topic [4].

Contact graphs for homothetic square packings
Unless stated otherwise, a homothetic square packing P = {S 1 , . . ., S n } will have contact graph G = ([n], E), centres p 1 , . . ., p n and radii r 1 , . . ., r n .We also denote the x-and y-coordinates of a centre p i to be x i , y i , i.e., p i = (x i , y i ).If two distinct squares S i and S j are in contact, at least one of two possible cases holds.
and S j have an x-direction contact; equivalently, S i and S j have an x-direction contact if and only if then S i and S j have a y-direction contact; equivalently, S i and S j have a y-direction contact if and only if The intersection of S i and S j will always contain the point If two squares have both an x-direction and y-direction contact then S i ∩ S j = {p ij }, and p ij will be a corner of both of S i and S j .In fact, this is the only way two squares in a homothetic packing can intersect at a single point.See Figure 2 to see a diagram of the possible types of contact between two squares.
Figure 2: Three possible types of contact between two squares: an x-direction contact represented by a red edge (left), a y-direction contact represented by a blue edge (middle) and a x-and ydirection contact represented by a red-blue pair of parallel edges (right).Although the latter type of contact is represented by two parallel edges, it will still be considered to be a single contact.
Using this extra information about the edges of the contact graph, we now define E x , E y ⊂ E to be the sets of x-direction and y-direction edges respectively.With this notation, we have that E x ∪ E y = E and E x ∩ E y is exactly the set of contacts with a single point in the intersection.When drawing the contact graph of a homothetic square packing, we shall always represent the edges in the set E x \ E y by a red line, the edges in the set E y \ E x by a blue line, and the edges in the set E x ∩ E y by both a red line and a blue line.Importantly, these "double edges" are still only counted as a single edge in our contact graph.See Figure 2 to see how the different contacts are represented.Interestingly, the subgraphs ([n], E x ), ([n], E y ) must always be triangle-free.Proof.It suffices to prove that ([n], E x ) is triangle-free since rotating P by 90 • will switch the edges E x and E y .Suppose for contradiction that ([n], E x ) contains a triangle.By relabelling vertices of G we may suppose that {1, 2, 3} is a clique in ([n], E x ) and x 1 ≤ x 2 ≤ x 3 .Since r i + r j = |x i − x j | for 1 ≤ i < j ≤ 3, all three x 1 , x 2 , x 3 must be distinct, i.e., x 1 < x 2 < x 3 .Hence By summing all three equations and halving the result, we have that x 3 −x 1 = r 1 +r 2 +r 3 .However this now implies that r 2 = 0, contradicting that all radii are positive.
One special way that one of the graphs ([n], E x ) or ([n], E y ) can contain a cycle is for four squares to share an intersection as seen in Figure 3; if this occurs, we say the four squares share a corner.As we shall soon prove, the only way to generate cliques with more than three vertices is with four squares sharing a corner.We first need to cover the following famous result of Helly.Theorem 2.2 (Helly's theorem; see, for example, [2]).Let C = {C 1 , . . ., C n } be a set of convex sets in R d where n ≥ d + 1.If every d + 1 distinct sets in C have a non-empty intersection, then We require the following two special cases of Theorem 2.2 where the set C contains only homothetic copies of the standard square S. Lemma 2.3.Let C = {S 1 , . . ., S n } be a set of pairwise-intersecting homothetic copies of S. Then Proof.Define π x , π y : R 2 → R to be the linear projections where π x (x, y) = x and π y (x, y) = y for each point (x, y) ∈ R 2 .Since the sets in C are pairwise-intersecting, so too are the sets in both {π x (S 1 ), . . ., π x (S n )} and {π y (S 1 ), . . ., π y (S n )}.By Theorem 2.2, there exists points x ′ , y ′ ∈ R such that x ′ ∈ n i=1 π x (S i ) and y ′ ∈ n i=1 π y (S i ).Equivalently, given each square Lemma 2.4.Let P be a homothetic packing of n squares.If {i, j, k} is a clique in the contact graph G = ([n], E), then S i ∩ S j ∩ S k contains exactly one point.
Proof.By relabelling vertices we may assume that {1, 2, 3} is the clique in G.By Lemma 2.3, the set S 1 ∩ S 2 ∩ S 3 is non-empty, hence it is sufficient to prove that S 1 ∩ S 2 ∩ S 3 contains at most one point.If any of the sets S 1 ∩ S 2 , S 1 ∩ S 3 or S 2 ∩ S 3 contain exactly one point then S 1 ∩ S 2 ∩ S 3 contains at most one point.Suppose instead that all three sets S 1 ∩ S 2 , S 1 ∩ S 3 and S 2 ∩ S 3 contain more than one point.Then each distinct pair S i , S j has either an x-or y-direction contact, but not both.By relabelling the vertices and applying rotations to P , we may suppose that both pairs S 1 , S 2 and S 1 , S 3 have an x-direction contact but not a y-direction contact.Hence by Lemma 2.1, S 2 and S 3 have a y-direction contact but not an x-direction contact.As the intersection of the three squares must be contained inside the intersection of two perpendicular line segments (e.g., S 1 ∩ S 2 and S 2 ∩ S 3 ), the set S 1 ∩ S 2 ∩ S 3 contains at most one point.
The previous two lemmas allow us to characterise the cliques in the contact graph of any given homothetic square packing.
Before we can deduce more properties of the contact graph, we require the following technical result regarding the straight-line embedding of the contact graph; i.e., the mapping of G into the plane where a vertex i is considered to be the point p i and an edge is considered to be the closed line segment Lemma 2.7.Let P be a homothetic packing of n squares.Choose any edge {i, j} ∈ E and let p ij = (x ij , y ij ) be the point described in eq.(1).Then the following holds.
(iii) The point p ij lies in the interior of the set S i ∪ S j if and only if {i, j} / ∈ E x ∩ E y .
Proof.Fix p i = (x i , y i ) and p j = (x j , y j ).Given a point z = (x, y) ∈ [p i , p ij ], we note that |x − x i | ≤ r i and |y − y i | ≤ r i , with equality in one of these inequalities if and only if z = p ij .An analogous observation can be made for any point in the line segment [p j , p ij ], hence (i) and (ii) hold.It now suffices for us to check whether p ij lies in (S i ∪ S j ) • .First suppose that {i, j} ∈ E x ∩ E y .By rotating P we may suppose that x i < x j and y i < y j .For any t > 0, the point Hence p ij does not lie in (S i ∪ S j ) • .Now suppose, without loss of generality, that {i, j} ∈ E x \ E y and x i < x j .Fix As this holds for any choice of s, t, the point p ij lies in (S i ∪ S j ) • .
If four squares do share a corner, then the straight-line embedding of G given by the centres p 1 , . . ., p n will not be planar.Fortunately, this is the only way that planarity can be lost.Lemma 2.8.Let P be a homothetic packing of n squares.Then the following properties hold for any pair of edges {i, j}, {k, ℓ} ∈ E that share no vertices.
(i) The interiors of the sets S i ∪ S j and S k ∪ S ℓ are disjoint.
(ii) If the closed line segments [p i , p j ] and [p k , p ℓ ] intersect, then the squares S i , S j , S k , S ℓ share a corner, the edges {i, j}, {k, ℓ} lie in both E x and E y , and the edges {i, k}, {i, ℓ}, {j, k}, {j, ℓ} lie in the symmetric difference of E x and E y (denoted by E x △E y ).
Proof.(i): Suppose for contradiction that the interiors of the sets S i ∪ S j and S k ∪ S ℓ are not disjoint.Let R ij and R kℓ be the relative interiors of the convex sets S i ∩ S j and S k ∩ S ℓ respectively.
Since the interiors of the squares in P are pairwise disjoint, the sets By rotating and translating P if necessary, we may further assume that R ij = {(s, 0) ∈ R2 : a < s < b} for some a, b ∈ R with a < b.Choose a sufficiently small scalar ε > 0 such that the open neighbourhood   1)) is the unique point in [p i , p j ] not contained in the interior of S i ∩ S j .Similarly, p kℓ is the unique point in [p k , p ℓ ] not contained in the interior of S k ∩ S ℓ .Since [p i , p j ] and [p k , p ℓ ] intersect non-trivially but the interiors of S i ∪ S j and S k ∪ S ℓ do not, we have p ij = p kℓ .Hence {i, j, k, ℓ} is a clique in G.By Lemma 2.5, the squares S i , S j , S k , S ℓ share a corner.
Suppose for contradiction that {i, k} Hence {i, k} ∈ E x △E y .By repeating the above argument we see that the edges {i, ℓ}, {j, k}, {j, ℓ} also lie in E x △E y , thus completing the proof.Interestingly, Lemma 2.8 also allows us to develop an easy-to-obtain upper bound for the maximum number of contacts possible in any homothetic square packing.It is worth mentioning that the upper bound is not best possible; indeed, the author believes that 4n − 6 √ n + 2 is the bestpossible upper bound for the maximum number contacts for a homothetic packing of n squares (the construction to obtain this upper bound is outlined in Section 1).
Proof.Let P be a homothetic square packing with contact graph G = ([n], E) and centres p 1 , . . ., p n .Let A be the set of cliques of size 4 contained in G. Choose any clique K = {i, j, k, ℓ} ∈ A. By Lemma 2.5, the squares S i , S j , S k , S ℓ all share a corner.Without loss of generality we may suppose {i, j}, {k, ℓ} are the unique edges supported on K that lie in E x ∩ E y .Note that if we remove the edge {i, j}, the two cliques {i, k, ℓ} and {j, k, ℓ} will now form facial triangles in the straight-line embedding given by the centres of P .For each clique K we now choose an edge e K ∈ E x ∩ E y supported on K and let T K , T ′ K be the two corresponding facial triangles that result from the removal of e K .Note that for two distinct cliques K, K ′ ∈ A, the triangles planar and the straight-line embedding given by the vertex map i → p i is a planar embedding.Furthermore, for every K ∈ A the triangles T K and T ′ K are facial triangles of G ′ with respect to the aforementioned straight-line embedding.It follows from Euler's formula that any embedding of a planar graph with n vertices has at most 2n − 4 triangle faces.As every edge e K pairs up two triangles of the embedded graph G ′ and no triangle is paired up more than once, we see that Before we close the section, we first mention the following interesting result of Schramm.
Theorem 2.10 ( [5]).Let G = ([n], E) be a planar graph with a planar embedding where the only cycle of length at most 4 that can contain vertices inside its interior is the outer cycle of the embedded graph.Then there exists a homothetic square packing P with contact graph Whilst being a very interesting result with a particularly beautiful proof -for example, the proof involves observing a correspondence between square tilings and a concept known as an extremal metric -we unfortunately cannot utilise Theorem 2.10 because of three important reasons.Firstly, the cycle assumption made in Theorem 2.10 unfortunately limits the types of contact graphs we can observe drastically.This assumption can be weakened, however the cost of doing so is that some squares could potentially have radius 0 (something we are explicitly not allowing).Secondly, the contact graph G ′ will be a triangulation of a quadrilateral and thus always have at least 3n − 7 contacts.Finally, the union of the squares in the constructed homothetic square packing will form a rectangle, and so it is fairly easy to see that the radii cannot satisfy condition (ii) of Theorem 1.1.

The weak generic condition
We begin the section with the following definition.It should be noted that almost all choices of radii will satisfy the weak generic condition; indeed it is sufficient that the radii form an algebraically independent set.In this section we use the weak generic condition to determine certain properties about cycles in the coloured graphs ([n], E x ) or ([n], E y ).We first require the following technical lemma.Lemma 3.2.Let P be a homothetic packing of n ≥ 6 squares.Suppose that the radii satisfy the weak generic condition.Further suppose that there exists a cycle (n 1 , . . ., n k ) in the coloured subgraph (here we set x n 0 = x n k and x n k+1 = x n 1 ).Then k = 4 and the four squares S n 1 , S n 2 , S n 3 , S n 4 share a corner.
Proof.We first note that for the x-coordinates of the cycle (n 1 , . . ., n k ) to have the required "zigzagging" property, k must be even (and hence k ≥ 4).By translating and reflecting P , we may assume that x n i = (−1) i r n i for each i ∈ [k].By shifting and reversing the order of the cycle (n 1 , . . ., n k ) as required, we may also suppose that y n 1 ≤ y n i for all i ∈ [k] and y n 2 ≤ y n k .We note that our new ordering will imply y n 1 < y n i for all odd i ∈ [k], and y n 2 < y n k , as otherwise the interiors of some of the squares in the packing will intersect.
Choose any distinct i, j ∈ [k].We now investigate two cases.In our first case, suppose that i ≡ j mod 2 and y n i < y n j .As and the interiors of the squares S n i and S n j do not intersect, we see that ( For our second case, suppose that {n i , n j } ∈ E and The following two inequalities, however, cannot hold: The inequality given by eq. ( 3) cannot hold as, given n ℓ is the single other vertex adjacent to n j in the cycle (n 1 , . . ., n k ) (ignoring all other edges of the contact graph), the interiors of the two squares S n i and S n ℓ will be forced to intersect so that both have an x-direction contact with S n j .The inequality given by eq. ( 4) also cannot hold as it implies r n i = r n j , contradicting the weak generic condition (since n ≥ 6).With this, we are left with 5 cases possible inequalites when {n i , n j } is an edge in the cycle (n 1 , . . ., n k ): We now use this analysis for the vertices n 1 , n 2 , n k to obtain some inequalities.By assumption we have y n 1 ≤ y n 2 < y n k .First note that, as k is even (and hence k ≡ 2 mod 2), y n 2 +r n 2 ≤ y n k −r n k by eq. ( 2).Suppose that which in turn implies r n 1 < r n 2 (as r n 1 = r n 2 by the weak generic condition).Hence y n 1 + r n 1 < y n 2 + r n 2 , and so the only possible case that can hold is case (v) with j = 1 and i = 2, i.e., However, since As before, we see that the only possibility is for case (v) to hold with j = 1 and i = k, i.e., It follows that for each ℓ ∈ {2, k}, one of cases (i), (ii), or (iii) holds with i = 1 and j = ℓ.By observing the possible cases for i = 1, j = k, we see that y n k − r n k ≤ y n 1 + r n 1 .If case (i) holds for i = 1 and j = 2, then, since contradicting that r n 2 > 0. Similarly, if case (ii) holds for i = 1 and j = 2, then a contradiction.Hence case (iii) holds for i = 1 and j = 2, i.e., ( As y n 2 + r n 2 ≤ y n k − r n k , the only possible case that can hold for i = 1 and j = k is case (i), i.e., Now we turn our attention to the vertex n 3 .Since 1 ≡ 3 mod 2 and y n 1 < y n 3 , we have y n 1 + r n 1 ≤ y n 3 − r n 3 by eq. ( 2).Hence y n 2 + r n 2 ≤ y n 3 − r n 3 and y n k − r n k ≤ y n 3 − r n 3 by eqs.( 5) and (6).It follows that case (i) holds for i = 2 and j = 3, and hence From this we observe that the squares S 1 , S  7)), we have y n 3 − r n 3 < y n 4 − r n 4 .As one of cases (i), (ii) and (iii) must hold for i = 3 and j = 4, we have y n 4 − r n 4 ≤ y n 3 + r n 3 .By combining this with the previous inequality of 7)), we would have r n 3 = r n 4 , contradicting the weak generic condition.Thus If y n 3 ≤ y n k−1 then by eqs.( 2) and (8) we have and so, since k is even and (k − 1) ≡ 3 mod 2, by eq. ( 2).By applying eq. ( 2) with i = 1 and j = k − 1 (since k is even), and then applying the substitutions from eq. ( 7), we see that However by combining eqs.( 7), ( 9) and (10) we see that Proof.Without loss of generality, we will assume (n 1 , . . ., n k ) is a cycle of ([n], E x ).We will also fix that n 0 := n k and n k+1 := n 1 .By Lemma 2.1, k ≥ 4. Let p i = (x i , y i ) for each i ∈ [n].Define the function σ : [n] → {−1, 0, 1}, where for each i ∈ [n] we have: Fix s, t ∈ [k] to be distinct points where . By our choice of σ we must have σ ns = σ nt = 0.As k ≤ n − 2, it follows that the map σ has at least 4 zeroes.We observe the following property for any i ∈ [k]: Adding this observation to the fact that (n 1 , . . ., n k ) is a cycle of ([n], E x ), we have that Hence σ i = 0 for all i ∈ [n], as the radii satisfy the weak generic condition.This implies that our cycle is "zigzagging", i.e., for each i ∈ [k] we have that either The result now follows from Lemma 3.2.
Our next goal of this section is to prove the following: if one of the coloured subgraphs contain a sufficiently long cycle, then the weak generic condition will imply that the number of edges in the contact graph is bounded above by 2n − 2. We first need the following technical lemma.Proof.Let H be the graph pictured in Figure 4. Suppose for contradiction that G contains a copy of H.Note that, as the radii r 1 , . . ., r n satisfy the weak generic condition, the radii r 1 , . . ., r 6 satisfy the weak generic condition.Hence without loss of generality we may assume that G contains H as a spanning subgraph (i.e., n = 6).By relabelling the vertices of G we may assume H has the vertex labelling described in Figure 4.As {1, 2, 4, 5} (respectively, {2, 3, 5, 6}) is a clique, by Lemma 2.5 and Lemma 2.8(ii) there exist exactly two edges supported on {1, 2, 4, 5} (respectively, {2, 3, 5, 6}) that are contained in E x ∩ E y , and these two edges do not share any vertices.Suppose that {2, 5} ∈ E x ∩ E y .Then the edges {2, 5}, {1, 4}, {3, 6} are contained in E x ∩E y and the rest of the edges of H are contained in E x △E y .It follows from Lemmas 2.4 and 2.7 that the point p 25 described in eq. ( 1) is the unique point in the set S 1 ∩ S 2 ∩ S 4 ∩ S 5 and also the unique point in the set S 2 ∩ S 3 ∩ S 5 ∩ S 6 .Hence p 25 is contained in every square of P .However this implies G contains a clique of size 6, contradicting Lemma 2.5.Hence {2, 5} cannot be both an x-and y-direction contact.
By relabelling the vertices of H, we can assume that the edges {1, 5}, {2, 4}, {2, 6}, {3, 5} are contained in E x ∩ E y and the rest of the edges of H are contained in E x △E y .By rotating P we may assume that {2, 5} ∈ E y (and hence {2, 5} / ∈ E x ).Hence the edges of H have the following colouring: We are now ready to prove the final key lemma of the section.Let . By relabelling the vertices (but maintaining that the order (n 1 , . . ., n k ) forms a cycle), we will assume that , where for each i ∈ [n] we have: 0 otherwise (here we set n 0 = n k and n k+1 = n 1 ).We now note four immediate properties of the map σ: (i) ) as Lemma 3.2 would then imply k = 4, contradicting that n ≥ 6.As n i=1 σ i r i = 0 (this follows from the same methods implemented in Lemma 3.3), there exists some a, b ∈ [k] such that σ na = 1 and σ n b = −1, and σ has at most 3 zeores (due to the radii satisfying the weak generic condition).It now follows that the number of indices j ∈ [k] where σ n j = 0 must be non-zero and even; to see this, note that as we traverse the cycle (n 1 , . . ., n k ) from n 1 back to n 1 , the map σ switches between 1 and −1 (ignoring any zeroes inbetween) an even amount of times and only the +1/ − 1 switches generate odd-length strings of zeroes.Since σ can have at most 3 zeroes, it follows that σ has exactly two zeroes contained in the cycle (n 1 , . . ., n k ).
As σ n 1 = σ ns = 0 and x n 1 ≤ x n i for all i ∈ [k], we see that Hence for i ∈ [k] with i = 1 we have (Here we are using the convention that b j=a t j = 0 if a > b.)We observe that a pair {n i , n j } with 1 ≤ i < j ≤ k is an edge of ([n], E y ) only if either j = i + 1 or i ≤ s ≤ j.Furthermore, the vertex n 1 is adjacent to a vertex n i in ([n], E) if and only if i ∈ {2, k}, and the vertex n s is adjacent to a vertex n j in ([n], E) if and only if j ∈ {s − 1, s + 1}.
Fix G ′ = (V ′ , E ′ ) to be the subgraph of G induced by V ′ := {n 1 , . . ., n k }, and define (V ′ , E ′ x ) and (V ′ , E ′ y ) to be the corresponding induced coloured subgraphs of x ) is a connected cycle with k edges.Since any neighbours of ) is a forest with at least 3 connected components (and thus at most k − 3 edges) and n 1 , n k as isolated vertices.
First suppose k = n.Then and we are done.Suppose instead that k = n − 1.Further suppose that the vertex n is adjacent to more than 2 vertices in ([n], E x ).Then the only possible structure that ([n], E x ) can take without generating a cycle of length 3 (contradicting Lemma 2.1), or generating a cycle of length more than 4 and less than n − 1 is the following graph with n = 7 and vertex n as the centre vertex: n As each cycle of length 4 must generate a clique of size 4 in G, we note that G must contain a copy of the graph featured in Figure 4, contradicting Lemma 3.4.Hence we may suppose that n is adjacent to at most two vertices in ([n], E x ).Furthermore, if n is adjacent to vertices n i , n j ∈ V ′ with i < j, then n, n i , n j must be contained in a cycle of 4. As n 1 , n s are isolated vertices in the forest (V ′ , E ′ y \ E ′ x ), any cycle of ([n], E y \ E x ) has length at most n − 2 and does not contain n 1 , n s .
Hence by Lemma 3.3, any cycle of ([n], E y \ E x ) has length 4 and is induced by 4 squares.However any cycle in ([n], E y ) induced by 4 squares sharing a corner will not be a cycle in ([n], E y \ E x ), since exactly two edges of the cycle must also be contained in E x .Hence ([n], E y \ E x ) is a forest, and, without loss of generality, one of three possible cases must hold: Suppose that case (i) holds.Since n is adjacent to at most 2 vertices in ([n], E x ) and ([n], E y \E x ) is a forest with at least 3 connected components, we see that and we are done.
Suppose now that case (ii) holds.By a similar counting method to that above, we observe that either G has at most 2n − 2 edges, or ([n], E y \ E x ) has exactly 2 connected components (with n s as an isolated vertex) and n is adjacent to exactly 2 vertices in ([n], E x ).Suppose for contradiction that the latter holds.Let (a, b, c, n) be the cycle of length 4 in ([n], E x ) that contains n and its two neighbours a, c.Note that a, b, c is a path contained in the cycle (n 1 , . . ., n k ) (the direction of the path might be the opposite of the cyclic ordering of the cycle) since (n 1 , . . ., n k ) is chordless, hence {a, b, c} x n − r n = x ns − r ns ; this follows from our knowledge of the x-coordinates of p a , p b , p c and then utilising that S a , S b , S c , S n share a corner to determine the x-coordinate of p n .In either case it now follows from examining the x-coordinates of the various centres of P that n is only adjacent to a, b, c in G. Since {n, a}, {n, b} ∈ E x , the forest ([n], E y \ E x ) has at least 3 connected components, contradicting our earlier assumption.
Finally, suppose that case (iii) holds.As {n 1 , n}, {n s , n} ∈ E y \E x , we have |x n 1 −x n | < r n 1 +r n and |x ns −x n | < r ns +r n .Using our prior knowledge of the positions of the x-coordinates for vertices in V ′ , it follows that for each i ∈ [k] \ {1, s} we have This completes the proof.

Proof of Theorem 1.1
Before we prove Theorem 1.1, we first require the following two technical lemmas.Lemma 4.1.Suppose that for a given set of radii r 1 , . . ., r n with n ≥ 2, there exists a homothetic square packing with radii r 1 , . . ., r n and k contacts.Then for any choice of r n+1 > 0, there exists a homothetic square packing with radii r 1 , . . ., r n+1 and at least k + 2 contacts.
Proof.Let P = {S 1 , . . ., S n } be a homothetic square packing with contact graph G = ([n], E), radii r 1 , . . ., r n and centres p 1 , . . ., p n , where |E| = k.We may assume that G is connected; indeed if it was not, we could translate one connected component of P until it was in contact with another and increase the amount of contacts by at least 1.Define the closed set Note that for any point z ∈ X, the interior of the set r n+1 S + z will not intersect n i=1 S i , and the set the set r n+1 S + z will intersect n i=1 S i if and only if z ∈ ∂X.Hence for any z ∈ ∂X, the set {S 1 , . . ., S n , r n+1 S + z} will be a homothetic square packing with at least k + 1 contacts.It follows that we now need only find a point z ∈ ∂X such that r n+1 S + z is in contact with at least two squares in P .
Choose any point z ′ ∈ ∂X.If the square r n+1 S + z ′ is in contact with two or more squares in P then we are done.Suppose that r n+1 S + z ′ is in contact with exactly one square S i .Given ∂S is the boundary of the standard square, z ′ is an element of the set C := (r i + r n+1 )∂S + p i .It is immediate that C ∩ X • = ∅.As the sets C and ∂X are closed, the set C ∩ ∂X is a non-empty closed subset of C. The boundary of C ∩ ∂X with respect to the ambient space C exists as C ⊂ ∂X; indeed if C ⊂ ∂X, then S i would not be in contact with any other square in P , contradicting that G is connected and n ≥ 2. Choose a point z ∈ C. If z is not contained in C \ ∂X then, since C ∩ X • = ∅, z / ∈ X and so the set r n+1 S + z will be in contact with S i and intersect the interior of another square S j = S i .If z is in the interior of C ∩ ∂X with respect to the ambient space C, then r n+1 S + z is in contact with S i and but it will not intersect any other square in P .Hence if we choose a point z in the boundary of C ∩ ∂X with respect to the ambient space C, then r n+1 S + z will be in contact with at least two squares in P .Lemma 4.2.Let P be a homothetic square packing with contact graph G = ([n], E), radii r 1 , . . ., r n and centres p 1 , . . ., p n .Suppose that for some 1 ≤ s ≤ n − 1, the following holds: Then the graph ([n], E y ) is connected.(See Figure 5 for an example of such a packing.) Proof.Fix p i = (x i , y i ) for each i ∈ [n].Define for each i ∈ [n] the closed interval Since s i=1 I i = n i=s+1 I i , we observe that every interval I i for i ≤ s must intersect at least one set I j for j ≥ s + 1. Choose any i ∈ [s − 1] and let j ∈ [n] be the largest index such that I i ∩ I j = ∅; by our previous observation we note that j ≥ s + 1. Suppose that contradicting the maximality of j.Hence x i +r i < x j +r j .Since x i+1 −r i+1 = x i +r i , it follows that I j ∩ I i+1 = ∅.From this we can deduce that for each i ∈ [n] where i ≤ s − 1, there exists j ∈ [n] such that j ≥ s + 1 and {i, j}, {i + 1, j} ∈ E y .By a similar technique we can show that for each j ∈ [n] where s + 1 ≤ j ≤ n − 1, there exists i ∈ [n] where i ≤ s such that {i, j}, {i, j + 1} ∈ E y .With this we can construct two paths P 1 , P 2 ∈ ([n], E y ) such that P 1 contains every vertex 1 ≤ i ≤ s and at least one vertex j ≥ s + 1, and P 2 contains every vertex s + 1 ≤ j ≤ n and at least one vertex i ≤ s.Hence the graph ([n], E y ) is connected.Proof of Theorem 1.1.Suppose that (ii) holds, i.e., the radii satisfy the weak generic condition.Let P be a homothetic square packing with contact graph G  Interestingly, the amount of contacts of a packing of n squares is not bounded by 2n − 2 even when the radii do not satisfy any polynomial equation with rational coefficients.Proposition 5.1.For each n ≥ 5, there exists a packing of n squares with algebraically independent radii and more than 2n − 2 contacts.
See Figure 7 (left) for the described square packing P with n = 7.We note that P has 2n − 1 contacts.Furthermore, for small perturbations of the vector r, we can always form a square packing similar to that indicated in Figure 7 (right), which will also always have 2n − 1 contacts.Hence there exists a packing of n squares with algebraically independent radii and 2n − 1 contacts.
Because of Proposition 5.1, we shall restrict which type of contacts we are interested in.Let P = {S 1 , . . ., S n } be a square packing with S i = r i R θ i S + p i for each i ∈ [n].We say that the distinct squares S i and S j have a face-to-face contact if the set S i ∩ S j is a line segment [z, z ′ ] with z = z ′ .It is important to note that if the vertex pair {i, j} describe a face-to-face contact, then θ i = θ j .Another useful observation is the following: if P is a homothetic square packing with contact graph G = ([n], E), then the face-to-face contacts of P are exactly the edges in the symmetric difference of E x and E y .Corollary 5.2.Let r 1 , . . ., r n be positive scalars that satisfy the weak generic condition.Then every packing of n squares with radii r 1 , . . ., r n has at most 2n − 2 face-to-face contacts.Furthermore, if a given square packing has 2n − 2 face-to-face contacts, then it is a homothetic square packing with no four squares sharing a corner.
Proof.Let P be a square packing with radii r 1 , . . ., r n , centres p 1 , . . ., p n and angles θ 1 , . . ., θ n .Define the equivalence relation ∼ on [n] by setting i ∼ j if and only if θ i = θ j , and set ñ1 , . . ., ñm to be the equivalence classes of [n].Each square packing P (ñ i ) := {S j : j ∼ n i } is homothetic, hence each has at most 2|ñ i | − 2 contacts by Theorem 1.1.Since there can be no face-to-face contacts between P (ñ i ) and P (ñ j ) when i ∼ j, we have that P has at most As the complete graph with n ≤ 6 vertices has at most 3n − 3 edges, Proposition 6.1 cannot be improved.However, the homothetic packing of n cubes described in Proposition 6.1 will always have less than 12(n/8) < 3n − 3 face-to-face contacts (i.e., a contact where the intersection is a 2-dimensional convex set).This leads one to wonder: is the natural analogue to Theorem 1.1 true if we restrict to face-to-face contacts?Unfortunately, this too can fail for very general choices of radii.Proposition 6.2.Let n ≥ 4 and r 1 ≥ . . .≥ r n > 0. If r 4 + . . .+ r n < r 3 , then there exists a homothetic packing of n cubes with radii r 1 , . . ., r n and at least 4n − 11 face-to-face contacts (and hence more than 3n − 3 face-to-face contacts when n ≥ 9).

Lemma 2 . 1 .
Let P be a homothetic packing of n squares.Then the coloured subgraphs ([n], E x ), ([n], E y ) of the contact graph G = ([n], E) are triangle-free.

Figure 3 :
Figure 3: Four squares sharing a corner.
trivially and non-empty open sets always have positive area, 2 the intersection of the open sets R ε ij and (S k ∪ S ℓ ) • is a non-empty open set with positive area.Since both R ij and R kℓ are null sets (i.e., have zero area), it follows

Definition 3 . 1 .
The radii of a homothetic square packing are said to satisfy the weak generic condition if they satisfy condition (ii) of Theorem 1.1.
Furthermore, since the squares S a , S b , S c , S n share a corner (Lemma 3.3) and the cycle is ordered (a, b, c, n), we must have σ b = 0. Hence we either have a = n 2 , b = n 1 , c = n k and x n + r n = x n 1 + r n 1 , or a = n s−1 , b = n s , c = n s+1 and

Figure 5 :
Figure 5: An example of the construction from Lemma 4.2.The radii of the squares on the top row from left to right are r 1 = 1, r 2 = 1.5, r 3 = 2.5, r 4 = 2 and r 5 = 3, and the radii of the squares on the bottom row from left to right are r 6 = 2, r 7 = 3, r 8 = 5.As can be seen, the graph ([n], E y ) for this homothetic square packing is connected.With this we are finally ready to prove Theorem 1.1.

Figure 6 :
Figure 6: An example of the construction from Theorem 1.1 with 17 > 2 • 9 − 2 contacts.The construction is possible because the sum of the radii for the middle three squares on the top row (from left to right; 1, 1.5, 2.5) is equal to the sum of the radii for the middle two squares on the bottom row (from left to right; 2, 3), and the radii sum equality does not use the radii of at least four squares.The four squares that are not involved in the summation are then placed on the left and right to form the two cliques of size 4.

Figure 7 :
Figure 7: (Left): The square packing with 2n − 1 contacts described in Proposition 5.1 for n = 7. (Right): A square packing with 2n − 1 contacts which can be formed from the square packing on the left by perturbing the values of the radii.All the squares except the top left square maintain their original orientation, while the top left square simply needs to rotate slightly to maintain the necessary 2n − 1 contacts.

Lemma 2.5. Let
By relabelling the vertices, suppose that {1, . . ., k} is a clique of G with k ≥ 4. By Lemmas 2.3 and 2.4, there exists a unique point z in the intersections of the squares S 1 , . . ., S k .Furthermore, z must lie on the boundary of each square S 1 , . . ., S k by our assumption that P is a homothetic square packing.The interior of each square S i covers an angle α i of points around z.For each i ∈ [k], we either have α i = π and z lies on exactly one face of S i , or α i = π/2 and z is a corner of S i .As k i=1 α i ≤ 2π, we see that k ≤ 4, with equality if and only if S 1 , S 2 , S 3 , S 4 share a corner.
By Lemma 2.7(ii) and Lemma 2.7(iii), {i, j} ∈ E x △E y if and only if [p i , p j ] is contained in the interior of the set S i ∪ S j , and {k, ℓ} ∈ E x △E y if and only if [p k , p ℓ ] is contained in the interior of the set S k ∪ S ℓ .As shown in (i), the interiors of S i ∪ S j and S k ∪ S ℓ are disjoint.Since [p i , p j ] and [p k , p ℓ ] are not disjoint, it follows that {i, j}, {k, ℓ} ∈ E x ∩ E y .By Lemma 2.7(ii) and Lemma 2.7(iii), p ij (see eq. ( ≡ 4 mod 2 and y n 2 ≤ y n 4 , we have y n 2 +r n 2 ≤ y n 4 −r n 4 by eq.(2).Hence by eq.(7), y n k −r n k ≤ y n 4 −r n 4 .If y n 4 −r n 4 < y n k +r n k then |y n 4 − y n k | < r n 4 + r n k , which, when combined with |x n 4 − x n k | < r n 4 + r n k , contradicts that the interiors of S n 4 and S n k are disjoint.Hence y n k 2 , S 3 , S 4 share a corner, with{n 1 , n 2 }, {n 3 , n k } ∈ E x \E y , {n 1 , n 3 }, {n 2 , n k } ∈ E y \ E x , and {n 1 , n k }, {n 2 , n 3 } ∈ E x ∩ E y .Suppose for contradiction that k > 4 (i.e., k ≥ 6).Then, since 2 completing the proof.Using the previous technical result, we now prove that the weak generic condition forces all cycles in ([n], E x ) and ([n], E y ) to either be very long or generated by four squares sharing a corner.Let P be a homothetic square packing with contact graph G = ([n], E), radii r 1 , . . ., r n and centres p 1 , . . ., p n .Suppose that the radii satisfy the weak generic condition.If either of the graphs ([n], E x ), ([n], E y ) contains a cycle (n 1 , . . ., n k ) with k ≤ n − 2, then k = 4 and the squares S n 1 , S n 2 , S n 3 , S n 4 share a corner.
Lemma 3.5.Let P be a homothetic square packing with contact graph G = ([n], E), radii r 1 , ..., r n and centres p 1 , ..., p n .Suppose that the radii satisfy the weak generic condition.If either of the subgraphs([n], E x ), ([n], E y ) contains a cycle (n 1 , ..., n k ) with k ≥ n − 1, then |E| ≤ 2n − 2.Proof.Without loss of generality, we will assume (n 1 , ..., n k ) is a cycle of ([n], E x ); this can be achieved by rotating P by 90• if necessary.If n = 4 then |E| ≤ 2n − 2. If n = 5 with |E| > 2n − 2 then G containstwo cliques of size 4 sharing 3 vertices, which contradicts Lemma 2.6.Hence we may assume n ≥ 6. Suppose that (n 1 , . . ., n k ) has a chord.By Lemmas 2.1 and 3.3, any cycles of ([n], E x ) or ([n], E y ) have length 4, n − 1 or n, and any cycle of length 4 is generated by four squares sharing a corner.So that the chord does not create a forbidden cycle in ([n], E x ), we must have k = 6 and the chord must split the cycle into two cycles of length 4, each of which generated by four squares sharing a corner.However this implies that G contains a copy of the graph pictured in Figure 4, contradicting Lemma 3.4.Hence the cycle (n 1 , . . ., n k ) is chordless in ([n], E x ).It follows that the vertex set {n 1 , . . ., n k } cannot induce cycles of length 4 in either ([n], E x ) or ([n], E y ); any cycle of length 4 in the subgraph of ([n], E y ) induced by {n 1 , . . ., n k } necessitates a cycle of length 4 in the subgraph of ([n], E x ) induced by {n 1 , . . ., n k } (Lemma 3.3), and any such cycle in the latter will contradict that (n 1 , . . ., n k ) is a chordless cycle of ([n], E x ).In particular, no four squares in the set {n 1 , . . ., n k } can share a corner.
r n and centres p 1 , . . ., p n .If either ([n], E x ) or ([n], E y ) contains a cycle with at least n−1 vertices, then |E| ≤ 2n−2 by Lemma 3.5.Suppose that any cycle in either ([n], E x ) or ([n], E y ) has length at most n − 2. By Lemmas 2.1 and 3.3, every cycle in ([n], E x ) (respectively, ([n], E y )) has length 4 and is generated by 4 squares sharing a corner.Let C x 1 , . . ., C x k ⊂ E x and C y 1 , . . ., C y k ⊂ E y be the cycles of ([n], E x ) and ([n], E y ) labelled so that for each 1 ≤ i ≤ k we have C x i ∩ C y i = {e i , f i } for some edges e i , f i ; this corresponds to the cycles C x i and C y i being generated by the same 4 squares sharing a corner.Define E ′ x := E x \ {e 1 , . . ., e k } and E ′ y