Example 1

Suppose we have labelled balls (i.e., they are labelled with the integers ), and labelled boxes (i.e. they are labelled with the integers ) How many different ways are there to distribute the balls in the boxes, if every ball has to go in a box, and every box can hold arbitrarily many balls?
The answer to this problem is . For the first of the balls, there are choices for where to put the ball. For the second ball, there are again choices. If we repeat this for each of the balls, we will find that each ball has a choice of boxes. Therefore, the total amount of ways to arrange the balls is , times ().

Like before, suppose we have labelled balls and labelled boxes, with the new conditions that and that each of the boxes has a capacity . How many ways are there to distribute the balls into the boxes?

definition factorial

Let be a positive integer. We define the factorial of , denoted , to be the product of positive integers at most . That is,
We also define

How many ways are there to choose 3 distinct objects out of a total of 10?

proposition

Let be a positive integer, and let be a nonnegative integer. The number of ways to distribute unlabelled balls into labelled boxes is

definition n choose k

Let be positive integers. We define n choose k, written , to be the quantity . The value is also called a “binomial coefficient.”

Notes on :

  • We can write out all the binomial coefficients using “Pascal’s Triangle”

proposition


There are 2 ways to prove this:

Now consider that you are allowed to choose any number of objects—i.e. distribute 10 labelled balls into 2 labelled boxes with arbitrary capacity: “chosen” and “not chosen.” There is another way to present this—there are 10 unlabelled balls, and there are 11 labelled boxes—one for each of the balls (each with capacity 1), and one “not chosen” box (with capacity ). We have already shown that for labelled balls and labelled boxes with arbitrary capacity, the answer is —in this case, the answer is (Note that one of these options is to choose none of the balls).

We can also answer this in a different way—it is the number of 0 ball choices (), plus the number of 1 ball choices () plus the number of 2 ball choices () and so on. From this, we can derive a formula:

theorem Binomial Theorem

Let be a positive integer. Then:

Example

proposition

Suppose we have labelled boxes, and balls— labelled with colour , labelled with colour , and so on up to labelled with colour , where. Then the number of distinct ways to distribute the balls among the boxes is

We give this quantity a symbol in analogy with binomial coefficients: , and call it a multinomial coefficient:

theorem Multinomial Theorem

Let be a positive integer. Then

Recall that if and are sets, a function assigns a single element of to each element of . There are some important classes of functions:

definition Injective

A function is injective or one-to-one if it takes each value at most once. That is, we never have for
It is only possible to have such a function if has at most as many elements as , i.e

definition Surjective

A function is surjective or onto if it takes each value at least once—i.e. if every is equal to for some .
It is only possible to have such a function if has at least as many elements as , i.e.

definition Bijective

A function that is both injective and surjective is called bijective.
It is only possible to have such a function if .

Note

A function is bijective if and only if it has an inverse—A function is bijective if and only if there exists a function such that , and , where and are the identity functions.

Example

Here is a bijection from to :

Notation

For brevity, we will denote and as and respectively. Note that 0 is not included, and is the empty set

We have counted functions (there are of them), as well as injective functions (, assuming , and 0 otherwise), and bijective functions ( assuming , otherwise 0). What about surjective functions?

Surjective functions are harder to count. Let’s define to be the number.

Example

Let and . We could put 3 balls in one box and 1 ball in another (8 ways), or we could put 2 balls in each box (6 ways).

Example

250 students are taking Combinatorics, and 350 students are taking Algebra. How many students are taking at least one of the 2? The answer could be anywhere from 250 (every Combinatorics student also takes algebra) to 600 (no student takes both). To get the right answer, we need to subtract the number of students taking both to avoid double-counting them:

Now what about ? Concretely:
Suppose 250 students are taking Combinatorics, 300 are taking Analysis, and 250 are taking Algebra. How many students in total are taking at least one of the three? To count, we could add , but clearly we have overcounted, as some students will have been counted more than once.

How much did we overcount by? Suppose 140 students do both Combinatorics and Algebra, 225 students do both Algebra and Analysis, and 175 students do both Analysis and Combinatorics. Furthermore, suppose 125 students are taking all 3 modules. So we have counted 125 students 3 times, and students twice. Overall, we have overcounted by , so the total number of students is .

theorem inclusion-Exclusion Theorem

Let be sets. Then

Back to the problem of counting surjections . We have discovered it may be easier to count functions that are not surjections, but how can we break up this set as much as possible?

How can a function fail to be surjective? It must miss some element —so the set of non-surjective functions is precisely the union, over , of functions that miss .

Define to be the set of functions missing . Now lets try to apply inclusion-exclusion. is the set of functions , so .

We also need to calculate . is the set of functions , so

We can calculate any term of the inclusion exclusion formula: . So the number of non-surjections is

Subtracting this from the total number of functions gives :

We can simplify this formula (to remove having to sum over a very large set) by grouping terms with the same size , as follows:



To check, let’s use the example from before:

We can also see that if and , then

Using and the substitution gives

What if we count surjections, but with unlabelled boxes. This can be interpreted as counting the ways of dividing into nonempty pieces. These numbers are called the Stirling numbers of the second kind. If we think this through carefully, each surjection gets counted exactly times, giving the formula:

Similarly to the binomial coefficients, we can make observations by writing the Stirling numbers out in a triangle

proposition

Notes

If we allowed empty parts, we would be partitioning into at most parts, which would form a summation.

Notation

For , define the Bell numbers . That is, is the number of ways to partition into any number of parts.
The first few Bell numbers are

proposition

If we have unlabelled balls, and labelled boxes (of arbitrary capacity), how many ways can we distribute the balls?

Example

Let and . The ways to arrange the balls are:
3 | 0 | 0 2 | 1 | 0 2 | 0 | 1 1 | 2 | 0 1 | 1 | 1
1 | 0 | 2 0 | 3 | 0 0 | 2 | 1 0 | 1 | 2 0 | 0 | 3

Which is the same as

Note that we get a recursion

This example can be redrawn as follows:
* * *|| |*| ||* *|**| *|*|*|
*|| |*| ||* |*| ||***

They are sequences of 5 symbols, with 2 bars and 3 stars. That is, choose 3 stars out of 5 slots.

proposition

There are ways to distribute the balls.

definition Ordinary and Exponential Generating Functions

Let be a sequence of numbers. The formal power series

is called the ordinary generating function of , and the formal power series

is called the exponential generating function of
Where “formal” means we haven’t checked whether the power series has a nonzero radius of convergence.

Example

Let denote the th Fibonacci number, defined by and for .
The generating function for the Fibonacci numbers is as follows:

Note what happens when is multiplied by and .


Using the recursion we see that . We can solve for to get .

Note: I am so confused what the fuck is this shit

Let be positive integers. How many ways are there to divide unlabelled balls into unlabelled boxes so that each box gets a ball? Now all that matters is the number of balls in each box. This is the number of ways to write the integer as a sum of positive integers (without caring about the order). We call this number .

Example

There are 8 partitions of 10 into 3 parts:

If we allow any number of boxes, we get , the number of partitions of .

Example

There are 7 partitions of 5:

There are no good formulas for or

definition Conjugate Partition

Let be a partition of . The conjugate partition of is the partition corresponding to the reflection of the Ferrers diagram of over the diagonal

Example is conjugate to . is conjugate to itself

proposition

The number of partitions of into at most parts is equal to the number of partitions of into parts of size at most

proposition

The number of partitions of into distinct off parts is equal to the number of self-conjugate partitions of

proposition The number of partitions of into odd parts is equal to the number of partitions of into distinct parts

definition Triangulation

A triangulation of a regular -gon is a collection of non-crossing diagonals that divide the -gon into triangles.

definition Catalan Number

The th Catalan number is the number of triangulations of a regular -gon.

definition Balanced Sequence

A balanced sequence of opening and closing parenthesis is a sequence such that every close-parenthesis has a matching open-parenthesis