CSE 20Ñ Discrete Math - University of California, San … · Winter , 200 6 February 21, Day 13...
Transcript of CSE 20Ñ Discrete Math - University of California, San … · Winter , 200 6 February 21, Day 13...
CSE 20—Discrete Math
Winter, 2006
February 21, Day 13Functions
Summations (portions from Concrete Mathematics by Graham, Knuth,
Patashnik)
Instructor: Neil Rhodes
Powers of Permutations
To calculate the power of a function fi, calculate the power of each cycle! Calculate final result for each element (using i mod cycle-length)! 1-cycles stay 1-cycles! For example, if f = (1, 2, 4), (3, 8, 7, 10), (5), (6, 9)
– f10 = (1, 2, 4), (3, 7), (8, 10), (5), (6), (9)
! If all cycle lengths divide i evenly, fi is the identity permutation! If f is a permutation of A, then f|A|! is the identity permutation
2
Functions
Given f:A->B! Inverse Image of f:
! Coimage of f: partition of A where all elements in a block map to the same element of B
3
Functions
Given f : A! B:
Inverse Image of f
f"1(b) = {a : a # A and f (a) = b}
Coimage is the partition of A where all elements in ablock map to the same element of B.
Coimage( f )= { f"1(b) : b # Image( f )}
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.2
Functions
Given f : A! B:
Inverse Image of f
f"1(b) = {a : a # A and f (a) = b}
Coimage is the partition of A where all elements in ablock map to the same element of B.
Coimage( f )= { f"1(b) : b # Image( f )}
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.2
Partition
Given a set S = {a1, a2, … an}:! A partition P is a set of subsets of S such that:
– the elements of P cover S
– The elements of P are pairwise disjoint
– No element of P is empty
– The elements of P are called the blocks of the partition
4
Number of Partitions
Given S = {a1, a2, …, an}:! How many partitions of S are there?! How many partitions of size k are there?
– If an is in a new block:
– If an is in an existing block
! S(n, k) is the Stirling number of the second kind
– S(n, k) =
5
Number of Partitions
Given S= {a1,a2, . . . ,an}:• How many partitions of S are there?
• How many partitions of size k are there?• If an is in a new block:• If an is in an existing block:
• S(n,k) or {nk} is the Stirling number of the secondkind
S(n,k) =
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.3
Calculating S(n, k)
6
1 2 3 4 5
1
2
3
4
5
Number of functions
Given sets A and B, how many functions are there of the form f:A->B where |Image(f)| = k! How many partitions of A are there of size k?
! How many images are there of size k?
! How many ways to map the blocks of Coimage(f) to Image(f)?
7
Summing a sequence
Specific sum! 1 + 2 + 3 + ... + n-1 + n
General summation of a sequence of terms:! a1 + a2 + … + an
8
Sigma notation
Ellipsis (…) notation is vague and wordy
Sigma notation is more compact:
Parts of the notation! Summand! Index variable! Lower limit! Upper limit
Sigma notation inline:
9
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=1 k
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.7
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=1 k
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.7
Generalized Sigma notation
Specify a condition that the index variable must satisfy:
! Compare:
! To:
10
Generalized Sigma Notation• Specify a condition that the index variable mustsatisfy
!1!k!n
k
• Compare:
!1!k!100k odd
k2
to:
49
!k=0
(2k+1)2
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.8
Generalized Sigma Notation• Specify a condition that the index variable mustsatisfy
!1!k!n
k
• Compare:
!1!k!100k odd
k2
to:
49
!k=0
(2k+1)2
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.849
!k=0
(2k +1)2
Changing the index variable
Can always change from one index variable to another:
What if we want to switch from k to k+1?
! Compare:
! To:
11
Changing the Index Variable
• Can always change from one variable to another
!1!k!n
ak =
• What if we want to switch from k to k+1?Compare:
!1!k!n
ak =
to:
n
!k=1
ak =
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.9
Changing the Index Variable
• Can always change from one variable to another
!1!k!n
ak =
• What if we want to switch from k to k+1?Compare:
!1!k!n
ak =
to:
n
!k=1
ak =
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.9
Changing the Index Variable
• Can always change from one variable to another
!1!k!n
ak =
• What if we want to switch from k to k+1?Compare:
!1!k!n
ak =
to:
n
!k=1
ak =
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.9
Zero terms are OK
Which is better?
or:
12
n!1
!k=2
k(k!1)(n! k)
n
!k=0
k(k!1)(n! k)
Using Iverson Notation
Iverson notation. True-or-false statement enclosed in brackets. Value is 0 or 1
! [p odd] =
Example:
0 in Iverson notation is very strongly zero
13
Using Iverson Notation
• Iverson notation. True-or-false statementenclosed in brackets. Value is 0 or 1
[p odd] =
• Example
!1!k!100k odd
k2 =!k
k2[1! k ! 100][k odd]
• 0 in Iverson notation is very strongly zero
!k
1
k[k > 0]
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.11
Using Iverson Notation
• Iverson notation. True-or-false statementenclosed in brackets. Value is 0 or 1
[p odd] =
• Example
!1!k!100k odd
k2 =!k
k2[1! k ! 100][k odd]
• 0 in Iverson notation is very strongly zero
!k
1
k[k > 0]
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.11
Using Iverson Notation
• Iverson notation. True-or-false statementenclosed in brackets. Value is 0 or 1
[p odd] =
• Example
!1!k!100k odd
k2 =!k
k2[1! k ! 100][k odd]
• 0 in Iverson notation is very strongly zero
!k
1
k[k > 0]
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.11
Products
Pi notation is similar to Sigma notation
14
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
Working with summations
Distributive law
Associative law
Commutative law
15
Working with Summations
Distributive 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
Working with Summations
Distributive 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
Working with Summations
Distributive 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
Closed forms for summations
Closed form is a formula for a summation with the summation removed.
16
Closed Forms for Summations
Closed form is a formula for a summation, with the
summation removed.
!0!k!n
k =n(n+1)
2
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.14
Example
17
Example
!0!k!n
(a+bk) =
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.15
Perturbation method
Given:
Rewrite Sn+1 by splitting off first and last term:
Then, work on last sum and express in terms of Sn. Finally, solve for Sn.
18
Perturbation Method
Given Sn = !0!k!n ak, rewrite Sn+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 of Sn.
Finally, solve for Sn.
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.16
Perturbation Method
Given Sn = !0!k!n ak, rewrite Sn+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 of Sn.
Finally, solve for Sn.
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.16
Perturbation method example
19
Perturbation Method Example
Sn = !0!k!n
xk
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.17
Standard closed forms
Arithmetic series
Sums of squares and cubes
20
Standard Closed Forms
Arithmetic series
n
!k=0
k =1
2n(n+1)
Sum of squares and cubes
n
!k=0
k2 =
n(n+1)(2n+1)
6
n
!k=0
k3 =
n2(n+1)2
4
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.18
Standard Closed Forms
Arithmetic series
n
!k=0
k =1
2n(n+1)
Sum of squares and cubes
n
!k=0
k2 =
n(n+1)(2n+1)
6
n
!k=0
k3 =
n2(n+1)2
4
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.18
Standard closed forms
Geometric series (x ! 1)
Infinite Geometric series (|x| < 1)
21
Standard Closed Forms
Geometric series (x != 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
Standard Closed Forms
Geometric series (x != 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
Standard closed form
Harmonic series
22
Standard Closed Forms
Harmonic series
Hn =n
!k=0
1
k! lnn
n 0 1 2 3 4 5 6
Hn 0 13
2
11
6
25
12
137
60
49
20
Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.20
Application of harmonic series
Given a stack of 52 playing cards (of length 2 units). Can you stack them overlapping so the top card completely overhangs the table?
23