# Truchet tiles on a flattened cube

We have 2 Truchet tiles and a flattened cube as shown.

We randomly place copies of the tiles into faces of the flattened cube.

1. Find the probability that the circular arcs on the Truchet tiles will form one loop, two loops, three loops and four loops?
2. If we divide each face of the flattened cube into 2x2 grid of squares, what will be the new probability for part (1)?

I saw a journal about the three-dimensional Truchet tiles and they want the beginners to start with the basic question. I don't have any idea to start with. I'm thinking of defining a binary variable but it doesn't seem so promising.

-
the image of Truchet tiles is here. imageshack.us/photo/my-images/339/truchet.jpg – Exeter May 9 '13 at 8:43
In part 2, you can have up to ten loops. – TonyK May 9 '13 at 9:46
@ TonyK: could you be more clear? thanks – Exeter May 9 '13 at 10:04
I was wrong -- you can have up to 14 loops. One at each corner, and one in the centre of each face. – TonyK May 9 '13 at 10:18
Why have you removed almost the entire question? – joriki May 9 '13 at 23:42

A cube has six sides and (given your particular Truchet pattern) there are exactly two choices of orientation for each side. Thus, there are only 64 total possibilities. You could simply enumerate them and count the possibilities.

Furthermore, as observed in the comments by Steven Stadnicki, we can cut this number in half by fixing the orientation of one side. That brings the number of configurations to examine down to 32, which is quite doable. According to his count (based on the images below), we have

• 8/32 = 25% chance of 1 or 3 loops
• 15/32 = 46.875% chance of two loops
• 1/32 = 3.125% chance of four loops

I enumerated all possibilities and generated the corresponding images with Mathematica; the results are below. This could certainly be pushed further to obtain a purely algorithmic approach. In the code shown after the images, each loop could be described as a triple $(p,v,\pm 1)$, where $p$ and $v$ correspond to the perp and vert in the code below and $\pm 1$ chooses between the loops on the side. Since each loop has two easily determined endpoints and two loops are adjacent iff they share an endpoint, one could write a function to determine adjacency between loops. This would allow you to write down a graph theoretic description of the problem and phrase the question in terms of connected components of a graph. This would come in handy if the problem were generalized by reducing the symmetry in the sides so that you could have up to four possible side orientations - or even more if there were multiple possible sides. I don't think I'll worry about that today, though.

Code

Since several folks specifically asked, here is the Mathematica code that I used to generate the images. Since this is mathematics site, as opposed to a coding site, I will not elaborate on this unless there are specific question. Clearly, though, the code is fundamental to the approach.

(* Generate a side, given a vector perpendicular to the side *)
(* and a vector vertical to the viewpoint for orientation. *)
side[perp_, vert_] := Module[{bi, c1, c2, c3, c4, circ1, circ2},
bi = Cross[perp, vert];
c1 = perp + vert + bi;
c2 = perp - vert + bi;
c3 = perp - vert - bi;
c4 = perp + vert - bi;
circ1 = Table[c1 - Cos[t] vert - Sin[t] bi,
{t, 0, Pi/2, Pi/24}];
circ2 = Table[c3 + Cos[t] vert + Sin[t] bi,
{t, 0, Pi/2, Pi/24}];
{{EdgeForm[], Opacity[0.8], Polygon[{c1, c2, c3, c4}]},
Thick, Line[{circ1, circ2}]}
];

(* choose[1] and choose[2] indicate the two possible vert *)
(* orientations given a particular perp vector *)
choose[1][pp_List] := Module[{pos, out},
pos = First[Flatten[Position[pp, 0]]];
out = {0, 0, 0};
out[[pos]] = 1;
out
];
choose[2][pp_List] := Module[{pos, out},
pos = Last[Flatten[Position[pp, 0]]];
out = {0, 0, 0};
out[[pos]] = 1;
out
];

(* The set of six perp vectors for the six sides of the cube *)
perps = {
{1, 0, 0}, {-1, 0, 0}, {0, 1, 0},
{0, -1, 0}, {0, 0, 1}, {0, 0, -1}
};

(* A configuration is specified by a list of six 1s and 2s *)
(* indicating the orientations of the six sides. *)
configuration[onesAndTwos_List] := Table[side[perps[[i]],
choose[onesAndTwos[[i]]][perps[[i]]]], {i, 1, 6}];

(* Here are all 32 possible orientations for all six sides of *)
(* the cube. *)
(* The Prepend[#,1] business guarantees that the top always *)
(* has the same orientation. *)
tuples = Map[Prepend[#, 1]&, Tuples[{1, 2}, 5]];

(* Finally, we put it all together. *)
Grid[Partition[Table[Graphics3D[configuration[tuple],
Rule[Boxed, False]], {tuple, tuples}], 4]]

-
Can you share your code for doing this? – FiveLemon May 10 '13 at 2:55
@FiveLemon Yes, I'm working on that right now. The code is written in Mathematica, which not everyone uses, so I'm not sure of the best way to post it. – Mark McClure May 10 '13 at 2:59
This can be cut in half, incidentally - the top face (e.g.) of the cube can be fixed to an arbitrary orientation. – Steven Stadnicki May 10 '13 at 3:26
@StevenStadnicki Oh yes, I'm sure there's plenty of symmetry that can be exploited. – Mark McClure May 10 '13 at 3:28
FWIW, BTW, I count eight configurations out of the 32 that have a single loop, fifteen that have two loops, eight that have three loops, and (unsurprisingly) a single configuration that has four loops (which go around four alternating vertices of the cube, as they must - note that no two adjacent vertices can both have 'small' loops around them). – Steven Stadnicki May 10 '13 at 3:47