Himpunan 1 Definisi himpunan set adalah kumpulan obyekobyek
Himpunan 1
Definisi: himpunan (set) adalah kumpulan obyek-obyek tidak urut (unordered) Obyek dalam himpunan disebut elemen atau anggota (member) Himpunan yang tidak berisi obyek disebut himpunan kosong (empty set) Universal set berisi semua obyek yang sedang dibahas Contoh : S = { a, e, i, o, u } U = himpunan semua huruf 2
Diagram Venn Salah satu cara merepresentasikan himpunan U S a u 3 e i o
Set Theory Set: Collection of objects (“elements”) a A “a is an element of A” “a is a member of A” a A “a is not an element of A” A = {a 1, a 2, …, an} “A contains…” Order of elements is meaningless It does not matter how often the same element is listed. 4
Set Equality Sets A and B are equal if and only if they contain exactly the same elements. Examples: 5 • A = {9, 2, 7, -3}, B = {7, 9, -3, 2} : A=B • A = {dog, cat, horse}, B = {cat, horse, squirrel, dog} : A B • A = {dog, cat, horse}, B = {cat, horse, dog} : A=B
Contoh (example 4): N = { 0, 1, 2, 3, …. } = himpunan bilangan natural Z = { …, -3, -2, -1, 0, 1, 2, 3, …. } = himpunan bilangan bulat (integer) Z+ = { 1, 2, 3, …. } = himpunan integer positif Q = { p/q | p Z, q 0 } = himpunan bilangan rasional R = himpunan bilangan nyata (real numbers) 6
Examples for Sets A= “empty set/null set” A = {z} Note: z A, but z {z} A = {{b, c}, {c, x, d}} A = {{x, y}} Note: {x, y} A, but {x, y} {{x, y}} A = {x | x N x > 7} = {8, 9, 10, …} “set builder notation” 7
Examples for Sets We are now able to define the set of rational numbers Q: Q = {a/b | a Z b Z+} or Q = {a/b | a Z b 0} 8
Definisi: A dan B merupakan himpunan A=B jika dan hanya jika elemen-elemen A sama dengan elemen-elemen B A B jika dan hanya jika tiap elemen A adalah elemen B juga x (x A x B) catatan: { } atau A dan A A A B jika A B dan A B |A| = n di mana A himpunan berhingga (finite set) (Himpunan A berisi n obyek yang berbeda) 9 bilqis disebut banyaknya anggota (cardinality) dari A
Subsets A B “A is a subset of B” A B if and only if every element of A is also an element of B. We can completely formalize this: A B x (x A x B) Examples: A B? true A = {3, 3, 3, 9}, B = {5, 9, 1, 3}, A B ? true A = {3, 9}, B = {5, 9, 1, 3}, A = {1, 2, 3}, B = {2, 3, 4}, 10 A B? false
Subsets Useful rules: A = B (A B) (B A) (A B) (B C) A C (see Venn Diagram) U B 11 A C
Subsets Useful rules: A for any set A A A for any set A Proper subsets: A B “A is a proper subset of B” A B x (x A x B) x (x B x A) or A B x (x A x B) x (x B x A) 12
Subsets Useful rules: A for any set A A A for any set A Proper subsets: A B “A is a proper subset of B” A B x (x A x B) x (x B x A) or A B x (x A x B) x (x B x A) 13
Cardinality of Sets If a set S contains n distinct elements, n N, we call S a finite set with cardinality n. Examples: A = {Mercedes, BMW, Porsche}, 14 |A| = 3 B = {1, {2, 3}, {4, 5}, 6} C= D = { x N | x 7000 } |B| = 4 |C| = 0 |D| = 7001 E = { x N | x 7000 } E is infinite!
The Power Set: S adalah himpunan berhingga dengan n anggota Maka power set dari S -dinotasikan P(S)- adalah himpunan dari semua subset dari S dan |P(S)| = 2 n Contoh: S = { a, b, c} P(S) = { { }, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} } The Cartesian Product: A dan B adalah himpunan, maka A B = { (a, b) | a A b B} 15
The Power Set 2 A or P(A) “power set of A” 2 A = {B | B A} (contains all subsets of A) Examples: A = {x, y, z} 2 A = { , {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}} A = 2 A = { } Note: |A| = 0, |2 A| = 1 16
The Power Set Cardinality of power sets: | 2 A | = 2|A| Imagine each element in A has an “on/off” switch Each possible switch configuration in A corresponds to one element in 2 A A 1 2 3 4 5 6 7 8 x x x x x y y y y y z z z z z • For 3 elements in A, there are 2 2 2 = 8 elements in 2 A 17
Cartesian Product The ordered n-tuple (a 1, a 2, a 3, …, an) is an ordered collection of objects. Two ordered n-tuples (a 1, a 2, a 3, …, an) and (b 1, b 2, b 3, …, bn) are equal if and only if they contain exactly the same elements in the same order, i. e. ai = bi for 1 i n. The Cartesian product of two sets is defined as: A B = {(a, b) | a A b B} Example: A = {x, y}, B = {a, b, c} A B = {(x, a), (x, b), (x, c), (y, a), (y, b), (y, c)} 18
Cartesian Product Note that: A = A = For non-empty sets A and B: A B B A |A B| = |A| |B| The Cartesian product of two or more sets is defined as: A 1 A 2 … An = {(a 1, a 2, …, an) | ai Ai for 1 i n} 19
Contoh: A = { 1, 2 } B = { p, q } A X B = { (1, p), (1, q), (2, p), (2, q) } ordered pairs Selanjutnya … A X A = { (1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2), (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2) } ordered triples Secara umum: (a 1, a 2, a 3, a 4) ordered quadruple (a 1, a 2, a 3, a 4, …. an) ordered n-tuple 20
Operasi terhadap himpunan: 1. A dan B himpunan 2. A B = { x | x A x B } 3. A B = { x | x A x B } jika A B = { } maka A dan B disebut disjoint 4. A – B = { x | x A x B } 5. A = { x | x A} = U – A, di mana U = universal set 6. A B = { x | x A x B } 21 = xor
Identitas himpunan: lihat tabel di halaman 89 Contoh: Buktikan hukum De Morgan A B = A B Bukti: A B = { x | x (A B) } = { x | ( x (A B) ) } = { x | ( (x A) (x B) ) } = { x | (x A) (x B) } ={x| x (A B)} 22 A B =A B
Representasi komputer untuk himpunan: U = universal set berhingga S = himpunan Maka x S dinyatakan dengan bit “ 1” dan x S dinyatakan dengan bit “ 0” Contoh: U = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } S = { 1, 3, 5, 7, 9 } S direpresentasikan dengan 1 0 1 0 1 0 23
Contoh: U = { semua huruf kecil } S = { a, e, i, o, u } Representasinya: 100010 00001 00000 10000 0 24
Contoh: Rosen halaman 456 no. 7 Dari survei terhadap 270 orang didapatkan hasil sbb. : 64 suka brussels sprouts, 94 suka broccoli, 58 suka cauliflower, 26 suka brussels sprouts dan broccoli, 28 suka brussels sprouts dan cauliflower, 22 suka broccoli dan cauliflower, 14 suka ketiga jenis sayur tersebut. Berapa orang tidak suka makan semua jenis sayur yang disebutkan di atas ? 26
A = {orang yang suka brussels sprouts } B = {orang yang suka broccoli } C = {orang yang suka cauliflower } |A B C| = |A| + |B| + |C| – |A B| – |A C| – |B C| + |A B C| = 64 + 94 + 58 – 26 – 28 – 22 + 14 = 154 Jadi mereka yang tidak suka ketiga jenis sayur tersebut ada sebanyak 270 – 154 = 116 orang 27
brussels sprouts broccoli 64 suka brussels sprouts, 94 suka broccoli, 58 suka cauliflower, b a c e f d g cauliflower 28 26 suka brussels sprouts & broccoli, 28 suka brussels sprouts & cauliflower, 22 suka broccoli & cauliflower, 14 suka ketiga jenis sayur tsb
brussels sprouts a = 24 broccoli b = 12 c = 60 e = 14 f=8 d = 14 64 suka brussels sprouts, 94 suka broccoli, 58 suka cauliflower, 26 suka brussels sprouts & broccoli, 28 suka brussels sprouts & cauliflower, 22 suka broccoli & cauliflower, 14 suka ketiga jenis sayur tsb a + b + d + e = 64 b + c + e + f = 94 g = 22 cauliflower d + e + f + g = 58 b + e = 26 d + e = 28 e + f = 22 yang tidak suka sayur = 270 -24 -12 -60 -14 -14 -8 -22 = 116 29 e = 14
PR 2. 1 1, 5, 7, 11, 17, 19, 23 2. 2 3, 27, 51, 55 30
- Slides: 30