Suppose that I am buying cakes for a party. There

copafumpv

copafumpv

Answered question

2022-05-21

Suppose that I am buying cakes for a party. There are k different types and I intend to buy a total of n cakes. How many different combinations of cakes could I possibly bring to the party?

Answer & Explanation

minnegodks

minnegodks

Beginner2022-05-22Added 10 answers

Using a method that's often called "stars and bars":
We draw n stars in a row to represent the cakes, and k 1 bars to divide them up. All of the stars to the left of the first bar are cakes of the first type; stars between the first two bars are of the second type;
| | | |
Here's an example with n = 6 and k = 5. We're getting 2 of the first type, 3 of the second type, 0 of the third type, 1 of the fourth type, and 0 of the fifth type.
In order to solve the problem, we just need to reorder the stars and bars by choosing the k 1 spots for the bars out of the n + k 1total spots, so our answer is:
cyfwelestoi

cyfwelestoi

Beginner2022-05-23Added 3 answers

Let's assume you have n items and k bins. You need k 1 separators to get the n items into the k bins. There are ( n + k 1 ) ! permutations of ordering n items and ( k 1 ) separators. The permutations of the n items don't matter, and the permutations of the ( k 1 ) separators don't matter, so you'll need to divide by n ! and ( k 1 ) !
Thus you have
( n + k 1 ) ! n ! ( k 1 ) ! = ( n + k 1 k 1 )

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?