Summations (portions from Concrete Mathematics by Graham...
Transcript of Summations (portions from Concrete Mathematics by Graham...
![Page 1: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/1.jpg)
Summations (portions fromConcrete Mathematicsby Graham,
Knuth, Patashnik)CSE 20— Nov. 1, 2005, Day 12
Neil Rhodes
UC San Diego
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.1
![Page 2: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/2.jpg)
FunctionsGiven f : A → B:
Inverse Image of f
f−1(b) = {a : a ∈ A and f (a) = b}
Coimage is the partition ofA where all elements in ablock map to the same element ofB.
Coimage(f ) = { f−1(b) : b ∈ Image(f )}
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.2
![Page 3: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/3.jpg)
Number of PartitionsGivenS = {a1,a2, . . . ,an}:
• How many partitions ofS are there?• How many partitions of sizek are there?
• If an is in a new block:• If an is in an existing block:
• S(n,k) or {nk} is theStirling number of the second
kind
S(n,k) =
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.3
![Page 4: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/4.jpg)
Calculating S(n,k)1 2 3 4 5
12345
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.4
![Page 5: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/5.jpg)
Number of FunctionsGiven setsA andB, how many functions are there ofthe form f : A → B where|Image(f )| = k?
• How many partitions ofA are there of sizek?• How many images are there of sizek?• How many ways to map the blocks of
Coimage(f ) to Image(f )?
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.5
![Page 6: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/6.jpg)
Summing a Sequence• Specific sum
1+2+3+ · · ·+n−1+n
• General summation of a sequence ofterms:
a1+a2+ · · ·+an
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.6
![Page 7: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/7.jpg)
Sigma Notation• Three-dots notation is vague and wordy.• Sigma notation is more compact:
n
∑k=1
k
• Parts of the notation• Summand• Index variable• Lower limit• Upper limit
• Sigma notation inline:∑nk=1k
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.7
![Page 8: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/8.jpg)
Generalized Sigma Notation• Specify a condition that the index variable must
satisfy
∑1≤k≤n
k
• Compare:
∑1≤k≤100
k odd
k2
to:
49
∑k=0
(2k +1)2
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.8
![Page 9: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/9.jpg)
Changing the Index Variable• Can always change from one variable to another
∑1≤k≤n
ak =
• What if we want to switch fromk to k +1?Compare:
∑1≤k≤n
ak =
to:
n
∑k=1
ak =
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.9
![Page 10: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/10.jpg)
Zero Terms are OKWhich is better?
n−1
∑i=2
k(k−1)(n− k)
or
n
∑i=0
k(k−1)(n− k)
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.10
![Page 11: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/11.jpg)
Using Iverson Notation• Iverson notation. True-or-false statement
enclosed in brackets. Value is 0 or 1
[p odd] =
• Example
∑1≤k≤100
k odd
k2 = ∑k
k2[1≤ k ≤ 100][k odd]
• 0 in Iverson notation isvery strongly zero
∑k
1k[k > 0]
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.11
![Page 12: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/12.jpg)
Products• Pi notation is similar to Sigma notation
n
∏k=1
k = 1×2×3×·· ·× (n−1)×n
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.12
![Page 13: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/13.jpg)
Working with SummationsDistributive law
∑k∈K
cak = c ∑k∈K
ak
Associative law
∑k∈K
ak +bk = ∑k∈K
ak + ∑k∈K
bk
Commutative law
∑k∈K
ak = ∑p(k)∈K
ak
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.13
![Page 14: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/14.jpg)
Closed Forms for SummationsClosed form is a formula for a summation, with thesummation removed.
∑0≤k≤n
k =n(n+1)
2
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.14
![Page 15: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/15.jpg)
Example
∑0≤k≤n
(a+bk) =
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.15
![Page 16: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/16.jpg)
Perturbation MethodGivenSn = ∑0≤k≤n ak, rewriteSn+1 by splitting offfirst and last term:
Sn +an+1 = a0+ ∑1≤k≤n+1
ak
= a0+ ∑1≤k+1≤n+1
ak+1
= a0+ ∑0≤k≤n
ak+1
Then, work on last sum and express in terms ofSn.
Finally, solve forSn.
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.16
![Page 17: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/17.jpg)
Perturbation Method Example
Sn = ∑0≤k≤n
xk
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.17
![Page 18: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/18.jpg)
Standard Closed FormsArithmetic series
n
∑k=0
k =12
n(n+1)
Sum of squares and cubes
n
∑k=0
k2 =n(n+1)(2n+1)
6n
∑k=0
k3 =n2(n+1)2
4
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.18
![Page 19: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/19.jpg)
Standard Closed FormsGeometric series (x 6= 1)
n
∑k=0
xk =xn+1−1
x−1
Infinite Geometric series (|x| < 1)
∞
∑k=0
xk =1
1− x
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.19
![Page 20: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/20.jpg)
Standard Closed FormsHarmonic series
Hn =n
∑k=0
1k≈ lnn
n 0 1 2 3 4 5 6Hn 0 1 3
2116
2512
13760
4920
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.20
![Page 21: Summations (portions from Concrete Mathematics by Graham ...cseweb.ucsd.edu/classes/fa05/cse20/Day12-CSE20.pdf · CSE 20— Nov. 1, 2005, Day 12 Neil Rhodes UC San Diego Summations](https://reader036.fdocuments.net/reader036/viewer/2022063011/5fc46aa68d6c841c2e3a209e/html5/thumbnails/21.jpg)
Application of Harmonic SeriesGiven a set of 52 playing cards (of length 2 units). Can
you stack them overlapping so the top card completely
overhangs the table?
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.21