$(1)$ The vertices $A,B,C,D$ of a square are to be coloured with one of three colours red, blue, or green such that adjacent vertices get different colours. What is the number of such colourings?
What I attempted :-
The vertex $A$ can be coloured with $3$ colours in $3$ ways.
There are $2$ choices for $B$ and $C$ (One restriction for each)
There is $1$ choice for $D$ (Two restrictions)
Required number of colourings = $3\times 2 \times 2 \times 1=12$
Am I Correct ?
It could be that $C$ and $A$ get the same color, which would leave two choices for $D$. We need to condition on that. There is one choice for $C$ that is the same as $A$ and one different, so it becomes $3 \times 2 \times 1 \times 2 + 3 \times 2 \times 1 \times 1=18$