Sets
Prof. Susan Older
15 September 2016
(CIS 375) Sets 15 Sept 2016 1 / 18
This Lecture Brought to You by the Symbols (, ), { and }
Some common delimiters
( and ) are parentheses (sometimes informally called parens).
{ and } are braces (sometimes called curly braces).
[ and ] are brackets (sometimes called square brackets).
They are not interchangeable:
Parentheses are used for ordered tuples, such as pairs, triples, etc.
Braces are used for sets.
Brackets are used for multiple purposes, but not for ordered tuples orsets.
(CIS 375) Sets 15 Sept 2016 2 / 18
This Lecture Brought to You by the Symbols (, ), { and }
Some common delimiters
( and ) are parentheses (sometimes informally called parens).
{ and } are braces (sometimes called curly braces).
[ and ] are brackets (sometimes called square brackets).
They are not interchangeable:
Parentheses are used for ordered tuples, such as pairs, triples, etc.
Braces are used for sets.
Brackets are used for multiple purposes, but not for ordered tuples orsets.
(CIS 375) Sets 15 Sept 2016 2 / 18
This Lecture Brought to You by the Symbols (, ), { and }
Some common delimiters
( and ) are parentheses (sometimes informally called parens).
{ and } are braces (sometimes called curly braces).
[ and ] are brackets (sometimes called square brackets).
They are not interchangeable:
Parentheses are used for ordered tuples, such as pairs, triples, etc.
Braces are used for sets.
Brackets are used for multiple purposes, but not for ordered tuples orsets.
(CIS 375) Sets 15 Sept 2016 2 / 18
This Lecture Brought to You by the Symbols (, ), { and }
Some common delimiters
( and ) are parentheses (sometimes informally called parens).
{ and } are braces (sometimes called curly braces).
[ and ] are brackets (sometimes called square brackets).
They are not interchangeable:
Parentheses are used for ordered tuples, such as pairs, triples, etc.
Braces are used for sets.
Brackets are used for multiple purposes, but not for ordered tuples orsets.
(CIS 375) Sets 15 Sept 2016 2 / 18
This Lecture Brought to You by the Symbols (, ), { and }
Some common delimiters
( and ) are parentheses (sometimes informally called parens).
{ and } are braces (sometimes called curly braces).
[ and ] are brackets (sometimes called square brackets).
They are not interchangeable:
Parentheses are used for ordered tuples, such as pairs, triples, etc.
Braces are used for sets.
Brackets are used for multiple purposes, but not for ordered tuples orsets.
(CIS 375) Sets 15 Sept 2016 2 / 18
The Basics of Sets
Definition
A set is an unordered collection of objects.
The objects in a set are called its elements (or members).
We write x ∈ A to indicate that x is an element of set A.
We write x 6∈ A to indicate that x is not an element of set A.
Some very common sets:
Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ ZR, the set of real numbers−5 ∈ R 2.1 ∈ R
√3 ∈ R
√−1 6∈ R
∅, the empty set (also written as: {})The set that contains no elements
(CIS 375) Sets 15 Sept 2016 3 / 18
The Basics of Sets
Definition
A set is an unordered collection of objects.
The objects in a set are called its elements (or members).
We write x ∈ A to indicate that x is an element of set A.
We write x 6∈ A to indicate that x is not an element of set A.
Some very common sets:
Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ ZR, the set of real numbers−5 ∈ R 2.1 ∈ R
√3 ∈ R
√−1 6∈ R
∅, the empty set (also written as: {})The set that contains no elements
(CIS 375) Sets 15 Sept 2016 3 / 18
The Basics of Sets
Definition
A set is an unordered collection of objects.
The objects in a set are called its elements (or members).
We write x ∈ A to indicate that x is an element of set A.
We write x 6∈ A to indicate that x is not an element of set A.
Some very common sets:
Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ ZR, the set of real numbers−5 ∈ R 2.1 ∈ R
√3 ∈ R
√−1 6∈ R
∅, the empty set (also written as: {})The set that contains no elements
(CIS 375) Sets 15 Sept 2016 3 / 18
The Basics of Sets
Definition
A set is an unordered collection of objects.
The objects in a set are called its elements (or members).
We write x ∈ A to indicate that x is an element of set A.
We write x 6∈ A to indicate that x is not an element of set A.
Some very common sets:
Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ ZR, the set of real numbers−5 ∈ R 2.1 ∈ R
√3 ∈ R
√−1 6∈ R
∅, the empty set (also written as: {})The set that contains no elements
(CIS 375) Sets 15 Sept 2016 3 / 18
The Basics of Sets
Definition
A set is an unordered collection of objects.
The objects in a set are called its elements (or members).
We write x ∈ A to indicate that x is an element of set A.
We write x 6∈ A to indicate that x is not an element of set A.
Some very common sets:
Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ Z
R, the set of real numbers−5 ∈ R 2.1 ∈ R
√3 ∈ R
√−1 6∈ R
∅, the empty set (also written as: {})The set that contains no elements
(CIS 375) Sets 15 Sept 2016 3 / 18
The Basics of Sets
Definition
A set is an unordered collection of objects.
The objects in a set are called its elements (or members).
We write x ∈ A to indicate that x is an element of set A.
We write x 6∈ A to indicate that x is not an element of set A.
Some very common sets:
Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ ZR, the set of real numbers−5 ∈ R 2.1 ∈ R
√3 ∈ R
√−1 6∈ R
∅, the empty set (also written as: {})The set that contains no elements
(CIS 375) Sets 15 Sept 2016 3 / 18
The Basics of Sets
Definition
A set is an unordered collection of objects.
The objects in a set are called its elements (or members).
We write x ∈ A to indicate that x is an element of set A.
We write x 6∈ A to indicate that x is not an element of set A.
Some very common sets:
Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ ZR, the set of real numbers−5 ∈ R 2.1 ∈ R
√3 ∈ R
√−1 6∈ R
∅, the empty set (also written as: {})The set that contains no elements
(CIS 375) Sets 15 Sept 2016 3 / 18
Ways of Expressing Sets
List notation: between braces, explicitly list all elements of set
{1, 4, 5, 10, 17}{red, green, blue}
Order of elements doesn’t matter.
Duplicate entries don’t matter.
Set-builder notation: describe properties of all elements
{y : y ∈ Z and y ≤ 100}“The set of those y such that y is in set Z and y ≤ 100”
{x : x ∈ R and x3 = x}“The set of those x such that x is in set R and x3 = x”
Note: You’ll often see variations in this notation, such as:
{y ∈ Z : y ≤ 100}“The set of those y in Z such that y ≤ 100”
{2x + 1 : x ∈ Z}“The set of those numbers 2x + 1 such that x ∈ Z” (aka odd integers)
(CIS 375) Sets 15 Sept 2016 4 / 18
Ways of Expressing Sets
List notation: between braces, explicitly list all elements of set
{1, 4, 5, 10, 17}{red, green, blue}
Order of elements doesn’t matter.
Duplicate entries don’t matter.
Set-builder notation: describe properties of all elements
{y : y ∈ Z and y ≤ 100}“The set of those y such that y is in set Z and y ≤ 100”
{x : x ∈ R and x3 = x}“The set of those x such that x is in set R and x3 = x”
Note: You’ll often see variations in this notation, such as:
{y ∈ Z : y ≤ 100}“The set of those y in Z such that y ≤ 100”
{2x + 1 : x ∈ Z}“The set of those numbers 2x + 1 such that x ∈ Z” (aka odd integers)
(CIS 375) Sets 15 Sept 2016 4 / 18
Ways of Expressing Sets
List notation: between braces, explicitly list all elements of set
{1, 4, 5, 10, 17}{red, green, blue}
Order of elements doesn’t matter.
Duplicate entries don’t matter.
Set-builder notation: describe properties of all elements
{y : y ∈ Z and y ≤ 100}“The set of those y such that y is in set Z and y ≤ 100”
{x : x ∈ R and x3 = x}“The set of those x such that x is in set R and x3 = x”
Note: You’ll often see variations in this notation, such as:
{y ∈ Z : y ≤ 100}“The set of those y in Z such that y ≤ 100”
{2x + 1 : x ∈ Z}“The set of those numbers 2x + 1 such that x ∈ Z” (aka odd integers)
(CIS 375) Sets 15 Sept 2016 4 / 18
Ways of Expressing Sets
List notation: between braces, explicitly list all elements of set
{1, 4, 5, 10, 17}{red, green, blue}
Order of elements doesn’t matter.
Duplicate entries don’t matter.
Set-builder notation: describe properties of all elements
{y : y ∈ Z and y ≤ 100}“The set of those y such that y is in set Z and y ≤ 100”
{x : x ∈ R and x3 = x}“The set of those x such that x is in set R and x3 = x”
Note: You’ll often see variations in this notation, such as:
{y ∈ Z : y ≤ 100}“The set of those y in Z such that y ≤ 100”
{2x + 1 : x ∈ Z}“The set of those numbers 2x + 1 such that x ∈ Z” (aka odd integers)
(CIS 375) Sets 15 Sept 2016 4 / 18
Know Thy Sets
Z: set of integers
Z+: set of positive integers
Z−: set of negative integers
N: set of natural numbers
R: set of real numbers
Q: set of rational numbers
Z+ = {n ∈ Z : n > 0}Z− = {n ∈ Z : n < 0}N = {n ∈ Z : n ≥ 0}
Q = {x ∈ R : there are p, q ∈ Z such that x =p
q}
(CIS 375) Sets 15 Sept 2016 5 / 18
Quick Quiz
What are these sets?
One = {y ∈ N : y < 10}Two = {w ∈ One : w is even}
Three = {x ∈ Two : x < 0}
Answers
One = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}Two = {0, 2, 4, 6, 8}
Three = {}
(CIS 375) Sets 15 Sept 2016 6 / 18
Quick Quiz
What are these sets?
One = {y ∈ N : y < 10}Two = {w ∈ One : w is even}
Three = {x ∈ Two : x < 0}
Answers
One = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
Two = {0, 2, 4, 6, 8}Three = {}
(CIS 375) Sets 15 Sept 2016 6 / 18
Quick Quiz
What are these sets?
One = {y ∈ N : y < 10}Two = {w ∈ One : w is even}
Three = {x ∈ Two : x < 0}
Answers
One = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}Two = {0, 2, 4, 6, 8}
Three = {}
(CIS 375) Sets 15 Sept 2016 6 / 18
Quick Quiz
What are these sets?
One = {y ∈ N : y < 10}Two = {w ∈ One : w is even}
Three = {x ∈ Two : x < 0}
Answers
One = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}Two = {0, 2, 4, 6, 8}
Three = {}
(CIS 375) Sets 15 Sept 2016 6 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}|
= 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}|
= 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}|
= 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}|
= 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}|
= 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}|
= 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}|
= 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Cardinality
Definition
The cardinality of a set A (written |A|) is the number of elements in A.
Set A is finite provided that |A| is an integer; otherwise, the set is infinite.
Let’s practice:
|{1, 8, 5, 3}| = 4
|{1, 8, 1, 5, 3}| = 4
|{y ∈ N : y < 10}| = 10
|{}| = 0
|{{}}| = 1
|{1, {8, 5}, {3}}| = 3
|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4
(CIS 375) Sets 15 Sept 2016 7 / 18
Set Equality
Definition
Sets A and B are equal (written A = B) provided that they have exactlythe same elements.
Example
{1, 3, 5, 8} = {3, 8, 1, 5} = {3, 5, 1, 3, 8}{x ∈ N : x is odd, x < 5} = {1, 3}{y + 1 : y ∈ N, y is even, y < 4} = {1, 3}{x ∈ N : x is odd, x < 5} = {y + 1 : y ∈ N, y is even, y < 4}
(CIS 375) Sets 15 Sept 2016 8 / 18
Set Equality
Definition
Sets A and B are equal (written A = B) provided that they have exactlythe same elements.
Example
{1, 3, 5, 8} = {3, 8, 1, 5}
= {3, 5, 1, 3, 8}{x ∈ N : x is odd, x < 5} = {1, 3}{y + 1 : y ∈ N, y is even, y < 4} = {1, 3}{x ∈ N : x is odd, x < 5} = {y + 1 : y ∈ N, y is even, y < 4}
(CIS 375) Sets 15 Sept 2016 8 / 18
Set Equality
Definition
Sets A and B are equal (written A = B) provided that they have exactlythe same elements.
Example
{1, 3, 5, 8} = {3, 8, 1, 5} = {3, 5, 1, 3, 8}
{x ∈ N : x is odd, x < 5} = {1, 3}{y + 1 : y ∈ N, y is even, y < 4} = {1, 3}{x ∈ N : x is odd, x < 5} = {y + 1 : y ∈ N, y is even, y < 4}
(CIS 375) Sets 15 Sept 2016 8 / 18
Set Equality
Definition
Sets A and B are equal (written A = B) provided that they have exactlythe same elements.
Example
{1, 3, 5, 8} = {3, 8, 1, 5} = {3, 5, 1, 3, 8}{x ∈ N : x is odd, x < 5} = {1, 3}
{y + 1 : y ∈ N, y is even, y < 4} = {1, 3}{x ∈ N : x is odd, x < 5} = {y + 1 : y ∈ N, y is even, y < 4}
(CIS 375) Sets 15 Sept 2016 8 / 18
Set Equality
Definition
Sets A and B are equal (written A = B) provided that they have exactlythe same elements.
Example
{1, 3, 5, 8} = {3, 8, 1, 5} = {3, 5, 1, 3, 8}{x ∈ N : x is odd, x < 5} = {1, 3}{y + 1 : y ∈ N, y is even, y < 4} = {1, 3}
{x ∈ N : x is odd, x < 5} = {y + 1 : y ∈ N, y is even, y < 4}
(CIS 375) Sets 15 Sept 2016 8 / 18
Set Equality
Definition
Sets A and B are equal (written A = B) provided that they have exactlythe same elements.
Example
{1, 3, 5, 8} = {3, 8, 1, 5} = {3, 5, 1, 3, 8}{x ∈ N : x is odd, x < 5} = {1, 3}{y + 1 : y ∈ N, y is even, y < 4} = {1, 3}{x ∈ N : x is odd, x < 5} = {y + 1 : y ∈ N, y is even, y < 4}
(CIS 375) Sets 15 Sept 2016 8 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
(CIS 375) Sets 15 Sept 2016 9 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
(CIS 375) Sets 15 Sept 2016 9 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
{1, 3} ⊆ {1, 2, 3, 4}
(CIS 375) Sets 15 Sept 2016 9 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
{1, 3} ⊆ {1, 2, 3, 4}
(CIS 375) Sets 15 Sept 2016 9 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}
(CIS 375) Sets 15 Sept 2016 9 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}
(CIS 375) Sets 15 Sept 2016 9 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}
(CIS 375) Sets 15 Sept 2016 9 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}
(CIS 375) Sets 15 Sept 2016 9 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}{1, 4} ⊆ {1, 4}
(CIS 375) Sets 15 Sept 2016 9 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}{1, 4} ⊆ {1, 4}
(CIS 375) Sets 15 Sept 2016 9 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}{1, 4} ⊆ {1, 4}N ⊆ Z
(CIS 375) Sets 15 Sept 2016 9 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}{1, 4} ⊆ {1, 4}N ⊆ ZZ 6⊆ N
(CIS 375) Sets 15 Sept 2016 9 / 18
Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
We write A 6⊆ B to indicate that A is not a subset of B.
Example
{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}{1, 4} ⊆ {1, 4}N ⊆ ZZ 6⊆ NZ ⊆ R
(CIS 375) Sets 15 Sept 2016 9 / 18
More About Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
A simple fact
Let S be a set. Then:
(i) ∅ ⊆ S (there is no x such that x ∈ ∅ and x 6∈ S)
(ii) S ⊆ S (every element of S is indeed an element of S)
What are the subsets of {3, 5, 8}?∅ {3} {5} {8} {3, 5} {5, 8} {3, 8} {3, 5, 8}
Fact (we’ll prove it later this semester)
Let A be a finite set. Then A has exactly 2|A| subsets.
(CIS 375) Sets 15 Sept 2016 10 / 18
More About Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
A simple fact
Let S be a set. Then:
(i) ∅ ⊆ S (there is no x such that x ∈ ∅ and x 6∈ S)
(ii) S ⊆ S (every element of S is indeed an element of S)
What are the subsets of {3, 5, 8}?∅ {3} {5} {8} {3, 5} {5, 8} {3, 8} {3, 5, 8}
Fact (we’ll prove it later this semester)
Let A be a finite set. Then A has exactly 2|A| subsets.
(CIS 375) Sets 15 Sept 2016 10 / 18
More About Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
A simple fact
Let S be a set. Then:
(i) ∅ ⊆ S (there is no x such that x ∈ ∅ and x 6∈ S)
(ii) S ⊆ S (every element of S is indeed an element of S)
What are the subsets of {3, 5, 8}?
∅ {3} {5} {8} {3, 5} {5, 8} {3, 8} {3, 5, 8}
Fact (we’ll prove it later this semester)
Let A be a finite set. Then A has exactly 2|A| subsets.
(CIS 375) Sets 15 Sept 2016 10 / 18
More About Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
A simple fact
Let S be a set. Then:
(i) ∅ ⊆ S (there is no x such that x ∈ ∅ and x 6∈ S)
(ii) S ⊆ S (every element of S is indeed an element of S)
What are the subsets of {3, 5, 8}?∅ {3} {5} {8} {3, 5} {5, 8} {3, 8} {3, 5, 8}
Fact (we’ll prove it later this semester)
Let A be a finite set. Then A has exactly 2|A| subsets.
(CIS 375) Sets 15 Sept 2016 10 / 18
More About Subsets
Definition
Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:
every element of A is also an element of B.
A simple fact
Let S be a set. Then:
(i) ∅ ⊆ S (there is no x such that x ∈ ∅ and x 6∈ S)
(ii) S ⊆ S (every element of S is indeed an element of S)
What are the subsets of {3, 5, 8}?∅ {3} {5} {8} {3, 5} {5, 8} {3, 8} {3, 5, 8}
Fact (we’ll prove it later this semester)
Let A be a finite set. Then A has exactly 2|A| subsets.
(CIS 375) Sets 15 Sept 2016 10 / 18
Powersets
Definition
Let A be a set. The power set of A (written 2A in our text, often P(A)elsewhere) is the set whose elements are the subsets of A:
2A = {S : S ⊆ A}.
Example
The powerset of {3, 5, 8} is:
2{3,5,8} = {∅, {3}, {5}, {8}, {3, 5}, {5, 8}, {3, 8}, {3, 5, 8}}
Corollary of previous fact:
For any set finite A, |2A| = 2|A|.
That is, if A has n elements, then A’s powerset has 2n elements.
(CIS 375) Sets 15 Sept 2016 11 / 18
Powersets
Definition
Let A be a set. The power set of A (written 2A in our text, often P(A)elsewhere) is the set whose elements are the subsets of A:
2A = {S : S ⊆ A}.
Example
The powerset of {3, 5, 8} is:
2{3,5,8} = {∅, {3}, {5}, {8}, {3, 5}, {5, 8}, {3, 8}, {3, 5, 8}}
Corollary of previous fact:
For any set finite A, |2A| = 2|A|.
That is, if A has n elements, then A’s powerset has 2n elements.
(CIS 375) Sets 15 Sept 2016 11 / 18
Powersets
Definition
Let A be a set. The power set of A (written 2A in our text, often P(A)elsewhere) is the set whose elements are the subsets of A:
2A = {S : S ⊆ A}.
Example
The powerset of {3, 5, 8} is:
2{3,5,8} = {∅, {3}, {5}, {8}, {3, 5}, {5, 8}, {3, 8}, {3, 5, 8}}
Corollary of previous fact:
For any set finite A, |2A| = 2|A|.
That is, if A has n elements, then A’s powerset has 2n elements.
(CIS 375) Sets 15 Sept 2016 11 / 18
Powersets
Definition
Let A be a set. The power set of A (written 2A in our text, often P(A)elsewhere) is the set whose elements are the subsets of A:
2A = {S : S ⊆ A}.
Example
The powerset of {3, 5, 8} is:
2{3,5,8} = {∅, {3}, {5}, {8}, {3, 5}, {5, 8}, {3, 8}, {3, 5, 8}}
Corollary of previous fact:
For any set finite A, |2A| = 2|A|.
That is, if A has n elements, then A’s powerset has 2n elements.
(CIS 375) Sets 15 Sept 2016 11 / 18
Recap: ∈ versus ⊆
Membership: X ∈ S
S is a set, and X is one of the elements of S
Subset: X ⊆ S
X and S are sets, and every element of X is an element of S
Powerset membership: X ∈ 2S
X and S are sets, and X ⊆ S
(CIS 375) Sets 15 Sept 2016 12 / 18
Recap: ∈ versus ⊆
Membership: X ∈ S
S is a set, and X is one of the elements of S
Subset: X ⊆ S
X and S are sets, and every element of X is an element of S
Powerset membership: X ∈ 2S
X and S are sets, and X ⊆ S
(CIS 375) Sets 15 Sept 2016 12 / 18
Recap: ∈ versus ⊆
Membership: X ∈ S
S is a set, and X is one of the elements of S
Subset: X ⊆ S
X and S are sets, and every element of X is an element of S
Powerset membership: X ∈ 2S
X and S are sets, and X ⊆ S
(CIS 375) Sets 15 Sept 2016 12 / 18
Creating New Sets from Old: Union
Definition
Let A and B be sets. The union of A and B is the set
A ∪ B = {x : x ∈ A or x ∈ B}.
A B
Example
{1, 2, 3} ∪ {2, 4, 6} = {1, 2, 3, 4, 6}
(CIS 375) Sets 15 Sept 2016 13 / 18
Creating New Sets from Old: Union
Definition
Let A and B be sets. The union of A and B is the set
A ∪ B = {x : x ∈ A or x ∈ B}.
A B
Example
{1, 2, 3} ∪ {2, 4, 6} = {1, 2, 3, 4, 6}
(CIS 375) Sets 15 Sept 2016 13 / 18
Creating New Sets from Old: Union
Definition
Let A and B be sets. The union of A and B is the set
A ∪ B = {x : x ∈ A or x ∈ B}.
A B
Example
{1, 2, 3} ∪ {2, 4, 6} = {1, 2, 3, 4, 6}
(CIS 375) Sets 15 Sept 2016 13 / 18
Creating New Sets from Old: Intersection
Definition
Let A and B be sets. The intersection of A and B is the set
A ∩ B = {x : x ∈ A and x ∈ B}.
A B
Example
{1, 2, 3} ∩ {2, 4, 6} = {2}
(CIS 375) Sets 15 Sept 2016 14 / 18
Creating New Sets from Old: Intersection
Definition
Let A and B be sets. The intersection of A and B is the set
A ∩ B = {x : x ∈ A and x ∈ B}.
A B
Example
{1, 2, 3} ∩ {2, 4, 6} = {2}
(CIS 375) Sets 15 Sept 2016 14 / 18
Creating New Sets from Old: Intersection
Definition
Let A and B be sets. The intersection of A and B is the set
A ∩ B = {x : x ∈ A and x ∈ B}.
A B
Example
{1, 2, 3} ∩ {2, 4, 6} = {2}
(CIS 375) Sets 15 Sept 2016 14 / 18
Creating New Sets from Old: Set Difference
Definition
Let A and B be sets. The set difference of A and B is the set
A− B = {x : x ∈ A and x 6∈ B}.
A B
Example
{1, 2, 3} − {2, 4, 6} = {1, 3}
(CIS 375) Sets 15 Sept 2016 15 / 18
Creating New Sets from Old: Set Difference
Definition
Let A and B be sets. The set difference of A and B is the set
A− B = {x : x ∈ A and x 6∈ B}.
A B
Example
{1, 2, 3} − {2, 4, 6} = {1, 3}
(CIS 375) Sets 15 Sept 2016 15 / 18
Creating New Sets from Old: Set Difference
Definition
Let A and B be sets. The set difference of A and B is the set
A− B = {x : x ∈ A and x 6∈ B}.
A B
Example
{1, 2, 3} − {2, 4, 6} = {1, 3}
(CIS 375) Sets 15 Sept 2016 15 / 18
Creating New Sets from Old: Symmetric Difference
Definition
Let A and B be sets. The symmetric difference of A and B is the set
A4B = {x : x ∈ A− B or x ∈ B − A}.
A B
Example
{1, 2, 3}4{2, 4, 6} = {1, 3, 4, 6}
(CIS 375) Sets 15 Sept 2016 16 / 18
Creating New Sets from Old: Symmetric Difference
Definition
Let A and B be sets. The symmetric difference of A and B is the set
A4B = {x : x ∈ A− B or x ∈ B − A}.
A B
Example
{1, 2, 3}4{2, 4, 6} = {1, 3, 4, 6}
(CIS 375) Sets 15 Sept 2016 16 / 18
Creating New Sets from Old: Symmetric Difference
Definition
Let A and B be sets. The symmetric difference of A and B is the set
A4B = {x : x ∈ A− B or x ∈ B − A}.
A B
Example
{1, 2, 3}4{2, 4, 6} = {1, 3, 4, 6}
(CIS 375) Sets 15 Sept 2016 16 / 18
Creating New Sets from Old: Cartesian Product
Definition
Let A and B be sets. The Cartesian product of A and B is the set
A× B = {(x , y) : x ∈ A and y ∈ B}.
Example
Be aware!
(1, 2) is an ordered pair, whereas {1, 2} is a set.
(1, 2) is not the same as (2, 1): order matters for pairs/tuples.
{1, 2} is the same as {2, 1}: order does not matter for sets.
(CIS 375) Sets 15 Sept 2016 17 / 18
Creating New Sets from Old: Cartesian Product
Definition
Let A and B be sets. The Cartesian product of A and B is the set
A× B = {(x , y) : x ∈ A and y ∈ B}.
Example
{1, 2} × {2, 4, 6} = { (1, 2), (1, 4), (1, 6), (2, 2), (2, 4), (2, 6) }
Be aware!
(1, 2) is an ordered pair, whereas {1, 2} is a set.
(1, 2) is not the same as (2, 1): order matters for pairs/tuples.
{1, 2} is the same as {2, 1}: order does not matter for sets.
(CIS 375) Sets 15 Sept 2016 17 / 18
Creating New Sets from Old: Cartesian Product
Definition
Let A and B be sets. The Cartesian product of A and B is the set
A× B = {(x , y) : x ∈ A and y ∈ B}.
Example
{1, 2} × {2, 4, 6} = { (1, 2), (1, 4), (1, 6), (2, 2), (2, 4), (2, 6) }
Be aware!
(1, 2) is an ordered pair, whereas {1, 2} is a set.
(1, 2) is not the same as (2, 1): order matters for pairs/tuples.
{1, 2} is the same as {2, 1}: order does not matter for sets.
(CIS 375) Sets 15 Sept 2016 17 / 18
Creating New Sets from Old: Cartesian Product
Definition
Let A and B be sets. The Cartesian product of A and B is the set
A× B = {(x , y) : x ∈ A and y ∈ B}.
Example
{1, 2} × {2, 4, 6} = { (1, 2), (1, 4), (1, 6), (2, 2), (2, 4), (2, 6) }
Be aware!
(1, 2) is an ordered pair, whereas {1, 2} is a set.
(1, 2) is not the same as (2, 1): order matters for pairs/tuples.
{1, 2} is the same as {2, 1}: order does not matter for sets.
(CIS 375) Sets 15 Sept 2016 17 / 18
Creating New Sets from Old: Cartesian Product
Definition
Let A and B be sets. The Cartesian product of A and B is the set
A× B = {(x , y) : x ∈ A and y ∈ B}.
Example
{1, 2} × {2, 4, 6} = { (1, 2), (1, 4), (1, 6), (2, 2), (2, 4), (2, 6) }
Be aware!
(1, 2) is an ordered pair, whereas {1, 2} is a set.
(1, 2) is not the same as (2, 1): order matters for pairs/tuples.
{1, 2} is the same as {2, 1}: order does not matter for sets.
(CIS 375) Sets 15 Sept 2016 17 / 18
Creating New Sets from Old: Cartesian Product
Definition
Let A and B be sets. The Cartesian product of A and B is the set
A× B = {(x , y) : x ∈ A and y ∈ B}.
Example
{1, 2} × {2, 4, 6} = { (1, 2), (1, 4), (1, 6), (2, 2), (2, 4), (2, 6) }
Be aware!
(1, 2) is an ordered pair, whereas {1, 2} is a set.
(1, 2) is not the same as (2, 1): order matters for pairs/tuples.
{1, 2} is the same as {2, 1}: order does not matter for sets.
(CIS 375) Sets 15 Sept 2016 17 / 18
Summary of Set Operations
A ∪ B = {x : x ∈ A or x ∈ B}A ∩ B = {x : x ∈ A and x ∈ B}A− B = {x : x ∈ A and x 6∈ B}A4B = {x : x ∈ A− B or x ∈ B − A}A× B = {(x , y) : x ∈ A and y ∈ B}
Fact
Suppose A and B are finite sets. Then:
|A ∪ B| = |A|+ |B| − |A ∩ B||A− B| = |A| − |A ∩ B||A× B| = |A| · |B|If A ⊆ B, then |A| ≤ |B|.
(CIS 375) Sets 15 Sept 2016 18 / 18
Summary of Set Operations
A ∪ B = {x : x ∈ A or x ∈ B}A ∩ B = {x : x ∈ A and x ∈ B}A− B = {x : x ∈ A and x 6∈ B}A4B = {x : x ∈ A− B or x ∈ B − A}A× B = {(x , y) : x ∈ A and y ∈ B}
Fact
Suppose A and B are finite sets. Then:
|A ∪ B| = |A|+ |B| − |A ∩ B|
|A− B| = |A| − |A ∩ B||A× B| = |A| · |B|If A ⊆ B, then |A| ≤ |B|.
(CIS 375) Sets 15 Sept 2016 18 / 18
Summary of Set Operations
A ∪ B = {x : x ∈ A or x ∈ B}A ∩ B = {x : x ∈ A and x ∈ B}A− B = {x : x ∈ A and x 6∈ B}A4B = {x : x ∈ A− B or x ∈ B − A}A× B = {(x , y) : x ∈ A and y ∈ B}
Fact
Suppose A and B are finite sets. Then:
|A ∪ B| = |A|+ |B| − |A ∩ B||A− B| = |A| − |A ∩ B|
|A× B| = |A| · |B|If A ⊆ B, then |A| ≤ |B|.
(CIS 375) Sets 15 Sept 2016 18 / 18
Summary of Set Operations
A ∪ B = {x : x ∈ A or x ∈ B}A ∩ B = {x : x ∈ A and x ∈ B}A− B = {x : x ∈ A and x 6∈ B}A4B = {x : x ∈ A− B or x ∈ B − A}A× B = {(x , y) : x ∈ A and y ∈ B}
Fact
Suppose A and B are finite sets. Then:
|A ∪ B| = |A|+ |B| − |A ∩ B||A− B| = |A| − |A ∩ B||A× B| = |A| · |B|
If A ⊆ B, then |A| ≤ |B|.
(CIS 375) Sets 15 Sept 2016 18 / 18
Summary of Set Operations
A ∪ B = {x : x ∈ A or x ∈ B}A ∩ B = {x : x ∈ A and x ∈ B}A− B = {x : x ∈ A and x 6∈ B}A4B = {x : x ∈ A− B or x ∈ B − A}A× B = {(x , y) : x ∈ A and y ∈ B}
Fact
Suppose A and B are finite sets. Then:
|A ∪ B| = |A|+ |B| − |A ∩ B||A− B| = |A| − |A ∩ B||A× B| = |A| · |B|If A ⊆ B, then |A| ≤ |B|.
(CIS 375) Sets 15 Sept 2016 18 / 18