Sets, Permutations, and Combinations. Lecture 4-1: Sets Sets: Powerful tool in computer science to solve real world problems. A set is a collection of.

Slides:



Advertisements
Similar presentations
Sets Lecture 11: Oct 24 AB C. This Lecture We will first introduce some basic set theory before we do counting. Basic Definitions Operations on Sets Set.
Advertisements

Discrete Mathematics Lecture 5 Alexander Bukharovich New York University.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Instructor: Hayk Melikya
2.1 Sets ‒Sets ‒Common Universal Sets ‒Subsets 2.2 Set Operations 2.3 Functions 2.4 Sequences and Summations 1.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Sets DISCRETE STRUCTURE ABDUL BASIT TAHIR, KAMRAN ALI, FAIZAN ILLAHI, NOMAN AHMAD, ARSALAN MUBASHIR.
Denoting the beginning
SET.   A set is a collection of elements.   Sets are usually denoted by capital letters A, B, Ω, etc.   Elements are usually denoted by lower case.
Discrete Structures Chapter 3 Set Theory Nurul Amelina Nasharuddin Multimedia Department.
EE1J2 – Discrete Maths Lecture 7
Sets 1.
CSE115/ENGR160 Discrete Mathematics 02/10/11 Ming-Hsuan Yang UC Merced 1.
Sets 1.
1 Set Theory. Notation S={a, b, c} refers to the set whose elements are a, b and c. a  S means “a is an element of set S”. d  S means “d is not an element.
Mathematics.
This section will discuss the symbolism and concepts of set theory
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
Partially borrowed from Florida State University
Objectives: By the end of class, I will be able to:  Identify sets  Understand subsets, intersections, unions, empty sets, finite and infinite sets,
Set Theory. What is a set?  Sets are used to define the concepts of relations and functions. The study of geometry, sequences, probability, etc. requires.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Sets.
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Sets Defined A set is an object defined as a collection of other distinct objects, known as elements of the set The elements of a set can be anything:
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
Copyright © 2014 Curt Hill Sets Introduction to Set Theory.
Discrete Structure Sets. 2 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.
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.
CS201: Data Structures and Discrete Mathematics I
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (1)
CompSci 102 Discrete Math for Computer Science
Section 2.1. Section Summary Definition of sets Describing Sets Roster Method Set-Builder Notation Some Important Sets in Mathematics Empty Set and Universal.
ELEMENTARY SET THEORY.
Set theory Neha Barve Lecturer Bioinformatics
Chapter SETS DEFINITION OF SET METHODS FOR SPECIFYING SET SUBSETS VENN DIAGRAM SET IDENTITIES SET 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.
Basic Structures: Sets, Functions, Sequences, and Sums.
Introduction to Set theory. Ways of Describing Sets.
Discrete Mathematics Lecture # 10. Set Theory  A well defined collection of {distinct} objects is called a set.  The objects are called the elements.
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.
Unit :1 Set Theory Prof. A.J. SHAKADWIPI. Sets and Subsets A well-defined collection of objects. finite sets, infinite sets, subset A={1,3,5,7,9} B={x|x.
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.
Section 2.1. Sets A set is an unordered collection of objects. the students in this class the chairs in this room The objects in a set are called the.
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
Section 6.1 Set and Set Operations. Set: A set is a collection of objects/elements. Ex. A = {w, a, r, d} Sets are often named with capital letters. Order.
Set. Outline Universal Set Venn Diagram Operations on Sets.
CSE15 Discrete Mathematics 02/13/17
Dr. Ameria Eldosoky Discrete mathematics
CHAPTER 2 Set Theory A B C.
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
Discrete Mathematical The Set Theory
Set, Combinatorics, Probability & Number Theory
Sets Section 2.1.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
Exercises Show that (P  Q)  (P)  (Q)
CS100: Discrete structures
Set Theory A B C.
        { } Sets and Venn Diagrams Prime Numbers Even Numbers
Discrete Mathematics CS 2610
Discrete Mathematics R. Johnsonbaugh
Chapter 7 Logic, Sets, and Counting
Lecture Sets 2.2 Set Operations.
Sets & Set Operations.
Presentation transcript:

Sets, Permutations, and Combinations

Lecture 4-1: Sets Sets: Powerful tool in computer science to solve real world problems. A set is a collection of elements or objects, and an element is a member of a set. Traditionally, sets are described by capital letters, and elements by lower case letters. –The symbol  means “belongs to”. a  A means that element a belongs to set A. –b  A implies that b is not an element of A. –Braces {} are used to indicate a set. Example –A = {2, 4, 6, 8, 10} 3  A and 2  A

Set theory Ordering –not imposed on the set elements Unique elements –listing elements twice or more is redundant. Two sets are equal if and only if they contain the same elements. –Hence, A == B means (  x)[(x  A  x  B) Λ (x  B  x  A)] Finite and infinite set: described by number of elements in a set –A = {1, 2, 3, 4, …, 100} //finite set; –B={all positive integers} //infinite set

Infinite Sets Members of infinite sets cannot be listed, but a pattern for listing elements could be indicated. – e.g. S = {x  x is a positive even integer} Can use predicate notation to represent sets –e. g. S = {x  P(x)} means (  x)[(x  S  P(x)) Λ (P(x)  x  S)] –Hence, every element of S has the property P and everything that has a property P is an element of S.

Set Theory Examples Describe each of the following sets by listing the elements: –{x | x is a month with exactly thirty days} {April, June, September, November} –{x | x is an integer and 4 < x < 9} {5, 6, 7, 8} What is the predicate for each of the following sets? –{1, 4, 9, 16} {x | x is one of the first four perfect squares} –{2, 3, 5, 7, 11, 13, 17, ….} {x | x is a prime number}

Set Theory Basics Set of sets –Set elements can be a set –e.g. S = {{Andre, Kyle, Jack}, {Amy, Betty}}; A={{1,3,5,…},{2,4,…}} A set with no member –null or empty set (represented by  or {}) –Note that  is different from {  }. The latter is a set with 1 element, which is the empty set. Some notations used for convenience of defining sets –N = set of all nonnegative integers (note that 0  N) –Z = set of all integers –Q = set of all rational numbers –R = set of all real numbers –C = set of all complex numbers

Open and closed interval Open interval –e.g.{x  R | -2 < x < 3} –Denotes the set containing all real numbers between - 2 and 3. This is an open interval, meaning that the endpoints -2 and 3 are not included. Closed interval – e.g. {x  R | -2  x  3} –Similar set but on a closed interval It includes all the numbers in the open interval described above, plus the endpoints.

Subsets For sets S and M, M is a subset of S if, and only if, every element in M is also an element of S. –Symbolically: M  S  (  x), if x  M, then x  S. Subset Example Question –Is S a subset of itself?, i.e. S  S ? If M  S and M  S, then there is at least one element of S that is not an element of M, then M is a proper subset of S. –Symbolically, denoted by M  S

Subset Example Say S is the set of all people, M is the set of all male humans, and C is the set of all computer science students. Subsets –M and C are both subsets of S, because all elements of M and C are also elements of S. –M is not a subset of C since there are elements of M that are not in C (specifically, all males who are not studying computer science).

Supersets A superset is the opposite of subset. If M is a subset of S, then S is a superset of M. –Symbolically, denoted S  M. Likewise, if M is a proper subset of S, then S is a proper superset of M. –Symbolically, denoted S  M.

Cardinality Cardinality of a set is simply the number of elements within the set. The cardinality of S is denoted by |S|. If M is a subset of S, then M  S  |M|  |S| If S is a superset of M, then S  M  |M|  |S|

Exercise A = {x | x  N and x  5}  {5, 6, 7, 8, 9, …… } B = {10, 12, 16, 20} C = {x | (  y)(y  N and x = 2y)}  {0, 2, 4, 6, 8, 10, …….} What statements are true? B  C B  A A  C26  C {11, 12, 13}  A {11, 12, 13}  C {12}  B{12}  B {x | x  N and x < 20}  B 5  A {  }  B   A

More Exercise For the following sets, prove A  B. –A = { x | x  R such that x 2 – 4x + 3 = 0} A = {1, 3} –B = { x | x  N and 1  x  4} B = {1, 2, 3, 4} –All elements of A exist in B, hence A  B (incomplete proof).

Power Set Set of sets From every set, many subsets can be generated. A set whose elements are all such subsets is called the power set. For a set S,  (S) is termed as the power set. For a set S = {1, 2, 3} ;  (S) = { ,{1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}} For a set with n elements, the power set has 2 n elements.

Operations on Sets The union of set A and B, denoted by A  B is the set that contains all elements in either set A or set B, i.e. A  B = {x | x  A or x  B}. The intersection of set A and B, denoted by A  B contain all elements that are common to both sets i.e. A  B = {x | x  A and x  B} If A = { 1,3,5,7,9} and B = {3,7,9,10,15} ; A  B = {1, 3, 5, 7, 9, 10, 15} and A  B = {3, 7, 9}.

More Set Operations The complement of set A, denoted as ~A or A, is the set of all elements that are not in A. A = {x | x  S and x  A } The difference of A-B is the set of elements in A that are not in B. This is also known as the complement of B relative to A. A - B = {x | x  A and x  B } Note A – B = A  B  B – A

Disjoint Sets Given set A and set B, if A  B = , then A and B are disjoint sets. In other words, there are no elements in A that are also in B.

Class Exercise Let A = {1, 2, 3, 5, 10} B = {2, 4, 7, 8, 9} C = {5, 8, 10} be subsets of S = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. Find A  B A – C B  (A  C) A  B  C (A  B)  C

Cartesian Product The cartesian product (cross product) of A and B denoted symbolically by A  B is defined by A  B = {(x,y) | x  A and y  B } –i.e. the set of all combinations of ordered pairs produced from the elements of both sets. –|AxB| = |A| x |B| Example, A = {a, b, c} and B = {1, 2, 3}, A  B = {(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3), (c, 1), (c, 2), (c, 3)} Is A  B = B  A? –Cross-product of a set with itself is represented as A  A or A 2

Cartesian Product Illustration 123 a(a, 1)(a, 2)(a, 3) b(b, 1)(b, 2)(b, 3) c(c, 1)(c, 2)(c, 3)

Cartesian Product Example Application –Relational database –Can extend to A1 x A2 x … x An Example –Students S = {Jean, Jack, John} –Courses C = {130, 140} S x C = ? –Let R = {0, 1} with 0 represents not registered and 1 represents registered. S x C x R = ?

Basic Set Identities Given sets A, B, and C, and a universal set S and a null/empty set , the following properties hold: –Commutative property (cp) A  B = B  A A  B = B  A –Associative property (ap) A  (B  C) = (A  B)  C A  (B  C) = (A  B)  C –Distributive properties (dp) A  (B  C) = (A  B)  (A  C) A  (B  C) = (A  B)  (A  C) –Identity properties(ip)   A = A   = A S  A = A  S = A –Complement properties (comp) A  A = S A  A = 

More Set Identities Double Complement Law (A) = A Idempotent Laws A  A = A A  A = A Absorption properties A  (A  B) = A A  (A  B) = A Alternate Set Difference Representation A - B = A  B Inclusion in Union A  A  B B  A  B Inclusion in Intersection A  B  A A  B  B Transitive Property of Subsets