Академический Документы
Профессиональный Документы
Культура Документы
Math 239
University of Waterloo
Spring 2017
Contents
1 Lecture 1: Intro 3
1.1 Important Syllabus Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 First 5 weeks - Enumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Second Part of the Course: Graph Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Last 10min Sutff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Lecture 2 4
2.1 Set Theory Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.1 Set Builder Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.2 Basic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 More Stuff Now . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2.1 Cartesian Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2.2 Binomial Coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Lecture 3 6
3.1 Announcements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 Last Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.3 First Example of a Combinatorial Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.4 Bijections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.4.1 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 Lecture 4 7
4.1 More Stuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.2 Generating Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.2.1 General Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
5 Lecture 5 9
5.1 Last Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5.2 More Stuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5.3 More Stuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.4 Coefficient Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.5 Formal Power Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
6 Lecture 6 11
6.1 Formal Power Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6.2 Multiplying FPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6.3 Justification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
7 Lecture 7 12
7.1 More Binomial Theorem Stuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
7.2 Sum and Product Lemmas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
8 Lecture 8 14
8.1 More About the Product Lemma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
8.1.1 An Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
8.2 Study Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
8.3 Compositions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
9 Lecture 9 15
9.1 Last Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
9.2 Some example of something . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
9.3 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1
10 Lecture 10 17
10.1 How to Solve Generating Series Problems (in 10 steps) . . . . . . . . . . . . . . . . . . . . . . 17
10.2 Binary Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
10.2.1 String Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
10.2.2 Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
10.2.3 Ambiguous vs Unambiguous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
11 Lecture 11 19
11.1 Set Stuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
11.2 * operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
11.3 A Note on Brackets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
11.4 Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
11.5 Generating Series for Sets of Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
12 Lecture 12 20
12.1 Finite String Lemma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
12.2 Standard Decompositions of Binary Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
12.3 Block Decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
13 Lecture 13 21
13.1 Chapter 3 - Coefficients of Rational Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
14 Lecture 14 23
14.1 Recurrence Relation and Initial Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
14.2 Another Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
14.3 A Third Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
15 Lecture 15 24
15.1 Things You Can Do to Get Coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
15.2 Solution to the Crazy Dice Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
16 Lecture 16 27
17 Lecture 17 27
17.1 Some Graph Stuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
17.2 Bipartite Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
18 Lecture 18 27
18.1 Paths and Walks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
19 Lecture 20 28
20 Lecture 24 28
21 Lecture 26 28
2
1 Lecture 1: Intro
The prof has green hair, and that’s pretty cool.
He says that this is a ”less serious” course - a fun introduction to combinatorics. That sounds like low
effort. dope.
Also, proofs in the second half are apparently a thing.
In the sixth week of classes, there will be a quiz in tutorials. Make sure you go to the sixth one!
Tutorials are for summary/recap and problems - not mandatory except for sixth week.
The point is that you didn’t count them one-by-one - instead, you multiplied three rows by four columns
to count. It’s a better method of counting, especially as the number of sheep gets bigger.
You have a regular icosahedron (20 sides, all the same) and three colours of paint. You want to paint
the icosahedron, not necessarily different colours or anything. How many ways can you paint it? The
thing that makes this interesting is that there isn’t any ordering to the sides, i.e. red on top and yellow
everywhere else is the same as red on the bottom and yellow elsewhere is the same as red on the side and
yellow elsewhere because of symmetry (you could rotate the thing and have it be the same).
The start of this course is all about one thing: generating functions. These are next-level counting tools.
The had part is putting problems in the right form for the tool to act on.
Another cool thing (but not one of the main things) you can do with generating functions is called the
crazy dice problem. Imagine you have two six-sided regular dice, and you roll them, and you’ll get two
outputs, and add them to a number between 2 and 12. You can analyze probabilites, and figure out what
the most likely number to get is. One way to do this (a simple way) is to just draw a table, with one die
3
on each axis. There are 36 outcomes, not all unique, so you can total them together into distinct outputs.
For example, there’s only one way to roll a 2, so it’s probability is 1/36. You’ll find out that a 7 is the most
likely number, with 6/36 (1/6) odds.
That, however is just a regular dice problem. What we’re interested in is the crazy dice problem, which
adds a variation: Is it possible to put different numbers on the dice, and have the same probability table
(i.e. the probability of rolling a 2 is still 1/36, 7 is still 6/36, etc.)? Also, to avoid trivial solutions, we have
to add the restriction that all numbers on the dice must be at least =1.
The Google problem uses Burnside’s Lemma, which we won’t learn about.
Example: how many ways are there to put the elements of 1, 2, ..., n in an ordered list of length n with
no repeats? If n=3, we are counting the elements in the set of lists 1, 2, 3, 1, 3, 2, 2, 3, 1, 2, 1, 3, 3, 1, 2, and
3, 2, 1. Thus, the answer is 6 for n=3, and the general answer is n! for n ¿ 0. For n=0, it’s important to
realize that the basic operation is multiplication, and by convention, multiplication with 0 inputs (and thus
0!) is defined to be 1.
2 Lecture 2
2.1 Set Theory Review
A set is a collection of (usually) mathematical objects. Fundamentally, all we are about is: is some
element in the set? (a ∈ A ?).
Important: ∈ and ⊆ are not interchangeable (because apparently that’s a common error).
1, 2, 3 ∈
/ 1, 2, 3, 4. 1, 2, 3 ⊂ 1, 2, 3, 4.
Example:
4
2.1.2 Basic Operations
Union:
A ∪ B = {a|a ∈ A ∨ a ∈ B}
Intersection:
A ∩ B = {a|a ∈ A ∧ a ∈ B}
Disjoint Union:
A∪B =∅
Number of Elements:
Cartesian Product:
A × B = {(a, b)|a ∈ A, b ∈ B}
Answer: Let A be the set of outcomes from the first die. Let B be the set of outcomes from the second
die. Then, the set of all possible outcomes must be A × B. |A| = 6 and |B| = 6, so |A × B| = 6 · 6 = 36.
The point of this example is that we took a problem, and reframed it as finding the cardinality of a set.
We also made an assumption to solve this problem (other than that the dice are six-sided): what different
means. For example, is rolling (1, 2) different than rolling (2, 1)? In other words, are the dice distinguishable?
If the dice are distinguishable, the answer is 36. If the dice are indistinguishable, the answer is 21.
A0 6= ∅
A0 = {()}
A0 is a set with a single element, and that element is called the empty list, denoted ().
5
2.2.2 Binomial Coefficients
One thing that you might want to count are subsets. Example:
Subsets of {1, 2, 3}. There are 8 sets, as each element can either be in or out of the set, and there are
two elements, so 2 · 2 · 2 = 23 = 8. Its subsets are:
3 Lecture 3
3.1 Announcements
Office hours: Fri. 10:45-12:15, Monday 3-4, MC 5122 (or by appointment)
Assignment 1 will be posted on Learn later today and on Crowdmark by Wednesday. It’s due Tues, May
16.
We will prove:
n n(n − 1)(n − 2)...(n − k + 1)
=
k k!
Let S of [sic] ordered lists of length k, of distinct elements from 1, ..., n. We will count the elements in
two ways.
6
In total: |S| = n(n − 1)(n − 2)...(n − k + 1) ways.
Second way:
n
• Choose a k-element subset of 1, ..., n ( k ways)
• Choose a first element from the subset to be the first elemtn of the list (k ways)
• Choose a second (k − 1 ways)
|S| = nk k(k − 1)(k − 2)...(2)(1)
3.4 Bijections
3.4.1 Functions
Consist of three parts:
1. Domain (Set)
2. Codomain (Another set)
3. Rule (Maps domain to codomain)
f (x) = x2 is not a function. It is a rule. To make this a function, you must add a domain and codomain.
So, f : R− > R, f (x) = x2 . The range is a subset of the codomain which represents all actually achievable
outputs.
Bijections are one-to-one and onto, and imply that the two spaces they map between must have the same
number of elements.
4 Lecture 4
First, we gonna do one more example of the concept of combinatorial proofs.
Soln :
So, either we want to count this thing in two different ways, or define a bijection. First, we need to
introduce a set of objects that this expression counts.
e.g. S0 = {1, 2, ..., n}, S1 = {{1, 2, ..., n − 1, n + 1}, {1, 2, .., n − 2, n, n + 1}, ...}
7
S = S0 ∪ S1 ∪ ... ∪ Sk
Why? To specify a n-element subset of {1, ..., n + k} with largest element = (n + i), put n + i in the set
and choose n − 1 other elements from {1, 2, ..., n + i − 1} to go in the set.
X n + i − 1
|S| = k
i=0
n−1
Si ∩ Sj = ∅ ∀i 6= j (1)
Given such a setup, the generating series for S (with respect to w can be defined as:
X
ΦS (x) = xw(σ) (3)
σ∈S
8
Example: Suppose S is the set of binary strings of length 4 and w : S → N is the weight function:
w(σ) = number of 1s inσ.
5 Lecture 5
Assignment 1 is now on Crowdmark.
ΦS (x) = (1 + x)4
9
5.3 More Stuff
How many elements is S? We can get this from ΦS (1).
S = {(the empty string with length 0), 0, 1, 00, 11, 01, 10, ...}
Now, let’s define the weight function w : S → N as w(σ) = length ofσ.
The set is infinite, so we can’t make a table. We can, however, get the generating function by solving
the counting problem. The answer to the question is 2n , so the generating function is:
X
ΣS (x) = 2 n xn
n≥0
Example:
m
X m k X m k
(1 + x)m = x = x
k k
k=0 k≥0
m
[xn ](1 + x)m =
n
which was the point of this example.
X
A(x) = an xn
n≥0
Example: is it correct?
10
1 − x2
=1+x
1−x
The Formal Interpretation says yes, because it only uses algebra to check.
The Analytic Interpretation says no, because plugging in x = 1 gives an undefined number.
6 Lecture 6
6.1 Formal Power Series
We will only do algebra, never plug in numbers.
Short answer:
• taking limits
X X X
( an xn ) + ( bn x n ) = (an + bn )xn
n≥0 n≥0 n≥0
e.g.
X X 1
( nxn ) + ( xn+1 )
n+1
n≥0 n≥0
X X 1
= (0x0 + mxm ) + ( xm )
m
m≥1 m≥1
X 1 m
= (m + )x
m
m≥1
X n
X
= ( ak bn−k )xn
n≥0 k=0
By multiplying out and inspecting. To use the sigma notation tricks, however:
11
X X
( an xn )( bn xn )
n≥0 n≥0
We need to change one of the dummy variables so that they are distinct:
X X
( ak xk )( bl xl )
k≥0 l≥0
Because one sum does not use the dummy variable of the other, one can be put inside the other:
XX XX
( ak xk )bl xl = bl xl ak xk
l≥0 k≥0 l≥0 k≥0
XX
= ak bl xk+l
l≥0 k≥0
n
XX
= ak bn−k xn
n≥0 k=0
6.3 Justification
How do we justify:
X 1
2 n xn =
1 − 2x
n≥0
1
We write A(X) = B(x)
Let’s do it.
7 Lecture 7
Assignment 1 is due tomorrow!
1.
n
X n k n−k
n
(x + y) = x y ,n ∈ N
k
k=0
2.
X n
(1 + x)h = xk
k
k≥0
3.
X n + k − 1
(1 − x)−n = xk
k
k≥0
Example: Compute:
[xn (2 + x2 + x3 )m
12
Solution:
X m
2 3 m m 2 3 m m
∗(2 + x + x ) = 2 (1 + 0.5(x + x )) =2 (0.5(x2 + x3 ))k
k
k≥0
X m X m X k
m 2 k k m −k 2k
=2 (0.5x ) (1 + x) = 2 2 x xj
k k j
k≥0 k≥0 j≥0
XX m k 2k+j X X m−k m k
= 2m−k x = 2 xn
k j k n − 2k
k≥0 j≥0 n≥0 k
b0.5n???c
n 2 3 n
X
m−k m k
= x (2 + x + x ) = 2
k n − 2k
k=0
Then:
Product Lemma:
Let A be a set with weight function α, and B be a aset with weight function β. Let S = A × B, and
defined weight function.
Then:
Key condition: the weight of a composite configuration must be the sum of the weights of its compo-
nents.
Example: you have 5 loonies & 4 toonies. How many ways to make $9? $10?
Solution:
Let S be the set of all combinations we can make with 5 loonies and 4 toonies.
13
8 Lecture 8
8.1 More About the Product Lemma
Let A and B be sets of configurations.
Let α be a weight function on A, and β be a wave function on B.
Let S = A × B
8.1.1 An Example
You have 5 loonies and 4 toonies. I have 8 loonies and 3 toonies. How many ways can we make $20
together?
Solution:
Let S be the set of all combinations of loonies and toonies we can produce together.
Let L1 be the set of ways you can contribute loonies. Let T1 be the set of ways you can contribute toonies.
Let L2 be the set of ways I can contribute loonies. Let T2 be the set of ways I can contribute toonies.
S = L1 × T1 × L2 × T2
This means that, to specify an element of S, we need to specify an element of each of L1 , L2 , T1 , andT2 .
The condition on the weights is satisfied, so we can use the product lemma.
8.3 Compositions
Definition: A composition of n with k (called the number of parts) parts is a sequence (c1 , ..., ck of positive
integers (called the parts) such that:
14
k
X
ca = n
a=0
The first question we will ask is: how many compositions of n with k parts?
Define the weight of the composition (c1 , ..., ck ) to be ω((c1 , ..., ck )) = c1 + ... + ck .
With this, the number of elements in S with weight n is the answer to our question. (this is a remark,
not part of the answer).
Then:
9 Lecture 9
Assignment 3 is on Learn later today (... fuck).
Remember, next Tuesday is a Monday.
Solution:
15
9.2 Some example of something
x
ΦS (x) = ( ))k
1−x
Answer is:
x
[xn ]Φs (x) = [xn ]( ))k = [xn ]xk (1 − x)k = [xn−k ](1 − x)k
1−x
Then continue with some more stuff.
9.3 Notes
• There are a variety of ways to ask the same question
For example: How many positive integer solutions to the eq. x1 + x2 + ... + xk = n?
• We can ask a variety of related questions by putting different restrictions on the parts of the
composition and/or the number of parts
Example:
Determine the number of compositions of n with k parts (k ≥ 1), where the first part is odd and all
other parts are ≥ 2.
Set of configurations: S = set of compositions with k parts such that the first part is odd and the
subsequent parts are at least 2.
x
ΦNodd (x) = x + x3 + ... =
1 − x2
x2
ΦN≥2 (x) = x2 + x3 + ... =
1−x
Then use product lemma and multiply them together.
16
10 Lecture 10
10.1 How to Solve Generating Series Problems (in 10 steps)
Note: these steps will not always come in exactly this order (although they usually do)
Extra step 0: do you really need generating series to solve this problem?
If no, then skip the next 10 steps and just answer the question.
1. Identify the parameters in the problem, as well as any constants to be treated as parameters
In our example, we can remove n, and just look at compositions with k parts.
3. Give a mathematical description of the set S, in terms of unions and Cartesian products based on
simpler sets (A1 , A2 , etc.)
4. Reintroduce the missing parameter as the weight function, so that the problem can be stated as “How
many elements of S with weight n?”
6. Check that weight functions behave correctly for the product lemma
7. Compute the generating series ΦA1 (x), ΦA2 (x), ... (usually by first principles)
8. Use the description in step 3 and the product & sum lemmas to get the generating series for S
17
10.2.1 String Theory
• Concatenation of Strings
If a, b are binary strings, then ab is the string whose digits are the digits of a followed by the
digits of b.
e.g. a = 0110, b = 11010, ab = 011011010, aa = 01100110
Define:
AB = ab|a ∈ A, b ∈ B
e.g. A = {1, 01}, B = {1, 10}
AB is unambiguous, because all elements are different. BA, however, would be ambiguous, as
101 would appear twice.
Note: a = a = a
10.2.2 Blocks
0011111000000001011111110
This string has 7 blocks:
00|11111|00000000|1|0|1111111|0
A block is defined as: a maximal non-empty substring using only one digit.
Recall: AB = {ab|a ∈ A, b ∈ B}
A × B = {(a, b)|a ∈ A, b ∈ B}
They differ by only a comma. However, if we compare the Cartesian product of A and B to
the concatenation product, the Cartesian product removes the ambiguity with 101. So, we can
define ambiguity as - do the Cartesian product and the concatenation product match up (have
the same number of elements)?
18
11 Lecture 11
Assignment 2 is now on Crowdmark.
For more complex expressions built out of ∪ and concatenation, we say that the expression is unambigu-
ous iff each individual operation is unambiguous.
11.2 * operation
If A is a set of strings:
Examples:
{0}{0}∗ = {0, 00, 000, 0000, ...} = all possible blocks of zeros
• finite sets
• finite unions
• finite concatenation
• the * operator
19
11.5 Generating Series for Sets of Strings
If A and B are sets of strings and A ∪ B is unambiguous, then:
12 Lecture 12
Assignment 4 has been posted on learn, but it doesn’t matter, because I still need to finish Assignment
3.
Quiz (midterm) is on June 9 and covers assignments 1-4. Seating will be on Odyssey.
In summary:
Example: determine the number of binary strings of length n, in which every 0 is followed by exactly 1,
2, or 3 1s.
Solution:
We saw that the set of binary strings of this type is S = {1} ∗ ({0}{1, 11, 111})∗
1 1
= ·
1 − Φ{1} (x) 1 − Φ({0}{1,11,111}) (x)
1 1
= ·
1 − x 1 − Φ{0} (x)Φ{1,11,111} (x)
20
1 1 1
= · =
1 − x 1 − (x)(x + x2 + x3 ) (1 − x)(x + x2 + x3 )
1
Answer: [xn ] (1−x)(x+x 2 +x3 )
This essentially says, every so often we have a zero, and between each two zeros there are some num-
ber of 1s. We can also write the same thing, but with the numbers flipped. That’s called the 1-decomposition.
We can replace any part of the 0-decomposition with a subset of that part, and it remains unambiguous.
That’s why that thing from before was unambiguous. This is a pretty common type of argument, apparently.
Determine the number of binary strings of length n in which all blocks are odd-length.
Solution: Let S be the set of all binary strings in which all blocks are odd.
13 Lecture 13
Nishad is teaching us today.
f (x)
[xn ]
g(x)
21
where f (x) and g(x) are polynomials.
Remark: if the degree of f is ≥ the degree of g, then f (x) = q(x)g(x) + r(x) for some uniquely deteer-
mined qandr (the quotient and remainder polynomials), such that the degree of r is less than the degree of g.
So:
q(x) = x2 − 1, r(x) = 1 − 5x
Now we have:
1 − 5x 1 − 5x
[xn ](x2 + 1) + [xn ] = [xn ](x2 + 1) + [xn ]
1 − 5x + 6x2 (1 − 2x)(1 − 3x)
By partial fraction expansion,
1 − 5x A B
= +
(1 − 2x)(1 − 3x) 1 − 2x 1 − 3x
So:
3 −2
[xn ](x2 + 1) +
+
1 − 2x 1 − 3x
Apply the geometric series formula to the second two terms:
f (x) c1 c2 ck
= + + ... +
g(x) 1 − a1 x 1 − a2 x 1 − ak x
22
However, (1 − ax)−1 = 1 + ax + a2 x2 + ...
So:
f (x)
[xn ] = c1 an1 + c2 an2 + ... + ck ank
g(x)
Example 2: what if the roots aren’t all distinct?
2
−4x+6
Find [xn ] x2x
3 −x2 −x−1
A B C
+ +
x + 1 1 − x (1 − x)2
Which becomes:
3 1 2 X X X
+ + 2
=3 (−x)i + xj + (m + 1)xm
x + 1 1 − x (1 − x)
i≥0 j≥0 m≥0
The last term (with the m) is obtained from the negative binomial expansion thing.
14 Lecture 14
Assignment 4 is now on Crowdmark. Solutions to assignment 3 and some of the extra problem sets have
been posted on Learn.
23
From this, we build the recurrence relation:
an − 5an−1 + 6an−2 = 0 ∀n ≥ 5
The recurrence relation comes from the thing on the side of the multiplication table.
15 Lecture 15
Assignment 5 is posted on Learn (fuck).
Quiz next Friday in tutorial, seating via Odyssey, material from assignments 2-4.
Theorem: Suppose
24
X p(x)
ai x∗ =
q(x)
i≥0
k
X
an = − qj an−j
j=1
This was obtained by moving the first equation all to one side and swapping out as for xs.
c0 = 1, c1 = 0, c2 = 2
Solution:
cn = (α + βn)2n + γ3n
plug in n = 0, 1, 2 (the inital conditions) to solve for the three unknowns.
25
15.2 Solution to the Crazy Dice Problem
Find 2 dice that give the same probability table as 2 ordinary dice.
Solution:
In each case, define the weight of a side to be the number written on it.
For S:
ΦS (x) = x1 + x2 + x3 + x4 + x5 + x6
Point: the total number of ways to roll and n on crazy dice should be equal to the total number of ways
to roll n on the ordinary dice.
x − x7
ΦS (x) =
1−x
So,
x − x7 2
( ) = ΦA (x)ΦB (x)
1−x
To find the ΦA (x) and ΦB (x), we factor the RHS and distribute the factors in such a way that we get a
reasonable answer.
Factoring RHS:
x − x7 1 − x6 x(1 − x3 )(1 + x3 )
=x =
1−x 1−x 1−x
We’ve taken the difference of squares and turned it into a difference of cubes. Using the difference of
cubes equation, we can turn this into:
26
Note that the numbers on each die must all be ≥ 1.
ΦA (1) = ΦB (1) = 6
So, we can distribute the factors into the two generating series. Thus, we can get:
A has 1, 3, 4, 5, 6, 8.
B has 1, 2, 2, 3, 4, 4.
16 Lecture 16
Now we doin’ Graph Theory.
Definition: a graph G consists of a finite set V (G) called the vertices and another finite set E(G) called
the edges.
17 Lecture 17
Reminder: quiz Friday
Examples:
• Compete graph Kp
A graph with p vertices, where they are all joined.
18 Lecture 18
something something Graph Theory something something
27
18.1 Paths and Walks
Definition: Walk
Often, when writing it down, we’ll omit listing the edges, as they’re kind of redundant (although still
part of it).
19 Lecture 20
There’s a second extra problem set on Learn.
20 Lecture 24
Reminder: Assignment 7 is due next week, and the midterm is next Thursday.
21 Lecture 26
The midterm is tomorrow at 4:30; don’t forget.
ama
28