1

I know this has been asked before, but most existing answers have been in the form of summations instead of framing this as a stars and bars problem as taught in class.

We were given that the answer is ($n-1$ choose $k-1$), as in $n-k$ stars and $k-1$ bars, but I'm having trouble seeing why the former is the case.

[Edit] This is what I have tried so far: I know that we can make each of the positive numbers into k bins, thus there will be k-1 bars when framing it into a stars and bars problem.

However, when it comes to the n-k stars, the only explanation I can think of is subtracting k (the value we first chose) from n to find the remaining value we need to account for, but I don't think this makes sense. Any help on figuring out why it is n-k stars would be appreciated!

RobPratt
  • 45,619
hey
  • 21
  • 1
    Welcome to [math.se] SE. Take a [tour]. You'll find that simple "Here's the statement of my question, solve it for me" posts will be poorly received. What is better is for you to add context (with an [edit]): What you understand about the problem, what you've tried so far, etc.; something both to show you are part of the learning experience and to help us guide you to the appropriate help. You can consult this link for further guidance. – Another User Aug 02 '22 at 17:37
  • 1
    The problem you are referring to in your question is the number of positive solutions to the equation $x_1+x_2+\cdots +x_k = n$. Here, you are including permutations of each sum in the total count, whereas in the answer to your previous question (the number of partitions), you are not counting permutations of each sum. I hope this clarifies the difference between the two problems. – Doug Aug 02 '22 at 17:38
  • @Doug Thank you, I've just edited that out to not confuse the two. However, I still am confused on why there would be n-k stars. – hey Aug 02 '22 at 17:40
  • @AnotherUser Thank you for your suggestion and resources! I have just edited my post accordingly. – hey Aug 02 '22 at 17:46
  • It is not $(n-k)$ stars and $(k-1)$ bars, it is n stars and (k-1) bars, (or k bins), see my answer – true blue anil Aug 02 '22 at 18:47
  • The other subtlety here is that you require exactly $k$ summands that are positive. One way to think about that restriction is to put one "star" in each bin and then tackle the distribution of the remaining $n-k$ stars into $k$ bins. NB: @trueblueanil – hardmath Aug 12 '22 at 17:22
  • @harfmath: Yes, that is another way to look at it, I have added a PS – true blue anil Aug 12 '22 at 19:15

2 Answers2

2

Stars and bars was evolved as a graphical method for easily understanding

Suppose the upper face of ten dice placed on a table show all $6$ numbers appearing at least once: one $1$, one $2$, one $3$, four $4's$, one $5$, and two $6's$

This result could be depicted as $\Large{\;\;\star|\star|\star|\star\star\star\star|\star |\star\star\;\;}$

Make two notes:

  • Only $5$ dividers (bars) are needed to depict $6$ "bins"

  • Since no bin can be empty, no two bars can be adjacent, and the bars must lie between the first and last star

  • It follows that the # of ways for all possible ways of getting a sum of $10$ $=\Large{\binom{10-1}{6-1}}$

  • And in general, $\Large{\binom{n-1}{k-1}}$ where n stars are to be put into k bins


ADDED

If you so prefer, instead of the $10$ stars depicted, you could instead write $x_1+x_2+x_3+x_4+x_5+x_6 = 10,$ over positive integers. The $+$ signs then serve as the $5$ bars

Also note that here we are not counting the sum of $10$ die throws; each die is one object, and we are counting the number of ways die faces may show in $10$ throws


NOTE

For the difference between a "stars and bars" count, and a multinomial coefficient count, look here

PS

If you see the Wikipedia page, there are two formulas with two theorems, but since $(n-k)$ stars was troubling you, and you want to carry only one formula in your head, viz $\large\binom{n+k-1}{k-1}$, a simple ruse is to put one star each in each bin, so now there are only $(n-k)$ non-negative integers to deal with, and you can then use $\large\binom{n+k-1}{k-1}$

1

Alternative perspective:

For the general theory of applying Stars and Bars, with upper boundaries on the variables, see this answer.

Here, I am going to borrow two concepts from that article:

[1]
In general, the number of solutions to
$y_1 + y_2 + \cdots + y_k = n ~: ~y_i \in \Bbb{Z_{\geq 0}}~$ is $$\binom{n + [k-1]}{k-1}.$$

The above formula, which is directly proven in this article, provides an easy to apply basis for attacking your question.

[2]
Using one of the methods in the article referenced in my first link, the standard approach is :

  • You wish to enumerate the number of solutions to :
    $x_1 + x_2 + \cdots + x_k = n ~: ~x_i = \Bbb{Z^+}.$

  • Let $y_i = x_i - 1 ~: ~i \in \{1,2,\cdots,k\}.$

  • Therefore, $y_i \in \Bbb{Z_{\geq 0}} ~: ~i \in \{1,2,\cdots,k\}.$

  • Note that there is a bijection between the set of solutions that you are trying to enumerate and the set of solutions to
    $y_1 + y_2 + \cdots + y_k = (n-k).$

Therefore, the desired enumeration must be

$$\binom{[n-k] + [k-1]}{k-1} = \binom{n-1}{k-1}.$$

user2661923
  • 35,619
  • 3
  • 17
  • 39