The aim of education is to teach students how to think rather than what to think. Sets The set is the fundamental discrete structure on which all other.

Slides:



Advertisements
Similar presentations
Introduction to Set Theory
Advertisements

More Set Definitions and Proofs 1.6, 1.7. Ordered n-tuple The ordered n-tuple (a1,a2,…an) is the ordered collection that has a1 as its first element,
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Week 21 Basic Set Theory A set is a collection of elements. Use capital letters, A, B, C to denotes sets and small letters a 1, a 2, … to denote the elements.
2.1 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.
Sets DISCRETE STRUCTURE ABDUL BASIT TAHIR, KAMRAN ALI, FAIZAN ILLAHI, NOMAN AHMAD, ARSALAN MUBASHIR.
Analytical Methods in CS (CIS 505)
Sets Sections 2.1 and 2.2 of Rosen Fall 2008 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions:
Discrete Structures Chapter 3 Set Theory Nurul Amelina Nasharuddin Multimedia Department.
Sets 1.
CSE115/ENGR160 Discrete Mathematics 02/10/11 Ming-Hsuan Yang UC Merced 1.
Sets 1.
Mathematics.
2.1 – Symbols and Terminology Definitions: Set: A collection of objects. Elements: The objects that belong to the set. Set Designations (3 types): Word.
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
Definition and Representation A set is a well-defined collection of objects; The objects are called elements or members of the set; A set can be represented.
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
Set Theory Dr. Ahmed Elmoasry. Contents Ch I: Experiments, Models, and Probabilities. Ch II: Discrete Random Variables Ch III: Discrete Random Variables.
Mathematical Proofs. Chapter 1 Sets 1.1 Describing a Set 1.2 Subsets 1.3 Set Operations 1.4 Indexed Collections of Sets 1.5 Partitions of Sets.
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (1)
CompSci 102 Discrete Math for Computer Science
Slide Chapter 2 Sets. Slide Set Concepts.
Developed by CSE Dept. cist Bhopal
Unit 2 Sets.
ELEMENTARY SET THEORY.
Chapter SETS DEFINITION OF SET METHODS FOR SPECIFYING SET SUBSETS VENN DIAGRAM SET IDENTITIES SET OPERATIONS.
Definition of a Set DM is study of discrete structures. Fundamental discrete structure upon which most of other discrete structures are built is the sets.
Module Code MA1032N: Logic Lecture for Week Autumn.
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 11 Basic Structure : Sets, Functions, Sequences, and Sums Sets Operations.
Chapter 2 With Question/Answer Animations. Section 2.1.
Rosen 1.6, 1.7. Basic Definitions Set - Collection of objects, usually denoted by capital letter Member, element - Object in a set, usually denoted by.
1 Chapter Two Basic Concepts of Set Theory –Symbols and Terminology –Venn Diagrams and Subsets.
(CSC 102) Lecture 13 Discrete Structures. Previous Lectures Summary  Direct Proof  Indirect Proof  Proof by Contradiction  Proof by Contra positive.
Sets Definition: A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a.
Discrete Mathematics Set.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Discrete Mathematics CS 2610 August 31, Agenda Set Theory Set Builder Notation Universal Set Power Set and Cardinality Set Operations Set Identities.
The Basic Concepts of Set Theory. Chapter 1 Set Operations and Cartesian Products.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
Introduction to Set Theory (§1.6) A set is a new type of structure, representing an unordered collection (group, plurality) of zero or more distinct (different)
CPCS 222 Discrete Structures I
CSE15 Discrete Mathematics 02/13/17
Chapter 4 Introduction to Set Theory
Dr. Ameria Eldosoky Discrete mathematics
Sets Page 746.
Chapter two Theory of sets
Sets Finite 7-1.
Set Definition: A set is unordered collection of objects.
CHAPTER 3 SETS, BOOLEAN ALGEBRA & LOGIC CIRCUITS
The Language of Sets If S is a set, then
CSNB 143 Discrete Mathematical Structures
Set, Combinatorics, Probability & Number Theory
The Basic Concepts of Set Theory
Sets Section 2.1.
Chapter 1 Logic and Proofs Homework 2 Given the statement “A valid password is necessary for you to log on to the campus server.” Express the statement.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
CS100: Discrete structures
Set and Set Operations Grab a sheet from front.
Set Operations Section 2.2.
The Basic Concepts of Set Theory
2.1 Sets Dr. Halimah Alshehri.
Sets. EXAMPLE 1 The set O of odd positive integers less than 10 can be expressed by O = { l, 3, 5, 7, 9}. * This way of describing a set is known as.
Discrete Mathematics CS 2610
2 Chapter Numeration Systems and Sets
Chapter 7 Logic, Sets, and Counting
Lecture Sets 2.2 Set Operations.
Sets & Set Operations.
Introduction A set is a collection of objects.
Presentation transcript:

The aim of education is to teach students how to think rather than what to think. Sets The set is the fundamental discrete structure on which all other discrete structures are built.

Sets Definition. A Set is an unordered collection of objects, called elements or members of the set. Definition. The elements of a set are the objects in a set. Notation. Usually we denote sets with upper-case letters, elements with lower-case letters. The following notation is used to show set membership means that x is a member of the set A means that x is not a member of the set A.

Ways of Describing Sets List the elements Give a verbal description “A is the set of all integers from 1 to 6, inclusive”

Another way to describe sets is to use set builder notation. For instance, the set O of all odd positive integers less than 10 can be written as O = {x | x is an odd positive integer less than 10}, or, specifying the universe as the set of positive integers, as O = {x ∈ Z+| x is odd and x < 10}. We often use this type of notation to describe sets when it is impossible to list all the elements of the set. . 2/18/2019

Special Sets of Numbers N = The set of natural numbers. = {0, 1, 2, 3, …}. Z = The set of integers. = { …, -3, -2, -1, 0, 1, 2, 3, …} Q = The set of rational numbers. ={x| x=p/q, where p and q are elements of Z and q ≠ 0 } H = The set of irrational numbers. R = The set of real numbers. C = The set of complex numbers.

Some Special Sets The Null Set or Empty Set. This is a set with no elements, often symbolized by The Universal Set. This is the set of all elements currently under consideration, and is often symbolized by U or

The Empty Set The empty set is a special set. It contains no elements. It is usually denoted as { } or . The empty set is always considered a subset of any set. Do not be confused by this question: Is this set {0} empty? It is not empty! It contains the element zero.

Universal Set and Subsets The Universal Set denoted by U is the set of all possible elements used in a problem. When every element of one set is also an element of another set, we say the first set is a subset of the second set. Example A={1, 2, 3, 4, 5} and B={2, 3} We say that B is a subset of A. The notation we use is B A. Let S={1,2,3}, list all the subsets of S. The subsets of S are , {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}.

The singleton set A set with one element is called a singleton set. A common error is to confuse the empty set ∅ with the set {∅}, which is a singleton set. The single element of the set {∅} is the empty set itself! A useful analogy for remembering this difference is to think of folders in a computer file system. The empty set can be thought of as an empty folder and the set consisting of just the empty set can be thought of as a folder with exactly one folder inside, namely, the empty folder. 2/18/2019

Membership Relationships Definition. Subset. “A is a subset of B”   We say “A is a subset of B” if , i.e., all the members of A are also members of B. The notation for subset is very similar to the notation for “less than or equal to,” and means, in terms of the sets, “included in or equal to.”

Membership Relationships Definition. Proper Subset.   “ A is a proper subset of B” We say “A is a proper subset of B” if all the members of A are also members of B, but in addition there exists at least one element c such that but . The notation for subset is very similar to the notation for “less than,” and means, in terms of the sets, “included in but not equal to.”

Difference between proper subset and subset Simply: A PROPER subset is any subset of a set EXCEPT ITSELF and the NULL SET. So for instance, if you start with the set {green, eggs, ham, cheese}; {ham, cheese} is a proper subset, but {green, eggs, ham, cheese} is NOT a proper subset. 2/18/2019

Combining Sets – Set Union “A union B” is the set of all elements that are in A, or B, or both. This is similar to the logical “or” operator.

Combining Sets – Set Intersection “A intersection B” is the set of all elements that are in both A and B. This is similar to the logical “and”

Set Complement “A complement,” or “not A” is the set of all elements not in A. The complement operator is similar to the logical not, and is reflexive, that is,

Set Difference The set difference “A minus B” is the set of elements that are in A, with those that are in B subtracted out. Another way of putting it is, it is the set of elements that are in A, and not in B, so

Examples

Remark: Note that the concept of a datatype, or type, in computer science is built upon the concept of a set. In particular, a datatype or type is the name of a set, together with a set of operations that can be performed on objects from that set. For example, boolean is the name of the set {0, 1} together with operators on one or more elements of this set, such as AND, OR, and NOT. 2/18/2019

Venn Diagram: Example U A set can be represented graphically using a Venn Diagram U x y B A z a C

Set Operators: Union Definition: The union of two sets A and B is the set that contains all elements in A, B, or both. We write: AB = { x | (a  A)  (b  B) } U A B

Disjoint Sets Definition: Two sets are said to be disjoint if their intersection is the empty set: A  B =  U A B

Set Operators: Intersection Definition: The intersection of two sets A and B is the set that contains all elements that are element of both A and B. We write: A  B = { x | (a  A)  (b  B) } U A B

Set Difference Definition: The difference of two sets A and B, denoted A\B ($\setminus$) or A−B, is the set containing those elements that are in A but not in B U A B

Set Complement Definition: The complement of a set A, denoted A ($\bar$), consists of all elements not in A. That is the difference of the universal set and A: U\A A= AC = {x | x  A } U A A

Mutually Exclusive and Exhaustive Sets Definition. We say that a group of sets is exhaustive of another set if their union is equal to that set. For example, if we say that A and B are exhaustive with respect to C. Definition. We say that two sets A and B are mutually exclusive if , that is, the sets have no elements in common.

Some Test Questions

Some Test Questions

Cardinal Number The Cardinal Number or cardinality of a set is the number of distinct elements in the set and is denoted by n(A) or |A| . Let A={2,4,6,8,10}, then n(A)=5. The Cardinal Number formula for the union of two sets is n(A U B)=n(A) + n(B) – n(A∩B). The Cardinal number formula for the complement of a set is n(A) + n(A’)=n(U).

Power Set (1) Definition: The power set of a set S, denoted P(S), is the set of all subsets of S. Examples Let A={a,b,c}, P(A)={,{a},{b},{c},{a,b},{b,c},{a,c},{a,b,c}} Let A={{a,b},c}, P(A)={,{{a,b}},{c},{{a,b},c}} Note: the empty set  and the set itself are always elements of the power set.

Power Set (2) The power set is a fundamental combinatorial object useful when considering all possible combinations of elements of a set Fact: Let S be a set such that |S|=n, then |P(S)| = 2n

Computer Representation of Sets (1) There really aren’t ways to represent infinite sets by a computer since a computer has a finite amount of memory If we assume that the universal set U is finite, then we can easily and effectively represent sets by bit vectors Specifically, we force an ordering on the objects, say: U={a1, a2,…,an} For a set AU, a bit vector can be defined as, for i=1,2,…,n bi=0 if ai  A bi=1 if ai  A

Assume that the universal set U is finite (and of reasonable size so that the number of elements of U is not larger than the memory size of the computer being used). First, specify an arbitrary ordering of the elements of U, for instance a1, a2, . . . , an. Represent a subset A of U with the bit string of length n, where the ith bit in this string is 1 if ai belongs to A and is 0 if ai does not belong to A. 2/18/2019

example Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, and the ordering of elements of U has the elements in increasing order; that is, ai = i. What bit strings represent the subset of all odd integers in U, the subset of all even integers in U, and the subset of integers not exceeding 5 in U? 2/18/2019

Solution The bit string that represents the set of odd integers in U, namely, {1, 3, 5, 7, 9}, has a one bit in the first, third, fifth, seventh, and ninth positions, and a zero elsewhere. It is 10 1010 1010. (We have split this bit string of length ten into blocks of length four for easy reading.) Similarly, we represent the subset of all even integers in U, namely, {2, 4, 6, 8, 10}, by the string 01 0101 0101. The set of all integers in U that do not exceed 5, namely, {1, 2, 3, 4, 5}, is represented by the string 11 1110 0000. 2/18/2019

Example 2 We have seen that the bit string for the set {1, 3, 5, 7, 9} (with universal set {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) is 10 1010 1010. What is the bit string for the complement of this set? Solution: The bit string for the complement of this set is obtained by replacing 0s with 1s and vice versa. This yields the string 01 0101 0101, which corresponds to the set {2, 4, 6, 8, 10}. 2/18/2019

Bit string representation for the union and intersection of two sets To obtain the bit string for the union and intersection of two sets we perform bitwise Boolean operations on the bit strings representing the two sets. The bit in the ith position of the bit string of the union is 1 if either of the bits in the ith position in the two strings is 1 (or both are 1), and is 0 when both bits are 0. Hence, the bit string for the union is the bitwise OR of the bit strings for the two sets. The bit in the ith position of the bit string of the intersection is 1 when the bits in the corresponding position in the two strings are both 1, and is 0 when either of the two bits is 0 (or both are). Hence, the bit string for the intersection is the bitwise AND of the bit strings for the two sets. 2/18/2019

Example The bit strings for the sets {1, 2, 3, 4, 5} and {1, 3, 5, 7, 9} are 11 1110 0000 and 10 1010 1010, respectively. Use bit strings to find the union and intersection of these sets. Solution: The bit string for the union of these sets is 11 1110 0000 ∨ 10 1010 1010 = 11 1110 1010, which corresponds to the set {1, 2, 3, 4, 5, 7, 9}. The bit string for the intersection of these sets is 11 1110 0000 ∧ 10 1010 1010 = 10 1010 0000, which corresponds to the set {1, 3, 5}. 2/18/2019

Computer Representation of Sets (2) Examples Let U={0,1,2,3,4,5,6,7} and A={0,1,6,7} The bit vector representing A is: 1100 0011 How is the empty set represented? How is U represented? Set operations become trivial when sets are represented by bit vectors Union is obtained by making the bit-wise OR Intersection is obtained by making the bit-wise AND

Computer Representation of Sets (3) Let U={0,1,2,3,4,5,6,7}, A={0,1,6,7}, B={0,4,5} What is the bit-vector representation of B? Compute, bit-wise, the bit-vector representation of AB Compute, bit-wise, the bit-vector representation of AB What sets do these bit vectors represent?