SlideShare a Scribd company logo
1 of 19
Download to read offline
Set, Combinatorics, Probability &
                     Number Theory



           Mathematical Structures
            for Computer Science
                   Chapter 3	





Copyright © 2006 W.H. Freeman & Co.   MSCS Slides   Set, Combinatorics, Probability & Number 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, sets are represented by capital letters, and
              elements by lower case letters.	

     ●        The symbol ∈ means “belongs to” and is used to represent the
              fact that an element belongs to a particular set. Hence, 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.	


     ●        A = {2, 4, 6, 8, 10} 	

       	

3∉A and 2∈A	





Section 3.1                                      Sets                         1
Set theory
     ●        Ordering is not imposed on the set elements and 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	

     ●        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} or using predicate
              notation.	

          	

S = {x | P(x)} means (∀x)[(x ∈ S → P(x)) Λ (P(x)→ x ∈ S)]
              where P is the unary predicate.	

     ●        Hence, every element of S has the property P and everything
              that has a property P is an element of S.	


Section 3.1                                   Sets                                   2
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}	



Section 3.1                                       Sets                   3
Set Theory Basics
     ●        A set that has no members is called a null or empty set and is
              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	

     ●        Using the above notations and predicate symbols, one can
              describe sets quite easily	

     ●        A = {x | (∃y)[(y∈ {0,1,2}) and (x = y2)]}	

               ■    Hence, A = {0,1, 4}	

     ●        A = {x | x ∈ N and (∀y)(y ∈ {2, 3, 4, 5} → x ≥ y)}	

     ●        B = {x | (∃y)(∃z)(y ∈ {1,2} and z ∈ {2,3} and x = z – y) }	


Section 3.1                                           Sets                          4
Open and closed interval
          	

      	

     	

     	

{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. 	

                ■    By all real numbers, we mean everything such as 1.05, -3/4, and
                     every other real number within that interval.	


          	

     	

      	

      	

{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.	





Section 3.1                                           Sets                               5
Relationship between Sets
     ●        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.	

     ●        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, however, since there are elements of M
              that are not in C (specifically, all males who are not studying
              computer science). 	

     ●        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.	

     ●        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 	





Section 3.1                                         Sets                          6
Relationship between Sets
     ●        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 of a set is simply the number of elements
              within the set.	

     ●        The cardinality of S is denoted by |S|. 	

     ●        By the above definition of subset, it is clear that set M
              must have fewer members than S, which yields the
              following symbolic representation:	

                                 S ⊃ M ⇒ |M| < |S|	


Section 3.1                                   Sets                        7
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 ⊆ C 	

            	

      	

       	

            	

26 ∈ C 	

      	

 √	

      {11, 12, 13} ⊆ A              	

 √     	

            	

{11, 12, 13} ⊂ C	

      {12} ∈ B             	

      	

       	

            	

{12} ⊆ B        	

 √	

      {x | x ∈ N and x < 20}⊄ B               	

 √          	

5 ⊆ A	

      {∅} ⊆ B              	

      	

       	

            	

∅ ∈ A 	

       	

 √	


Section 3.1                                           Sets                                 8
Set of Sets
     ●        For the following sets, prove A ⊂ B.	

     ●        A = { x | x ∈ R such that x2 – 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.	


     ●        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 2n elements.	



Section 3.1                                      Sets                             9
Set operations
     ●        Binary and unary operators	

               ■    Binary acts on two elements, say x-y or y-x.	

               ■    Unary acts on a single element, say negation of an element x is –x.	

               ■    Example: +, - and * are all binary operators on Z.	

     ●        An ordered pair of elements is written as (x,y) and is different
              from (y,x).	

               ■       Two ordered pairs (a,b) and (c,d) are equal if and only if a = c and 	

                    	

b = d.	

               ■       If S = {2,3}, the ordered pairs of this set are (2,2), (2,3), (3,2), (3,3).	

     ●        Binary operation (represented by °) on a set defined as follows: 	

     ●        If for every ordered pair (x,y) of elements of S, x ° y exists, and is
              unique, and is a member of S. 	

               ■    The fact that x ° y exists, and is unique is the same as saying that the
                    binary operation ° is well-defined. 	

               ■    The fact that x ° y always belongs to S means that S is closed under
                    the operation °.	

               ■    The operator ° is just a placeholder for a real operator like +, -, * etc.	


Section 3.1                                               Sets                                      10
Binary or unary operations

     ●        Which of the following are neither binary nor unary
              operations on the given sets? Why?	


     ●        x ° y = x/y; 	

S = set of all positive integers	

               ■    S is not closed under division (x/0 does not exist).	

     ●        x ° y = x/y; 	

S = set of all positive rational numbers	

     ●        x ° y = xy; 	

S = R	

               ■    00 is not defined	

     ●        x ° y = maximum of x and y; 	

S = N	

     ●        x ° y = x + y;  	

S = set of Fibonacci numbers	

               ■    S is not closed under addition since, 1+3 = 4 and 4 is
                    not a Fibonacci number	


Section 3.1                                      Sets                         11
Operations on Sets
     ●        New sets can be formed in a variety of ways, and can be
              described using both set builder notation and Venn diagrams. 	

     ●        Let A, B ∈ ℘(S). 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}.	


Section 3.1                                      Sets                                12
Disjoint, Universal and Difference 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.	




     ●        For a set A ∈ ℘(S), 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 	



Section 3.1                                     Sets                              13
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	

                      {1, 2, 3, 4, 5, 7, 8, 9, 10}	

     ●        A – C	

                      {1, 2, 3}	

     ●         Bʹ′ ∩ (A ∪ C)	

                     {1, 3, 5, 10}	

     ●         A ∩ B ∩ C	

                     {∅}	

     ●        (A ∪ B) ∩ Cʹ′	

                    {1, 2, 3, 4, 7, 9}	



Section 3.1                                      Sets                     14
Cartesian Product
     ●        If A and B are subsets of S, then 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 }	

     ●        The Cartesian product of 2 sets is the set of all combinations of ordered
              pairs that can be produced from the elements of both sets. Example,
              given 2 sets A and B, where A = {a, b, c} and B = {1, 2, 3}, the
              Cartesian product of A and B can be represented as	

                 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 A2	

     ●        An ordered n-tuple is a set of elements that is defined by the order in
              that the elements appear, and by the number of times which distinct
              elements appear. 	

               ■    Example, the coordinates of points on a graph are ordered pairs, where the
                    first value must be the x coordinate, and the second value must be the y
                    coordinate.	

     ●        An represents the set of all n-tuples (x1, x2, …, xn) of elements of A.	



Section 3.1                                             Sets                                           15
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ʹ′ = ∅       	

	


Section 3.1                                           Sets                                          16
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 	

                 	

if A ⊆ B, and B ⊆ C, then A ⊆ C	


Section 3.1                                           Sets               17
Exercise
     ●        Use the set identities to prove	

          	

     	

[A ∪ (B ∩ C)] ∩ ([Aʹ′ ∪ (B ∩ C)] ∩ (B ∩ C)ʹ′) = ∅	


     ●        Proof:	

          	

[A ∪ (B ∩ C)] ∩ ([Aʹ′ ∪ (B ∩ C)] ∩ (B ∩ C)ʹ′) =	

          	

([A ∪ (B ∩ C)] ∩ [Aʹ′ ∪ (B ∩ C)]) ∩ (B ∩ C)ʹ′        	

using ap	

          	

 ([(B ∩ C) ∪ A] ∩ [(B ∩ C) ∪ Aʹ′]) ∩ (B ∩ C)ʹ′       	

using cp twice	

          	

 [(B ∩ C) ∪ (A ∩ Aʹ′)] ∩ (B ∩ C)ʹ′     	

           	

using dp	

          	

 [(B ∩ C) ∪ ∅] ∩ (B ∩ C)ʹ′    	

      	

           	

using comp	

          	

 (B ∩ C) ∩ (B ∩ C)ʹ′ 	

      	

      	

           	

using ip	

          	

 ∅ 	

       	

      	

     	

      	

           	

using comp	





Section 3.1                                      Sets                                    18

More Related Content

What's hot

Xc ngwenya 201007180
Xc ngwenya 201007180Xc ngwenya 201007180
Xc ngwenya 201007180spounge
 
Concepts of root locusplots by tarun gehlot
Concepts of root locusplots by tarun gehlotConcepts of root locusplots by tarun gehlot
Concepts of root locusplots by tarun gehlotTarun Gehlot
 
CBSE Class 12 Mathematics formulas
CBSE Class 12 Mathematics formulasCBSE Class 12 Mathematics formulas
CBSE Class 12 Mathematics formulasParth Kshirsagar
 
Lattices and codes
Lattices and codesLattices and codes
Lattices and codesSpringer
 
Types of functions 05272011
Types of functions 05272011Types of functions 05272011
Types of functions 05272011Boyet Aluan
 
Chapter 03-group-theory (1)
Chapter 03-group-theory (1)Chapter 03-group-theory (1)
Chapter 03-group-theory (1)한석 나
 
A Note on Hessen berg of Trapezoidal Fuzzy Number Matrices
A Note on Hessen berg of Trapezoidal Fuzzy Number MatricesA Note on Hessen berg of Trapezoidal Fuzzy Number Matrices
A Note on Hessen berg of Trapezoidal Fuzzy Number MatricesIOSRJM
 
The Mullineux Map and p-Regularization For Hook Partitions
The Mullineux Map and p-Regularization For Hook PartitionsThe Mullineux Map and p-Regularization For Hook Partitions
The Mullineux Map and p-Regularization For Hook Partitionsayatan2
 

What's hot (20)

Relations and functions
Relations and functionsRelations and functions
Relations and functions
 
Xc ngwenya 201007180
Xc ngwenya 201007180Xc ngwenya 201007180
Xc ngwenya 201007180
 
Concepts of root locusplots by tarun gehlot
Concepts of root locusplots by tarun gehlotConcepts of root locusplots by tarun gehlot
Concepts of root locusplots by tarun gehlot
 
Matrix calculus
Matrix calculusMatrix calculus
Matrix calculus
 
Functions
FunctionsFunctions
Functions
 
function
functionfunction
function
 
CBSE Class 12 Mathematics formulas
CBSE Class 12 Mathematics formulasCBSE Class 12 Mathematics formulas
CBSE Class 12 Mathematics formulas
 
Relations and functions
Relations and functionsRelations and functions
Relations and functions
 
Blackbox task 2
Blackbox task 2Blackbox task 2
Blackbox task 2
 
Unary and binary set operations
Unary and binary set operationsUnary and binary set operations
Unary and binary set operations
 
senior seminar
senior seminarsenior seminar
senior seminar
 
Fourier series
Fourier seriesFourier series
Fourier series
 
Lattices and codes
Lattices and codesLattices and codes
Lattices and codes
 
Types of functions 05272011
Types of functions 05272011Types of functions 05272011
Types of functions 05272011
 
04
0404
04
 
smtlecture.7
smtlecture.7smtlecture.7
smtlecture.7
 
Chapter 03-group-theory (1)
Chapter 03-group-theory (1)Chapter 03-group-theory (1)
Chapter 03-group-theory (1)
 
patel
patelpatel
patel
 
A Note on Hessen berg of Trapezoidal Fuzzy Number Matrices
A Note on Hessen berg of Trapezoidal Fuzzy Number MatricesA Note on Hessen berg of Trapezoidal Fuzzy Number Matrices
A Note on Hessen berg of Trapezoidal Fuzzy Number Matrices
 
The Mullineux Map and p-Regularization For Hook Partitions
The Mullineux Map and p-Regularization For Hook PartitionsThe Mullineux Map and p-Regularization For Hook Partitions
The Mullineux Map and p-Regularization For Hook Partitions
 

Viewers also liked

CPSC 125 Ch 4 Sec 4
CPSC 125 Ch 4 Sec 4CPSC 125 Ch 4 Sec 4
CPSC 125 Ch 4 Sec 4David Wood
 
Statistics lesson 1
Statistics   lesson 1Statistics   lesson 1
Statistics lesson 1Katrina Mae
 
CPSC 125 Ch 3 Sec 2
CPSC 125 Ch 3 Sec 2CPSC 125 Ch 3 Sec 2
CPSC 125 Ch 3 Sec 2David Wood
 
CPSC 125 Ch 3 Sec 3
CPSC 125 Ch 3 Sec 3CPSC 125 Ch 3 Sec 3
CPSC 125 Ch 3 Sec 3David Wood
 
CPSC 125 Ch 1 sec 1
CPSC 125 Ch 1 sec 1CPSC 125 Ch 1 sec 1
CPSC 125 Ch 1 sec 1David Wood
 
Measures of central tendency
Measures of central tendencyMeasures of central tendency
Measures of central tendencyNilanjan Bhaumik
 
Probability distribution 2
Probability distribution 2Probability distribution 2
Probability distribution 2Nilanjan Bhaumik
 
PROJECT REPORT 2(2014)TATA PROJECT
PROJECT REPORT 2(2014)TATA PROJECTPROJECT REPORT 2(2014)TATA PROJECT
PROJECT REPORT 2(2014)TATA PROJECTNilanjan Bhaumik
 
Binomial probability distributions ppt
Binomial probability distributions pptBinomial probability distributions ppt
Binomial probability distributions pptTayab Ali
 
Statistics lesson 1
Statistics   lesson 1Statistics   lesson 1
Statistics lesson 1Katrina Mae
 
Permutations & Combinations
Permutations & CombinationsPermutations & Combinations
Permutations & Combinationsrfant
 
So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301David Wood
 

Viewers also liked (18)

Forecasting
ForecastingForecasting
Forecasting
 
CPSC 125 Ch 4 Sec 4
CPSC 125 Ch 4 Sec 4CPSC 125 Ch 4 Sec 4
CPSC 125 Ch 4 Sec 4
 
Statistics lesson 1
Statistics   lesson 1Statistics   lesson 1
Statistics lesson 1
 
CPSC 125 Ch 3 Sec 2
CPSC 125 Ch 3 Sec 2CPSC 125 Ch 3 Sec 2
CPSC 125 Ch 3 Sec 2
 
CPSC 125 Ch 3 Sec 3
CPSC 125 Ch 3 Sec 3CPSC 125 Ch 3 Sec 3
CPSC 125 Ch 3 Sec 3
 
Introductory sessions
Introductory sessionsIntroductory sessions
Introductory sessions
 
CPSC 125 Ch 1 sec 1
CPSC 125 Ch 1 sec 1CPSC 125 Ch 1 sec 1
CPSC 125 Ch 1 sec 1
 
Measures of central tendency
Measures of central tendencyMeasures of central tendency
Measures of central tendency
 
Probability+distribution
Probability+distributionProbability+distribution
Probability+distribution
 
Probability distribution 2
Probability distribution 2Probability distribution 2
Probability distribution 2
 
Hypothesis
HypothesisHypothesis
Hypothesis
 
PROJECT REPORT 2(2014)TATA PROJECT
PROJECT REPORT 2(2014)TATA PROJECTPROJECT REPORT 2(2014)TATA PROJECT
PROJECT REPORT 2(2014)TATA PROJECT
 
Measures of dispersion
Measures of dispersionMeasures of dispersion
Measures of dispersion
 
Sampling distribution
Sampling distributionSampling distribution
Sampling distribution
 
Binomial probability distributions ppt
Binomial probability distributions pptBinomial probability distributions ppt
Binomial probability distributions ppt
 
Statistics lesson 1
Statistics   lesson 1Statistics   lesson 1
Statistics lesson 1
 
Permutations & Combinations
Permutations & CombinationsPermutations & Combinations
Permutations & Combinations
 
So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301
 

Similar to CPSC 125 Ch 3 Sec 1

Functions And Relations
Functions And RelationsFunctions And Relations
Functions And Relationsandrewhickson
 
Moazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptx
Moazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptxMoazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptx
Moazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptxKhalidSyfullah6
 
Sets functions-sequences-exercises
Sets functions-sequences-exercisesSets functions-sequences-exercises
Sets functions-sequences-exercisesRoshayu Mohamad
 
Set
SetSet
SetH K
 
Functions And Relations
Functions And RelationsFunctions And Relations
Functions And Relationsandrewhickson
 
Sets and Functions By Saleh ElShehabey
Sets and Functions By Saleh ElShehabeySets and Functions By Saleh ElShehabey
Sets and Functions By Saleh ElShehabeyravingeek
 
Lecture 1- DM Intro.pptx
Lecture 1- DM Intro.pptxLecture 1- DM Intro.pptx
Lecture 1- DM Intro.pptxRydaS1
 
Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...
Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...
Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...Amr Rashed
 
Set Theory - Unit -II (Mathematical Foundation Of Computer Science).pptx
Set Theory - Unit -II (Mathematical Foundation  Of  Computer Science).pptxSet Theory - Unit -II (Mathematical Foundation  Of  Computer Science).pptx
Set Theory - Unit -II (Mathematical Foundation Of Computer Science).pptxKalirajMariappan
 
Mathematics JEE quick revision notes pdf
Mathematics JEE quick revision notes pdfMathematics JEE quick revision notes pdf
Mathematics JEE quick revision notes pdfgowhiksankar54
 
INTRODUCTION TO SETS.pptx
INTRODUCTION TO SETS.pptxINTRODUCTION TO SETS.pptx
INTRODUCTION TO SETS.pptxSumit366794
 
Set Theory
Set TheorySet Theory
Set Theoryitutor
 
SETS in Discrete Structure
SETS in Discrete StructureSETS in Discrete Structure
SETS in Discrete StructureNANDINI SHARMA
 

Similar to CPSC 125 Ch 3 Sec 1 (20)

Functions And Relations
Functions And RelationsFunctions And Relations
Functions And Relations
 
Moazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptx
Moazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptxMoazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptx
Moazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptx
 
Sets functions-sequences-exercises
Sets functions-sequences-exercisesSets functions-sequences-exercises
Sets functions-sequences-exercises
 
Set
SetSet
Set
 
discrete maths notes.ppt
discrete maths notes.pptdiscrete maths notes.ppt
discrete maths notes.ppt
 
Functions And Relations
Functions And RelationsFunctions And Relations
Functions And Relations
 
4898850.ppt
4898850.ppt4898850.ppt
4898850.ppt
 
file_5.pptx
file_5.pptxfile_5.pptx
file_5.pptx
 
Sets and Functions By Saleh ElShehabey
Sets and Functions By Saleh ElShehabeySets and Functions By Saleh ElShehabey
Sets and Functions By Saleh ElShehabey
 
Lecture 1- DM Intro.pptx
Lecture 1- DM Intro.pptxLecture 1- DM Intro.pptx
Lecture 1- DM Intro.pptx
 
2.1 Sets
2.1 Sets2.1 Sets
2.1 Sets
 
Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...
Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...
Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...
 
7-Sets-1.ppt
7-Sets-1.ppt7-Sets-1.ppt
7-Sets-1.ppt
 
G-1-SETS.pdf
G-1-SETS.pdfG-1-SETS.pdf
G-1-SETS.pdf
 
Set Theory - Unit -II (Mathematical Foundation Of Computer Science).pptx
Set Theory - Unit -II (Mathematical Foundation  Of  Computer Science).pptxSet Theory - Unit -II (Mathematical Foundation  Of  Computer Science).pptx
Set Theory - Unit -II (Mathematical Foundation Of Computer Science).pptx
 
Mathematics JEE quick revision notes pdf
Mathematics JEE quick revision notes pdfMathematics JEE quick revision notes pdf
Mathematics JEE quick revision notes pdf
 
INTRODUCTION TO SETS.pptx
INTRODUCTION TO SETS.pptxINTRODUCTION TO SETS.pptx
INTRODUCTION TO SETS.pptx
 
Set Theory
Set TheorySet Theory
Set Theory
 
Set theory
Set theorySet theory
Set theory
 
SETS in Discrete Structure
SETS in Discrete StructureSETS in Discrete Structure
SETS in Discrete Structure
 

More from David Wood

Internet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainInternet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainDavid Wood
 
Returning to Online Privacy?
Returning to Online Privacy?Returning to Online Privacy?
Returning to Online Privacy?David Wood
 
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...David Wood
 
BlockSW 2019 Keynote
BlockSW 2019 KeynoteBlockSW 2019 Keynote
BlockSW 2019 KeynoteDavid Wood
 
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221David Wood
 
Privacy in the Smart City
Privacy in the Smart CityPrivacy in the Smart City
Privacy in the Smart CityDavid Wood
 
Controlling Complexities in Software Development
Controlling Complexities in Software DevelopmentControlling Complexities in Software Development
Controlling Complexities in Software DevelopmentDavid Wood
 
Privacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsPrivacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsDavid Wood
 
Implementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelImplementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelDavid Wood
 
Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601David Wood
 
When Metaphors Kill
When Metaphors KillWhen Metaphors Kill
When Metaphors KillDavid Wood
 
Secularism in Australia
Secularism in AustraliaSecularism in Australia
Secularism in AustraliaDavid Wood
 
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsMeditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsDavid Wood
 
Building a writer's platform with social media
Building a writer's platform with social mediaBuilding a writer's platform with social media
Building a writer's platform with social mediaDavid Wood
 
Summary of the Hero's Journey
Summary of the Hero's JourneySummary of the Hero's Journey
Summary of the Hero's JourneyDavid Wood
 
Open by Default
Open by DefaultOpen by Default
Open by DefaultDavid Wood
 
Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926David Wood
 
Linked Data ROI 20110426
Linked Data ROI 20110426Linked Data ROI 20110426
Linked Data ROI 20110426David Wood
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesDavid Wood
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesDavid Wood
 

More from David Wood (20)

Internet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainInternet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchain
 
Returning to Online Privacy?
Returning to Online Privacy?Returning to Online Privacy?
Returning to Online Privacy?
 
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
 
BlockSW 2019 Keynote
BlockSW 2019 KeynoteBlockSW 2019 Keynote
BlockSW 2019 Keynote
 
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
 
Privacy in the Smart City
Privacy in the Smart CityPrivacy in the Smart City
Privacy in the Smart City
 
Controlling Complexities in Software Development
Controlling Complexities in Software DevelopmentControlling Complexities in Software Development
Controlling Complexities in Software Development
 
Privacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsPrivacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable Claims
 
Implementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelImplementing the Verifiable Claims data model
Implementing the Verifiable Claims data model
 
Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601
 
When Metaphors Kill
When Metaphors KillWhen Metaphors Kill
When Metaphors Kill
 
Secularism in Australia
Secularism in AustraliaSecularism in Australia
Secularism in Australia
 
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsMeditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
 
Building a writer's platform with social media
Building a writer's platform with social mediaBuilding a writer's platform with social media
Building a writer's platform with social media
 
Summary of the Hero's Journey
Summary of the Hero's JourneySummary of the Hero's Journey
Summary of the Hero's Journey
 
Open by Default
Open by DefaultOpen by Default
Open by Default
 
Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926
 
Linked Data ROI 20110426
Linked Data ROI 20110426Linked Data ROI 20110426
Linked Data ROI 20110426
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
 

CPSC 125 Ch 3 Sec 1

  • 1. Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co. MSCS Slides Set, Combinatorics, Probability & Number Theory
  • 2. Set theory ●  Sets: Powerful tool in computer science to solve real world problems. ●  A set is a collection of distinct objects called elements. ●  Traditionally, sets are represented by capital letters, and elements by lower case letters. ●  The symbol ∈ means “belongs to” and is used to represent the fact that an element belongs to a particular set. Hence, 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. ●  A = {2, 4, 6, 8, 10} 3∉A and 2∈A Section 3.1 Sets 1
  • 3. Set theory ●  Ordering is not imposed on the set elements and 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 ●  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} or using predicate notation. S = {x | P(x)} means (∀x)[(x ∈ S → P(x)) Λ (P(x)→ x ∈ S)] where P is the unary predicate. ●  Hence, every element of S has the property P and everything that has a property P is an element of S. Section 3.1 Sets 2
  • 4. 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} Section 3.1 Sets 3
  • 5. Set Theory Basics ●  A set that has no members is called a null or empty set and is 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 ●  Using the above notations and predicate symbols, one can describe sets quite easily ●  A = {x | (∃y)[(y∈ {0,1,2}) and (x = y2)]} ■  Hence, A = {0,1, 4} ●  A = {x | x ∈ N and (∀y)(y ∈ {2, 3, 4, 5} → x ≥ y)} ●  B = {x | (∃y)(∃z)(y ∈ {1,2} and z ∈ {2,3} and x = z – y) } Section 3.1 Sets 4
  • 6. Open and closed interval {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. ■  By all real numbers, we mean everything such as 1.05, -3/4, and every other real number within that interval. {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. Section 3.1 Sets 5
  • 7. Relationship between Sets ●  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. ●  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, however, since there are elements of M that are not in C (specifically, all males who are not studying computer science). ●  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. ●  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 Section 3.1 Sets 6
  • 8. Relationship between Sets ●  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 of a set is simply the number of elements within the set. ●  The cardinality of S is denoted by |S|. ●  By the above definition of subset, it is clear that set M must have fewer members than S, which yields the following symbolic representation: S ⊃ M ⇒ |M| < |S| Section 3.1 Sets 7
  • 9. 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 ⊆ C 26 ∈ C √ {11, 12, 13} ⊆ A √ {11, 12, 13} ⊂ C {12} ∈ B {12} ⊆ B √ {x | x ∈ N and x < 20}⊄ B √ 5 ⊆ A {∅} ⊆ B ∅ ∈ A √ Section 3.1 Sets 8
  • 10. Set of Sets ●  For the following sets, prove A ⊂ B. ●  A = { x | x ∈ R such that x2 – 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. ●  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 2n elements. Section 3.1 Sets 9
  • 11. Set operations ●  Binary and unary operators ■  Binary acts on two elements, say x-y or y-x. ■  Unary acts on a single element, say negation of an element x is –x. ■  Example: +, - and * are all binary operators on Z. ●  An ordered pair of elements is written as (x,y) and is different from (y,x). ■  Two ordered pairs (a,b) and (c,d) are equal if and only if a = c and b = d. ■  If S = {2,3}, the ordered pairs of this set are (2,2), (2,3), (3,2), (3,3). ●  Binary operation (represented by °) on a set defined as follows: ●  If for every ordered pair (x,y) of elements of S, x ° y exists, and is unique, and is a member of S. ■  The fact that x ° y exists, and is unique is the same as saying that the binary operation ° is well-defined. ■  The fact that x ° y always belongs to S means that S is closed under the operation °. ■  The operator ° is just a placeholder for a real operator like +, -, * etc. Section 3.1 Sets 10
  • 12. Binary or unary operations ●  Which of the following are neither binary nor unary operations on the given sets? Why? ●  x ° y = x/y; S = set of all positive integers ■  S is not closed under division (x/0 does not exist). ●  x ° y = x/y; S = set of all positive rational numbers ●  x ° y = xy; S = R ■  00 is not defined ●  x ° y = maximum of x and y; S = N ●  x ° y = x + y; S = set of Fibonacci numbers ■  S is not closed under addition since, 1+3 = 4 and 4 is not a Fibonacci number Section 3.1 Sets 11
  • 13. Operations on Sets ●  New sets can be formed in a variety of ways, and can be described using both set builder notation and Venn diagrams. ●  Let A, B ∈ ℘(S). 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}. Section 3.1 Sets 12
  • 14. Disjoint, Universal and Difference 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. ●  For a set A ∈ ℘(S), 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 Section 3.1 Sets 13
  • 15. 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 {1, 2, 3, 4, 5, 7, 8, 9, 10} ●  A – C {1, 2, 3} ●  Bʹ′ ∩ (A ∪ C) {1, 3, 5, 10} ●  A ∩ B ∩ C {∅} ●  (A ∪ B) ∩ Cʹ′ {1, 2, 3, 4, 7, 9} Section 3.1 Sets 14
  • 16. Cartesian Product ●  If A and B are subsets of S, then 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 } ●  The Cartesian product of 2 sets is the set of all combinations of ordered pairs that can be produced from the elements of both sets. Example, given 2 sets A and B, where A = {a, b, c} and B = {1, 2, 3}, the Cartesian product of A and B can be represented as 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 A2 ●  An ordered n-tuple is a set of elements that is defined by the order in that the elements appear, and by the number of times which distinct elements appear. ■  Example, the coordinates of points on a graph are ordered pairs, where the first value must be the x coordinate, and the second value must be the y coordinate. ●  An represents the set of all n-tuples (x1, x2, …, xn) of elements of A. Section 3.1 Sets 15
  • 17. 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ʹ′ = ∅ Section 3.1 Sets 16
  • 18. 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 if A ⊆ B, and B ⊆ C, then A ⊆ C Section 3.1 Sets 17
  • 19. Exercise ●  Use the set identities to prove [A ∪ (B ∩ C)] ∩ ([Aʹ′ ∪ (B ∩ C)] ∩ (B ∩ C)ʹ′) = ∅ ●  Proof: [A ∪ (B ∩ C)] ∩ ([Aʹ′ ∪ (B ∩ C)] ∩ (B ∩ C)ʹ′) = ([A ∪ (B ∩ C)] ∩ [Aʹ′ ∪ (B ∩ C)]) ∩ (B ∩ C)ʹ′ using ap ([(B ∩ C) ∪ A] ∩ [(B ∩ C) ∪ Aʹ′]) ∩ (B ∩ C)ʹ′ using cp twice [(B ∩ C) ∪ (A ∩ Aʹ′)] ∩ (B ∩ C)ʹ′ using dp [(B ∩ C) ∪ ∅] ∩ (B ∩ C)ʹ′ using comp (B ∩ C) ∩ (B ∩ C)ʹ′ using ip ∅ using comp Section 3.1 Sets 18