Discrete Mathematics
Chapter 2 �Basic Structures : Sets, Functions, Sequences, and Sums
大葉大學 資訊工程系 黃鈴玲
2-1 Sets (集合)
Ch2-2
Ch2-3
Ch2-4
5. 判定2是否為下列集合的元素。� (a) {x ∈ R | x 為大於1的整數 }� (b) {x ∈ R | x 為整數的平方 }� (c) {2, {2}}� (d) {{2}, {{2}}} � (e) {{2}, {2, {2}}}
(f) {{{2}}}
Exercise 2-1
7. 判定下列陳述是否為真。� (a) 0 ∈ ∅ (b) ∅ ∈ {0}� (c) {0} ⊂ ∅ (d) ∅ ⊂ {0}� (e) {0} ∈ {0} (f) {0} ⊂ {0}� (g) {∅} ⊆ {∅}��
Ch2-5
8. 判定下列陳述是否為真。� (a) ∅ ∈ {∅} (b) ∅ ∈ {∅, {∅}}� (c) {∅} ∈ {∅} (d) {∅} ∈ {{∅}}� (e) {∅} ⊂ {∅, {∅}} (f) {{∅}} ⊂ {∅, {∅}}���
Exercise 2-1
Ch2-6
Ch2-7
17. 下列各集合的基數(cardinality)為何?� (a) {a}� (b) {{a}}� (c) {a, {a}}� (d) {a, {a}, {a, {a}}}
Exercise 2-1
21(修改). 求出下列集合,其中a與b為相異元素。� (a) P({a, b})� (b) P(∅)� (c) P(P(∅))�
A×B = { (1, a), (1, b), (1, c), (2,a), (2,b), (2,c) }
Ch2-8
Ch2-9
A×B×C = { (0,x,a), (0,x,b), (0,x,c), � (0,y,a), (0,y,b), (0,y,c),
(1,x,a), (1,x,b), (1,x,c), � (1,y,a), (1,y,b), (1,y,c)}
Ch2-10
23. 令A = {a, b, c, d}與B = {y, z},C={1,2}求出� (a) A×B� (b) B×A� (c) B×C×A
Exercise 2-1
2-2 Set Operations(集合的運算)
pf :
此種圖稱為 Venn Diagram(范式圖)
Ch2-11
U
�
�� Let I = {1,3,5} ,�
The symmetric difference (對稱差集) of A and B, denoted by A⊕B , is the set
{ x | x ∈ A − B or x ∈ B − A } = ( A∪B ) − ( A ∩B )
|A ∪ B| = |A| + |B| − |A ∩ B|
Ch2-12
∪Ai =A1∪A2∪…∪An
n
i=1
∩Ai =A1∩A2∩…∩An
n
i=1
∪Ai =A1∪A3∪A5
i ∈I
26. 若ABC為集合,繪出下列集合組合之范式圖。�(a) A ∩ (B∪C) �(b) A ∩ B ∩ C�(c) (A−B)∪(A−C)∪(B-C)
Ch2-13
14. 若A−B = {1,5,7,8}, B−A = {2,10},以及A∩B = {3,6,9}。� 求出集合A與B。
Exercise 2-2
45. 令Ai = {1,2,3,…,i},i = 1, 2, 3, …。� 求出(a) (b) 。
∪Ai
n
i=1
∩Ai
n
i=1
32. 找出 {1,3, 5}及{1, 2, 3}的對稱差集(symmetric difference)。
A
B
C
2-3 Functions (函數)
A function f : A → B is an assignment of exactly one element of B to each element of A. �We write f (a) = b if b is the unique element of B assigned by f to a ∈ A.
Ch2-14
Not a function
Not a function
A
B
1
2
3
α
β
γ
f
f(α)=1�f(β)=1�f(β)=2�f(γ)=3
f(α)=1�f(β)=?�f(γ)=2
A
B
1
2
α
β
γ
f
A: domain (定義域) of f , B: codomain (對應域) of f
f (α) = 1 , f (β) = 4 , f (γ) = 2
1稱為α的image (映像, 必定唯一), �α稱為1的pre-image(前像, 可能不唯一)
range(值域) of f = { f (a) | a ∈ A} = f (A) = {1,2,4} (未必=B)
Example 4 : f : Z → Z, f (x) = x2, 則 f 的domain, codomain 及range為何?
Ch2-15
a function
a function
g(α)=1�g(β)=2�g(γ)=1
A
B
1
2
α
β
γ
g
A
B
1
2
3
4
α
β
γ
f
f(α)=1�f(β)=4�f(γ)=2
( f1 + f2 )(x) = f1(x) + f2(x) � (f1 f2)(x) = f1(x) f2(x)
f1(x) = x2, f2(x) = x − x2. What are the function f1 + f2 and f1 f2?
Sol :
( f1 + f2 )(x) = f1(x) + f2(x) = x2 + ( x – x2 ) = x
(f1 f2)(x) = f1(x).f2(x) = x2( x – x2 ) = x3 – x4
�
Ch2-16
Ch2-17
Exercise 2-3
1. 為何下列 f 不為R到R的函數?� (a) f (x) = 1/x � (b) f (x) = √x� (c) f (x) = ± √(x2+1)
Ch2-18
是 1-1
不是 1-1 , 因 g(a) = g(d) = 4
A
B
1
2
a
b
c
d
3
4
5
f
A
B
1
2
a
b
c
d
4
5
3
g
※ 一對一函數與映成函數
⇒ f (x) ≠ f (y)
∴ f is 1-1
Ch2-19
Note : �當|A| < |B| 時,必定不會onto.
onto
a
b
c
d
2
3
1
f
not onto
A
B
a
b
c
1
2
3
4
f
※補充 : f : A →B
(1) If f is 1-1 , then |A| ≤ |B|
(2) If f is onto , then |A| ≥ |B|
(3) if f is 1-1 and onto , then |A| = |B|.
Ch2-20
1-1 , not onto
a
b
c
2
3
1
4
not 1-1, onto
a
b
c
1
2
3
d
1-1 and onto
a
b
c
d
2
3
1
4
Ch2-21
Exercise 2-3
12, 13, 19. 判斷為何下列 由Z對應到Z的函數是否為一對一、映成或雙射函數。� (a) f (n) = n−1 � (b) f (n) = n2+1� (c) f (n) = n3� (d) f (n) = ⎡n/2⎤
※Some important functions
⎣½⎦ = ⎣-½⎦ = ⎣7⎦ =
⎡½⎤ = ⎡-½⎤ = ⎡7⎤ =
factorial function (階乘函數):
f : N → Z+ , f (n) = n! = 1 x 2 x … x n
Ch2-22
Ch2-23
Exercise 2-3
27. 令f (x) = ⎣x2/3⎦。若集合如下,求出 f (S)。� (a) S = {−2, −1, 0, 1, 2, 3} � (b) S = {0, 1, 2, 3, 4, 5} � (c) S = {1, 5, 7, 11} � (d) S = {2, 6, 10, 14 }
2.4 Sequences and Summations
※Sequence (數列)
Def 1. A sequence is a function f from A ⊆ Z+
(or A ⊆ N) to a set S. We use an to denote f(n), and call an a term (項) of the sequence.
Example 1. {an} , where an = 1/n , n =1, 2, 3, …
⇒ a1 =1, a2 =1/2 , a3 =1/3, …
Example 2. {bn} , where bn= (−1)n, n =0, 1, 2, …
⇒ b0 = 1, b1 = −1 , b2 = 1, …
Ch2-24
Ch2-25
Exercise 2-4
1. 求出序列 {an} 中下列各項,其中an = 2(−3)n+5n。� (a) a0� (b) a1� (c) a4
6. 列出下列序列的前十項。� (a)序列由10開始,接下去的項都是前項減3。� (e)序列的首兩項為1與2,接下去的項都是前兩項之和。
Example 5. 給定數列的前五項,求序列的公式:�(a) 1, 1/2, 1/4, 1/8, 1/16�(b) 1, 3, 5, 7, 9�(c) 1, −1, 1, − 1, 1
Sol :
(a) a0 = 1, a1 = 1/2, a2 = 1/22, a3 = 1/23, a4 = 1/24,
∴ an = 1/2n, n =0, 1, 2, 3, …
(b) a0 = 1, a1 = 3, a2 = 5, a3 = 7, a4 = 9
∴ an = 2n+1, n =0, 1, 2, 3, …
(c) a0 = 1, a1 = −1, a2 = 1, a3 = −1, a4 = 1
∴ an = (−1)n, n =0, 1, 2, 3, …
Ch2-26
Example 7. How can we produce the terms of a sequence if the first 10 terms are �5, 11, 17, 23, 29, 35,41, 47, 53, 59?
Sol : (等差數列)
a1 = 5
a2 =11 = 5 + 6
a3 =17 = 11 + 6 = 5 + 6 × 2
:
:
∴ an= 5 + 6(n−1) = 6n−1, n =1, 2, 3, …
Ch2-27
注意:序列的第一項是 a0 還是 a1 會影響 an 的公式,
所以寫公式時一定要標示出 n 從 0 還是 1 開始
Example 8. Conjecture a simple formula for an if
the first 10 terms of the sequence {an} are
1, 7, 25, 79, 241, 727, 2185, 6559, 19681, 59047?
Sol:
顯然非等差數列
後項除以前項的值接近3
⇒ 猜測數列為 3n ± …
比較:
{3n} : 3, 9, 27, 81, 243, 729, 2187,…
{an} : 1, 7, 25, 79, 241, 727, 2185,…
∴ an = 3n − 2 , n ≥ 1
Ch2-28
Ch2-29
Exercise 2-4
9. 為下面給定的序列找出簡單的一般項公式,假設你的公式正確,列出接下的三項。� (c) 1, 0, 2, 0, 4, 0, 8, 0, 16, 0, … � (d) 3, 6, 12, 24, 48, 96, 192, …
(e) 15, 8, 1, −6, −13, −20, − 27, …
(f) 3, 5, 8, 12, 17, 23, 30, 38, 47, …
(g) 2, 16, 54, 128, 250, 432, 686, …
(h) 2, 3, 7, 25, 121, 721, 5041, 40321, …
※ Summations (級數,數列總和)
�
Here, the variable j is call the index of summation, �m is the lower limit (下限), and n is the upper limit (上限).
Ch2-30
Example 10.
= 12+22+32+42+52=55
Example 13. (Double summation)
Example 14.
Table 2. Some useful summation formulae
Ch2-31
Ch2-32
Exercise 2-4
13. 下列總和之值為何?� (a) (b) (c) �� (d)
17. 計算下面的多重總和� (a) (b) (c) �� (d)
※Cardinality(基數) (此部分跳過)
Def 4. The sets A and B have the same cardinality (size) if and only if there is a one-to-one correspondence �(1-1,onto 的function) from A to B.
Def 5. A set that is either finite or has the same
cardinality as Z+ (or N) is called countable (可數).
A set that is not countable is called uncountable.
Ch2-33
Ch2-34
Example 18. Show that the set of odd positive
integers is a countable set.
Pf: (Figure 1)
Z+ : 1 2 3 4 5 6 7 8 …
……
{ 正奇數 } : 1 3 5 7 9 11 13 15 …
f : Z+ → {正奇數}
f (n) = 2n – 1 is 1-1 & onto.
Example 19. Show that the set of positive rational number (Q+) is countable.
Ch2-35
∴ Z+ : 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 …
Q+ :
(注意,因 等於 ,故 不算)
※Note. R is uncountable. (Example 21)
Pf: Q+ = { a / b | a, b∈ Z+ }
(Figure 2)
1
1