Math Problem : H.10 Paint four places by three colors

As for the method to paint A to D by using three colors among four colors of red, blue, yellow and white to distinguish the border of A,B,C,D in the figure below, how many ways are there?







Answer
48 ways

Solution
Because it is the same as how to choose one color among four colors as how to choose three colors among four colors is four ways. 

When I paint A - D with three colors, A and D, or B and D becomes the same color. 

In the case that A and D is the same color, it is three ways in choosing one color among three colors. 

Because the color to paint B is chosen one color among two colors except one color that is painted in A and D, it is two ways. 

Because the color to paint C is one color that remained last, it is one way. 

Thus, it is 3 × 2 × 1 = six ways. 

In the case that B and D is the same color, it is also six ways in the same way above. 

Therefore it is 4 × (6 + 6) = 48 ways in total.