How many distinct coloring is there

combinatorics

Suppose you want to color 5 cards. The rules are:

  • there are three distinct colors;
  • each card can't be colored with more than one color;
  • each card is colored;
  • the three given colors must be used in each coloring.

How many distinct coloring is there?

Failed attempt: In each configuration we must use the three given colors, so we could start painting three cards using those colors and then complete the rest. There are $5!/2!=60$ ways to color three out of five cards with the given colors. The remaining $2$ cards could be colored in any way you like, so for each configuration of three cards which were already colored, we have $3\cdot 3=9$ options. So the total ways to color the cards would be $60\cdot 9=540$.

I know this is wrong for I'm counting some repetitions and I don't know how to get rid of them.

Best Answer

If we ignore the last rule, there are $3^5$ colourings using red, green, and blue. From this we have to subtract $2^5$ colourings using only red and green, $2^5$ colourings using only red and blue, and $2^5$ colourings using only green and blue. But wait, we subtracted the all-red colouring twice! As well as the all-green and the all-blue colouring. So the final result is $$ 3^5-3\cdot 2^5+3.$$

Related Question