Sets and Set Operations
Explore the foundations of set theory, including set definitions, operations, identities, power sets, and Cartesian products. Sets are fundamental to all of mathematics and computer science.
- Understand set definitions, notation, and methods of specifying sets
- Master set operations including union, intersection, difference, and complement
- Apply set identities and prove set equalities using multiple methods
- Work with power sets and understand their cardinality
- Construct and analyze Cartesian products of sets
- Use Venn diagrams to visualize set relationships
1. Sets and Basic Concepts
A set is an unordered collection of distinct objects. The objects in a set are called elements or members of the set.
Notation:
- means "a is an element of set A"
- means "a is not an element of set A"
- Sets are typically denoted by capital letters: A, B, C, ...
- Elements are typically denoted by lowercase letters: a, b, c, ...
There are several ways to describe a set:
1. Roster Method (Enumeration):
List all elements:
2. Set-Builder Notation:
Read as: "A is the set of all x such that x is a positive integer less than 6"
3. Interval Notation (for real numbers):
(closed interval)
(open interval)
= Natural numbers =
= Integers =
= Positive integers =
= Rational numbers =
= Real numbers
= Complex numbers =
- The empty set (or null set), denoted or , is the set with no elements.
- The universal set, denoted , is the set containing all objects under consideration in a particular context.
Set Equality:
Two sets A and B are equal, written , if they contain exactly the same elements.
Subset:
A is a subset of B, written , if every element of A is also an element of B.
Proper Subset:
A is a proper subset of B, written or , if and .
For any sets A, B, and C:
- (the empty set is a subset of every set)
- (every set is a subset of itself)
- If and , then (transitivity)
The cardinality of a set A, denoted , is the number of elements in A.
For finite sets:
- If , then
(Infinite sets have infinite cardinality; we'll explore this concept more in Course 5)
2. Set Operations
The union of sets A and B, denoted , is the set of all elements that are in A, in B, or in both.
The intersection of sets A and B, denoted , is the set of all elements that are in both A and B.
The difference of sets A and B, denoted or , is the set of elements in A that are not in B.
The complement of set A (relative to universal set U), denoted or , is the set of all elements in U that are not in A.
Two sets A and B are disjoint if they have no elements in common, i.e., .
Let , , and .
For any finite sets A and B:
This generalizes to three sets:
If we simply add , we count each element in twice (once from A and once from B).
To get the correct count for , we must subtract once to compensate for the double counting.
Therefore, .
3. Set Identities
Let A, B, and C be sets, and let U be the universal set:
(Double Complement)
Prove:
Method 1: Element Argument
We show both and .
Part 1: Let
Then and
So and ( or )
Case 1: If , then , so
Case 2: If , then , so
Therefore
Part 2: Let
Then or
Case 1: If , then and , so and
Case 2: If , then and , so and
In both cases,
Therefore
Since both inclusions hold, .
Methods for Proving Set Equalities:
- Element Argument: Show and
- Logical Equivalence: Use logical equivalences on set-builder notation
- Venn Diagrams: Visual verification (not a rigorous proof, but useful for intuition)
- Algebraic Manipulation: Use known set identities
4. Power Sets
The power set of a set A, denoted or , is the set of all subsets of A (including the empty set and A itself).
If A is a finite set with , then .
To form a subset of A, we make a binary choice for each element: include it or exclude it.
Since there are n elements in A, and each element has 2 choices (in or out), by the multiplication principle, there are possible subsets.
Therefore, .
Example 1: Let
Note:
Example 2: Let
Note:
Example 3: Let
Note: . The empty set has one subset: itself!
Important Distinctions:
- is the empty set (contains no elements)
- is a set containing one element (the empty set)
- for any set A
- for any set A
5. Cartesian Product
An ordered pair is a pair of elements where order matters. Two ordered pairs and are equal if and only if and .
Note: unless (unlike sets, where )
The Cartesian product of sets A and B, denoted , is the set of all ordered pairs where and .
If A and B are finite sets, then .
Example 1: Let and
Note:
Example 2:
This represents the Cartesian coordinate plane (all points (x, y) where x, y are real numbers)
Example 3: Let
Also written as
The Cartesian product can be extended to multiple sets:
For n copies of the same set A: (n times)
Properties of Cartesian Product:
- (not commutative, unless A = B)
- (distributive over union)
- (distributive over intersection)
In databases, a relation (table) can be viewed as a subset of a Cartesian product:
Let
Let
An enrollment relation might be:
For example:
This represents which students are enrolled in which courses.
Practice Quiz
Frequently Asked Questions
What's the difference between ∈ and ⊆?
∈ (element of): Relates an element to a set. Example: 3 ∈ {1, 2, 3}
⊆ (subset of): Relates a set to another set. Example: {1, 2} ⊆ {1, 2, 3}
Common mistake: Writing {1} ∈ {1, 2, 3} is FALSE. The correct statement is {1} ⊆ {1, 2, 3} or 1 ∈ {1, 2, 3}.
However, {{ 1 } } ∈ {{ 1 }, { 2 }, 3} is TRUE because {1} is an element of this set.
Why is the empty set a subset of every set?
By definition, A ⊆ B means "for all x, if x ∈ A then x ∈ B".
For the empty set ∅, there are no elements x in ∅, so the statement "if x ∈ ∅ then x ∈ B" is vacuously true (the hypothesis is always false).
Therefore, ∅ ⊆ A for any set A, including ∅ ⊆ ∅.
How do I remember De Morgan's Laws for sets?
De Morgan's Laws: When you negate (take complement of) a union or intersection:
- The operation flips: ∪ becomes ∩, and vice versa
- Each set gets complemented
Think: "Break the line, change the sign"
- ("not in A or B" = "not in A and not in B")
- ("not in both" = "not in A or not in B")
What's the difference between {∅} and ∅?
∅ is the empty set - it contains zero elements: |∅| = 0
{∅} is a set containing one element (which happens to be the empty set): |{∅}| = 1
Analogy: ∅ is like an empty box, while {∅} is a box containing an empty box.
Similarly, ∅ ≠ {∅} ≠ {{∅} } - these are all different sets with cardinalities 0, 1, and 1 respectively.
Why does |𝒫(A)| = 2ⁿ?
To form any subset of A, you make a binary decision for each element: include it or not.
With n elements, that's 2 choices for element 1, times 2 choices for element 2, ..., times 2 choices for element n.
Total: 2 × 2 × ... × 2 (n times) = 2ⁿ subsets.
This is also why the power set is sometimes denoted 2ᴬ - it represents "2 to the power of A".
When would I use Cartesian products in real applications?
Cartesian products appear frequently in computer science and mathematics:
- Databases: Relations (tables) are subsets of Cartesian products of attribute domains
- Coordinates: ℝ² = ℝ × ℝ represents the 2D plane, ℝ³ represents 3D space
- State spaces: In game theory or AI, possible states are often Cartesian products
- Testing: Test cases covering all combinations of input values
- Cryptography: Key spaces are often Cartesian products of character sets