Every vertex of the unit squares on an $m$ x $n$ grid is colored either blue, green or red, such that all vertices on the boundary are colored red, where $m,n>0$ A square is properly colored if and only if one pair of its adjacent vertices are colored the same color. Show that the number of properly colored squares is even.
What I have: assume there exist a properly colored square (o/w we're done) and look at a side with two vertices of the same/different color, but then I'm stuck. Can I have a hint please? Thank you.
As it stands, if all vertices were red, then there are zero properly coloured squares, which is fine.
We will now allow any vertex not on the edge to change colour (to any of the other two colours). This will affect only the surrounding four squares. If we can prove that this change only changes the number of properly coloured squares by an even number (i.e. by $0, \pm 2, \pm 4$), then, applying this operation of colour change multiple times, we will arrive at any desired colouring, and the number of properly coloured squares will stay even all the time.
This means we have reduced the problem to just a $2\times 2$ grid, eight surrounding vertices and one in the centre changing colour - altogether there are $3^9=19683$ cases to consider.
In the absence of better inspiration, one can write a program to brute-force this search. For example, in Python: a,b,c,d,e,f,g,h are colours of the surrounding vertices, x is the colour of the central vertex, num_red, num_green, num_blue are the counts of properly coloured (out of the four) squares with x taking values of 'red', 'green' and 'blue':
which ends up not printing anything, as a proof that num_red, num_green and num_blue are always of the same parity.