# Bilqis1 Pertemuan 4 2010. bilqis2 Himpunan bilqis3 Definisi: himpunan (set) adalah kumpulan obyek-obyek tidak urut (unordered) Obyek dalam himpunan disebut.

## Presentasi berjudul: "Bilqis1 Pertemuan 4 2010. bilqis2 Himpunan bilqis3 Definisi: himpunan (set) adalah kumpulan obyek-obyek tidak urut (unordered) Obyek dalam himpunan disebut."— Transcript presentasi:

bilqis1 Pertemuan 4 2010

bilqis2 Himpunan

bilqis3 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

bilqis4 Diagram Venn Salah satu cara merepresentasikan himpunan S a e i o u U

bilqis5 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, …, a n } “A contains…” •Order of elements is meaningless •It does not matter how often the same element is listed.

bilqis6 Set Equality •Sets A and B are equal if and only if they contain exactly the same elements. •Examples: • 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, dog} : A = B

bilqis7 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  Z, q  0 } = himpunan bilangan rasional R = himpunan bilangan nyata (real numbers)

bilqis8 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”

bilqis9 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  Z  b  0}

bilqis10 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) disebut banyaknya anggota (cardinality) dari A

bilqis11 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 = {3, 9}, B = {5, 9, 1, 3}, A  B ? true A = {3, 3, 3, 9}, B = {5, 9, 1, 3}, A  B ? false true A = {1, 2, 3}, B = {2, 3, 4}, A  B ?

bilqis12 Subsets •Useful rules: •A = B  (A  B)  (B  A) •(A  B)  (B  C)  A  C (see Venn Diagram) U A B C

bilqis13 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)

bilqis14 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)

bilqis15 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}, |A| = 3 B = {1, {2, 3}, {4, 5}, 6} |B| = 4 C =  |C| = 0 D = { x  N | x  7000 } |D| = 7001 E = { x  N | x  7000 } E is infinite!

bilqis16 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}

bilqis17 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

bilqis18 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 A12345678 xxxxxxxxx yyyyyyyyy zzzzzzzzz •For 3 elements in A, there are 2  2  2 = 8 elements in 2 A

bilqis19 Cartesian Product •The ordered n-tuple (a 1, a 2, a 3, …, a n ) is an ordered collection of objects. •Two ordered n-tuples (a 1, a 2, a 3, …, a n ) and (b 1, b 2, b 3, …, b n ) are equal if and only if they contain exactly the same elements in the same order, i.e. a i = b i 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)}

bilqis20 Cartesian Product •Note that: • A  =  •  A =  • For non-empty sets A and B: A  B  A  B  B  A • |A  B| = |A|  |B| •The Cartesian product of two or more sets is defined as: •A 1  A 2  …  A n = {(a 1, a 2, …, a n ) | a i  A i for 1  i  n} Example 16, 17 dan 18 hal 118

bilqis21 Contoh: A = { 1, 2 } B = { p, q } A X B = { (1, p), (1, q), (2, p), (2, q) } ordered pairs Selanjutnya … A X 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, ….a n ) ordered n-tuple

bilqis22 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 }  = xor

bilqis23 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)  (x  B) } = { x | x  ( A  B ) } A  B = A  B

bilqis24 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 1 0 1 0

bilqis25 Contoh: U = { semua huruf kecil } S = { a, e, i, o, u } Representasinya: 10001 00010 00001 00000 10000 0

bilqis26 Prinsip inklusi-eksklusi: |A  B| = |A| + |B| – |A  B| |A  B  C| = |A| + |B| + |C| – |A  B| – |A  C| – |B  C| + |A  B  C| |A  B  C  D| = |A| + |B| + |C| + |D| – |A  B| – |A  C| – |A  D| – |B  C| – |B  D| – |C  D| + |A  B  C| + |A  B  D| + |A  C  D| + |B  C  D| – |A  B  C  D|

bilqis27 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 ?

bilqis28 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

bilqis29 a b c d e f g brussels sprouts broccoli cauliflower 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

bilqis30 a = 24 b = 12 c = 60 d = 14 e = 14 f = 8 g = 22 brussels sprouts broccoli cauliflower 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 d + e + f + g = 58 b + e = 26 d + e = 28 e + f = 22 e = 14 yang tidak suka sayur = 270-24-12-60-14-14-8-22 = 116

bilqis31 PR •2.1  1, 5, 7, 11, 17, 19, 23 •2.2  3, 27, 51, 55

Presentasi serupa