Set Theory

927 words
5 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Set Theory ## ๐ŸŽฏ Learning Objectives - Define sets using roster and set-builder notation - Perform set operations: $\cup$, $\cap$, $-$ (difference), $\overline{A}$ (complement) - Prove set identities using element arguments - Understand power sets and Cartesian products - Compare finite and infinite cardinalities...

Set Theory

๐ŸŽฏ Learning Objectives

  • Define sets using roster and set-builder notation
  • Perform set operations: โˆช\cup, โˆฉ\cap, โˆ’- (difference), Aโ€พ\overline{A} (complement)
  • Prove set identities using element arguments
  • Understand power sets and Cartesian products
  • Compare finite and infinite cardinalities

5.1 Intuition: The Building Blocks of Mathematics

A set is a collection of distinct objects. It's the most fundamental concept in mathematics โ€” everything else (numbers, functions, relations) is built from sets.
๐Ÿ”‘ Key Insight: Two sets are equal iff they have exactly the same elements. Order and repetition don't matter.

5.2 Definitions

Basic Notation

  • A={1,2,3}A = \{1, 2, 3\} โ€” roster notation
  • B={xโˆˆN:x>5}B = \{x \in \mathbb{N} : x > 5\} โ€” set-builder notation
  • โˆ…\emptyset โ€” empty set (or {}\{\})
  • aโˆˆAa \in A โ€” aa is an element of AA
  • AโІBA \subseteq B โ€” AA is a subset of BB

Important Sets

  • N={1,2,3,โ€ฆโ€‰}\mathbb{N} = \{1, 2, 3, \dots\} โ€” natural numbers
  • Z={โ€ฆ,โˆ’2,โˆ’1,0,1,2,โ€ฆโ€‰}\mathbb{Z} = \{\dots, -2, -1, 0, 1, 2, \dots\} โ€” integers
  • Q={pq:p,qโˆˆZ,qโ‰ 0}\mathbb{Q} = \{\frac{p}{q} : p,q \in \mathbb{Z}, q \neq 0\} โ€” rationals
  • R\mathbb{R} โ€” real numbers
  • C\mathbb{C} โ€” complex numbers

5.3 Set Operations

OperationNotationDefinitionExample ( A={1,2},B={2,3}A=\{1,2\}, B=\{2,3\} )
UnionAโˆชBA \cup B{x:xโˆˆAโˆจxโˆˆB}\{x : x \in A \lor x \in B\}{1,2,3}\{1,2,3\}
IntersectionAโˆฉBA \cap B{x:xโˆˆAโˆงxโˆˆB}\{x : x \in A \land x \in B\}{2}\{2\}
DifferenceAโˆ’BA - B{x:xโˆˆAโˆงxโˆ‰B}\{x : x \in A \land x \notin B\}{1}\{1\}
ComplementAโ€พ\overline{A}{xโˆˆU:xโˆ‰A}\{x \in U : x \notin A\}Depends on universe UU

5.4 Set Identities

NameIdentity
CommutativeAโˆชB=BโˆชAA \cup B = B \cup A ; AโˆฉB=BโˆฉAA \cap B = B \cap A
Associative(AโˆชB)โˆชC=Aโˆช(BโˆชC)(A \cup B) \cup C = A \cup (B \cup C)
DistributiveAโˆฉ(BโˆชC)=(AโˆฉB)โˆช(AโˆฉC)A \cap (B \cup C) = (A \cap B) \cup (A \cap C)
De MorganAโˆชBโ€พ=Aโ€พโˆฉBโ€พ\overline{A \cup B} = \overline{A} \cap \overline{B} ; AโˆฉBโ€พ=Aโ€พโˆชBโ€พ\overline{A \cap B} = \overline{A} \cup \overline{B}
IdentityAโˆชโˆ…=AA \cup \emptyset = A ; AโˆฉU=AA \cap U = A
DominationAโˆชU=UA \cup U = U ; Aโˆฉโˆ…=โˆ…A \cap \emptyset = \emptyset

Proving Set Identities: Element Method

Prove Aโˆฉ(BโˆชC)=(AโˆฉB)โˆช(AโˆฉC)A \cap (B \cup C) = (A \cap B) \cup (A \cap C): Proof (โІ\subseteq): Let xโˆˆAโˆฉ(BโˆชC)x \in A \cap (B \cup C). Then xโˆˆAx \in A AND xโˆˆBโˆชCx \in B \cup C.
  • Since xโˆˆBโˆชCx \in B \cup C, either xโˆˆBx \in B or xโˆˆCx \in C.
  • If xโˆˆBx \in B, then xโˆˆAโˆฉBx \in A \cap B, so xโˆˆ(AโˆฉB)โˆช(AโˆฉC)x \in (A \cap B) \cup (A \cap C).
  • If xโˆˆCx \in C, then xโˆˆAโˆฉCx \in A \cap C, so xโˆˆ(AโˆฉB)โˆช(AโˆฉC)x \in (A \cap B) \cup (A \cap C). Proof (โЇ\supseteq): Let xโˆˆ(AโˆฉB)โˆช(AโˆฉC)x \in (A \cap B) \cup (A \cap C).
  • Either xโˆˆAโˆฉBx \in A \cap B or xโˆˆAโˆฉCx \in A \cap C.
  • In either case, xโˆˆAx \in A. And xโˆˆBx \in B or xโˆˆCx \in C, so xโˆˆBโˆชCx \in B \cup C.
  • Therefore xโˆˆAโˆฉ(BโˆชC)x \in A \cap (B \cup C). โ–ก\square

5.5 Power Sets

The power set P(A)\mathcal{P}(A) is the set of all subsets of AA. If โˆฃAโˆฃ=n|A| = n, then โˆฃP(A)โˆฃ=2n|\mathcal{P}(A)| = 2^n. Example: A={a,b}A = \{a, b\}, P(A)={โˆ…,{a},{b},{a,b}}\mathcal{P}(A) = \{\emptyset, \{a\}, \{b\}, \{a, b\}\}.

5.6 Cartesian Products

Aร—B={(a,b):aโˆˆA,bโˆˆB}A \times B = \{(a, b) : a \in A, b \in B\} โ€” ordered pairs. If โˆฃAโˆฃ=m|A| = m and โˆฃBโˆฃ=n|B| = n, then โˆฃAร—Bโˆฃ=mn|A \times B| = mn.

5.7 Cardinality

Finite sets: โˆฃAโˆฃ|A| = number of elements. Infinite sets: Two sets have the same cardinality if there's a bijection between them.
  • โˆฃNโˆฃ=โˆฃZโˆฃ=โˆฃQโˆฃ|\mathbb{N}| = |\mathbb{Z}| = |\mathbb{Q}| (countably infinite)
  • โˆฃRโˆฃ|\mathbb{R}| is uncountably infinite (Cantor's diagonal argument)

โœ… Practice Questions

Q1: If A={1,2,3}A = \{1,2,3\}, B={2,3,4}B = \{2,3,4\}, find AโˆชBA \cup B, AโˆฉBA \cap B, Aโˆ’BA - B, Bโˆ’AB - A.
Solution
AโˆชB={1,2,3,4}A \cup B = \{1,2,3,4\}, AโˆฉB={2,3}A \cap B = \{2,3\}, Aโˆ’B={1}A - B = \{1\}, Bโˆ’A={4}B - A = \{4\}. Q2: Prove AโˆฉBโ€พ=Aโ€พโˆชBโ€พ\overline{A \cap B} = \overline{A} \cup \overline{B} using element argument. Solution
(โІ\subseteq): Let xโˆˆAโˆฉBโ€พx \in \overline{A \cap B}. Then xโˆ‰AโˆฉBx \notin A \cap B, so xโˆ‰Ax \notin A or xโˆ‰Bx \notin B. If xโˆ‰Ax \notin A, then xโˆˆAโ€พโІAโ€พโˆชBโ€พx \in \overline{A} \subseteq \overline{A} \cup \overline{B}. Similarly if xโˆ‰Bx \notin B. (โЇ\supseteq): Let xโˆˆAโ€พโˆชBโ€พx \in \overline{A} \cup \overline{B}. Then xโˆ‰Ax \notin A or xโˆ‰Bx \notin B, so xโˆ‰AโˆฉBx \notin A \cap B, hence xโˆˆAโˆฉBโ€พx \in \overline{A \cap B}. Q3: How many subsets does {a,b,c,d}\{a,b,c,d\} have? Solution
24=162^4 = 16 subsets. Q4: Prove AโІBA \subseteq B iff AโˆฉB=AA \cap B = A. Solution
(โ†’\to) Assume AโІBA \subseteq B. If xโˆˆAx \in A, then xโˆˆBx \in B, so xโˆˆAโˆฉBx \in A \cap B. Thus AโІAโˆฉBA \subseteq A \cap B. Also AโˆฉBโІAA \cap B \subseteq A always. So AโˆฉB=AA \cap B = A. (โ†\leftarrow) Assume AโˆฉB=AA \cap B = A. If xโˆˆAx \in A, then xโˆˆAโˆฉBx \in A \cap B, so xโˆˆBx \in B. Thus AโІBA \subseteq B. Q5: Show โˆฃNโˆฃ=โˆฃZโˆฃ|\mathbb{N}| = |\mathbb{Z}| by constructing a bijection. Solution
Define f:Nโ†’Zf: \mathbb{N} \to \mathbb{Z} as:
>f(n)={0n=1n2nย evenโˆ’nโˆ’12nย odd,n>1>> f(n) = \begin{cases} 0 & n=1 \\ \frac{n}{2} & n \text{ even} \\ -\frac{n-1}{2} & n \text{ odd}, n>1 \end{cases} >
This gives: 1โ†’01 \to 0, 2โ†’12 \to 1, 3โ†’โˆ’13 \to -1, 4โ†’24 \to 2, 5โ†’โˆ’25 \to -2, etc. It's bijective. Join Discord PreviousAdvanced ProofsNextSet Operation Proofs
Document outline

Keep your place and jump directly to a heading.

Table of contents

No note selected

Open a chapter to see its outline, backlinks, and sources here.