Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is a question. I seem to have a hard time answering questions of this kind. I would appreciate it if you would not only help answer this, but carefully explain the process so I can understand it, and apply the same when I encounter questions of this kind.

Six houses in a row are each to be painted with one of the colors red, blue, green, and yellow. In how many different ways can the houses be painted so that no two adjacent houses can be the same color?

Thanks in advance!

share|cite|improve this question
up vote 2 down vote accepted

The general strategy is to ask yourself:

  • How many ways can I color the first house?
  • And having chosen a color for the first house, how many ways can I color the second house?
  • And having chosen colors for the first two houses, how many ways can I color the third house?
  • (etc.)

And then you multiply the numbers all together. This is called the counting principle or the rule of product.

Here is a simpler example: How many ways can I color a big vase and a little vase, if I have three colors of paint, and the vases may not be the same color?

I can color the big vase in any of three colors, and then I can color the little vase in any of the two remaining colors, and so the answer is that there are 3×2=6 ways to color the vases.

In general, the problems might get harder, and that is why we have the branch of mathematics known as combinatorics.

share|cite|improve this answer
Is the answer then 4*3*3*3*3*3 = 972? – user10695 Jun 19 '12 at 21:02
If I understand the question correctly, then yes. – MJD Jun 19 '12 at 21:09
thank you very much for the help! – user10695 Jun 19 '12 at 21:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.