## Painting Train Cars

Each car of a five-car train must be painted a solid color. The only color choices are red, blue, and yellow. If each of these colors must be used for at least one car, in how many ways can this train be painted?
Source: NCTM Mathematics Teacher, November 2006

SOLUTION
The number of possible ways to paint the five cars using three colors is
$3^5=243$
This way of three-color painting would include two-color painting as well as one-color painting both of which we want to exclude.
The number of possible ways to paint the five cars using three colors is
$3\times 2^5=96$
For example,
R and B: RBRBR, …, RRRRR, BBBBB
R and Y: RYRYR, …, RRRRR, YYYYY
B and Y: BYBYB, …, BBBBB, YYYYY
Note that the $96$ count includes two RRRRR, two BBBBB, and two YYYYY, so the number of distinct ways is only
$96-3=93$
The number of possible ways to paint the five cars such that each of the three colors must be used for at least one car is
$243-93=150$

Answer: $150$