P&C

© All Rights Reserved

25 views

P&C

© All Rights Reserved

- 9781909287723 Topics in Programming Languages:A Philosophical Analysis Through the Case of Prolog
- Sample Set Theory Midterm
- Theorem on the Circle
- Macro
- all about being a math major
- Lines Midpoint
- tailer
- NI FOL Into Df3 Proof
- Fund Phy Los
- Venn Diagram
- Slide02 2 Functions
- Saharon Shelah- Colouring and Non-Productivity of ℵ2-C.C.
- prm ex 2
- Agazzi, Rise of the Foundational Research Studies in Mathematics
- Chap 9 Extra
- System
- postfix infix 2
- Informe Punto Parcial 2 SS
- 2006 Spring Notes
- Inequalities & Graphing

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

- 9781909287723 Topics in Programming Languages:A Philosophical Analysis Through the Case of PrologUploaded byChartridge Books Oxford
- Sample Set Theory MidtermUploaded byfradleybox
- Theorem on the CircleUploaded byNganku Junior
- MacroUploaded byFredVoria
- all about being a math majorUploaded byapi-308417892
- Lines MidpointUploaded byniharranjanroy
- tailerUploaded byNitin Grover
- NI FOL Into Df3 ProofUploaded byJanossyA
- Venn DiagramUploaded byGeevee Naganag Ventula
- Fund Phy LosUploaded byCharlie
- Slide02 2 FunctionsUploaded byKenneth Marie Belandres Quilaton
- Saharon Shelah- Colouring and Non-Productivity of ℵ2-C.C.Uploaded byJgfm2
- prm ex 2Uploaded bysenthilvl
- Agazzi, Rise of the Foundational Research Studies in MathematicsUploaded bygzalzalkovia
- Chap 9 ExtraUploaded byDonovan Leong 도노반
- SystemUploaded byjsn75
- postfix infix 2Uploaded byInilah Isi Batinku
- Informe Punto Parcial 2 SSUploaded bySofia Charry Alvernia
- 2006 Spring NotesUploaded byRaekpacman
- Inequalities & GraphingUploaded byDaisyListening
- Comprehensive CV of Amarnath Murthy as on 01-01-2014Uploaded byAmarnath Murthy
- POTWE-13-CP-03-SUploaded byscribd-in-action
- Java_CodeUploaded bypatrijk
- Pga MoHinh 4 v12 (Repaired)Uploaded bylnxt_smt
- Math E104 Syllabus Fall 2008 heyUploaded byPreyanshMitharwal
- 04 Cetking Functions BasicsUploaded byPrateek Gupta
- Set Relations Functions 2009 MalestromUploaded byKhmer Cham
- latihan statistikaUploaded bynurmaya putri ira
- Array1Uploaded byidaayu17
- q3 exam - originalUploaded byapi-456913177

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

- Story of TrigonometryUploaded byAkshat Jain
- 1-s2.0-S1877705813013313-mainUploaded byadelmin
- 6.3 Transfer FuncUploaded bydev1712
- 4024_w11_qp_22Uploaded byHamza Nawaz
- Cookbook MatrixUploaded byVanêzä Souza
- Modified Approach of Hough Transform for Skew Detection and Correction in Documented ImagesUploaded byWhite Globe Publications (IJORCS)
- Physical System ResponseUploaded bymuhammadjati_yh
- MST121 HandbookUploaded byJon Wilkes
- An Interactive Introduction to Mathematical Analysis-J.lewineUploaded byZerina Dragnic
- AverageUploaded bysyedkhawarraza
- geo & menUploaded byshashank1511
- 3290346-Geometry-Skill-BuildersUploaded bythouartu
- Double Integration SMATUploaded byAndrew Jose
- Calulus Course-Important StuffUploaded bySuneth Kelum
- Genetic and Fuzzy SystemsUploaded byVictoria Lambert
- ECE 495N Lecture 8 - Schrodinger Equation and Finite DifferenceUploaded byTheodore Chandra
- 275443640-Signals-and-Systems-Lab-Manual-Print.pdfUploaded byTejhas Kapoor
- Shear Flow ExampleUploaded byHaliunaa Batbold
- BS in Marine Engineering in the PhilippinesUploaded byBi8ikity
- MIT OpenCourseWare Http://Ocw.mit.EduUploaded bysparsh
- emUploaded byMSUIIT
- the fractal dimension of architectureUploaded byinfo_is_free
- Turing's Vision_ The Birth of Computer Sci - Chris Bernhardt.pdfUploaded byIvan Mrkvc
- Normal Distribution -- From Wolfram MathWorldUploaded byAdam Tomlinson
- discoverersbrochureUploaded byapi-292900873
- MITSG_12-25_2018Uploaded byAlexNeumann
- 01 (1).pptUploaded byPraveen Raj
- diff2Uploaded byMarko Markovic
- Residual VectorsUploaded byBrian Spencer
- ipg -rational numbersUploaded byapi-238866940