MathIsimple
DM-03
Course 3

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.

Learning Objectives
  • 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

Definition 3.1: Set

A set is an unordered collection of distinct objects. The objects in a set are called elements or members of the set.

Notation:

  • aAa \in A means "a is an element of set A"
  • aAa \notin 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, ...
Example: Specifying Sets

There are several ways to describe a set:

1. Roster Method (Enumeration):

List all elements: A={1,2,3,4,5}A = \{1, 2, 3, 4, 5\}

2. Set-Builder Notation:

A={xx is a positive integer less than 6}A = \{x \mid x \text{ is a positive integer less than 6}\}

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):

[a,b]={xRaxb}[a, b] = \{x \in \mathbb{R} \mid a \leq x \leq b\} (closed interval)

(a,b)={xRa<x<b}(a, b) = \{x \in \mathbb{R} \mid a < x < b\} (open interval)

Definition 3.2: Common Number Sets

N\mathbb{N} = Natural numbers = {0,1,2,3,}\{0, 1, 2, 3, \ldots\}

Z\mathbb{Z} = Integers = {,2,1,0,1,2,}\{\ldots, -2, -1, 0, 1, 2, \ldots\}

Z+\mathbb{Z}^+ = Positive integers = {1,2,3,}\{1, 2, 3, \ldots\}

Q\mathbb{Q} = Rational numbers = {pqp,qZ,q0}\{\frac{p}{q} \mid p, q \in \mathbb{Z}, q \neq 0\}

R\mathbb{R} = Real numbers

C\mathbb{C} = Complex numbers = {a+bia,bR,i2=1}\{a + bi \mid a, b \in \mathbb{R}, i^2 = -1\}

Definition 3.3: Empty Set and Universal Set
  • The empty set (or null set), denoted \emptyset or {}, is the set with no elements.
  • The universal set, denoted UU, is the set containing all objects under consideration in a particular context.
Definition 3.4: Set Equality and Subsets

Set Equality:

Two sets A and B are equal, written A=BA = B, if they contain exactly the same elements.

A=B    x(xAxB)A = B \iff \forall x (x \in A \leftrightarrow x \in B)

Subset:

A is a subset of B, written ABA \subseteq B, if every element of A is also an element of B.

AB    x(xAxB)A \subseteq B \iff \forall x (x \in A \rightarrow x \in B)

Proper Subset:

A is a proper subset of B, written ABA \subset B or ABA \subsetneq B, if ABA \subseteq B and ABA \neq B.

Theorem 3.1: Properties of Subsets

For any sets A, B, and C:

  • A\emptyset \subseteq A (the empty set is a subset of every set)
  • AAA \subseteq A (every set is a subset of itself)
  • If ABA \subseteq B and BCB \subseteq C, then ACA \subseteq C (transitivity)
  • A=B    (ABBA)A = B \iff (A \subseteq B \land B \subseteq A)
Definition 3.5: Cardinality

The cardinality of a set A, denoted A|A|, is the number of elements in A.

For finite sets:

  • If A=1,2,3A = {1, 2, 3}, then A=3|A| = 3
  • =0|\emptyset| = 0

(Infinite sets have infinite cardinality; we'll explore this concept more in Course 5)

2. Set Operations

Definition 3.6: Union

The union of sets A and B, denoted ABA \cup B, is the set of all elements that are in A, in B, or in both.

AcupB=xmidxinAlorxinBA cup B = {x mid x in A lor x in B}
Definition 3.7: Intersection

The intersection of sets A and B, denoted ABA \cap B, is the set of all elements that are in both A and B.

AcapB=xmidxinAlandxinBA cap B = {x mid x in A land x in B}
Definition 3.8: Difference

The difference of sets A and B, denoted ABA - B or ABA \setminus B, is the set of elements in A that are not in B.

AB=xmidxinAlandxotinBA - B = {x mid x in A land x otin B}
Definition 3.9: Complement

The complement of set A (relative to universal set U), denoted A\overline{A} or AcA^c, is the set of all elements in U that are not in A.

overlineA=UA=xinUmidxotinAoverline{A} = U - A = {x in U mid x otin A}
Definition 3.10: Disjoint Sets

Two sets A and B are disjoint if they have no elements in common, i.e., AB=A \cap B = \emptyset.

Example: Set Operations

Let U=1,2,3,4,5,6,7,8,9,10U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, A=1,2,3,4,5A = {1, 2, 3, 4, 5}, and B=4,5,6,7B = {4, 5, 6, 7}.

AcupB=1,2,3,4,5,6,7A cup B = {1, 2, 3, 4, 5, 6, 7}

AcapB=4,5A cap B = {4, 5}

AB=1,2,3A - B = {1, 2, 3}

BA=6,7B - A = {6, 7}

overlineA=6,7,8,9,10overline{A} = {6, 7, 8, 9, 10}

overlineB=1,2,3,8,9,10overline{B} = {1, 2, 3, 8, 9, 10}

Theorem 3.2: Inclusion-Exclusion Principle

For any finite sets A and B:

AcupB=A+BAcapB|A cup B| = |A| + |B| - |A cap B|

This generalizes to three sets:

AcupBcupC=A+B+CAcapBAcapCBcapC+AcapBcapC|A cup B cup C| = |A| + |B| + |C| - |A cap B| - |A cap C| - |B cap C| + |A cap B cap C|
Proof of Inclusion-Exclusion Principle (two sets)

If we simply add A+B|A| + |B|, we count each element in ABA \cap B twice (once from A and once from B).

To get the correct count for ABA \cup B, we must subtract AB|A \cap B| once to compensate for the double counting.

Therefore, AB=A+BAB|A \cup B| = |A| + |B| - |A \cap B|.

3. Set Identities

Theorem 3.3: Fundamental Set Identities

Let A, B, and C be sets, and let U be the universal set:

Identity Laws:

A=AA \cup \emptyset = A

AU=AA \cap U = A

Domination Laws:

AU=UA \cup U = U

A=A \cap \emptyset = \emptyset

Idempotent Laws:

AA=AA \cup A = A

AA=AA \cap A = A

Complement Laws:

AA=UA \cup \overline{A} = U

AA=A \cap \overline{A} = \emptyset

A=A\overline{\overline{A}} = A (Double Complement)

Commutative Laws:

AB=BAA \cup B = B \cup A

AB=BAA \cap B = B \cap A

Associative Laws:

(AB)C=A(BC)(A \cup B) \cup C = A \cup (B \cup C)

(AB)C=A(BC)(A \cap B) \cap C = A \cap (B \cap C)

Distributive Laws:

A(BC)=(AB)(AC)A \cup (B \cap C) = (A \cup B) \cap (A \cup C)

A(BC)=(AB)(AC)A \cap (B \cup C) = (A \cap B) \cup (A \cap C)

De Morgan's Laws:

AB=AB\overline{A \cup B} = \overline{A} \cap \overline{B}

AB=AB\overline{A \cap B} = \overline{A} \cup \overline{B}

Absorption Laws:

A(AB)=AA \cup (A \cap B) = A

A(AB)=AA \cap (A \cup B) = A

Example: Proving Set Identities

Prove: A(BC)=(AB)(AC)A \cap (B \cup C) = (A \cap B) \cup (A \cap C)

Method 1: Element Argument

Proof of Distributive Law

We show both A(BC)(AB)(AC)A \cap (B \cup C) \subseteq (A \cap B) \cup (A \cap C) and (AB)(AC)A(BC)(A \cap B) \cup (A \cap C) \subseteq A \cap (B \cup C).

Part 1: Let xA(BC)x \in A \cap (B \cup C)

Then xAx \in A and x(BC)x \in (B \cup C)

So xAx \in A and (xBx \in B or xCx \in C)

Case 1: If xBx \in B, then xABx \in A \cap B, so x(AB)(AC)x \in (A \cap B) \cup (A \cap C)

Case 2: If xCx \in C, then xACx \in A \cap C, so x(AB)(AC)x \in (A \cap B) \cup (A \cap C)

Therefore A(BC)(AB)(AC)A \cap (B \cup C) \subseteq (A \cap B) \cup (A \cap C)

Part 2: Let x(AB)(AC)x \in (A \cap B) \cup (A \cap C)

Then x(AB)x \in (A \cap B) or x(AC)x \in (A \cap C)

Case 1: If xABx \in A \cap B, then xAx \in A and xBx \in B, so xAx \in A and xBCx \in B \cup C

Case 2: If xACx \in A \cap C, then xAx \in A and xCx \in C, so xAx \in A and xBCx \in B \cup C

In both cases, xA(BC)x \in A \cap (B \cup C)

Therefore (AB)(AC)A(BC)(A \cap B) \cup (A \cap C) \subseteq A \cap (B \cup C)

Since both inclusions hold, A(BC)=(AB)(AC)A \cap (B \cup C) = (A \cap B) \cup (A \cap C).

Remark

Methods for Proving Set Equalities:

  1. Element Argument: Show ABA \subseteq B and BAB \subseteq A
  2. Logical Equivalence: Use logical equivalences on set-builder notation
  3. Venn Diagrams: Visual verification (not a rigorous proof, but useful for intuition)
  4. Algebraic Manipulation: Use known set identities

4. Power Sets

Definition 3.11: Power Set

The power set of a set A, denoted P(A)\mathcal{P}(A) or 2A2^A, is the set of all subsets of A (including the empty set and A itself).

mathcalP(A)=SmidSsubseteqAmathcal{P}(A) = {S mid S subseteq A}
Theorem 3.4: Cardinality of Power Set

If A is a finite set with A=n\left|A\right| = n, then P(A)=2n\left|\mathcal{P}(A)\right| = 2^n.

Proof of Cardinality of Power Set

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 2×2××2=2n2 \times 2 \times \cdots \times 2 = 2^n possible subsets.

Therefore, P(A)=2n\left|\mathcal{P}(A)\right| = 2^n.

Example: Power Sets

Example 1: Let A=1,2A = {1, 2}

mathcalP(A)=emptyset,1,2,1,2mathcal{P}(A) = {emptyset, {1}, {2}, {1, 2}}

Note: P(A)=4=22\left|\mathcal{P}(A)\right| = 4 = 2^2

Example 2: Let B=a,b,cB = {a, b, c}

mathcalP(B)=emptyset,a,b,c,a,b,a,c,b,c,a,b,cmathcal{P}(B) = {emptyset, {a}, {b}, {c}, {a,b}, {a,c}, {b,c}, {a,b,c}}

Note: P(B)=8=23\left|\mathcal{P}(B)\right| = 8 = 2^3

Example 3: Let C=C = \emptyset

mathcalP(emptyset)=emptysetmathcal{P}(emptyset) = {emptyset}

Note: P()=1=20\left|\mathcal{P}(\emptyset)\right| = 1 = 2^0. The empty set has one subset: itself!

Note

Important Distinctions:

  • \emptyset is the empty set (contains no elements)
  • emptyset{emptyset} is a set containing one element (the empty set)
  • P(A)\emptyset \in \mathcal{P}(A) for any set A
  • AP(A)A \in \mathcal{P}(A) for any set A

5. Cartesian Product

Definition 3.12: Ordered Pair

An ordered pair (a,b)(a, b) is a pair of elements where order matters. Two ordered pairs (a,b)(a, b) and (c,d)(c, d) are equal if and only if a=ca = c and b=db = d.

Note: (a,b)(b,a)(a, b) \neq (b, a) unless a=ba = b (unlike sets, where a,b=b,a{a, b} = {b, a})

Definition 3.13: Cartesian Product

The Cartesian product of sets A and B, denoted A×BA \times B, is the set of all ordered pairs (a,b)(a, b) where aAa \in A and bBb \in B.

AimesB=(a,b)midainAlandbinBA imes B = {(a, b) mid a in A land b in B}
Theorem 3.5: Cardinality of Cartesian Product

If A and B are finite sets, then A×B=AB|A \times B| = |A| \cdot |B|.

Example: Cartesian Products

Example 1: Let A=1,2A = {1, 2} and B=x,y,zB = {x, y, z}

AimesB=(1,x),(1,y),(1,z),(2,x),(2,y),(2,z)A imes B = {(1,x), (1,y), (1,z), (2,x), (2,y), (2,z)}

Note: A×B=6=2×3|A \times B| = 6 = 2 \times 3

Example 2: R×R=R2\mathbb{R} \times \mathbb{R} = \mathbb{R}^2

This represents the Cartesian coordinate plane (all points (x, y) where x, y are real numbers)

Example 3: Let A=1,2A = {1, 2}

AimesA=(1,1),(1,2),(2,1),(2,2)A imes A = {(1,1), (1,2), (2,1), (2,2)}

Also written as A2A^2

Definition 3.14: Cartesian Product of Multiple Sets

The Cartesian product can be extended to multiple sets:

A1imesA2imescdotsimesAn=(a1,a2,ldots,an)midaiinAiextfori=1,2,ldots,nA_1 imes A_2 imes cdots imes A_n = {(a_1, a_2, ldots, a_n) mid a_i in A_i ext{ for } i = 1, 2, ldots, n}

For n copies of the same set A: An=A×A××AA^n = A \times A \times \cdots \times A (n times)

Remark

Properties of Cartesian Product:

  • A×BB×AA \times B \neq B \times A (not commutative, unless A = B)
  • A×=A \times \emptyset = \emptyset
  • A×(BC)=(A×B)(A×C)A \times (B \cup C) = (A \times B) \cup (A \times C) (distributive over union)
  • A×(BC)=(A×B)(A×C)A \times (B \cap C) = (A \times B) \cap (A \times C) (distributive over intersection)
Example: Application: Database Relations

In databases, a relation (table) can be viewed as a subset of a Cartesian product:

Let extStudentID=1001,1002,1003 ext{StudentID} = {1001, 1002, 1003}

Let extCourses=extMath,extCS,extPhysics ext{Courses} = { ext{Math}, ext{CS}, ext{Physics}}

An enrollment relation might be: RsubseteqextStudentIDimesextCoursesR subseteq ext{StudentID} imes ext{Courses}

For example: R=(1001,extMath),(1001,extCS),(1002,extPhysics),(1003,extCS)R = {(1001, ext{Math}), (1001, ext{CS}), (1002, ext{Physics}), (1003, ext{CS})}

This represents which students are enrolled in which courses.

Practice Quiz

Sets and Set Operations Quiz
10
Questions
0
Correct
0%
Accuracy
1
Which of the following correctly represents the set of positive even integers less than 10?
Easy
Not attempted
2
If A={1,2,3}A = \{1, 2, 3\} and B={3,4,5}B = \{3, 4, 5\}, what is ABA \cup B?
Easy
Not attempted
3
If A={1,2,3,4}A = \{1, 2, 3, 4\} and B={3,4,5,6}B = \{3, 4, 5, 6\}, what is ABA - B?
Medium
Not attempted
4
If A=5|A| = 5, how many elements are in the power set P(A)\mathcal{P}(A)?
Medium
Not attempted
5
Which of the following is true about the empty set \emptyset?
Medium
Not attempted
6
If A×B={(1,3),(1,4),(2,3),(2,4)}A \times B = \{(1,3), (1,4), (2,3), (2,4)\}, what are sets A and B?
Medium
Not attempted
7
Which set identity is represented by A(BC)=(AB)(AC)A \cap (B \cup C) = (A \cap B) \cup (A \cap C)?
Easy
Not attempted
8
If U is the universal set and A is any set, what is AAA \cap \overline{A}?
Easy
Not attempted
9
Which of the following represents De Morgan's Law for sets?
Hard
Not attempted
10
If A=m|A| = m and B=n|B| = n, what is A×B|A \times B|?
Hard
Not attempted

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"

  • AB=AB\overline{A \cup B} = \overline{A} \cap \overline{B} ("not in A or B" = "not in A and not in B")
  • AB=AB\overline{A \cap B} = \overline{A} \cup \overline{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