Context: At school today, a friend of mine ripped up a piece of paper he had written on. I was considering the number of possible ways I could rearrange these individual pieces to try to reconstruct the whole, and the runtime complexity of such a de-rearrangement. However, that’s a question for the theoretical CS StackExchange, not here.
What I’m interested in is a more simplified problem: If some polygon in a Euclidean space which only contains right-angles is cut into equally-sized individual squares, into how many possible configurations can these squares be rearranged, allowing only rotation and translation, and no reflections (since a reflection of an actual piece of paper would imply flipping over whatever text is written on it)?
I thought of using graph theory to analyze this–that is, each square node can be in 4 possible states, because it can be rotated into 4 separate states ($4^{n}$ possible rotational states overall) and each node can have at most 4 edges extending from it (since equally-sized squares can touch at most 4 others).
However, note that if you have square-nodes A, B, and C, and they are connected in a line from left to right like ABC, that is a different configuration from CBA even though each individual letter has an edge connecting it to the same other nodes, which doesn’t align with the way that graph theory equates any two such graphs regardless of their physical representation. ABC is the same thing, however, to CBA with each node rotated twice if I’m not mistaken, if you wish to think of all rotations of the overall structure as the same thing.
I’m thinking that maybe each edge can also be labeled with a number 1-4 that represents the direction in which the contact between the two squares occurs, but at this point I’m stuck because I have no formal training in graph theory. This certainly seems like a problem within combinatorics, in which I have very minor experience (I learned a little bit for Academic Decathlon last year). I think the problem will be more easily represented by looking at a few cases.
Case 1: 1 square
Result: Either 1 or 4 ways, depending on whether you wish to consider rotations of the entire structure to be the same thing. From now on, for simplicity’s sake, I will say that every rotation of the entire structure is a separate structure.
Case 2: 2 squares
Result: Let’s call these squares A and B. A can connect to B’s left, right, top, or bottom side. A being on B’s left is the same as B being on A’s right. There are thus 4 connection states, and for each square, there are 4 rotation states. That’s $4^2 = 16$ rotation states overall, multiplied by the 4 connection states, giving $4^3 = 64$ states overall.
Case 3: 3 squares
Result: Let’s call these squares A, B, and C. I think that each outcome might be able to be represented by a tree, where at each point I choose whether to include or exclude a square from the next side.
Each time I make a choice to include another square, I have one fewer squares to choose from. I must, however, choose every square, because I’m not making a discontinuous or incomplete shape here. Note that if two squares touch the same other square, they do not touch each other, so contact is never transitive. However, if the difference between the sides chosen on a given square (A) for two other squares (B and C) has an absolute value of 1, then a fourth square (D) is able to touch both B and C. This makes a tree very confusing to deal with.
So, at square A, I can choose either B or C to go on either side 1, 2, 3, or 4. Once I place 1 of those 2 squares, I have only 1 square left to choose from that can go on 1 of the 3 remaining sides of the other two squares, giving me 6 choices. If I choose B the first time around, then that gives me 4 possible position-configurations, and then after placing C I can actualize the next 6 possible configurations one step down the line. This gives $4*6 = 24$ possible position configurations when choosing B first.
The same follows with C, meaning that there are actually $4*6*2 = 48$ possible position-configurations.
With the 4 possible rotations for each square, I have $4^3 = 64$ rotation-states for the figure, giving $64*48 = 3,072$ possible configuration states for the three squares in the image.
If, hypothetically (though not applicable in my usage case), we were allowed to reflect each of these squares as well, you would have to consider the 4 axes of symmetry on each of the squares, giving another $4^3 = 64$ reflection states for the shape, which when multiplied by our previous $3,072$ states gives $196,608$ possible states for the image. I’m not sure which sets of rotations or reflections would be equivalent (I’d have to learn some group theory to predict that), but that’s a lot for 3 squares.
Case 4: 4 squares
Results: This one is a bit harder. Since the first three squares can be placed in an L-shape, the fourth square can be placed to fill in the corner, which can be reached two separate ways by placing the square on one side of two separate squares respectively. I don’t know how to calculate this one.
Overall: I think it would be nice if anyone could tell me of a more general view of this problem and its solution (for example, using any polygon as the decomposed shape which can be arranged into a gapless tiling like a triangle, square, or hexagon, and considering the options based on its number of sides and its number of symmetries).
Edit: I just realized that in the case of the three squares, I can also perform a similar process of choice starting with each of the three squares individually rather than the others. This means that I have a separate set of $3,072$ configurations starting with each square, giving me $3*3072 = 9,216$ arrangements with rotation, and $9,216*64 = 589,824$ reflection-allowing states.