25 views

Uploaded by Ajitesh Abhishek

P&C

- Ch6 Generating Functions Problems
- Ramsey y
- Midterm Solutions
- Peter Smith - Teach Yourself Logic 2015; A Study Guide
- Solution2_1_17
- 07. Closet - An Efficient Algorithm for Mining Frequent
- Mathematical-Morphology-40-Years-On-Proceedings-of-the-7th-International-Symposium-on-Mathematical-Morphology-April-18-20-2005
- Logic and Critical Thinking
- On α-ρ-Continuity Where ρ ϵ {L, M, R, S}
- How to write a Proof!!!
- 553Mathematics-12
- A New S-(a,d) Antimagic Labelling of a Class of Generalized Petersen Graphs
- Distribution Problems
- Sorting
- Sets Relations Functions
- Advanced Search
- 07 Shortest Path Algorithms
- mf-param-oper2
- Design Representation
- 1A Functions Q No 18

You are on page 1of 12

In this chapter we are going to discuss a very helpful family of problems.

Problem. Suppose we have n balls, and k boxes. How many dierent ways

are there of distributing the balls into the boxes? }

and boxes are distinguishable. Imagine that if the balls are distinguishable,

then they are numbered 1 to n, but if they are indistinguishable, then they

have exactly the same appearance. The same comment applies to the boxes.

5), and two distinguishable boxes (numbered 1 and 2). Then these two

distributions of balls in boxes are dierent.

1 3 5 2 4 1 2 5 3 4

Notice, however, that if the balls were indistinguishable, then these distri-

butions would be identical: in both distributions, Box 1 gets three balls,

and Box 2 get two. Similarly, these two distributions are distinct:

1 3 5 2 4 2 4 1 3 5

the same. }

We sometimes further divide the four variants of the balls and boxes

problem by saying that each box must contain at least one ball. In addition,

we might insist that each box must contain no more than one ball, but the

answers in this case tend not to be very interesting. Thus there are twelve

potential subproblems, so this classification of problems is sometimes called

the Twelvefold Way.

25

MATH 261 Enumeration 4. Balls and boxes

Proposition 4.1. Suppose that we have n indistinguishable balls, and k

distinguishable boxes. The number of dierent ways of distributing the balls

into the boxes is

n+k 1

.

n

Proof. As in the proof of Proposition 2.6, we set up a correspondence be-

tween distributions of balls and strings of the form

| || |

In this case each of the symbols represents a ball, and the | symbols are

separators between consecutive boxes. So the string above represents the

distribution where Box 1 gets three balls, Box 2 gets one, Box 3 gets none,

Box 4 gets two, and Box 5 gets one.

Now we just need to count the number of such strings. Each string

contains n + k 1 characters (n to represent the n balls, and k 1 to

represent the separators between the k boxes). Once we have decided which

of the n + k 1 slots contains a character, then the string is completely

determined. Therefore the number of strings is equal to the number of ways

we can choose n slots from n + k 1 possibilities. This is just n+kn 1 .

x1 + + xk = n,

integers (that is, integers that are greater than or equal to zero). We can

think of this problem as distributing n identical balls into k distinguishable

bins. At the end of this distribution, the number of balls in Bin 1 will be x1 ,

the number of balls in Bin 2 will be x2 , and so on. Therefore the number of

solutions to the equation is

n+k 1

.

n }

Example. We have access to red, blue, and green marbles. We would like

to fill a jar with 50 marbles. How many dierent ways can we do this?

The answer is going to be the number of solutions to the equation

26

MATH 261 Enumeration 4. Balls and boxes

where xred , for example, is the number of red marbles in the jar. (So xred

must be a non-negative integer.) Therefore the answer is 50+3

50

1

= 1326.}

Next, lets look at the case that every box must contain at least one ball.

distinguishable boxes. The number of dierent ways of distributing the balls

into the boxes so that each box contains at least one ball is

n 1

.

k 1

strings of and | symbols that we employed in Proposition 4.1. However,

this time each box must contain at least one ball, so we cannot have two

consecutive | symbols. Nor can we start or end with a | symbol. How many

strings are there satisfying these constraints?

Think of the n symbols representing the balls lined up in a row. There are

n 1 spaces between them. We want to choose exactly k 1 of these spaces

to fill with | symbols. This way, no two | symbols fall into the same space, so

there are no consecutive | symbols. Therefore the number of strings is equal

to the number of ways we can choose k 1 spaces out of n 1 possibilities.

This is nk 11 .

constrained to be positive integers (that is, integers that are greater than

or equal to one). In the same way as an earlier example, we see that this is

like distributing n indistinguishable balls into k boxes, while insisting that

every box contains at least one ball. Therefore number of solutions to this

is nk 11 . }

Example. We want to fill a jar with 50 marbles, and the marbles are either

red, green, or blue. How many ways are there to fill the jar if we insist that

we take at least one of each colour? The answer is equal to the number of

solutions to the equation

ber of ways of filling the jar is 50 1

3 1 = 1176. }

27

MATH 261 Enumeration 4. Balls and boxes

Proposition 4.3. Suppose that we have n distinguishable balls and k dis-

tinguishable boxes. Then there are k n dierent ways of distributing the balls

into the boxes.

Proof. For each ball we have k options when deciding which box to put it

in. Thus we have to make n choices, and for each choice we have k options.

The Multiplication Principle tells us that the total number of options is k n .

These options are all distinct, as the balls and boxes are distinguishable.

Chapter 2. We are selecting boxes with repetition, where the order matters.

The first box selected is the destination of the first ball, the second box

selected is the destination of the second ball, and so on. }

Example. How many functions are there from {1, . . . , 10} to {1, . . . , 8}?

We think of choosing a function as putting balls labeled 1 to 10 into

boxes labeled 1 to 8. Putting Ball 1 into Box 4, for example, means that

we have chosen f (1) to be 4. Therefore there are 810 = 1073741824 possible

functions. }

Example. Suppose we have a class of 30 students, and every student needs

to assigned to one of 3 tutors. How many ways are there of dividing the

class?

We have 30 balls, each labeled with the name of a student, and we are

going to distribute them into 3 boxes, each of which is labeled with the name

of a tutor. There are 330 = 205891132094649 ways of doing this. }

What if we insist that each tutor must be assigned at least one student?

The next result result shows us how to find the answer.

Proposition 4.4. Suppose that we have n distinguishable balls, and k dis-

tinguishable boxes. The number of dierent ways of distributing the balls

into the boxes so that each box contains at least one ball is

n n k n s k

k k(k 1) + (k 2) + + ( 1) (k s)n

k 2 k s

k 1

X

k 1 s k

+ + ( 1) k = ( 1) (k s)n .

k s

s=0

28

MATH 261 Enumeration 4. Balls and boxes

box number i. Then we are interested in the distributions that are in none of

the sets A1 . . . , Ak . Thus we want to find |Ac1 \ \ Ack |. By Equation (3.3)

this is equal to

X X

|U | |Ai | + |Ai \ Aj | + +

1ik 1i<jk

X

( 1)s |Ai1 \ \ Ais | + + ( 1)k |A1 \ \ Ak | (4.1)

1i1 <<is k

We already know what |U | is: Proposition 4.3 says that it is k n . Suppose

that i1 < < is are distinct integers between 1 and k. We want to know

the cardinality of Ai1 \ \ Ais . But this is just the set of distributions

that leave boxes i1 , . . . , is empty. Therefore its cardinality is equal to the

number of ways of distributing the n balls among the remaining k s boxes,

and this is equal to (k s)n . There are ks = k k s ways of choosing the

integers 1 i1 < < is k from the range 1, . . . , k. By combining these

facts, we see that

X

k

|Ai1 \ \ Ais | = (k s)n .

k s

1i1 <<is k

every element b 2 B, there is some a 2 A such that f (a) = b. What is the

number of surjective functions from {1, . . . , 12} to {1, . . . , 4}? This is equal

to the number of ways we can assign balls labeled 1 to 12 to boxes labeled

1 to 4 in such a way that each box receives at least one ball. Therefore the

solution is

412 4 312 + 6 212 4 112 = 14676024. }

Proposition 2.4

set of size k is

k 1

X

s k

( 1) (k s)n .

k s

s=0

29

MATH 261 Enumeration 4. Balls and boxes

to assigned to one of 3 tutors. How many ways are there of dividing the

class if we insist that each tutor must have at least one student assigned to

them.

We have 30 balls, each labeled with the name of a student, and we are

going to distribute them into 3 boxes, each of which is labeled with the name

of a tutor. We insist that the boxes are non-empty. There are

330 3 230 + 3 130 = 205887910869180

ways of doing this. }

we are going to discuss an important family of numbers called Stirling num-

bers.

A partition of {1, . . . , n} into k parts is a collection of k non-empty sets

that are pairwise disjoint, and whose union is equal to {1, . . . , n}. The parts

of the partition are also called blocks.

Example. There is one partition of {1, 2, 3} into one part: namely

{{1, 2, 3}}. (Note that this is a collection of one set, thus it is a set containing

a set.) There are three partitions of {1, 2, 3} into two parts:

{{1}, {2, 3}}, {{2}, {1, 3}}, and {{3}, {1, 2}}.

Finally, there is one partition of {1, 2, 3} into three parts: {{1}, {2}, {3}}.}

Definition 4.6. Suppose that n is a positive integer and 1 k n. The

number of partitions of {1, . . . , n} into k parts is said to be a Stirling number

of the second kind, and is denoted S(n, k).

Example. The previous example shows that S(3, 1) = 1, S(3, 2) = 3, and

S(3, 3) = 1. }

Remark. The notation

n

k

is often used instead of S(n, k). }

Remark. So what is a Stirling number of the first kind? You can think

of it this way: we have n people at a wedding with k circular tables. How

many ways can we arrange the people at the tables so that there is at least

one person at each table? The answer to this question is a Stirling number

of the first kind. }

30

MATH 261 Enumeration 4. Balls and boxes

n

(ii) If n > 1, then S(n, n 1) = 2 .

lation called a recurrence relation. Stirling numbers obey a similar rule.

Proposition 4.8. Suppose that n > 1 is an integer, and 1 < k < n. Then

Proof. Consider the partitions of {1, . . . , n} into k parts. There are two

types of such partitions: those where n is contained in a block by itself,

and those where it is not. If we have a partition of the first type, we can

construct a partition of {1, . . . , n 1} into k 1 parts by simply deleting n.

This is a one-to-one correspondence between partitions of the first type, and

partitions of {1, . . . , n 1} into k 1 parts. Thus the number of partitions

of the first type is S(n 1, k 1).

Now we consider partitions of the second type, where n is contained

in a block with other element(s). By deleting n, we produce a partition

of {1, . . . , n 1} into k parts. But there are k partitions that would have

produced the same partition of {1, . . . , n 1} after deleting n, because n

might have been contained in any of the k blocks. Therefore the number of

partitions of the second type is kS(n 1, k). The result follows.

Stirling numbers of the second type.

1

1 1

1 3 1

1 7 6 1

1 15 25 10 1

1 31 90 65 15 1

1 63 301 350 140 21 1

31

MATH 261 Enumeration 4. Balls and boxes

the case that balls are distinguishable, but boxes are not. It turns out to be

easier to first look at the case where each box must be non-empty.

distinguishable boxes. The number of dierent ways of distributing the balls

into the boxes so that each box contains at least one ball is

k 1

1 X k

( 1)s (k s)n .

k! k s

s=0

balls and k distinguishable boxes. By Proposition 4.4 the answer is

k 1

X

k

( 1)s (k s)n . (4.2)

k s

s=0

bution with indistinguishable boxes: just imagine removing the labels from

the boxes. How many distinguishable arrangements correspond to each in-

distinguishable arrangement? Starting from a distinguishable distribution,

we could reorder the numbers on the k boxes in any way we like, and the

resulting distribution will correspond to exactly the same indistinguishable

distribution. There are k! ways of numbering the boxes, so every indistin-

guishable distribution has k! distinguishable distributions that correspond

to it. Therefore we can get the number of indistinguishable distributions by

dividing the quantity in (4.2) by k!. This provides us with the answer.

(There is an important subtlety that we have glossed over: we said that

there were k! ways to number the k boxes, and that therefore every indis-

tinguishable distribution has k! dierent distributions that correspond to

it. This is true, but only because the boxes are not empty. If there were

two empty boxes, we could swap the numbers on those boxes, and get two

identical distributions.)

Then

k 1

1 X k

S(n, k) = ( 1)s (k s)n .

k! k s

s=0

32

MATH 261 Enumeration 4. Balls and boxes

where no box is empty, is just the same as a partition of {1, . . . , n} into k

non-empty blocks.

Now we can solve the more general problem, where boxes are allowed to

be empty.

balls into k indistinguishable boxes is

k

X

S(n, 1) + S(n, 2) + + S(n, k) = S(n, i).

i=1

Proof. If no boxes are empty, then there are S(n, k) distributions, by Propo-

sition 4.10. If exactly one box is empty, then k 1 boxes are non-empty, so

there are S(n, k 1) such solutions. We continue in this way, until we see

that there are S(n, 1) = 1 distributions with k 1 boxes empty, and 1 box

not empty. Adding these numbers together gives us the result.

balls-in-boxes.

Earlier, we considered the number of solutions to equations of the form

x1 + + xk = n, where x1 , . . . , xk are constrained to be positive integers.

In this scenario, order matters. Thus, if n = 5 and k = 2, then x1 = 2 and

x2 = 3 is a dierent solution to x1 = 3 and x2 = 2. What if we ignore order?

Then we can put the variables x1 , . . . , xk into any order we like, so we may

as well assume that

x1 x2 xk .

A solution to x1 + + xk = n in which x1 , . . . , xk are positive integers

satisfying x1 x2 xk is known as an integer partition of n with k

parts.

5 + 1 + 1, 4 + 2 + 1, 3 + 3 + 1, and 3 + 2 + 2. }

n. The number of integer partitions of n with k parts is denoted p(n, k).

Numbers of the form p(n, k) are called partition numbers.

33

MATH 261 Enumeration 4. Balls and boxes

p(n, n) = 1.

the partition numbers.

Proposition 4.14. Suppose that n > 1 is an integer, and 1 < k < n. Then

into two sets, according to whether xk = 1 or not. The number of partitions

with xk = 1 is equal to the number of solutions to x1 + + xk 1 = n 1,

where x1 , . . . , xk 1 are positive integers satisfying x1 x2 xk 1 .

This is equal to p(n 1, k 1). Now consider an integer partition with

x1 x2 xk > 1. By subtracting one from each variable xi , we

create a one-to-one correspondence with integer partitions of n k into k

parts. The result follows.

numbers.

1

1 1

1 1 1

1 2 1 1

1 2 2 1 1

1 3 3 2 1 1

1 3 4 3 2 1 1

1 4 5 5 3 2 1 1

Entry number k in row number n is p(n, k). The rows of this triangle

are sequence A008284.

If n is a positive integer, then we define p(n) to be

n

X

p(n, k).

k=1

partition number.

34

MATH 261 Enumeration 4. Balls and boxes

4, 3 + 1, 2 + 2, 2 + 1 + 1, and 1 + 1 + 1 + 1.

Therefore p(4) = 5. }

There is a helpful way to visualize integer partitions. The integer parti-

tion x1 + +xk = n is represented by placing x1 dots in a row. Underneath

this we place x2 dots in a row, and so on. Thus the partition 6 + 3 + 3 + 1

of 13 is represented by

A diagram of this type is called a Ferrers graph, after Norman Macleod

Ferrers (18291903).

Ferrers graphs can make apparently difficult facts about integer parti-

tions quite straightforward to prove. By flipping the Ferrers graph, we can

prove the following result.

Proposition 4.15. The number of integer partitions of n with x1 = k is

equal to p(n, k).

tition numbers, we can finish our tabulation of ball-in-boxes problems. The

answers in this section are not quite as satisfactory as some of the previ-

ous ones, because there is no neat formula which allows us to find partition

numbers.

Proposition 4.16. The number of dierent ways of distributing n indis-

tinguishable balls into k indistinguishable boxes so that each box contains at

least one ball is p(n, k).

Proof. Let xi denote the number of balls in box i. Then each xi is a positive

integer. Since the boxes can be arranged in any order we like, we can assume

that x1 x2 xk . Now there is an obvious one-to-one correspondence

between distributions of balls and integer partitions of n.

Corollary 4.17. The number of dierent ways of distributing n indistin-

guishable balls into k indistinguishable boxes is

k

X

p(n, 1) + p(n, 2) + + p(n, k) = p(n, i).

i=1

35

MATH 261 Enumeration 4. Balls and boxes

Proof. We sum over the number of boxes that are non-empty, and apply

Proposition 4.16.

We can now state a solution to all the variants of the balls in boxes

problem. Each cell in Table 1 contains a reference to the corresponding

result in these notes. Moreover, we have also collected all the solutions

to the subproblem of the balls and boxes problem where all the boxes are

required to contain at least one ball. The solutions to that subproblem are

noted in Table 2.

Balls Balls

distinguishable indistinguishable

Bins n+k 1

kn (4.3) n (4.1)

distinguishable

Bins Pk Pk

indistinguishable i=1 S(n, i) (4.11) i=1 p(n, i) (4.17)

Balls Balls

distinguishable indistinguishable

Bins n 1

k!S(n, k) (4.4),(4.10) k 1 (4.2)

distinguishable

Bins

S(n, k) (4.10) p(n, k) (4.16)

indistinguishable

36

- Ch6 Generating Functions ProblemsUploaded bypja752
- Ramsey yUploaded byNanni Sumarni
- Midterm SolutionsUploaded byshandeva99
- Peter Smith - Teach Yourself Logic 2015; A Study GuideUploaded byaymansousa
- Solution2_1_17Uploaded byArsy
- 07. Closet - An Efficient Algorithm for Mining FrequentUploaded byapi-19799369
- Mathematical-Morphology-40-Years-On-Proceedings-of-the-7th-International-Symposium-on-Mathematical-Morphology-April-18-20-2005Uploaded bycenkj
- Logic and Critical ThinkingUploaded byUmair Nisar
- On α-ρ-Continuity Where ρ ϵ {L, M, R, S}Uploaded byIOSRjournal
- How to write a Proof!!!Uploaded byap021
- 553Mathematics-12Uploaded bySaanvi Triphati
- A New S-(a,d) Antimagic Labelling of a Class of Generalized Petersen GraphsUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Distribution ProblemsUploaded bySwapnil Joshi
- SortingUploaded byDilip Kumar
- Sets Relations FunctionsUploaded byMutt3012
- Advanced SearchUploaded byShohihul Maksud
- 07 Shortest Path AlgorithmsUploaded byahm
- mf-param-oper2Uploaded bypankajbhatti1
- Design RepresentationUploaded byjiten_161
- 1A Functions Q No 18Uploaded bySalmanAnjans
- LllUploaded bylloydmuya
- textbook 2 5Uploaded byapi-293865618
- EC304Uploaded byapi-3853441
- Fuzzy LogicUploaded byCybergeek Varun
- 9.TransportationUploaded byNeeraj Tripathi
- Digital electronicsUploaded bySumathy Subramanian
- CA PresUploaded bySadia Awan
- TowersHanoiUploaded byAlfonso Mérida García
- projectreport.docUploaded byMayank Mehta
- dfasUploaded byNandita Gupta

- Acer India Private LimitedUploaded byAjitesh Abhishek
- Acer India Private LimitedUploaded byAjitesh Abhishek
- Ingram Micro India LimitedUploaded byAjitesh Abhishek
- Charles Schwab CorporationUploaded byAjitesh Abhishek
- firebase-implementation-sheet_v2.xlsxUploaded byAjitesh Abhishek
- Delta Model business StrategyUploaded byAjitesh Abhishek
- Analyst Reports 2Uploaded byAjitesh Abhishek
- MockUploaded byAjitesh Abhishek
- B2B Marketing 1-1 1-Few and 1 to ManyUploaded byAjitesh Abhishek
- Tones_and_Styles_AparnaUploaded byapi-3854593
- MS Excel ShortcutsUploaded byTanmay Amodekar
- Thinking StrategicallyUploaded byAjitesh Abhishek
- Ron Purewal Sc Mgmat TipsUploaded byTin Phan
- GMAT-Practice-Grid.xlsUploaded byAjitesh Abhishek
- PDF for Foundations of GMAT GrammarUploaded byTanzyy.2018
- Award CriteriaUploaded byAjitesh Abhishek
- rep_version1.docxUploaded byAjitesh Abhishek
- Albedo_atmosphereUploaded byAjitesh Abhishek
- Copy of EndowmentsUploaded byAjitesh Abhishek
- CHL471-TuteSheet03.pdfUploaded byAjitesh Abhishek
- FDI in Indian Retail Sector Analysis of Competition in Agri-Food SectorUploaded byTimur Rastomanoff
- term paperUploaded byAjitesh Abhishek
- Media & Communications Ntwg ReportUploaded byAjitesh Abhishek
- Media & Communications Ntwg ReportUploaded byAjitesh Abhishek
- Media & Communications Ntwg ReportUploaded byAjitesh Abhishek
- Project Scheduling with limited resourcesUploaded byAjitesh Abhishek
- ProjectManagementUploaded byAjitesh Abhishek
- learn Book5Uploaded byAjitesh Abhishek
- How to write Minutes of MeetingUploaded byAjitesh Abhishek

- Gradient and Directional Derivative ExampleUploaded byRobert
- Order of OperationsUploaded byKris Ann Tacluyan
- Modified.cholesky.decompositionUploaded byPino Bacada
- Quantum MechanicsUploaded byRastko Vukovic
- Three Dimensional Geometry AssignmentUploaded bysheetal
- LimitsUploaded byVishalRaman
- Chapter 2 QuadricsUploaded byLeonardo Amorim Silva
- Taylor Further Math A2Trial P3 QP September 2012Uploaded byChung Chee Yuen
- צפינה- מצגת 3 | Intro Finite FieldsUploaded byRon
- 9ABS301 Mathematics - IIUploaded bysivabharathamurthy
- act testUploaded byapi-235149986
- oleson instructions project matlabUploaded byapi-273162418
- math 9 study guide final examUploaded byapi-283427523
- Am or Us Op a Per 1Uploaded bynmf77
- 3 phase load flow 2Uploaded bySajith Rp
- HW #2Uploaded bysshanbhag
- UOL Statistic 2 Exam Commentary Zone AUploaded byBoon Kiat Teh
- MATH204_4_10Uploaded byandrewaoun7687
- Definite Matrices 13Uploaded byjuangasa
- EAS 2.6 SampleUploaded byJoão Medeiros Melo
- EM-Quiz12Uploaded bySingh Karan
- Self-study Textbook Algebra Ch1Uploaded byTO Chau
- TI CASUploaded byMary Dunham
- 1203.4558Uploaded byCarlos Mostachú Reivaj Perez
- Maths - Number SystemUploaded byabhishek123456
- Matlab Test 1Uploaded byMichael Gboneh
- field theory Vector AlgebraUploaded byleon619
- Advan Half Pap 2 SolutionUploaded byDeepa Lakshmi
- Iitjee Notes by Dipesh Sir Straight LineUploaded byKakakaun
- Simultaneity as an Invariant Equivalence Relation 1202.6578Uploaded byforizsl