I'm learning for my highschool finals (in the Netherlands) and reviewing all the chapter I've done this and last year in maths.

For three weeks I'll be repeating Combinatorics and Probability Theory. And I have a question my math teacher couldn't answer.

Let's assume we need to make a row of 5 pencils. And those pencils can be black or white.

The ammount of colour combinations I can make is 2^5

Now suppose we can choose out of three kinds of colours: white, black and green.

The ammount of colour combinations is 3^5

Now let's say there must be three black pencils and two white ones

The ammount of colour combinations is:

5 ncr 3 or 5 ncr 2

( with ncr this is what I mean: 5 ncr 3 - Wolfram|Alpha)

Now my question:

Let's assume we have 3 black penciles, 5 white peciles and 2 green one. How many combinations can I make?

I know you can write all possibilities down but I'm curious if there is a mathematical way and if not why not.

Thanks in advance!