Discrete Math Lecture Notes 2024-2025 Fall Semester PDF

Document Details

PolishedSnake

Uploaded by PolishedSnake

The Egyptian E-Learning University

2024

Basem Mohamed Elomda

Tags

discrete mathematics set theory mathematics lecture notes

Summary

These are lecture notes from an Information Technology course, Discrete Mathematics, at the Egyptian E-Learning University (EELU) during the Fall Semester 2024-2025. Covering topics such as sets, set operations, relations, and set theory identities, it includes examples and exercises. These notes are useful for students studying discrete mathematics.

Full Transcript

2024-2025 Fall Semester Discrete Mathematics. 1 MA 112 : Discrete Structures Week 1 2 2 MA 112 : Discrete Structures  Instructor: Basem Mohamed Elomda E...

2024-2025 Fall Semester Discrete Mathematics. 1 MA 112 : Discrete Structures Week 1 2 2 MA 112 : Discrete Structures  Instructor: Basem Mohamed Elomda E-mail: My Office : Lecture : 3 Computer Science Department 3 Text Book : “Discrete Mathematics and its Application “, by K.Rosen , 8th Edition , Course URL: Use lecture notes as a study guide. 4 4 Assessment method Activity % assignments Quizzes Tutorial and Lab Attendance Performance and Interaction (electronic and physical) Mid -Term Exam 20 Final Exam 50 Total 100 5 Topics Covered This course will cover the following topics: Sets And Sets Operations Functions Relations Mathematical Induction Propositional Logic Proof Technical. Graphs. Trees 6 Computer Science Department 6 7 Sets and sets operations Sets Lecture Contents Set Definition. Some Important Sets. Notation used to describe membership in sets. How to describe a set? Venn diagrams. Subset. Finite and Infinite Sets. Cardinality. 8 Computer Science Department 8 Lecture Contents The power of a set. Cartesian Products. Sets Operations. Exercises. 9 Computer Science Department 9 Sets DEFINITION 1 A set is an unordered collection of objects. DEFINITION 2 The objects in a set are called the elements, or members, of the set. A set is said to contain its elements. We write a  A to denote that a is an element of the set A. The notation a  A denotes that a is not an element of the set A. It is common for sets to be denoted using uppercase letters. Lowercase letters are usually used to denote elements of sets. 𝑒. 𝑔. 𝑆 = {𝑎, 𝑏, 𝑐, 𝑑} We have 𝑎 ∈ 𝑆 since 𝑎 is an element of the set 𝑆, but 𝑒 ∉ 𝑆 since 𝑒 is not an element of the set 𝑆 10 Computer Science Department 10 How to describe a set? List all the members of a set, when this is possible. We use a notation where all members of the set are listed between braces { }. This way of describing a set is known as the roster method. Note that: In the roster method The order in which the elements of a set are listed does not matter. It does not matter if an element of a set is listed more than once, so {1, 3, 3, 3, 5, 5, 5, 5} is the same as the set {1, 3, 5} because they have the same elements. 11 Computer Science Department 11 Example : The set V of all vowels in the English alphabet can be written as V = {a, e, i, o, u}. The set O of odd positive integers less than 10 can be expressed by O = {1,3,5,7,9}. Sometimes the roster method is used to describe a set without listing all its members. Some members of the set are listed, and then ellipses (...) are used when the general pattern of the elements is obvious. Example: The set A of positive integers less than 100 can be denoted by A={1, 2, 3,... , 99}. Set of all integers less than 0: S= {…., -3,-2,-1} 12 12 How to describe a set? Another way to describe a set is to use set builder notation. We characterize all those elements in the set by stating the property or properties they must have to be members. Example: the set O of all odd positive integers less than 10 can be written as: O = {x | x is an odd positive integer x > 50}. Definition: A set that contains an infinite number of elements is called an infinite set. e.g., S = {x: x ∈ N and x > 10}. 30 Set Cardinality: (size, | | ) Definition The cardinality of a set A,|A|, is the number of elements in A. Written as |A| Examples Let R = {1, 2, 3, 4, 5}. Then |R| = 5 || = 0 Let S = {, {a}, {b}, {a, b}}. Then |S| = 4 |{1,2,3}| = 3, |{a,b}| = 2, |{{1,2,3},{4,5}}| =2 Let A be the set of odd positive integers less than 1 0. Then I A I = 5. Let S be the set of letters in the English alphabet. Then l S I = 26. 31 Computer Science Department 31 Cardinality: Find S = {1,2,3}, |S| = |{1,2,3} | = 3. S = {3,3,3,3,3}, |S| = 1 S = , |S| = |  | = 0. S = { , {}, {,{}} }, |S| = 3. S = {0,1,2,3,…}, |S| is infinite S = { } |S| = | { } | = 1. 32 Computer Science Department 32 The power of a set: Power Set Definition Given a set 𝑆, the power set of S is the set of all subsets of the set 𝑆. The power set of 𝑆 is denoted by 𝑃(𝑆). Remark if S set has n elements , then the power set P (S) has 2n elements. Example What is the power set of the set {0, 1, 2}? 𝑷(𝑺) = 𝟐𝟑 = 𝟖 𝐞𝐥𝐞𝐦𝐞𝐧𝐭𝐬 Solution: The power set 𝑃({0, 1, 2}) is the set of all subsets of {0, 1, 2}. Hence, 𝑃({0, 1, 2}) = {∅, {0}, {1}, {2}, {0, 1}, {0, 2}, {1, 2}, {0, 1, 2}}. Note that the empty set and the set itself are members of this set of subsets. 33 The power of a set: Example: Find the power set of the set A = {a,b}. Solution: The power set P(A) N.B. the power set of any subset P(A) = { ø, {a}, {b}, {a, b} }. has at least two elements The null set and the set itself Example: Find the power set of the set T = {0, 1, 2}. Solution: P(T) = P({0,1,2})= { , {0},{1},{2},{0,1},{0,2},{1,2},{0,1,2}} Note that |T| = 3 and |P(T)| = 8 34 Computer Science Department 34 The power of a set: What is the power set of the empty set? What is the power set of the set {∅}? Solution: The empty set has exactly one subset, namely, itself. Consequently, 𝑃(∅) = {∅} The set {∅} has exactly two subsets, namely, ∅ and the set {∅} itself. Therefore, 𝑃({∅}) = {∅, {∅}}. 35 The power of a set: Quick Quiz: Find the power set of the following: S = {a}, S = {a,b}, S = , S = {,{}}, 36 Computer Science Department 36 Ordered n-tuples Definition The ordered n-tuple (a1, a2, …, an) is the ordered collection that has a1 as its first element, a2 as its second element,... , and an as its nth element. We say that two ordered n-tuples are equal if and only if each corresponding pair of their elements is equal. In other words, (a1, a2, …, an) = (b1, b2, …, bn) if and only if ai = bi , for i = 1, 2,... , n. In particular, ordered 2-tuples are called ordered pairs. The ordered pairs (a, b) and (c, d) are equal if and only if a = c and b = d. Note that (a, b) and (b, a) are not equal unless a = b. 37 (c)2001-2003, Michael P. Frank 37 The Cartesian product of two sets DEFINITION Let A and B be sets. The Cartesian product of A and B, denoted by A x B, is the set of all ordered pairs (a,b), where a ϵ A and b ϵ B. Hence, A x B = {(a , b) | a ϵ A ᴧ b ϵ B }. DEFINITION The Cartesian product of n set A1, A2, …, An is denoted by A1×A2×…×An and is defined as: A1×A2×…×An={(a1, a2,…, an) | aiAi for I =1,2,…,n}. Note that The Cartesian product is not commutative, i.e. A x B and B x A are not equal unless A =  or B =  (so that A x B = ) or A = B. For finite A, B, |AB|=|A||B|. 38 The Cartesian product of two sets Example : If A={1,2} , B={3,4} find A×B and B×A. Solution A×B={(1,3),(1,4),(2,3),(2,4)} B×A={(3,1),(3,2),(4,1),(4,2)} Example: If A = {a,b} B = {1,2,3} find A × B. Solution A × B = {(a,1),(a,2),(a,3), (b,1),(b,2),(b,3)}. Example: If A = {x, y, z, w}, B = {a, b} find B × A and B × B. Solution B × A = {(a,x), (a,y), (a,z), (a,w), (b,x), (b,y), (b,z), (b,w)}. B × B = {(a,a), (a,b), (b,a), (b,b)}. 39 The Cartesian product of two sets Example: What is the Cartesian product A × B × C, where A = {0, 1}, B = {1, 2}, and C = {0, 1, 2}? Solution: AxBxC = {(0,1,0), (0,1,1), (0,1,2), (0,2,0), (0,2,1), (0,2,2), (1,1,0), (1,1,1), (1,1,2), (1,2,0), (1,2,1), (1,2,2)}. 40 Computer Science Department 40 Review: Set Notations So Far Variable objects x, y, z; sets S, T, U. Literal set {a, b, c} and set-builder {x|P(x)}.  relational operator, and the empty set . Set relations =, , , , , , etc. Venn diagrams. Cardinality |S| and infinite sets N, Z, R. Power sets P(S). Cartesian product A × B. 41 41 42 Sets and sets operations Sets Operations Computer Science Department UNION: ∪ Definition Let A and B be sets. The union of the sets A and B, denoted by 𝐴 ∪ 𝐵, is the set that contains those elements that are either in A or in B, or in both. 𝐴 ∪ 𝐵 = {𝑥 ∣ 𝑥 ∈ 𝐴 ∨ 𝑥 ∈ 𝐵}. 43 43 UNION: ∪ EXAMPLE: If A = {1, 2, 3}, and B = {2, 4}, find A ∪ B. Solution: A ∪ B = {1,2,3,4} EXAMPLE : Find {1,2,3} ∪ {3, 4, 5}. Solution: {1,2,3} ∪ {3, 4, 5} = {1,2,3,4,5}. :EXAMPLE Find the union of the sets {1,3,5} and {1,2,3}. Solution: {1,3,5} U {1,2,3} = {1,2,3,5}. 44 Computer Science Department 44 Intersection: ∩ Definition: Let A and B be sets. The intersection of the sets A and B, denoted by A ∩ B, is the set containing those elements in both A and B. A ∩ B = { x | x  A  x  B} 45 Computer Science Department 45 Intersection: ∩ EXAMPLE Find {1,2,3} ∩ {3,4,5}. Solution: {1,2,3} ∩ {3,4,5} = {3}. EXAMPLE Find the intersection of the sets {1,3,5} and {1,2,3}. Solution: {1,3,5} ∩ {1,2,3} = {1,3}. EXAMPLE Find the intersection of the sets {1,2,3} and {4,5,6}. Solution: {1,2,3} ∩ {4,5,6} = . 46 9-Oct-24 Computer Science Department 46 (Disjoint Sets) DEFINITION Two sets are called disjoint if their intersection is the empty set, i.e. AB = . B Sets whose intersection A is empty are called disjoint sets For Example: the set of even integers is disjoint with the set of odd integers. 47 Computer Science Department 47 (Disjoint Sets) Example: Are {1,2,3} and {4,5,6} disjoint? Solution: {1,2,3} ∩ {4,5,6} = ∅, then {1,2,3} and {4,5,6} are disjoint. Example: Let A = {1,3,5,7,9} and B = {2, 4, 6, 8 , 10}. Are A and B disjoint? Solution: A and B are disjoint because A ∩ B = Ф. 48 Computer Science Department 48 The Cardinality Of a Union Of Two Finite Sets The principle of inclusion-exclusion  Let A and B be any two finite sets, then I A U B I = I A I + I B I - I A ∩ B I.  Let A and B be two finite disjoint sets, then I A U B I = I A I + I B I. 49 Difference: Definition Let A and B be sets. The difference of A and B, denoted by A − B, is the set containing those elements that are in A but not in B. A-B={x:xAxB} 50 Computer Science Department 50 Difference: EXAMPLE Find the difference of {1,3,5} and {1,2,3}. Solution {1,3,5} - {1,2,3} = {5}. Caution! This is different from the difference of {1,2,3} and {1,3,5}, which is the set {2}. {1,2,3}- {1,3,5} = {2}. 51 Computer Science Department 51 Symmetric Difference: Definition The symmetric difference of A and B, denoted by A ⊕ B, is the set containing those elements in either A or B, but not in both A and B. A  B = (A - B)  (B - A) = (A  B) - (A  B ) 52 Computer Science Department 52 Symmetric Difference: Example: If A = {1,2,3,4,5,6,7} and B = {3,4,p,q,r,s}. Find A  B, A  B, and A  B. Solution A  B = {1,2,3,4,5,6,7,p,q,r,s} A  B = {3,4} A  B = (A  B) - (A  B ) = {1,2,5,6,7,p,q,r,s}. Example: If A = {1,2,3,4,5} and B = {4,5,6,7,8}. Find A  B. Solution A – B = {1,2,3}, B – A = {6,7,8} A  B = (A - B)  (B - A) = {1,2,3,6,7,8}. 53 Computer Science Department 53 Universal Set Definition: If there are some sets under consideration, then there happens to be a set that contains each one of the given sets. Such a set is known as the universal set and it is denoted by U. Example: Let A = {2, 4, 6}, B = {1, 3, 5} and C = {0, 7}. Then, U = {0, 1, 2, 3, 4, 5, 6, 7} is a universal set. For the set of all integers, the universal set can be the set of rational numbers or the set of real numbers. 54 Complement: Definition ഥ , is the Let U be the universal set. The complement of the set A, denoted by A complement of A with respect to U. Therefore, the complement of the set A is U − A. ഥ = A’ = { x : x  A} A It is also written as Ac U A =U AB=BA and U= 55 Computer Science Department 55 Set Theory - Identities Identity AU=A AU=A Domination AU=U A=A Idempotent AA=A AA=A 56 56 Set Theory – Identities, cont. Complement Laws AA=U AA= Double complement A=A (A )  A c c 57 57 Set Theory - Identities, cont. Commutativity AUB =B U A A  B =B  A Associativity (A U B) U C = A U (B U C) (A  B)  C = A  (B  C) Distributivity A U (B  C) = (A U B)  (A U C) A  (B U C) = (A  B) U (A  C) 58 58 DeMorgan’s I (A U B) = A  B DeMorgan’s II (A  B) = A U B 59 59 06-04-1446 Computer Science Department 60 TABLE 1: Set Identities Identity Name AU =A Identity laws AU=A AU U=U Domination laws A= A  A=A Idempotent laws AA=A (A) = A Complementation laws A B=B  A Commutative laws AB=BA A  (B  C) = (A  B)  C Associative laws A  (B  C) = (A  B)  C A  (B U C) = (A  B)  (A  C) Distributive laws A  (B  C) = (A U B)  (A U C) AUB=AB De Morgan’s laws AB=AUB A  (A  B) = A Absorption laws A  (A  B) = A A  A=U Complement laws 9-Oct-24 AA= Computer Science Department 61 Let’s proof one of the Identities Using a Membership Table A  (B  C) = (A  B)  (A  C) TABLE 2: A Membership Table for the Distributive Property A B C B  C A  (B  C) AB AC (A  B)  (A  C) 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 Computer Science Department 62 Exercise 1: List the members of these sets: a) {x | x is a real number such that x² = 1} b) {x | x is a positive integer less than 12} c) {x | x is the square of an integer and x < 100} d) {x | x is an integer such that x² = 2} 63 Computer Science Department 63 Exercise 2: Determine whether each of these pairs of sets are equal: a) {4, 3, 3, 7, 4, 7, 7, 3}, {4, 3, 7} b) {{1}}, {1, {2}} c) , {} 64 Computer Science Department 64 Exercise 3: Determine whether these statements are true or false. a) 0 ∈ ∅ b) ∅ ∈ {0} c) {0} ⊂ ∅ d) ∅ ⊂ {0} e) {0} ∈ {0} f) {0} ⊂ {0} g) {∅} ⊆ {∅} 65 Computer Science Department 65 Exercise 4: Use a Venn diagram to illustrate the relationships 𝐀 ⊂ 𝑩 𝒂𝒏𝒅 𝑩 ⊂ 𝑪. 66 Computer Science Department 66 Exercise 5: What is the cardinality of each of these sets? a) {a} b) {{a}} c) {∅, {∅}} d) {a, {a}, {a, {a}}} 67 9-Oct-24 Computer Science Department 67 Exercise 6: Let A = {1, 2, 3, 4, 5} and B = {0, 3, 6}. Find : a) A ∪ B b) A ∩ B c) A – B d) B – A 68 9-Oct-24 Computer Science Department 68 Exercise 7: For U = {1, 2,3, 4,5,6,7,8,9,10} let A = {1, 2,3,4,5} , B = {1,2, 4,8}, C = {1, 2,3,5,7}, and D = {2, 4,6,8}. Determine each of the following: a) (A∪B)∩C = b) A∪(B∩C)= c) C ∪ D = d) (A∪B)−C = e) A∪(B−C)= f) (B −C)−D = g) B−(C−D)= h) (A∪B)−(C ∩D)= i) A ⊕ B = 69 9-Oct-24 Computer Science Department 69 Exercise 8: Draw the VENN DIAGRAM of these sets and find (A∪B)−C and B′ 70 Computer Science Department 70 Exercise 9: Given the Universal set U={positive integers not larger than 12}, and the sets : A={positive integers not more than 6}, B={3,4,6,7} , C={5,6,7,8,9,10} , Find : i) A U B = ii) | A−B |= iii) P(A‐B)=Power set of (A‐B)= 71 Computer Science Department 71 72

Use Quizgecko on...
Browser
Browser