Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 36 · Getting Started

Sets, Functions and Relations: a Review

Refresh the set language topology needs: unions, intersections, complements, images, preimages, bijections and equivalence relations, with checks in code.

Topology is written almost entirely in the language of sets and functions. Before we define open sets, let us make sure the vocabulary is solid. If you know it well, skim the headings and run the code; if not, take your time. Everything here is used again and again in later lessons.

Sets and operations

A set is a collection of distinct objects, called elements. We write x ∈ A for "x belongs to A" and A ⊆ B for "every element of A is in B" (A is a subset of B). The empty set ∅ has no elements. Within one discussion we usually fix a universe X and talk only about subsets of it.

Operation Symbol Meaning
Union A ∪ B in A or in B (or both)
Intersection A ∩ B in both A and B
Complement X \ A or Aᶜ in X but not in A
Difference A \ B in A but not in B

Unions and intersections can be taken over many sets. For a family of sets A_i, written ⋃ A_i and ⋂ A_i, the union collects everything that is in at least one A_i, and the intersection keeps what is in all of them. A family may even be infinite, and that detail matters a great deal in topology.

De Morgan's laws connect the operations through complements:

Text
(A ∪ B)ᶜ = Aᶜ ∩ Bᶜ
(A ∩ B)ᶜ = Aᶜ ∪ Bᶜ

They also hold for any number of sets. You will use them to move between open sets and closed sets, because closed sets are complements of open ones.

The power set P(X) is the set of all subsets of X. If X has n elements, P(X) has 2ⁿ elements.

Functions: image and preimage

A function f: X → Y sends each element of X to exactly one element of Y. For a subset A ⊆ X, the image is f(A) = { f(x) : x ∈ A }. For a subset B ⊆ Y, the preimage is f⁻¹(B) = { x ∈ X : f(x) ∈ B }.

Be careful: f⁻¹(B) is defined even when f has no inverse function. It is simply "everything that lands in B".

Preimages behave beautifully, and images do not:

  • f⁻¹(B ∪ C) = f⁻¹(B) ∪ f⁻¹(C) and f⁻¹(B ∩ C) = f⁻¹(B) ∩ f⁻¹(C) always.
  • f⁻¹(Bᶜ) = (f⁻¹(B))ᶜ always.
  • f(A ∪ B) = f(A) ∪ f(B) always, but f(A ∩ B) ⊆ f(A) ∩ f(B) can be a strict subset.

This asymmetry is why topology defines continuity with preimages: they respect every set operation, so open sets stay well behaved.

Python Preimages versus images

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The last two lines show the failure: A ∩ B is empty, so its image is empty, but f(A) and f(B) both contain "a" and "b". Elements of A and B were sent to the same place without being the same element.

Injective, surjective, bijective

A function f: X → Y is:

  • injective (one-to-one) if different inputs give different outputs;
  • surjective (onto) if every element of Y is hit;
  • bijective if it is both. A bijection has an inverse function f⁻¹: Y → X.

In topology, a bijection is only the first requirement for two spaces to be "the same". You also need the function and its inverse to respect open sets. You will see this in Homeomorphisms.

Relations and equivalence

A relation on X is a set of ordered pairs of elements of X. An equivalence relation ~ is one that is:

  1. reflexive: x ~ x;
  2. symmetric: x ~ y implies y ~ x;
  3. transitive: x ~ y and y ~ z imply x ~ z.

An equivalence relation splits X into equivalence classes: groups of elements that are all related to each other, with no overlap between groups. Such a splitting is called a partition. "Being homeomorphic" is an equivalence relation on spaces, which is why we can speak of "classes of shapes". Later, quotient spaces (see the second half of this track) glue points together using exactly this idea.

Python Equivalence classes of a relation

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Cardinality in one paragraph

Two sets have the same size (cardinality) if there is a bijection between them. A set is countable if it is finite or can be matched with the natural numbers 1, 2, 3, …. The integers and the rational numbers are countable; the real numbers are not. Countability appears in topology when we ask for a countable list of neighborhoods or a countable dense set, so keep the idea handy.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. Let f(x) = x² on the real numbers and B = {4}. What is the preimage f⁻¹(B)?

    The preimage collects every input whose output lies in B: both 2 and -2 square to 4.
  2. 2. Which statement is true for every function f and subsets A and B of its domain?

    Images preserve unions. They only satisfy f(A ∩ B) ⊆ f(A) ∩ f(B) for intersections.
  3. 3. Which property is NOT required of an equivalence relation?

    An equivalence relation is reflexive, symmetric and transitive. Antisymmetry is a requirement for order relations, not equivalences.
  4. 4. A set X has 5 elements. How many subsets does X have?

    The power set of an n-element set has 2^n elements, and 2^5 = 32.

Summary

  • Unions, intersections and complements obey De Morgan's laws, also for infinite families.
  • The preimage f⁻¹(B) preserves unions, intersections and complements; the image only preserves unions.
  • A bijection has an inverse function, but topology also asks the inverse to be well behaved.
  • Equivalence relations partition a set into classes.
  • Countable means finite or matchable with the natural numbers.

Next: Open Sets on the Real Line