Math 205: Real Analysis

Lecture 02 — Cartesian Products, Relations, and Functions

Lecture Notes


1   Cartesian Product of Sets

Definition: Cartesian Product

Let \(A\) and \(B\) be sets. The Cartesian product of \(A\) and \(B\) is

$$A \times B = \{(a, b) : a \in A,\; b \in B\}.$$

An element of \(A \times B\) is an ordered pair: \((a,b) \neq (b,a)\) unless \(a = b\).

Example: Interactive Cartesian Product

Let \(A = \{1, 2\}\) and \(B = \{\alpha, \beta, \gamma\}\). Click any dot in the grid to see its ordered pair:

B A α β γ 1 2

Click a dot to reveal the ordered pair!

\(|A \times B| = |A| \cdot |B| = 2 \cdot 3 = 6\)

Theorem: Cardinality of Cartesian Product

If \(A\) and \(B\) are finite sets, then \(|A \times B| = |A| \cdot |B|\).

Important Note: The Cartesian Plane

The familiar \(xy\)-plane is precisely \(\mathbb{R} \times \mathbb{R} = \mathbb{R}^2\). Every point \((x,y)\) is an ordered pair of real numbers. This is why Cartesian products carry Descartes' name!

2   Relations

Definition: Relation

A relation from \(A\) to \(B\) is any subset of \(A \times B\). If \((a,b) \in R\), we write \(a\,R\,b\).

Theorem: Counting Relations

The number of distinct relations from \(A\) to \(B\) is \(2^{|A| \cdot |B|}\).

Why? Each ordered pair is either included or not — two choices per pair.

Example: Explore Relations — Interactive

Click to explore three different relations from \(A = \{1,2\}\) to \(B = \{\alpha, \beta, \gamma\}\):

\(R_1\)

\(\{(1,\alpha),(2,\beta)\}\)

\(R_2\)

\(\{(1,\gamma),(2,\gamma)\}\)

\(R_3\)

\(\varnothing\)

Total number of relations: \(2^{2 \cdot 3} = 2^6 = 64\).

3   Relations on a Set

Definition: Relation on a Set

If \(B = A\), a relation from \(A\) to \(A\) is called a relation on \(A\).

Example: Congruence Modulo 3 — Interactive

Define \(a\,R\,b \iff 3 \mid (b - a)\) on \(\mathbb{Z}\). Enter two integers to check:

Number line colored by residue class:

4   Properties of Relations

Definition: Properties of Relations

Let \(R\) be a relation on a set \(A\).

Reflexive: \(a\,R\,a\) for all \(a \in A\). — Every element related to itself

Symmetric: \(a\,R\,b \Rightarrow b\,R\,a\). — Goes both ways

Antisymmetric: \(a\,R\,b\) and \(b\,R\,a \Rightarrow a = b\). — Two-way implies equal

Transitive: \(a\,R\,b\) and \(b\,R\,c \Rightarrow a\,R\,c\). — Chains together

Interactive: Property Visualizer

Click each property to see a diagram illustrating it:

Example: Properties of Congruence Mod 3

For \(a\,R\,b \iff 3 \mid (b-a)\) on \(\mathbb{Z}\):

✓ Reflexive \(3 \mid (a - a) = 0\)

✓ Symmetric \(3 \mid (b-a) \Rightarrow 3 \mid (a-b)\)

✓ Transitive \(3 \mid (b-a)\) and \(3 \mid (c-b) \Rightarrow 3 \mid (c-a)\)

✗ Not Antisymmetric \(0\,R\,3\) and \(3\,R\,0\) but \(0 \neq 3\)

5   Equivalence Relations

Definition: Equivalence Relation

A relation that is reflexive, symmetric, and transitive is an equivalence relation.

Equivalence relations formalize the idea of "being the same in some sense."

The Three Tests
PropertyConditionQuantifier
Reflexive\(a\,R\,a\)for all \(a \in A\)
Symmetric\(a\,R\,b \Rightarrow b\,R\,a\)for all \(a,b \in A\)
Transitive\(a\,R\,b\) and \(b\,R\,c \Rightarrow a\,R\,c\)for all \(a,b,c \in A\)

If any one fails, \(R\) is not an equivalence relation.

6   Equivalence Classes

Definition: Equivalence Class
$$[a] = \{x \in A : x\,R\,a\}$$

The set of all elements related to \(a\).

Example: Equivalence Classes Mod 3 — Interactive

Click a class to highlight its elements. Notice: \([3] = [0]\), \([4] = [1]\), etc.

Click a class above!

Key observation: \([3] = [0]\) since \(3\,R\,0\). Elements in the same class give the same class.

Exercise

Let \(R\) be an equivalence relation on \(A\). Prove that if \(a\,R\,b\), then \([a] = [b]\).

Hint: Double containment. Use transitivity with \(a\,R\,b\).

7   Partitions

Definition: Partition

A partition of \(A\) is a collection of nonempty, pairwise disjoint subsets whose union is \(A\).

Theorem: Equivalence Classes Form a Partition

The equivalence classes of an equivalence relation on \(A\) form a partition of \(A\).

Conversely, every partition determines an equivalence relation.

Key Insight

There is a one-to-one correspondence between equivalence relations on \(A\) and partitions of \(A\). Two sides of the same coin!

8   The Sets \(\mathbb{Z}_n\)

Definition: \(\mathbb{Z}_n\)
$$\mathbb{Z}_n = \{[0], [1], \ldots, [n-1]\}$$

Operations: \([a] \oplus [b] = [a+b]\), \(\;[a] \odot [b] = [a \cdot b]\).

Interactive: Arithmetic in \(\mathbb{Z}_n\)

Choose \(n\) and explore the operation tables. Red cells show zero divisors!

\(n =\)

Addition \(\oplus\)

Multiplication \(\odot\)

9   Functions

Definition: Function

A function \(f : A \to B\) is a relation such that:

1. Every element of \(A\) has some output. — every input mapped

2. No element of \(A\) has more than one output. — unique output

Interactive: Is It a Function?

Click each diagram to check whether it represents a valid function:

10   Injective, Surjective, and Bijective

Definition: Injective, Surjective, Bijective

Injective (one-to-one): \(f(x) = f(y) \Rightarrow x = y\). — No collisions

Surjective (onto): \(\forall y \in B,\; \exists x \in A\) with \(f(x) = y\). — Everything hit

Bijective: Both injective and surjective. — Perfect pairing

Interactive: Classify the Function

Click each example to see its classification:

Theorem: Size Constraints

For finite sets: injection \(\Rightarrow |A| \leq |B|\), surjection \(\Rightarrow |A| \geq |B|\), bijection \(\Rightarrow |A| = |B|\).

Questions to Think About

Q1: Can there be a surjection from a 2-element set to a 3-element set?

No — not enough inputs to cover all outputs.

Q2: Can there be an injection from a 3-element set to a 2-element set?

No — pigeonhole principle forces a collision.

11   Exercises

Exercises for Lecture 02

Exercise 1. Let \(A = \{1,2,3\}\). How many relations on \(A\)? How many reflexive?

Exercise 2. Show \(a\,R\,b \iff a+b\) is even defines an equivalence relation on \(\mathbb{Z}\).

Exercise 3. Prove: if \(a\,R\,b\), then \([a] = [b]\).

Exercise 4. Build addition/multiplication tables for \(\mathbb{Z}_5\). Zero divisors?

Exercise 5. Is \(f(x) = x^2\) on \(\mathbb{R}\) injective? Surjective?

Exercise 6. Show \(f(x) = 2x+3\) is a bijection. Find its inverse.

Exercise 7. Prove: if \(f:A\to B\) and \(g:B\to C\) are injective, then \(g \circ f\) is injective.


Math 205: Real Analysis — Lecture 02