Page 100 Exercise 4: simplified version (no point at origin)
(a choose 2)(b choose 1) + (a choose 1)(b choose 2)
(a+b choose 3) - (a choose 3) - (b choose 3)
Stars and bars:
Mostly this does not matter.
Page 106: Example 1.5.1: 10 flavors, 6 scoops. Analogous to 10 kids, 6 cookies [!]
The 10 flavors / 10 kids are distinguishable. The scoop order and cookie type are not.
Page 106: Example 1.5.2
Note how we handle the non-decreasing nature of the digits
Page 107: Example 1.5.3
Integer solutions to the equation
Page 112 (PIE): 1.6.1
Alberto, Bernadette and Carlos, and 11 cookies. Nobody gets more than 4.
1.6.2
1.6.4: Derangements do not do
Additive: if you're making one choice from either of two disjoint sets
2-set PIE: if the sets are not disjoint
Multiplicative: if you're making two choices, one from each set, and the order matters (or can be inferred)
Count the complement and subtract (variation of additive rule)
Count with multiplicity, then divide, like the permutations/combinations trick
variants of counting subsets: counting lattice paths, bitstrings
Stars and bars: counting how many ways you can divide M identical things among N bins
3-set PIE
Tower of Hanoi
Wednesday:
Example 2.1.1: what is the pattern?
Factorials, triangle numbers
Recursively defined sequences
Example 2.1.2
Python example like 2.1.2 third sequence (but note differences); compare to sixth sequence
import math
phi=(1+math.sqrt(5))/2
pho=(1-math.sqrt(5))/2
def s(n):
return (pow(phi,n)-pow(pho,n))/math.sqrt(5)
for i in range(20):
print(i,'\t',s(i))
Recursive (or inductive) definitions
Example 2.1.3
def a(n): if n==0: return 3
if n==1: return 4
return 2*a(n-1) - a(n-2)
But there is a much simpler way to calculate a(n)!
p 140:
Example 2.1.4: first step is to identify the patterns
2.1.5: summation notation
2.1.6: more summation
p 148: Investigate!
Example 2.2.1: arithmetic sequences
Example 2.2.2: geometric sequences
Sums of arithmetic and geometric sequences
1 + 2 + 3 + ... + 100
Example 2.2.4
Example 2.2.5
Example 2.2.6: fix
1+2+4+...+512
Example 2.2.7
Example 2.2.8
Example 2.2.9
S = 0.464646.... When we subtract from 100S, we get +46 on the right, but there is no minus term. Why?
Friday:
mathwithbaddrawings.com/2017/02/08/how-to-tell-a-mathematician-you-love-them
Example 2.2.6 on Levin p 154
Let bk = 1+3k. Then the sum
an = 2 + 1 + 4 + 7 + 10 + · · · + (1 + 3(n−1))
can be rewritten as
an =2 + b0 + b1 + ... + bn-1.
Written this way it is clearer that there are n terms of the form bk here, ranging from 0 to (n-1).
Homework 4 questions
Proof by induction: 1 + 2 + ... + N = N(N+1)/2
Find 12 + 22 + 32 + ... + N2.
Investigate!, page 167
def a(n):
if n== 0: return 1
if n==1: return 2
return 5*a(n-1) - 6*a(n-2)
def b(n):
if n== 0: return 1
if n==1: return 3
return 5*b(n-1) - 6*b(n-2)
def c(n):
if n== 0: return 1
if n==1: return 4
return 5*c(n-1) - 6*c(n-2)
Example 2.4.2, p 168
Example 2.4.3: an = an-1 + n
Example 2.4.4: same problem, alternative approach
Example 2.4.5: introduce a factor: an = 3*an-1 + 2. Make a guess?
def a(n):
if n== 0: return 1
return 3*a(n-1) + 2
Characteristic roots
Example 2.4.6
Example at start of chapter: an = 5*an-1 - 6*an-2
Fibonacci example
Postage in Investigate!
Example 2.5.1: triangle numbers
Example 2.5.2: 6n-1 is divisible by 5
Example 2.5.3: n2 < 2n for n>=5
Warning: Canadians
Euclidean algorithm theorem: for integers a and b<a, we can find q and r so a=qb+r