← mapSet Theory

Set Operations

⚗ Dr. Möbius, from the lab

Here's the secret the Federation of Boring Textbook Authors buries under a pile of cutesy Venn diagrams and pastel highlighters: set theory is just logic in a bag costume. Union is "or". Intersection is "and". Complement is "not". Once you see that, every set operation becomes a connective you already know cold from the Logic stratum. I'm going to rip the costume off, and it's going to be a little violent — in the best possible way.

THE BIG IDEA

Every set operation is a logical connective in disguise: union is OR, intersection is AND, complement is NOT.

Four operations, four connectives

In the last node we built sets and the membership question \in. Now we combine sets — and every combination is defined by a logical connective acting on membership statements. That's not an analogy. It's the literal definition, and anyone who sells you a different story is lying to you, possibly for grant money.

Union. ABA \cup B is everything in AA or BB (or both):

xAB    xA  xB.x \in A \cup B \quad \iff \quad x \in A \ \lor\ x \in B.

Intersection. ABA \cap B is everything in AA and BB:

xAB    xA  xB.x \in A \cap B \quad \iff \quad x \in A \ \land\ x \in B.

Difference. ABA \setminus B ("AA minus BB") is everything in AA but not in BB:

xAB    xA  xB.x \in A \setminus B \quad \iff \quad x \in A \ \land\ x \notin B.

Complement. Fix a universe UU (the set of all things under discussion). The complement AA' (also written AcA^c or A\overline{A}) is everything in UU not in AA:

xA    xU  xA.x \in A' \quad \iff \quad x \in U \ \land\ x \notin A.

Look at the right-hand sides. \lor, \land, ¬\neg, \land. Set theory is logic wearing a bag costume — every truth table you sweated over in the Logic stratum is secretly a statement about sets, and vice versa. This is the single most important idea in the next three lessons, so let it sink all the way in. Write it on the lab wall if you have to. I have chalk — some of it is technically contraband, but the math doesn't care.

Venn diagrams are truth tables you can see

A Venn diagram draws each set as a circle and the universe as the box around them. For two sets that box is carved into exactly four regions, one for each combination of "in AA? / in BB?":

in AA?in BB?region
yesyesABA \cap B
yesnoABA \setminus B
noyesBAB \setminus A
nonooutside both, i.e. (AB)(A \cup B)'

That table is a truth table with rows P=P = "xAx \in A" and Q=Q = "xBx \in B". Four rows, four regions — same object. For three sets, you get 23=82^3 = 8 regions (each of AA, BB, CC independently in or out), which is exactly why the standard three-circle picture has eight pieces. Push the buttons and watch each expression light up its regions; this is a truth table you can poke:

venn lab — three sets
ABCU

When a "set identity" looks mysterious, color the regions on both sides. If they match, the identity is plausible — but a picture is only a hypothesis. We promote it to a theorem with an element proof in the next node. For now, let the picture build your intuition.

Disjoint sets and the preview of partitions

Two sets are disjoint when they share nothing: AB=A \cap B = \emptyset. On the Venn diagram their circles don't overlap at all. Disjointness is the cleanest possible relationship — no double-counting, no overlap, no messy specimens contaminating each other's beakers.

Push this further. Suppose you carve a universe UU into several pieces that are pairwise disjoint (no two overlap) and that cover everything (their union is all of UU). That's a partition of UU — a clean division into non-overlapping blocks with nothing left over. The even and odd integers partition Z\mathbb{Z}: disjoint, and together they're all of Z\mathbb{Z}. Hold this thought — partitions become the secret heart of equivalence relations two lessons from now, where "same remainder mod nn" slices the integers into perfect disjoint blocks.

These operations work on real intervals, not just toy sets

Finite sets like {1,2,3}\{1, 2, 3\} are great for practice, but the operations don't care about size — they run on infinite sets too, and the most important case is intervals of R\mathbb{R}. Recall the interval notation: [a,b][a, b] includes both endpoints, (a,b)(a, b) excludes both, and half-open ones like [a,b)[a, b) mix.

Run the connectives. Let A=[0,5]A = [0, 5] and B=[3,8]B = [3, 8].

  • Intersection (in both, so overlap): AB=[3,5]A \cap B = [3, 5] — the stretch they share.
  • Union (in either, and they touch): AB=[0,8]A \cup B = [0, 8] — one continuous block, because they overlap.
  • Difference (AA but not BB): AB=[0,3)A \setminus B = [0, 3) — note the open endpoint at 33, because 3B3 \in B gets removed from AA.

That open bracket at 33 in ABA \setminus B is where students bleed out — and they bleed consistently, predictably, despite my yelling: removing BB removes the point 33 itself, so the leftover can't include it. The connective "xAxBx \in A \land x \notin B" demands it. Now suppose instead A=[0,2]A = [0, 2] and B=[5,7]B = [5, 7] — no overlap, so AB=A \cap B = \emptyset (disjoint), and AB=[0,2][5,7]A \cup B = [0,2] \cup [5,7] stays as two separate blocks because there's a gap between them. Union doesn't magically fill gaps; it just collects.

The grand summary

Every operation, one connective, no exceptions:

,,¬,(¬).\cup \leftrightarrow \lor, \qquad \cap \leftrightarrow \land, \qquad {}' \leftrightarrow \neg, \qquad \setminus \leftrightarrow (\cdots \land \neg \cdots).

Memorize the goddamn dictionary, not a pile of rules. If I catch you memorizing rules instead of understanding why they're true, I will be genuinely upset — not performing upset, actually upset, the kind that fuses the reactor core. When you hit a set identity you can't remember, translate it into logic, where you already know the answer, and translate back. That trick — set statement \to logic statement \to answer — is the whole engine of the next lesson's proofs.

🔬 SPECIMENS (worked examples)

Worked example 1 — the four regions, ground out by hand

Let A={1,2,3,4}A = \{1, 2, 3, 4\} and B={3,4,5,6}B = \{3, 4, 5, 6\} inside the universe U={1,2,,8}U = \{1, 2, \dots, 8\}. Compute ABA \cup B, ABA \cap B, ABA \setminus B, and AA'.

Run each connective element by element.

ABA \cup B (in AA or BB): sweep up everything that appears in either list. AB={1,2,3,4,5,6}.A \cup B = \{1, 2, 3, 4, 5, 6\}. (No duplicates — 33 and 44 appear once each, even though they're in both.)

ABA \cap B (in AA and BB): keep only the shared elements. AB={3,4}.A \cap B = \{3, 4\}.

ABA \setminus B (in AA, not in BB): start with AA, throw out anything also in BB. AB={1,2}.A \setminus B = \{1, 2\}.

AA' (in UU, not in AA): everything in the universe outside AA. A={5,6,7,8}.A' = \{5, 6, 7, 8\}.

Sanity check: AB={3,4}A \cap B = \{3,4\} and AB={1,2}A \setminus B = \{1,2\} together rebuild A={1,2,3,4}A = \{1,2,3,4\} — they're the two halves of AA split by "in BB or not". That's the four-region carve-up in action.

Worked example 2 — intervals and the open-endpoint trap (this is where students bleed)

Let A=(2,4]A = (-2, 4] and B=[1,7)B = [1, 7), with universe U=RU = \mathbb{R}. Find ABA \cap B, ABA \cup B, and ABA \setminus B.

Picture two overlapping segments on the line and apply the connectives.

ABA \cap B (in both): the overlap runs from where the later left-end starts to where the earlier right-end stops. Left end: 11, and 1B1 \in B (closed) and 1A1 \in A, so include it. Right end: 44, and 4A4 \in A (closed) and 4B4 \in B, so include it. AB=[1,4].A \cap B = [1, 4].

ABA \cup B (in either): they overlap, so it's one block from the leftmost start to the rightmost end. Left end: 2-2, open (from AA). Right end: 77, open (from BB). AB=(2,7).A \cup B = (-2, 7).

ABA \setminus B (in AA but not BB): start with A=(2,4]A = (-2, 4] and remove everything in B=[1,7)B = [1, 7), i.e. remove [1,)[1, \infty)'s overlap. We strip out [1,4][1, 4], leaving everything in AA below 11: AB=(2,1).A \setminus B = (-2, 1).

Why open at 11? Because 1B1 \in B, so 11 is removed — it can't survive in ABA \setminus B. The connective "xAxBx \in A \land x \notin B" fails at x=1x = 1. That open endpoint is the whole point.

Worked example 3 — disjoint, and a partition check

Let U={1,2,,10}U = \{1, 2, \dots, 10\}, with E={2,4,6,8,10}E = \{2,4,6,8,10\} (evens) and O={1,3,5,7,9}O = \{1,3,5,7,9\} (odds). Show EE and OO are disjoint and form a partition of UU. Then find a third set disjoint from EE.

Disjoint? Check EOE \cap O: is any number both even and odd? No. EO=,E \cap O = \emptyset, so EE and OO are disjoint.

Partition? A partition needs (i) pairwise disjoint blocks and (ii) blocks covering all of UU. We have disjointness. For coverage: EO={1,2,3,4,5,6,7,8,9,10}=U.E \cup O = \{1,2,3,4,5,6,7,8,9,10\} = U. Disjoint and covering — so {E,O}\{E, O\} is a partition of UU. Every element of UU lands in exactly one block, no overlaps, nothing missed.

A third set disjoint from EE: any set sharing no even number works — for instance {1,3}O\{1, 3\} \subseteq O gives E{1,3}=E \cap \{1,3\} = \emptyset. In fact every subset of OO is disjoint from EE, because EE and OO already share nothing. This split of UU into evens and odds is your first taste of partitions — and it returns as "congruence mod 22" when we hit equivalence relations.

☠ KNOWN HAZARDS

  • Swapping \cup and \cap. Union is "or" (bigger, collects everything); intersection is "and" (smaller, only the overlap). If your "intersection" came out larger than the original sets, you ran the wrong connective. Go back to the dictionary.

  • Mishandling endpoints in interval differences. [0,5][3,8]=[0,3)[0,5] \setminus [3,8] = [0,3), open at 33, because 33 belongs to [3,8][3,8] and gets removed. Closing that bracket is the classic off-by-one-point bug — it's embarrassing and completely avoidable.

  • Assuming union fills gaps. [0,2][5,7][0,2] \cup [5,7] stays two blocks; union only collects what's there. It doesn't connect disjoint pieces. "But they're close!" is not an argument.

  • Forgetting complement needs a universe. AA' is meaningless until you declare UU. "Everything not in AA" depends entirely on what "everything" is. No universe, no complement — that's not a suggestion, that's a definition.

TL;DR

  • ABA \cup B is defined by OR, ABA \cap B by AND, AA' by NOT, and ABA \setminus B by "xAxBx \in A \land x \notin B". Set theory is logic in a bag costume.

  • A 22-set Venn has 44 regions, a 33-set Venn has 88 — one per combination of in/out. A Venn diagram is a truth table you can see.

  • Sets are disjoint when AB=A \cap B = \emptyset. A partition chops a universe into pairwise-disjoint blocks that cover everything.

  • The operations run on infinite sets: e.g. [0,5][3,8]=[3,5][0,5] \cap [3,8] = [3,5], and [0,5][3,8]=[0,3)[0,5] \setminus [3,8] = [0,3) — the removed endpoint goes open.

  • To recall a set fact, translate to logic, solve there, translate back. That dictionary powers every proof in the next lesson.

unlocks