Week 1 - Sets A
1.104 The definition of a set
- Set Theory
- a branch of maths about well-defined collections of objects.
- concept of sets by Georg Cantor, a German mathematician.
- forms the basis of other fields:
- counting theory
- relations
- graph theory
- finite state machines
- Set
- a collection of any kind of "well-defined" objects:
- people, ideas, numbers etc.
- Set is unordered and contains unique objects.
- Examples and notation:
- Set of positive even integers < 10:
- Set of vowels in English alphabet:
- Set of colours:
- Empty set (a set containing nothing): =
- In math notation, use to represent that something is element of set: * .
- Use if not an element of set:
- .
- a collection of any kind of "well-defined" objects:
- Cardinality
- Given set , the cardinality of is the number of elements contained in .
- Write cardinality as
- Example:
- Subset
- Express as:
- Latex:
\subseteq
- Latex:
- is a subset of if and only if every element of is also in .
- .
- This gives us equivalence:
- Any set is a subset of itself:
- Express as:
- Empty Set
- is a subset of any set
- empty set is a subset of itself:
- Special Sets
- = set of natural numbers =
- = set of integers =
- = set of rational numbers (of form a/b where a and b are elements of Z and b 0)
- = set of real numbers
1.106 The listing method and rule of inclusion
- Set Representation Methods
- Listing Method
- Represent a set using all elements of set .
- Examples:
- Set of all vowels in English alphabet.
- Set of all positive integers less than 10.
- Set of all vowels in English alphabet.
- Set Builder Notation
- Examples:
- Set of all even integers: { ..., -6, -4, -2, 0, 2, 4, 6 ... }
- Set of rational numbers : { ..., 1/1, 1/2, 1/3, 1/4, ... }
- Set of things in my bag: {pen, book, laptop, ...}
- Set of all even integers: { ..., -6, -4, -2, 0, 2, 4, 6 ... }
- Exercise
- Rewrite the following sets using listing method
- Rewrite the following sets using set building method
- Rewrite the following sets using listing method
- Examples:
1.108 The Powerset of a set
- Powerset
- A set can have another set as its element. * *
- A set containing all subsets of another set.
- The powerset of is which is the set containing all subsets of .
- Example
- Exercise 1
- - empty set is subset of
- - empty set is also in
- Exercise 2
- Powerset of empty set is set containing empty set:
- Empty set is the only subset of the empty set:
- Empty set is a set subset of the power set of empty set:
- Cardinality of a powerset
- , ,
1.110 Set operations
-
- The union of two sets are all element in either A or B.
- Notion:
- Latex operator
\cup
- "The U thing"
- Set builder:
-
Python example:
A = {1, 2} B = {2, 3} A.union(B) # {1, 2, 3}
-
Think of a union between people: it's when people come together to make up a larger set.
- Membership table
- Show all combinations of sets an element can belong to.
- Put 1 if element belongs to set.
- Put 0 if it doesn't
- Show all combinations of sets an element can belong to.
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
- Intersection
- Notion:
- Set builder:
- Looks like a horse shoe. The kind you'd take to a dirt road intersection.
- Think of an intersection between roads: it's the part of road that both of them share.
- Membership table
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
- Set Difference
- Elements in , but not .
- Example:
- Membership table:
- Elements in , but not .
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 1 |
1 | 1 | 0 |
- Symmetric Difference
- Elements in or in but not in both.
- Latex:
\oplus
- Can think of it as union of A and B, with all the common elements of A and B removed.
- Example:
- A = {1, 2, 3}
- B = {3, 4, 5}
- Membership table
- Elements in or in but not in both.
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
1.112 Essential reading
- Koshy, Thomas. Discrete Mathematics with Applications:
- pp. 67-70 and pp. 72- 75
- pp.76: Exercises: 1–8, 13-27, 30-32 and 41-44.