Index Ai Academy
Foundation · Foundation mathAlgebra

Sets, and reading the symbols

About 41 minLooking ahead: some prerequisites aren't done yet

Why this matters

Written math has an alphabet of symbols, and most people stall at the first unfamiliar one. This lesson is a phrase book. It starts with sets, the idea of a collection, and the symbols for "is in", "both" and "either". Then it reads the shorthand that opens almost every machine learning paper: ℝⁿ for a list of numbers, f : ℝⁿ → ℝ for a model, and the hats, bars and subscripts you've already met. By the end you can read a paper's first equation aloud.

  • Read set notation: ∈, ⊆, ∪, ∩ and ∅, and work out unions and intersections
  • Name the number sets ℕ, ℤ and ℝ, and read ℝⁿ as lists of n real numbers
  • Read a function's signature, f : ℝⁿ → ℝᵐ, and the marks ML uses: hats, bars, subscripts and Greek letters
  • Use Python's set, in, | and &, and describe a model's inputs and outputs as sets
  • Build a vocabulary as a sorted set and turn words into ids, and read x ∈ ℝᵈ as a tensor's shape
Quick check
Have a guess before you start. A = {cat, dog} and B = {dog, owl}. How many different animals are in A or B, or both?

The math: collections, and the symbols for them

Purpose. Learn the alphabet of written math, starting with collections.

A set is a collection of different things, written in curly brackets: {2, 4, 6}. Order doesn't matter, and nothing is counted twice. A few symbols do almost all the work:

  • ∈ means "is in": 4 ∈ {2, 4, 6}. ∉ means "isn't in".
  • ⊆ means "is a subset of": every member of the first is in the second. {2, 4} ⊆ {2, 4, 6}.
  • ∪, union, is everything in either set. ∩, intersection, is what's in both.
  • ∅ is the empty set, with nothing in it.
  • |A|, a set between bars, is its size: how many members it has. |{2, 4, 6}| = 3.