Combinatorics - Painting the Unit Squares of a 3x3 Square

I need some help with the exercise I was assigned in math class. We were given a 3x3 square made of unit squares, and we wanted to paint all the squares. We had 3 sets of paint, red, blue, and green. Each paint was distinct from each other, but two unit squares with the same color were the same. Additionally, there's only enough paint of each color to color 3 unit squares, and all the paint has to be used. The goal of the exercise was to find the total amount of distinct possible ways such that no two unit squares that share an edge (that is to say they are next to each other vertically or horizontally, having same color across a diagonal is fine).

I've started by trying to take a look at each possible arrangement of the bottom 3 unit squares, but I can't seem to find a pattern between it. Is there a better way than continuing by brute force? Any ideas on how I should proceed from here?


There are $3$ colours for the central square. For each such case we have:-

The four squares adjacent to the central square either consist of

A. $3$ squares of the same colour - $8$ possibilities.

B. $2$ squares of each colour opposite each other- $2$ possibilities.

C. $2$ squares of each colour not opposite each other- $4$ possibilities.

The corner squares can then be chosen in the following number of ways

A. $1$

B. $0$

C. $1$

Total number of arrangements is $3\times (8+4)=36$

N.B. This number will be smaller if we count arrangements which are the same under rotation as actually being the same.


** NOT A SOLUTION **

Hint: Consider diagonals. There are 3 classes

3 different values

2 different values

1 value

Easier to enumerate them all in each class and by definition they are mutually exclusive and collectively exhaustive.

For example for $\text{diag}(1,2,3)$ this is the only solution $\{132,321,213\}$

For $\text{diag}(1,1,1)$ there are two.