Mathematics.

foundations

Sets and Set Operations

Set Theory30 minDifficulty2 out of 10

Overview

A set is a collection of distinct objects, called its elements or members. The objects can be anything — numbers, points, letters, even other sets. Sets are the foundational language of modern mathematics: nearly every mathematical object is ultimately built from sets. What matters about a set is only which elements it contains, not their order or repetition, so {1, 2, 3} and {3, 2, 1, 1} denote the same set.

Intuition

Think of a set as a box that either contains a given thing or doesn't — no counting, no ordering, just membership. Two boxes are the same set exactly when they hold the same things. From this single idea — membership — you can build unions (everything in either box), intersections (things in both), and complements (everything outside the box), and those three operations behave like a clean algebra.

Formal Definition

Definition

A set A is determined entirely by its members: x ∈ A means x is an element of A. Two sets are equal iff they have exactly the same elements (the axiom of extensionality). Core operations: union A ∪ B, intersection A ∩ B, complement Aᶜ, and subset A ⊆ B.

AB={x:xA or xB}A \cup B = \{x : x \in A \text{ or } x \in B\}
Union
AB={x:xA and xB}A \cap B = \{x : x \in A \text{ and } x \in B\}
Intersection
AB    (xAxB)A \subseteq B \iff (x \in A \Rightarrow x \in B)
Subset

Notation

NotationMeaning
\inIs an element of
\subseteqIs a subset of
\cupUnion
\capIntersection
\emptysetThe empty set — the set with no elements
A|A|Cardinality — the number of elements of A

Properties

Commutativity of union

AB=BAA \cup B = B \cup A

Commutativity of intersection

AB=BAA \cap B = B \cap A

Associativity of union

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

Distributivity

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

De Morgan's law

(AB)c=AcBc(A \cup B)^c = A^c \cap B^c

Applications

Database queries are set operations: SQL's UNION, INTERSECT, and EXCEPT are exactly union, intersection, and difference of result sets.

Worked Examples

  1. Union collects all elements from either set (no repeats); intersection keeps only shared ones.

    AB={1,2,3,4,5},AB={3}A \cup B = \{1,2,3,4,5\}, \quad A \cap B = \{3\}

Answer: A ∪ B = {1,2,3,4,5}; A ∩ B = {3}

Practice Problems

Difficulty 2/10

If A = {2,4,6} and B = {1,2,3}, what is A ∩ B?

Difficulty 3/10

How many elements are in the power set of a 4-element set?

Difficulty 3/10

State De Morgan's law for (A ∩ B)ᶜ.

Common Mistakes

Common Mistake

Thinking order or repetition matters in a set.

A set is defined only by membership: {1,2,2,3} = {1,2,3} = {3,1,2}. Use a sequence or multiset if order/repetition matters.

Common Mistake

Confusing ∈ (element of) with ⊆ (subset of).

1 ∈ {1,2} (1 is a member), but {1} ⊆ {1,2} ({1} is a subset). '1 ⊆ {1,2}' and '{1} ∈ {1,2}' are both wrong.

Quiz

What is A ∪ ∅?
De Morgan's law says (A ∪ B)ᶜ equals:

Flashcards

1 / 4

Summary

  • A set is a collection of distinct elements, determined solely by membership.
  • Core operations: union (∪), intersection (∩), complement (ᶜ), subset (⊆).
  • Set algebra obeys commutative, associative, distributive, and De Morgan laws.
  • A set of n elements has 2ⁿ subsets (its power set).
  • Sets are the foundational language for functions, relations, probability, and logic.

References

  1. BookHalmos, P. Naive Set Theory.