1

I HAVE SEEN stars and bars reference from this sum. But still I dont get it .

I dont get it whether it is permutation or combination.

I have done the sum in this way. All arrangements

C1 C2 C3 C4

7 0 0 0. = 4p1 (from 4 cakes choosing one)

5 2 0 0. = 4p2 (from 4 cakes choosing two)

6 1 0 0 = 4p2 (from 4 cakes choosing 2)

5 1 1 0= 4p3

4 2 1 0 = 4p3

4 1 1 1= 4p4

3 3 1 0= 4p3

3 2 2 0 = 4p3

3 2 1 1 = 4p4

2 2 2 1 = 4p4

Summing all of these will give me the correct answer???

  • The difference between combination and permutation is that in permutation, the different orders (of elements within a set) are counted as different cases. It's usually not used, so combination is far more popular. – Matti P. Jan 21 '20 at 09:51
  • 1
    What do you not understand in the answer to this question? – almagest Jan 21 '20 at 09:58
  • @Matti P. if i take arrangement like this 7,0,0,0 and another like this 0,0,7,0 then the two arrangements are unique .That means ordering matters . then it should be permutaation – Saumyojit Das Jan 21 '20 at 10:16
  • 1
    In this case, you are asked for sets of pastries, so this is a combination with repetition problem. – N. F. Taussig Jan 21 '20 at 10:16
  • @SaumyojitDas Thinking about how to label a problem is the wrong way to go. Get a clear understanding of how particular techniques work and why. – almagest Jan 21 '20 at 10:22
  • Permutations count arrangements of distinct objects; combinations count subsets of distinct objects. However, in this problem, there must be at least one type of pastry in which more than one pastry of that type is selected. – N. F. Taussig Jan 21 '20 at 10:27
  • What do you hope to learn by asking this question? Do you want to know how to classify the problem or how to solve it? Please edit your question accordingly. – N. F. Taussig Jan 21 '20 at 11:04
  • @– N. F. Taussig I dont understand this line. Permutations count arrangements of distinct objects; combinations count subsets of distinct objects. However, in this problem, there must be at least one type of pastry in which more than one pastry of that type is selected.

    What are the distinct objects here ? pastry?? What odes this mean in this pastry context "combinations count subsets of distinct objects".

    – Saumyojit Das Jan 21 '20 at 14:37
  • It is a combination – PythonSage Jan 21 '20 at 16:20
  • FIRST TELL ME WHAT is wrong here?

    C1 C2 C3 C4

    7 0 0 0

    As we can see ordering of cakes matter . If ordering did not matter first 3 arrangements should be considered as one . Ordering means permutation.

    – Saumyojit Das Jan 21 '20 at 16:21
  • @N.F.Taussig I have edited my approach. Where is it wrong? – Saumyojit Das Jan 22 '20 at 12:45
  • @SaumyojitDas The issue is that you lack clarity of the problem. No offence but I feel that you should practice simpler questions if you did not understand anything of what anyone here is saying here. Combinatorics is a topic that doesn't work by knowing the right formula. You have to understand what the problem is asking, what method you should use and why it will work. – Sam Jan 23 '20 at 11:09
  • @Sam see 5110 combo and 0151 in this 2 arrangements cake2(1's) is getting repeated.Like this all the arrangements of this (5110) ; repetition is happening . That's why we are dividing by 2fact from the 4fact?? – Saumyojit Das Jan 23 '20 at 13:56

3 Answers3

1

The problem that you have stated is a combination problem. This is because the order in which the pastries are arranged does not matter. Now suppose you had to give $7$ pastries to $7$ different children. Here the order does matter as for the same set of pastries, each kid can get different arrangements. You could swap the pastries of two kids while maintaining the same number of each pastry being picked. The second problem is one of permutations. The two problems require different approaches to solve them.

Let $a, b, c, d$ denote the $4$ types of pastries. The solution to your problem would be the number of whole number solutions for this equation- $$a+b+c+d=7$$ Think about this for a bit. This is equivalent to the stars and bars problem. I leave you to calculate the number of solutions for this equation.

$C={{7+4-1}\choose {4-1}}={10\choose 3}=\frac {10!}{7!\cdot3!}$

Now, for the permutations problem, each kid may get any of the $4$ pastries. Hence for each kid, you have $4$ options. Hence the permutations will be $P=4\times 4\times4 \cdots \text{7 times}=4^7$

Sam
  • 2,447
  • I dont get it whether it is permutation or combination.

    I have done the sum in this way. All arrangements

    C1 C2 C3 C4

    7 0 0 0. = 4p1 (from 4 cakes choosing one)

    5 2 0 0. = 4p2 (from 4 cakes choosing two)

    6 1 0 0 = 4p2 (from 4 cakes choosing 2)

    5 1 1 0= 4p3

    4 2 1 0 = 4p3

    4 1 1 1= 4p4

    3 3 1 0= 4p3

    3 2 2 0 = 4p3

    3 2 1 1 = 4p4

    2 2 2 1 = 4p4

    Summing all of these will give me the correct answer???

    – Saumyojit Das Jan 22 '20 at 14:29
  • @SaumyojitDas If you sum all of them correctly then yes but as you can clearly see, this is not practical when dealing with larger numbers. Also, you will have to divide according to the repetitions. For example, $(2,2,2,1)=\frac {4!}{3!}$ and $(3,3,1,0)=\frac {4!}{2!}$ – Sam Jan 22 '20 at 16:17
0

You can simply think of this as a combination of several cases.
Case I: You buy only one kind of pastry in $4\choose1$ ways.

Case II: You buy only two types of pastries. You choose two types of pastries in $4\choose 2$ ways.
Secondly, you can buy $(1,6),(2,5)...$ pastries to get a total of seven in ${7-1}\choose{2-1}$ ways. [Do you know why we wrote ${7-1}\choose{2-1}$?]

Case III: Buy three kinds of pastries in $4\choose 3$ ways. Buy $(1,1,5),(1,2,4)...$ pastries in ${7-1}\choose{3-1}$ ways.

Case IV: Buy all four kinds in one way. Buy $(1,1,1,4),(1,1,2,3)...$ pastries in ${7-1}\choose{4-1}$ ways.

Total number of ways = ${4\choose{1}}+{4\choose2}\cdot{6\choose1}+{4\choose3}\cdot{6\choose2}+1\cdot{6\choose3}=120$ ways

PythonSage
  • 1,074
0

What matters here is how many of each type of pastry are selected. Selecting three pecan pies, two apple strudel, one croissant, and one baklava is different from selecting four baklava, two apple strudels, and one pecan pie.

Let's label the types of pastries 1, 2, 3, and 4. Let $x_i$, $1 \leq i \leq 4$, be the number of pastries of type $i$ that are selected. Since a total of seven pastries are selected from the four types, $$x_1 + x_2 + x_3 + x_4 = 7 \tag{1}$$ The number of ways the pastries can be selected is the number of solutions of equation 1 in the nonnegative integers. A particular solution of equation 1 corresponds to the placement of three addition signs in a row of seven ones. For instance, $$1 1 + 1 1 1 + 1 + 1$$ corresponds to the solution $x_1 = 2$, $x_2 = 3$, $x_3 = 1$, $x_4 = 1$, while $$1 + + 1 1 1 1 + 1 1$$ corresponds to the solution $x_1 = 1$, $x_2 = 0$, $x_3 = 4$, $x_4 = 2$.

The number of solutions of equation 1 in the nonnegative integers is the number of ways $4 - 1 = 3$ addition signs can be placed in a row of $7$ ones, which is $$\binom{7 + 4 - 1}{4 - 1} = \binom{10}{3}$$ since we must select which three of the ten positions required for seven ones and three addition signs will be filled with addition signs.

What was wrong with your attempt?

The partitions of $7$ into at most four parts are \begin{align*} 7 & = 7\\ & = 6 + 1\\ & = 5 + 2\\ & = 5 + 1 + 1\\ & = 4 + 3\\ & = 4 + 2 + 1\\ & = 4 + 1 + 1 + 1\\ & = 3 + 3 + 1\\ & = 3 + 2 + 2\\ & = 3 + 2 + 1 + 1\\ & = 2 + 2 + 2 + 1 \end{align*}

Your counts are correct for the cases in which a different number of each type of pastry is selected. However, they are incorrect when the same number of pastries are selected from two or more types.

$5 + 1 + 1$: There are four ways to select the type of pastry from which five pieces of pastry will be selected. There are $\binom{3}{2}$ ways to select the two types of pastry from which one piece of pastry each will be selected. Hence, there are $$\binom{4}{1}\binom{3}{2}$$ such selections.

$3 + 3 + 1$: There are $\binom{4}{2}$ ways to select the two types of pastries from which three pieces of pastry will be drawn and two ways to select the type of pastry from which one piece of pastry will be drawn. Hence, there are $$\binom{4}{2}\binom{2}{1}$$ such selections.

Notice that $$\binom{4}{1}\binom{3}{2} = \binom{4}{2}\binom{2}{1}$$ This is because in both the $5 + 1 + 1$ case and the $3 + 3 + 1$ case, there are three types of pastry drawn, with equal amounts of exactly two of them. We could have done the $3 + 3 + 1$ case by first selecting the type of pastry from which one piece of pastry will be drawn, then selecting from which two of the three types of pastry three pieces of pastry each would be drawn, which would have yielded the count $$\binom{4}{3}\binom{3}{2}$$

$3 + 2 + 2$: The argument above shows that there are also $$\binom{4}{1}\binom{3}{2}$$ such cases.

$4 + 1 + 1 + 1$: There are four ways to select the type of pastry from which four pieces will be selected. We must select one of each the other types. Hence, there are $$\binom{4}{1}$$ such selections.

$2 + 2 + 2 + 1$: There are four ways to select the type of pastry from which one piece will be selected. We must select two pieces each from each of the remaining types of pastry. Hence, there are $$\binom{4}{1}$$ such selections.

$3 + 2 + 1 + 1$: There are four ways to select the type of pastry from which three pieces will be drawn and three ways to select the type of pastry from which two pieces will be drawn. We must select one piece each from each of the remaining types of pastry. Hence, there are $$\binom{4}{1}\binom{3}{1}$$ such selections.

With these corrections, we obtain a total of $$\binom{4}{1} + \binom{4}{1}\binom{3}{1} + \binom{4}{1}\binom{3}{1} + \binom{4}{1}\binom{3}{2} + \binom{4}{1}\binom{3}{1} + \binom{4}{1}\binom{3}{1}\binom{2}{1} + \binom{4}{1} + \binom{4}{2}\binom{2}{1} + \binom{4}{1}\binom{3}{2} + \binom{4}{1}\binom{3}{1} + \binom{4}{1} = \binom{10}{3}$$ ways to select seven pastries of four types.

What type of problem is this?

This is a combination with repetition problem since we are selecting $k$ objects from $n$ types of objects, where we may take the same type of object repeatedly.

N. F. Taussig
  • 76,571
  • Your counts are correct for the cases in which a different number of each type of pastry is selected. However, they are incorrect when the same number of pastries are selected from two or more types.

    U are saying that At this point, we are only counting ways to arrange the numbers 5, 1, 1, 0. We are not taking about cakes/pastries at all

    But arranging the numbers would give me a new set everytime how can i omit that "We are not talking about cakes/pastries at all" ordering is deciding qunatity of cakes of each type.

    New question how many distinct ways can u arrange {5,1,1,0}

    – Saumyojit Das Jan 23 '20 at 09:22
  • The answer I gave is for the number of ways of selecting seven pastries for four types of pastries. Let the pastries have types 1, 2, 3, 4. I claimed that there are $\binom{4}{1}\binom{3}{2} = 12$ ways to have a distribution of the form $5 + 1 + 1$. They are \begin{align} 1, 1, 1, 1, 1, 2, 3\ 1, 1, 1, 1, 1, 2, 4\ 1, 1, 1, 1, 1, 3, 4\ 1, 2, 2, 2, 2, 2, 3\ 1, 2, 2, 2, 2, 2, 4\ 2, 2, 2, 2, 2, 3, 4\ 1, 2, 3, 3, 3, 3, 3\ 1, 3, 3, 3, 3, 3, 4\ 2, 3, 3, 3, 3, 3, 4\ 1, 2, 4, 4, 4, 4, 4\ 1, 3, 4, 4, 4, 4, 4\ 2, 3, 4, 4, 4, 4, 4 \end{align} You can similarly verify my other counts. – N. F. Taussig Jan 23 '20 at 09:33
  • This is not a permutation problem unless you care about the order in which the pastries are selected. As for the link, it says the requested page could not be found. – N. F. Taussig Jan 23 '20 at 09:53
  • 1,1,1,1,1,2,3 and 1,1,1,1,1,2,4 choosing 5 cakes of type 1 and each one of 2 and 3 && second arrangement means choosing 5 cakes of type 1 and each one of 2 and type 4 . So due to presence of 5 cakes of type 1 in both the sets we will get repetiton or for the individual set due to presence of more than 1 type1 cake we are telling there is repetion involved? – Saumyojit Das Jan 23 '20 at 14:48
  • Yes, that is correct. There is repetition involved since there are five cakes of type 1. In fact, in each of the $120$ selections, repetition is involved since there is at least one type of pastry for which more than one piece of pastry of that type is selected. – N. F. Taussig Jan 23 '20 at 15:36