Evanalysis
2.1Embedded interactionEstimated reading time: 10 min

2.1 Sets and set operations

Build the language of membership, subset proofs, and standard set constructions that later chapters repeatedly rely on.

Course contents

MATH1090: Set theory

Rigorous course notes on logic, sets, number construction, the real numbers, limits, cardinality, and the first algebraic structures, written in linked sections with careful proofs and examples.

Chapter 7Sets with structure1 sections

Sets are the basic objects that let us talk about collections without constantly repeating the same description. In this course, sets are not a side topic. They are the language behind logic, functions, relations, and the later number constructions.

If the notation here feels unfamiliar, that is normal. The point of this unit is to make the language precise enough that later chapters can use it freely.

Sets, membership, and equality

Definition

A set

A set is a collection of things.

If x is an element of a set AA, we write xAx ∈ A. If x is not an element of AA, we write xAx ∉ A.

Examples:

  • {1, 2, 3} is a set.
  • {Hong Kong Island, Kowloon, New Territories} is a set.
  • is the empty set, the set with no elements.

The same object may be written in different ways, but a set is determined only by its elements.

Theorem

Extensionality

Two sets are equal if and only if they have exactly the same elements.

In symbols:

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

This is the rule that makes set equality practical. To prove A=BA = B, the standard method is to prove both inclusions:

  1. show ABA \subset B;
  2. show BAB \subset A.

Common mistake

Do not confuse equal sets with equal descriptions

{1, 2, 3} and {3, 2, 1} are the same set, because they have the same elements. The order of listing does not matter.

Common mistake

Subset notation varies across books

This course uses ABA \subset B to mean “every element of AA is in BB”. Some books write ABA \subseteq B for that idea and reserve ABA \subset B for strict subset. Always check the local convention.

Building new sets

Once we know some sets, we usually want to build more. The standard operations do exactly that.

| Operation | Symbol | Definition | | --- | --- | --- | | Union | ABA \cup B | elements in AA or in BB | | Intersection | ABA \cap B | elements in both AA and BB | | Difference | ABA \setminus B | elements in AA but not in BB | | Complement | AcA^c | elements outside AA in a chosen universal set |

The complement depends on a universal set EE. In this unit we usually assume all sets live inside some fixed EE, so AcA^c means EAE \setminus A.

Worked example

Track elements through several set operations

Let

A={1,2,4},B={2,3,4},A = \{1, 2, 4\}, \qquad B = \{2, 3, 4\},

and take the universal set

E={1,2,3,4,5}.E = \{1, 2, 3, 4, 5\}.

Then:

  • AB={1,2,3,4}A \cup B = \{1, 2, 3, 4\}
  • AB={2,4}A \cap B = \{2, 4\}
  • AB={1}A \setminus B = \{1\}
  • BA={3}B \setminus A = \{3\}
  • Ac={3,5}A^c = \{3, 5\}
  • (AB)c={5}(A \cup B)^c = \{5\}

Solution

Why the complement needs a universal set

Why the identities are true

The set laws in this unit are not memorized by magic. They are proved by tracking one element at a time.

Theorem

Basic algebra of sets

For sets AA, BB, and CC:

  • A=AA \cup \varnothing = A
  • AB=BAA \cup B = B \cup A
  • A(BC)=(AB)CA \cup (B \cup C) = (A \cup B) \cup C
  • AA=AA \cup A = A
  • A(BC)=(AB)(AC)A \cap (B \cup C) = (A \cap B) \cup (A \cap C)
  • A(BC)=(AB)(AC)A \cup (B \cap C) = (A \cup B) \cap (A \cup C)
  • (AB)c=AcBc(A \cup B)^c = A^c \cap B^c
  • (AB)c=AcBc(A \cap B)^c = A^c \cup B^c
  • ABA \subset B if and only if AB=BA \cup B = B
  • ABA \subset B if and only if AB=AA \cap B = A

The key proof method is element chasing. For example:

xA(BC)    xA and (xB or xC)x \in A \cap (B \cup C) \iff x \in A \text{ and } (x \in B \text{ or } x \in C)

which is equivalent to

(xA and xB) or (xA and xC),(x \in A \text{ and } x \in B) \text{ or } (x \in A \text{ and } x \in C),

and therefore to

x(AB)(AC).x \in (A \cap B) \cup (A \cap C).

Proof

Guided proof: why ABA \subset B implies AB=BA \cup B = B

Other set constructions

The course also uses a few larger constructions that are still built from the same language.

Cartesian products

A×BA \times B is the set of ordered pairs (a, b) with aAa \in A and bBb \in B. Order matters: (a, b) and (b, a) are different unless a=ba = b.

If A=5|A| = 5 and B=3|B| = 3, then A×B=15|A \times B| = 15.

R×R=R2R \times R = R^2 is the Cartesian plane.

Finite products

The n-fold product AnA^n is the set of all n-tuples with entries in AA. This is just the repeated Cartesian product of AA with itself.

Power sets

P(A) is the set of all subsets of AA.

If AA has n elements, then P(A) has 2n2^n elements. A useful way to think about this is the indicator-function viewpoint: every subset of AA can be encoded by a function A0,1A → {0, 1}.

For example,

P({a,b})={,{a},{b},{a,b}}.P(\{a, b\}) = \{\varnothing, \{a\}, \{b\}, \{a, b\}\}.

Disjoint union

Sometimes two sets may overlap as raw collections, but we still want to keep track of where each element came from. The disjoint union does that by tagging the elements with their origin.

Informally, ABA \sqcup B is “AA with tag 1” together with “BB with tag 2”.

How to prove a set identity carefully

At this stage of the course, a set identity should be read as a statement about membership, not as a picture to be memorized.

The standard proof pattern is:

  1. take an arbitrary element x;
  2. rewrite xx \in each side into logical conditions;
  3. simplify those conditions until both sides say the same thing.

Worked example

Prove A(BC)=(AB)CA \cap (B \setminus C) = (A \cap B) \setminus C

Start with

xA(BC).x \in A \cap (B \setminus C).

This means:

  • xAx \in A,
  • xBx \in B,
  • xCx \notin C.

But that is exactly the condition for

x(AB)C.x \in (A \cap B) \setminus C.

Since the reasoning can be read in either direction, the two sets are equal.

This is the same idea used for De Morgan’s laws, distributive laws, and later proofs about relations and number constructions.

Counting finite sets

The language of sets also controls counting.

For finite sets:

  • A×B=AB|A \times B| = |A|\,|B|,
  • P(A)=2A|P(A)| = 2^{|A|},
  • AB=A+BAB|A \cup B| = |A| + |B| - |A \cap B|.

The last formula matters because elements in the intersection are counted twice if you simply add |A| and |B|.

Worked example

Count a union and a power set

Suppose A=6|A| = 6, B=5|B| = 5, and AB=2|A \cap B| = 2.

Then

AB=6+52=9.|A \cup B| = 6 + 5 - 2 = 9.

Now let S={a,b,c}S = \{a,b,c\}. Each element either belongs to a subset or does not, so there are

222=23=82 \cdot 2 \cdot 2 = 2^3 = 8

possible subsets. Hence P(S)=8|P(S)| = 8.

A checklist for subset proofs

Subset proofs are common enough that they should become routine.

To prove ABA \subseteq B, start with an arbitrary element x in AA. Then use the definition of AA to deduce enough information to show that the same x lies in BB. Because x was arbitrary, the conclusion applies to every element of AA.

This direct-proof pattern is exactly what later chapters reuse for relations, orders, and equivalence classes.

Common mistakes

Common mistake

Complement is not the same as difference

AcA^c means “everything outside AA in the chosen universe”. ABA \setminus B means “the part of AA that is not in BB”. They are related, but not the same.

Common mistake

The universal set cannot be ignored

If you write a complement, you must know what universe you are working in. Otherwise the symbol c^c is ambiguous.

Common mistake

Order matters in products

A×BA \times B and B×AB \times A usually contain different ordered pairs. This is why products are the correct language for functions and relations.

Quick checks

Quick check

If A=a,b,cA = {a, b, c} and B=b,c,dB = {b, c, d}, what is ABA \cap B?

Keep only the elements that belong to both sets.

Solution

Answer

Quick check

Why is AcA^c not defined until a universal set is chosen?

Ask what the complement is supposed to be taken inside.

Solution

Answer

Quick check

If ABA \subset B, what do ABA \cup B and ABA \cap B simplify to?

Use the absorption laws from the theorem above.

Solution

Answer

Why this matters later

This unit is the first place where the course starts building the later number systems in a disciplined way.

  • N2N^2 is used to construct the integers.
  • Equivalence classes are later used to construct the rationals.
  • Relations on one set become the language for orders and classes.
  • Power sets and products reappear whenever we talk about families of subsets or tuples.

Read and try

Compare one pair of sets

The live explorer lets you move elements in and out of A and B and watch the resulting operations update immediately.

Set A

Set B

Union

{1, 2, 3, 4}

Intersection

{2, 4}

Difference A \ B

{1}

Prerequisites

This section can be read on its own.

Key terms in this unit