In a row of five squares, each square is to be colored either red, yellow, or blue, so that no two consecutive squares have the same color. How many ways are there to color the five squares?

Guest Jun 11, 2023

#1**0 **

We can solve this problem by casework.

Case 1: The first square is red.

The second square must be yellow, and the third square must be blue. The fourth square can be red, yellow, or blue, and the fifth square can be the color that was not used in the first three squares. This gives us 3×3=9 possible arrangements.

Case 2: The first square is yellow.

The second square must be red, and the third square must be blue. The fourth square can be red, yellow, or blue, and the fifth square can be the color that was not used in the first three squares. This gives us 3×3=9 possible arrangements.

Case 3: The first square is blue.

The second square must be yellow, and the third square must be red. The fourth square can be red, yellow, or blue, and the fifth square can be the color that was not used in the first three squares. This gives us 3×3=9 possible arrangements.

Therefore, there are 9+9+9=27 ways to color the five squares.

Guest Jun 11, 2023