How to calculate the number of unique patterns in a 3x3 grid using 4 different elements

370 Views Asked by At

I have a 3x3 grid (9 cells) I would like to populate with 4 different elements (e.g., colors or shapes or numbers, etc.) in four of the cells. How many different unique patterns can I generate with the four elements? By "unique" I mean that the patterns are not a symmetrical doubles of other patterns. Is there a way to calculate this? Trying to manually count the possibilities is too tedious and error prone and the math seems to be beyond me.

1

There are 1 best solutions below

0
On

If all your pieces are different from one another, then it's impossible to make any symmetric configuration - since every symmetry of the square fixes at most three cells, we'll always have at least one piece in a cell not fixed by that symmetry.

So every arrangement you come up with will have all $8$ possible rotations and reflections, without any repeats. This means that it's very easy to correct for overcounting, since we can just divide the total number of arrangements by $8$:

$$\frac{9\cdot 8\cdot 7\cdot 6}{8} = 9\cdot7\cdot6 =388$$