Stars and bars (combinatorics)

From HandWiki - Reading time: 6 min

Short description: Graphical aid for deriving some concepts in combinatorics

In the context of combinatorial mathematics, stars and bars (also called "sticks and stones",[1] "balls and bars",[2] and "dots and dividers"[3]) is a graphical aid for deriving certain combinatorial theorems. It was popularized by William Feller in his classic book on probability. It can be used to solve many simple counting problems, such as how many ways there are to put n indistinguishable balls into k distinguishable bins.[4]

Statements of theorems

The stars and bars method is often introduced specifically to prove the following two theorems of elementary combinatorics concerning the number of solutions to an equation.

Theorem one

For any pair of positive integers n and k, the number of k-tuples of positive integers whose sum is n is equal to the number of (k − 1)-element subsets of a set with n − 1 elements.

For example, if n = 10 and k = 4, the theorem gives the number of solutions to x1 + x2 + x3 + x4 = 10 (with x1, x2, x3, x4 > 0) as the binomial coefficient

[math]\displaystyle{ \binom{n - 1}{k - 1} = \binom{10 - 1}{4 - 1} = \binom{9}{3} = 84. }[/math]

This corresponds to compositions of an integer.

Theorem two

For any pair of positive integers n and k, the number of k-tuples of non-negative integers whose sum is n is equal to the number of multisets of cardinality n taken from a set of size k, or equivalently, the number of multisets of cardinality k − 1 taken from a set of size n + 1.

For example, if n = 10 and k = 4, the theorem gives the number of solutions to x1 + x2 + x3 + x4 = 10 (with x1, x2, x3, x4 [math]\displaystyle{ \ge0 }[/math] ) as:

[math]\displaystyle{ \left(\!\!{k\choose n}\!\!\right) = {k+n-1 \choose n} = \binom{13}{10} = 286 }[/math]
[math]\displaystyle{ \left(\!\!{n+1\choose k-1}\!\!\right) = {n+1+k-1-1 \choose k-1} = \binom{13}{3} = 286 }[/math]
[math]\displaystyle{ \binom{n + k - 1}{k - 1} = \binom{10+4-1}{4 - 1} = \binom{13}{3} = 286 }[/math]

This corresponds to weak compositions of an integer.

Proofs via the method of stars and bars

Theorem one proof

Suppose there are n objects (represented here by stars) to be placed into k bins, such that all bins contain at least one object. The bins are distinguishable (say they are numbered 1 to k) but the n stars are not (so configurations are only distinguished by the number of stars present in each bin). A configuration is thus represented by a k-tuple of positive integers, as in the statement of the theorem.

For example, with n = 7 and k = 3, start by placing the stars in a line:

★ ★ ★ ★ ★ ★ ★
Fig. 1: Seven objects, represented by stars

The configuration will be determined once it is known which is the first star going to the second bin, and the first star going to the third bin, etc.. This is indicated by placing k − 1 bars between the stars. Because no bin is allowed to be empty (all the variables are positive), there is at most one bar between any pair of stars.

For example:

★ ★ ★ ★ | ★ | ★ ★
Fig. 2: These two bars give rise to three bins containing 4, 1, and 2 objects

There are n − 1 gaps between stars. A configuration is obtained by choosing k − 1 of these gaps to contain a bar; therefore there are [math]\displaystyle{ \tbinom{n - 1}{k - 1} }[/math] possible combinations.

Theorem two proof

In this case, the weakened restriction of non-negativity instead of positivity means that we can place multiple bars between stars, before the first star and after the last star.

For example, when n = 7 and k = 5, the tuple (4, 0, 1, 2, 0) may be represented by the following diagram:

★ ★ ★ ★ | | ★ | ★ ★ |
Fig. 3: These four bars give rise to five bins containing 4, 0, 1, 2, and 0 objects

To see that there are [math]\displaystyle{ \tbinom{n + k - 1}{k-1} }[/math] possible arrangements, observe that any arrangement of stars and bars consists of a total of n + k − 1 objects, n of which are stars and k − 1 of which are bars. Thus, we only need to choose k − 1 of the n + k − 1 positions to be bars (or, equivalently, choose n of the positions to be stars).

Theorem 1 can now be restated in terms of Theorem 2, because the requirement that all the variables are positive is equivalent to pre-assigning each variable a 1, and asking for the number of solutions when each variable is non-negative.

For example:

[math]\displaystyle{ x_1+x_2+x_3+x_4=10 }[/math]

with [math]\displaystyle{ x_1,x_2,x_3,x_4\gt 0 }[/math]

is equivalent to:

[math]\displaystyle{ x_1+x_2+x_3+x_4=6 }[/math]

with [math]\displaystyle{ x_1,x_2,x_3,x_4\ge0 }[/math]

Proofs by generating functions

Both cases are very similar, we will look at the case when [math]\displaystyle{ x_i\ge0 }[/math] first. The 'bucket' becomes

[math]\displaystyle{ \frac{1}{1-x} }[/math]

This can also be written as

[math]\displaystyle{ 1+x+x^2+\dots }[/math]

and the exponent of x tells us how many balls are placed in the bucket.

Each additional bucket is represented by another [math]\displaystyle{ \frac{1}{1-x} }[/math], and so the final generating function is

[math]\displaystyle{ \frac{1}{1-x}\frac{1}{1-x}\dots\frac{1}{1-x} = \frac{1}{(1-x)^k} }[/math]

As we only have n balls, we want the coefficient of [math]\displaystyle{ x^n }[/math] (written [math]\displaystyle{ [x^n]: }[/math]) from this

[math]\displaystyle{ [x^n]: \frac{1}{(1-x)^k} }[/math]

This is a well-known generating function - it generates the diagonals in Pascal's Triangle, and the coefficient of [math]\displaystyle{ x^n }[/math] is

[math]\displaystyle{ \binom{n+k-1}{k-1} }[/math]

For the case when [math]\displaystyle{ x_i\gt 0 }[/math], we need to add x into the numerator to indicate that at least one ball is in the bucket.

[math]\displaystyle{ \frac{x}{1-x}\frac{x}{1-x}\dots\frac{x}{1-x} = \frac{x^k}{(1-x)^k} }[/math]

and the coefficient of [math]\displaystyle{ x^n }[/math] is

[math]\displaystyle{ \binom{n-1}{k-1} }[/math]

Examples

Many elementary word problems in combinatorics are resolved by the theorems above.

The three-choose-two combination yields two results, depending on whether a bin is allowed to have zero items. In both cases the number of bins is 3. If zero is not allowed, the number of cookies is n = 6, as described in the previous figure. If zero is allowed, the number of cookies is only n = 3.

Example 1

If one wishes to count the number of ways to distribute seven indistinguishable one dollar coins among Amber, Ben, and Curtis so that each of them receives at least one dollar, one may observe that distributions are essentially equivalent to tuples of three positive integers whose sum is 7. (Here the first entry in the tuple is the number of coins given to Amber, and so on.) Thus stars and bars theorem 1 applies, with n = 7 and k = 3, and there are [math]\displaystyle{ \tbinom{7-1}{3-1} = 15 }[/math] ways to distribute the coins.

Example 2

If n = 5, k = 4, and a set of size k is {a, b, c, d}, then ★|★★★||★ could represent either the multiset {a, b, b, b, d} or the 4-tuple (1, 3, 0, 1). The representation of any multiset for this example should use SAB2 with n = 5, k – 1 = 3 bars to give [math]\displaystyle{ \tbinom{5+4-1}{4-1} = \tbinom{8}{3} = 56 }[/math].

Example 3

SAB2 allows for more bars than stars, which isn't permitted in SAB1.

So, for example, 10 balls into 7 bins is [math]\displaystyle{ \tbinom{16}{6} }[/math], while 7 balls into 10 bins is [math]\displaystyle{ \tbinom{16}{9} }[/math], with 6 balls into 11 bins as [math]\displaystyle{ \tbinom{16}{10}=\tbinom{16}{6}. }[/math]

Example 4

If we have the infinite power series

[math]\displaystyle{ \left[\sum_{k=1}^{\infty}x^k\right], }[/math]

we can use this method to compute the Cauchy product of m copies of the series. For the nth term of the expansion, we are picking n powers of x from m separate locations. Hence there are [math]\displaystyle{ \tbinom{n-1}{m-1} }[/math] ways to form our nth power:

[math]\displaystyle{ \left[\sum_{k=1}^{\infty}x^k\right]^{m} = \sum_{n=m}^{\infty}{{n-1} \choose {m-1}}x^{n} }[/math]

Example 5

The graphical method was used by Paul Ehrenfest and Heike Kamerlingh Onnes – with symbol ε (quantum energy element) in place of a star – as a simple derivation of Max Planck's expression of "complexions".[5]

Planck called "complexions" the number R of possible distributions of P energy elements ε over N resonators:[6]

[math]\displaystyle{ R=\frac {(N+P-1)!}{P!(N-1)!} \ }[/math]

The graphical representation would contain P times the symbol ε and N – 1 times the sign | for each possible distribution. In their demonstration, Ehrenfest and Kamerlingh Onnes took N = 4 and P = 7 (i.e., R = 120 combinations). They chose the 4-tuple (4, 2, 0, 1) as the illustrative example for this symbolic representation: εεεε|εε||ε

See also

References

  1. Batterson, J. Competition Math for Middle School. Art of Problem Solving. 
  2. Flajolet, Philippe; Sedgewick, Robert (June 26, 2009). Analytic Combinatorics. Cambridge University Press. ISBN 978-0-521-89806-5. 
  3. "Art of Problem Solving". https://artofproblemsolving.com/wiki/index.php/Ball-and-urn. 
  4. Feller, William (1950). An Introduction to Probability Theory and Its Applications. 1 (3rd ed.). Wiley. p. 38. 
  5. Ehrenfest, Paul; Kamerlingh Onnes, Heike (1915). "Simplified deduction of the formula from the theory of combinations which Planck uses as the basis of his radiation theory". The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science. Series 6 29 (170): 297–301. doi:10.1080/14786440208635308. http://dx.doi.org/10.1080/14786440208635308. Retrieved 5 December 2020. 
  6. Planck, Max (1901). "Ueber das Gesetz der Energieverteilung im Normalspectrum". Annalen der Physik 309 (3): 553–563. doi:10.1002/andp.19013090310. Bibcode1901AnP...309..553P. 

Further reading




Licensed under CC BY-SA 3.0 | Source: https://handwiki.org/wiki/Stars_and_bars_(combinatorics)
8 views | Status: cached on September 19 2024 11:00:22
↧ Download this article as ZWI file
Encyclosphere.org EncycloReader is supported by the EncyclosphereKSF