1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor:...

51
1 Introduction (Pengenalan) About the Lecturer: Nama lengkap: Heru Suhartanto, Ph.D Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok E-mail: [email protected] Pendidikan formal: Sarjana Matematika UI, 1986 Master of Science, Computer Science, University of Toronto, Canada, 1990. Philosiphy Doctor (Ph.D), Parallel Computing, University of Queensland, Australia, 1998. Other lecturers Achmad Nizar Hidayanto Ade Azurat Kasiyah M. Yunus Dina Cahyati Siti Aminah Materi Matrikulasi Matematika – pengenalan (lihat Outline), sebagian diberikan dalam text bahasa Inggris. Materi: http://telaga.cs.ui.ac.id/WebKuliah/Matrikulasi/math/

Transcript of 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor:...

Page 1: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

1

Introduction (Pengenalan) About the Lecturer:– Nama lengkap: Heru Suhartanto, Ph.D– Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok– E-mail: [email protected]– Pendidikan formal:

– Sarjana Matematika UI, 1986– Master of Science, Computer Science, University of Toronto, Canada, 1990.– Philosiphy Doctor (Ph.D), Parallel Computing, University of Queensland,

Australia, 1998. Other lecturers

– Achmad Nizar Hidayanto– Ade Azurat– Kasiyah M. Yunus– Dina Cahyati– Siti Aminah

Materi Matrikulasi Matematika – pengenalan (lihat Outline), sebagian diberikan dalam text bahasa Inggris.

Materi: http://telaga.cs.ui.ac.id/WebKuliah/Matrikulasi/math/

Page 2: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

2

Lecture 1

Set Theory

Reading: Chp 5

Susanna S. Epp, Discrete Mathematics with Application 2-nd Ed, Brooks/Cole, 1995

Page 3: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

3

1. Sets

1.1 (Definition: Set)

A SET is an unordered collection of unique elements.

Notation: It is written as:

{x1,…,xn}

where n 0 and x1,…,xn are the elements of the set.

Page 4: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

4

1. Sets

1.2 Examples of sets– {1, 24, 32}– {apple, car, pencil}– {,,,}– {1, apple, }– {{1,2}, apple, { {},{,3}}}– {} is a set with no elements. It is known as

the empty set and is also denoted as ‘’

Page 5: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

5

1. Sets

1.3 Remarksa. Ordering does not matter.

{1,2,3} = {1,3,2} = {2,1,3}

b. Repetitions are ignored.

{1,1,2,3} = {1,2,3}

c. Elements in the set need not be of the ‘same type’.

{1, apple, } is a set

Page 6: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

6

1. Sets

1.3 Remarks (cont’d)d. A set can contain other sets as

elements

{{1,2}, apple, {{},{,3}}}

is a set with 3 elements:• {1,2}• apple• {{},{,3}}

e. A set can be finite or infinite.

Page 7: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

7

1. Sets

1.4 Predefined Sets– The set of Natural numbers

N = {0, 1, 2, 3,…}– The set of Integers

Z = {…,-2,-1,0,1,2,…}– The set of Rational numbers

Q = {a/b | aZ bZ b0}– The set of Real numbers: R

Real numbers comprise all rational (eg. 1/2) and all irrational numbers (eg. 2).

(Note: There are numbers which are not real numbers, these are not covered in this course).

Page 8: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

8

1. Sets

1.4 Predefined Sets (cont’d)– The superscript ‘+’ to Z, Q or R indicates

positive numbers (> 0)– The superscript ‘–’ to Z, Q or R indicates

negative numbers (< 0)– The superscript ‘nonneg’ to Z, Q or R

indicates positive numbers including 0.– Therefore, given that Z = {…,-2,-1,0,1,2,…},

Z+ = {1,2,3,…}

Z- = {-1,-2,-3,…}

Znonneg = {0,1,2,3,…}

Page 9: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

9

1. Sets

1.5 Defining a Set– A set may be defined directly by listing every

element:

S = {2, 4, 6, 8, 10}– Or it may be defined indirectly by defining it in

terms of other sets:

S = {x | x Z, 1 x 10}

S = {x Z | 1 x 10}

Note: Read the symbol ‘|’ as ‘such that’– In general,

S = {element | element Another set, list of conditions}

S = {element Another set | list of conditions}

Page 10: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

10

2. Visualization tool: Venn Diagram

A Venn Diagram is used to visualize relationships between sets.

1. Draw Sets as Circles. – Spatial relationship between circles is used to

depict set relationships

2. Draw Elements as Dots.

Page 11: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

11

Outline

Sets– Defn & Notation– Examples– Remarks– Predefined Sets– Defining a set

Venn Diagrams Predicates

– Membership ()– Subset ()– Equality ()– Proper Subset ()

Functors– Union ()– Intersection ()– Difference ()– Complement (c)

Proofs Special sets

– Empty Set– Universal Set– Proofs

Set Equivalences More operations on sets

– Power Set– Cartesian product– Disjoint Unions

Page 12: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

12

3. Predicates: 3.1 Definition: Set Membership ()

– If x is an element of a set A, we write

x AWe say “x is in A”, “x is a member of A”, or “x is an element of A”

– If x is NOT an element of a set A, we write x A

which is actually an abbreviation of(x A)

A2 1

1 A, 2 A

Venn Diagram:

Page 13: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

13

3. Predicates:

3.1.1 Examples of ‘’:

• 1 {1, 2, 3}

• 1 {{1,2}, {4}, 5}

• {1} {{1,2}, {4}, 5}

• {1,2} {{1,2}, {4}, 5}

• {1,2} {1, 2, 3, 4, 5}

Page 14: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

14

3. Predicates:

3.2 Definition: Subset (). Given 2 sets A and B,

A B iff x, xA xB

A

A B

B

Page 15: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

15

3. Predicates:

Examples

3.2 Definition: Subset (). Given 2 sets A and B,

A B iff x, xA xB

• {1,2} {{1,2}}• {1,2} not {1,{2}}

• {1,2} {1,2,3}

• {1,2} Z

• {} {1,2}

• Is 2 {1,2,3} ?• Is {2} {1,2,3} ?

• Is {2} {2,{2}} ?

• Is 2 {1,2,3} ?• Is {2} {1,2,3} ?

• Is {2} {2,{2}} ?

Note the difference between ‘’ and ‘’. No.

Yes.

Yes.

Yes.

No.

Yes.

Page 16: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

16

3. Predicates:

3.3 Definition: Set Equality (). Given 2 sets A, B,

A B iff A B B A

Page 17: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

17

3. Predicates:

3.4 Definition: Proper Subset (). Given 2 sets A and B,

A B iff A B A B

A

A B

B

Page 18: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

18

3. Predicates:

3.4 Definition: Proper Subset (). Given 2 sets A and B,

A B iff A B A B

Example:– {1,2} {1,2}– {1,2} {1,2,3}– Z+ Z– Z Q– Q R

Page 19: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

19

Outline

Sets– Defn & Notation– Examples– Remarks– Predefined Sets– Defining a set

Venn Diagrams Predicates

– Membership ()– Subset ()– Equality ()– Proper Subset ()

Functors (Operation)– Union ()– Intersection ()– Difference ()– Complement (c)

Proofs Special sets

– Empty Set– Universal Set– Proofs

Set Equivalences More operations on sets

– Power Set– Cartesian product– Disjoint Unions

Page 20: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

20

4. Operations (Functors) on sets

If A and B are sets, then

(a) A B (set union)

(b) A B (set intersection)

(c) A B (set difference)

(d) Ac (set complement)

are sets that obey the following axiomatic definitions:

– x, x (A B) iff xA xB– x, x (A B) iff xA xB– x, x (A B) iff xA xB– x, x Ac iff xA

Daffy-nitions

Don’t leave home without them!!!

Page 21: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

21

4. Operations (Functors) on sets

A B

A B

BA

A B

BA

A B

A

Ac

Page 22: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

22

5. Proofs

5.2 Prove that A (B C) (A B) (A C)

Proof:

Assume e A (B C) e A e (B C) e A (e B e C)

A (B C) (A B) (A C)

(e A e B) (e A e C) (e A B) (e A C)

e (A B) (A C)

(A B) (A C) A (B C)

Therefore A (B C) (A B) (A C)

Page 23: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

23

5. Proofs

5.3 Prove that (A B)c Ac Bc

Proof:

Assume e (A B)c

e (A B)

(A B)c Ac Bc

~(e (A B)) ~(e A e B) e A e B

Ac Bc (A B)c

Therefore (A B)c Ac Bc

e Ac e Bc

e Ac Bc

Page 24: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

24

5. Proofs

5.4 Prove that if A B then A B B

Proof:

e A e B

Case 1: e A

e B (Since A B)

Case 2: e B

e A e BAssume e A B

Therefore, if A B then A B B

e B

Assume e B

e A B

Page 25: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

25

Outline

Sets– Defn & Notation– Examples– Remarks– Predefined Sets– Defining a set

Venn Diagrams Predicates

– Membership ()– Subset ()– Equality ()– Proper Subset ()

Functors– Union ()– Intersection ()– Difference ()– Complement (c)

Proofs Special sets

– Empty Set– Universal Set– Proofs

Set Equivalences More operations on sets

– Power Set– Cartesian product– Disjoint Unions

Page 26: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

26

6.1 The Empty Set

Definition: The Empty Set ()– {} is a set with NO elements. – It is known as the empty set and is also denoted

as – It obeys the following axiom:

x, x {}or, worded in another way:

(x, x A) A = {} Misconceptions About the Empty Set:

– {} is an empty set– {{}} is NOT an empty set.

• {{}} has one element: {}• Always look at the outer brackets

– {{},{{}}} is NOT an empty set.

Page 27: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

27

6.2 The Universal Set

Definition: The Universal Set (U)– U is a set with ALL elements. – It is known as the universal set– It obeys the following axiom:

x, x U

or, worded in another way:

(x, x A) A = U

Page 28: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

28

6.3 Proofs involving and U

6.3.1 Theorem: For any set A, A.

Page 29: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

29

6.3 Proofs involving and U

6.3.2 Show that there is only one empty set.

Q: How do we express the idea of ‘only one’?

A: Express it indirectly: ‘there cannot be two’

x, y, If P(x) and P(y), then x = y

Proof: if 1 and 2 be 2 empty sets, then 1 2 .

– Let 1 and 2 be 2 empty sets.

– By previous theorem, 1 2

(Since the empty set 1 must be the subset of any set)

– Also by previous theorem, 2 1

(Since the empty set 2 must be the subset of any set)

– Therefore 1 2, (by definition of set equality).

Page 30: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

30

6.3 Proofs involving and U

6.3.3 Show that A A (Identity Law)

Proof:

Assume e A e A e e (since axiom of empty set: x, x )

e A

Assume e A e A e e A

Note that you can’t go backwards. As long as there is one reason used in the forward direction which is not an IFF reason, the way back is broken.

Page 31: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

31

6.3 Proofs involving and U

6.3.4 Show that A (Universal Bound Law)

Proof:

e A e A e

BUT e (Since x, x )

We just need to show that A has no elements.

Remember the axiom: (x, x ???) ??? = {}

e

(By contradiction): Assume A has some element e.

Contradiction!Therefore e A .

Therefore A has no elements.

Page 32: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

32

6.3 Proofs involving and U

6.3.5 Show that A Ac U (Complementation Law)

Proof:

e U

e A e A

e A e Ac

e A Ac

Page 33: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

33

7. Set Equivalences

Set Equivalences are very similar to Logical Equivalences

– Intersection similar to – Union similar to – Complement similar to ~– Universal set similar to T– Empty set () similar to

List of identities in p247 and p260 of textbook

Page 34: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

34

Outline

Sets– Defn & Notation– Examples– Remarks– Predefined Sets– Defining a set

Venn Diagrams Predicates

– Membership ()– Subset ()– Equality ()– Proper Subset ()

Functors– Union ()– Intersection ()– Difference ()– Complement (c)

Proofs Special sets

– Empty Set– Universal Set– Proofs

Set Equivalences More operations on sets

– Power Set– Cartesian product– Disjoint Unions

Page 35: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

35

8 Power Set

8.1 Definition (Power Set): – Given a set A, the power set of A, denoted as P(A)

is the set of all subsets of A.– It obeys the following axiom:

S, (S A) (S P(A))

Examples:– A = {1,2}, P(A) = {{},{1},{2},{1,2}}– A = {1,2,3}, P(A)={{},{1},{2},{3},{1,2},{1,3},{2,3},

{1,2,3}}– A = {{1},{{2}}}

P(A)={{},{{1}},{{{2}}},{{1},{{2}}}}

Page 36: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

36

8 Power Set , exercises

8.2 Show that for all sets: if A B, then P(A) P(B)

Page 37: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

37

8 Power Set

Theorem: If A has n elements,

then P(A) has 2n elements.

Proof in recommended text (p264,p265)

Page 38: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

38

9 Ordered n-tuple

9.1 Definition: (Ordered n-tuple)

Let n be a positive integer and x1,…,xn be (not necessarily unique) elements. An ordered n-tuple is a collection of n objects denoted as:

(x1,…,xn)

with x1 as the first element, x2 as the second element…xn as the nth element.

NOTE: Ordering of elements is important!

Page 39: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

39

9 Ordered n-tuple

9.2 Examples:– (1,4,2,5,2) is an ordered 5-tuple– (4,3,3,4) is an ordered 4-tuple– (1,3,1) is an ordered 3-tuple, also known as

an ordered triplet.– (5,3) is an ordered 2-tuple, also known as

an ordered pair.– (3) is an ordered 1-tuple, also known as an

singleton.

Page 40: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

40

9 Ordered tuples

9.3 Definition (Equality of ordered tuples) (x1,…,xn) = (y1,…,ym) iff

n=m and x1 = y1 and x2=y2 and … and xn=yn

9.4 Examples:– (1,a) (1,a,c)– (1,a,c) (1,c,a)– (1,a,c) (1,a,c)– (2,4,3) (1+1,22,5-2)

Page 41: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

41

10. Cartesian Product

10.1 Definition (Cartesian Product)– Given 2 Sets A and B, the cartesian

product of A and B is denoted as A x B.

– It obeys the following axiom:(x,y) A B iff xA yB

– We can also write:A B = { (x,y) | xA yB}

Examples:– {1,2} x {2,3} = {(1,2),(1,3),(2,2),(2,3)}

Page 42: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

42

10. Cartesian Product

10.1 Definition (Cartesian Product)– Given 2 Sets A and B, the cartesian

product of A and B is denoted as A x B.

– It obeys the following axiom:(x,y) A B iff xA yB

– We can also write:A B = { (x,y) | xA yB}

Examples:– {1,2,3} x {a,b}

= {(1,a),(2,a),(3,a), (1,b),(2,b),(3,b)}

Page 43: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

43

10. Cartesian Product

10.1 Definition (Cartesian Product)– Given 2 Sets A and B, the cartesian

product of A and B is denoted as A x B.

– It obeys the following axiom:(x,y) A B iff xA yB

– We can also write:A B = { (x,y) | xA yB}

Examples:– {{1},2,{3,4}} x {a,b}

= { ({1},a), (2,a), ({3,4},a),

({1},b), (2,b), ({3,4},b)}

Page 44: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

44

10. Cartesian Product

10.1 Definition (Cartesian Product)– Given 2 Sets A and B, the cartesian

product of A and B is denoted as A x B.

– It obeys the following axiom:(x,y) A B iff xA yB

– We can also write:A B = { (x,y) | xA yB}

Q: {1,2} x {} = ? A: {}

Page 45: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

45

10. Cartesian Product

10.2 Definition (Generalised definition of cartesian product):

Given sets A1,…,An, A1 A2 … An is the set of all ordered n-tuples (x1,…,xn) where x1A1 x2A2 … xnAn

Examples:{1,2} x {2,3} x {a,b}

= {(1,2,a), (1,2,b), (1,3,a), (1,3,b), (2,2,a),

(2,2,b), (2,3,a), (2,3,b)}

Page 46: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

46

10. Cartesian Product (Proofs)

10.3 Show that A x (B C) (A x B) (A x C)

Proof:

Assume (m,n) A x (B C) m A n (B C) m A (n B n C) (m A n B) (m A n C) ((m,n) A x B) ((m,n) A x C)

(m,n) (A x B) (A x C)

Therefore A x (B C) (A x B) (A x C)

Page 47: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

47

11. Disjoint Unions

11.1 Definition:a. Two sets A and B are disjoint iff they

have no elements in common. In other words, A and B are disjoint A B =

b. A1,A2,…,An are mutually disjoint iff

i,j, Ai Aj =

c. {A1,A2,…,An } is a partition of A iff

i. A = A1 A2 … An

ii. A1,A2,…,An are mutually disjoint

Page 48: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

48

11. Disjoint Unions

Partitioning a set

Page 49: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

49

11. Disjoint Unions

11.2 Example: Let Z be the set of all integers.– Let A = {n Z | n = 3k for some integer k}– Let B = {n Z | n = 3k+1 for some integer k}– Let C = {n Z | n = 3k+2 for some integer k}

A = {…,-6,-3,0,3,6,…} B = {…,-5,-2,1,4,7,…} C = {…,-4,-1,2,5,8,…} A B = A C = B C = Z = A B C Therefore {A, B, C} form a partition of Z.

Page 50: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

50

12. Summary: Axiomatic Definitions Subset: A B iff x, xA xB Set Equality: A B iff A B B A Strict Subset: A B iff A B A B Union: x, x (A B) iff xA xB Intersection: x, x (A B) iff xA xB Difference: x, x (A B) iff xA xB Complement: x, x Ac iff xA Empty Set: (x, x {}) …or…(x, x A) A = {} Universal Set: (x, x U) …or …(x, x A) A = U Power Set: S, (S A) (S P(A)) Tuple Equality: (x1,…,xn) = (y1,…,ym) iff

n=m x1 = y1 x2=y2 … xn=yn

Cartesian Prod:(x,y) A B iff xA yB Disjoint Union: …

Page 51: 1 Introduction (Pengenalan) n About the Lecturer: –Nama lengkap: Heru Suhartanto, Ph.D –Kantor: Ruang 1214, Gedung A, Fakultas Ilmu Komputer UI, Depok.

51

Power sets, disjoint unions, ordered pairs and Cartesian Products are used in the lectures on Relations.

End of lecture