Count the squares [closed]

My professor at college loves geometry and discrete mathematics.
He gave us a question let see if you can solve it.

He asked us

how many unique squares which have the same size and each corner
colored in red,green and blue?

Two squares will be called Unique to each other if no matter how you rotate them or flip them
they will not look the same.


Here is an example of two equilateral triangle that aren't unique to each other.
(same concept but with triangles didn't want to give spoilers in the example)
The reason why they not unique because You can flip one of them (in y axis) and you will get the same triangle.

2 Answers

This is a standard application of the Burnside Lemma.

I'll solve the more general case of a square with $$n$$ colours.

The group of symmetries of the square has 8 elements. The number of ways to colour the square such that it stays the same under each symmetry are: $$\begin{array}{|c|c|} \hline \text{Symmetry} & \text{Count}\\ \hline i& n^4 \\ \hline r_{90} & n \\ \hline r_{180} & n^2 \\ \hline r_{270} & n \\ \hline m_{vert} & n^2 \\ \hline m_{hor} & n^2 \\ \hline m_{diag1} & n^3 \\ \hline m_{diag2} & n^3 \\ \hline \end{array}$$ The actual number of distinct colourings is then the average of all these numbers, viz.: $$\frac{(n^4 + 2n^3 + 3n^2 + 2n)}8 = \frac{n(n+1)(n^2 + n + 2)}8$$ If you are wondering why this is always a whole number, you can relate it to triangular numbers. If $$T_k=\frac{k(k+1)}2$$ is the $$k$$th triangular number, the above expression for the number of colourings is simply $$T_{T_n}$$. For $$n=3$$ colours you get $$T_{T_3}=T_6=21$$.

• yes but still I think counting them by hand is really hard. – Vlad Barkanass Aug 1 at 16:53

I think the answer is

21

Counting

Consider first squares which are monochromatic (just one colour).
There are 3 of these (all red, all blue, all green).

Now consider the squares which are composed of just two colours.
If we pick blue and green for example, we can colour just one of the vertices green (just one way to do this up to rotations and reflections), one of the vertices blue (just one way again) or two blue and two green. There are two ways to do this - colour opposite vertices the same or colour adjacent vertices the same.
Hence there are 4 ways to colour the vertices with two colours.
Since we have 3 possible choices of two colours (red-blue, red-green, blue-green), there are 12 squares coloured in this way.

Now consider squares which are coloured with all three colours. Exactly one of the colours will be picked twice. The two vertices with the same colour must either be adjacent (only one way to do this up to rotations and reflections) or opposite (also just one way to do this). Hence, for each choice of the "double colour" there are two possible colourings and overall we have 6 squares coloured in this way.

This means that overall we have 3 + 12 + 6 = 21

• cool aproach :) – Vlad Barkanass Aug 1 at 16:54