Discrete math Bijections 2 A function f is a one-to-one correspondence, or a bijection or...
-
Upload
randell-dorsey -
Category
Documents
-
view
220 -
download
1
Transcript of Discrete math Bijections 2 A function f is a one-to-one correspondence, or a bijection or...
Bijections
2
A function f is a one-to-one correspondence, or a bijection or reversible, or invertible, iff it is both one-to-one and onto.
Inverse of a Function
3
For bijections f:AB, there exists an inverse of f, written f 1:BA, which is the unique function such that: Iff 1
The Identity Function
4
For any domain A, the identity function I:AA (variously written, IA, 1, 1A) is the unique function such that aA: I(a)=a.
Note that the identity function is both one-to-one and onto (bijective).
10
Sequences
• A sequence represents an ordered list of elements.A sequence represents an ordered list of elements.
e.g., {e.g., {aann} = 1, 1/2, 1/3, } = 1, 1/2, 1/3, 1/4, …1/4, …
• Formally:Formally: A A sequencesequence or or seriesseries { {aann} is identified } is identified
with a with a generating functiongenerating function ff::SSAA for some subset for some subset SSNN and for some set and for some set AA..
e.g., e.g., aann= = ff((nn) = 1/) = 1/nn..
• The symbol The symbol aann denotes denotes ff((nn), also called ), also called term nterm n of of
the sequencethe sequence..
11
Example with Repetitions
• Consider the sequence Consider the sequence bbn n = (= (1)1)nn..
• {{bbnn}} = 1, = 1, 1, 1, 1, 1, 1, …1, …
• {{bbnn} denotes an infinite sequence of 1’s and } denotes an infinite sequence of 1’s and
1’s, 1’s, notnot the 2-element set {1, the 2-element set {1, 1}.1}.
12
Recognizing Sequences
• Sometimes, you’re given the first few terms Sometimes, you’re given the first few terms of a sequence, and you are asked to find the of a sequence, and you are asked to find the sequence’s generating function, or a sequence’s generating function, or a procedure to enumerate the sequence.procedure to enumerate the sequence.
13
Recognizing Sequences
• Examples: What’s the next number?Examples: What’s the next number?– 1,2,3,4,…1,2,3,4,…– 1,3,5,7,9,…1,3,5,7,9,…– 2,3,5,7,11,... 2,3,5,7,11,... – 5,11,17,23,…5,11,17,23,…– 1,7,25,79,…1,7,25,79,…
5
11
13 (the 6th smallest prime number)
29
241 (3 - 2)n
14
The Trouble with Recognition
• The problem of finding “the” generating The problem of finding “the” generating function given just an initial subsequence is function given just an initial subsequence is not well defined.not well defined.
• This is because there are This is because there are infinitely infinitely many many computable functions that will generate computable functions that will generate anyany given initial subsequence.given initial subsequence.
16
Summation Notation
• Given a series {Given a series {aann}, the }, the summation of summation of {{aann} }
from j to kfrom j to k is written and defined as follows: is written and defined as follows:
• Here, Here, ii is called the is called the index of summationindex of summation..
kjj
k
jii aaaa
...: 1
17
Generalized Summations
• For an infinite series, we may write:For an infinite series, we may write:
• To sum a function over all members of a set To sum a function over all members of a set XX={={xx11,, x x22, …}:, …}:
...)()(:)( 21
xfxfxfXx
...: 1
jj
jii aaa
21
More Summation Examples
• An infinite series with a finite sum:An infinite series with a finite sum:
• Using a predicate to define a set of elements Using a predicate to define a set of elements to sum over:to sum over:
874925947532 2222
10 prime) is (
2
x
x
x
2...1...222 41
2110
0
i
i
22
Summation Manipulations
• Some handy identities for summations:Some handy identities for summations:
( ) ( )
( ( ) ( )) ( ) ( )
( ) ( )
x x
x x x
k k n
i j l j n
cf x c f x
f x g x f x g x
f i f l n
(Index shifting.)
24
More Summation Manipulations
1
0
0 0
2 1
0 0 0
( ) ( ) ( ) if
( ) ( )
( ) ( )
( ) (2 ) (2 1)
k m k
i j i j i m
k jk
i j l
n n
i l
k k k
i i i
f i f i f i j m k
f i f k l
f i f n l
f i f i f i
(Grouping.)
(Order reversal.)
(Series splitting.)
25
Example: Impress Your Friends
• Boast, “I’m so smart; give me any digit Boast, “I’m so smart; give me any digit nn, , and I’ll add all the numbers from 1 to and I’ll add all the numbers from 1 to nn in in my head in just a few seconds.”my head in just a few seconds.”
• I.e.I.e., Evaluate the summation:, Evaluate the summation:
• There is a simple closed-form formula for There is a simple closed-form formula for the result, discovered by Euler at age 12! the result, discovered by Euler at age 12!
n
i
i1
LeonhardEuler
(1707-1783)
26
Euler’s Trick, Illustrated
• Consider the sum:Consider the sum:1+2+…+(1+2+…+(nn/2)+((/2)+((nn/2)+1)+…+(/2)+1)+…+(nn-1)+-1)+nn
• nn/2 pairs of elements, each pair summing to /2 pairs of elements, each pair summing to nn+1, for a total of (+1, for a total of (nn/2) (n+1)./2) (n+1).
…
n+1n+1
n+1
27
Symbolic Derivation of Trick
( 1)2
1 1 1 1 1 0
1 1
/ 2 / 2
1 1 1 1
( )
( ( 1))
( 1 ) ( 1 )
n kn k k n k
i i i i k i l
k n k
i l
k n k n n
i l i l
i i i i i n l
i n l
i n l i n l
(k=n/2)
order reversal
index shifting
Suppose n is even, that is, n=2k
28
Concluding Euler’s Derivation
• Also works for odd Also works for odd nn (prove this at home). (prove this at home).
/ 2 / 2 / 2
1 1 1
/ 2
21
( 1 ) ( 1 )
( 1) ( 1) ( 1) / 2
n n n
i i i
nn
i
i n i i n i
n n n n
29
Geometric Series
• A A geometric series geometric series is a series of the form is a series of the form
aa, , arar, , arar22, , arar33, …, , …, ararkk, where , where a,ra,rRR..
• The sum of such a series is given by:The sum of such a series is given by:
0 0
k ki i
i i
S ar a r
30
• HereHerewewego...go...
Geometric Sum Derivation
...1
1
1
11
1
1
1
1
)1(1
0
1
0
1
000
0
nn
i
in
ni
in
i
i
n
i
in
i
in
i
i
n
i
in
i
in
i
in
i
i
n
i
i
arararar
ararar
rararrrararrrS
arS
31
Derivation example cont...
)1()1(
)(
11
0
1
1
0
0
01
1
0
1
1
001
1
nnn
i
i
nn
i
i
i
i
nn
i
i
nn
i
inn
i
i
raSraar
aararar
arararar
ararararararrS
32
Concluding long derivation...
anaaarSr
rr
raS
rarS
raSrS
raSrS
n
i
n
i
in
i
i
n
n
n
n
)1(11 ,1When
1en wh1
1
)1()1(
)1(
)1(
000
1
1
1
1
34
More Series
4/)1(
6/)12)(1(
2/)1(
1),1/()1(
22
1
3
1
2
1
1
0
nnk
nnnk
nnk
rrraar
n
k
n
k
n
k
nn
k
kGeometric series
Arithmetic Series
(Euler’s trick)
Quadratic series
Cubic series
35
Example
• Evaluate Evaluate
100
50
2
k
k
.925,297
425,40350,3386
995049
6
201101100
49
1
2100
1
2100
50
2
100
50
249
1
2100
1
2
kkk
kkk
kkk
kkk
Recursively defined Function
• Factorial FunctionFactorial Function– The product of the positive integers from 1 to n, The product of the positive integers from 1 to n,
inclusive, is called “n factorial” and is usually inclusive, is called “n factorial” and is usually denoted by n!. That isdenoted by n!. That is
n!=n(n-1)(n-2)………n!=n(n-1)(n-2)………
37
Factorial Example
• Calculate 4! Using the recursive definitionCalculate 4! Using the recursive definition
38