Settings

Theme
Lite Mode (saves mobile data)

In Lite Mode, animations and videos don't play until you tap them, and their size is shown first. Interactive widgets still work.

Text size

Back up or move your progress →

Part 1: Math FoundationsPre-calculus Refresher

Sets, notation and reading math

P1.A440 min●○○ BeginnerReviewed Nov 30, 2026

Why this matters for machine learning

Every later lesson and every ML paper is written in this notation, so being able to read it turns formulas from a wall of symbols into sentences you can check with numbers.

  • A vector of n features is an element of Rn\mathbb{R}^n, and the notation tells you the shape of every input and parameter. (P1.B1: Scalars, vectors and spaces)
  • Training means finding θ^=arg⁡min⁡θL(θ)\hat{\theta} = \arg\min_\theta \mathcal{L}(\theta), the parameters with the smallest loss. (P1.F1: What is optimization?)
  • A classifier predicts the class with the largest probability: y^=arg⁡max⁡kp(k∣x)\hat{y} = \arg\max_k p(k \mid x), built on softmax outputs. (P3.A8: Softmax regression, coming soon)
  • Conditional probability is written p(y∣x)p(y \mid x), and you need the symbol to read any probabilistic model. (P1.D5: Joint, marginal and conditional probability)
  • Reading a research paper means reading its equations, and every paper has its own small dialect. (P12.8: How to read a research paper, coming soon)

Before this: Functions and graphs, Summation, products and indices

After this lesson you can

  • Read and write small sets with the symbols ∈, ∉, ⊆, ∪, ∩, \, ∅, |S| and set-builder notation, and name the number sets ℕ, ℤ, ℚ, ℝ
  • Say what ℝⁿ, ℝ^(m×n), {0,1}ⁿ and f: ℝⁿ → ℝ mean, and read f(x; θ), ↦ and f ∘ g
  • Read the logic symbols ∀, ∃, ⇒, ⇔ and the common ML marks (argmax versus max, hats, bars, ∝, ∼, indicator, log) and know which of them vary between authors
  • Read an unfamiliar formula step by step, and check it with small numbers

Open any ML paper and you will meet a line like this:

θ^=arg⁡min⁡θ 1N∑i=1N(f(xi;θ)−yi)2\hat{\theta} = \arg\min_{\theta}\ \frac{1}{N}\sum_{i=1}^{N}\bigl(f(\mathbf{x}_i;\theta) - y_i\bigr)^2

It looks like a secret code. It is a sentence. It says: “θ^\hat\theta is defined as the parameter values θ\theta for which the average squared error of the model ff on the NN examples is smallest.” You already know the pieces from P1.A1 (functions, argmin) and P1.A3 (sums). This lesson fills the rest: sets (the language for “what kind of thing is this?”), the symbols for logic, the usual ML marks, and a method for reading any formula. At the end there is an interactive cheat sheet that you can print.

One warning first: notation is a dialect. Most symbols are the same everywhere, but some vary by author. When that happens, this lesson says so, and the rule is always the same: check how the paper defines its symbols.

Sets: collections of things

A set is a collection of distinct things, called its elements (or members). We write a set by listing its elements between curly braces:

A={1,2,3,4}A = \{1, 2, 3, 4\}

Two facts about sets are easy to miss:

  • Order does not matter: {1,2,3}={3,2,1}\{1,2,3\} = \{3,2,1\}.
  • Repeats do not matter: {1,2,2,3}={1,2,3}\{1,2,2,3\} = \{1,2,3\}. A set has 3 elements here, not 4.

(A list or a vector is different: (1,2)(1,2) is not the same as (2,1)(2,1). Round brackets usually mean an ordered list.)

Membership and subsets

  • x∈Sx \in S is read “x is in S”: x is an element of S. So 3∈{1,2,3}3 \in \{1,2,3\} is true.
  • x∉Sx \notin S means “x is not in S”: 5∉{1,2,3}5 \notin \{1,2,3\}.
  • A⊆BA \subseteq B is read “A is a subset of B”: every element of A is also in B. So {1,2}⊆{1,2,3}\{1,2\} \subseteq \{1,2,3\}. Any set is a subset of itself. Some authors write ⊂\subset for the same thing and others for “a smaller subset, not equal”: check the paper.
  • ∅\varnothing (or ∅\emptyset) is the empty set, which has no elements. It is a subset of every set.
  • ∣S∣|S| is the size of S, the number of elements. ∣{1,2,3,4}∣=4|\{1,2,3,4\}| = 4 and ∣∅∣=0|\varnothing| = 0. (For a plain number, ∣x∣|x| means absolute value instead. The context tells you which.)

Combining sets

Take A={1,2,3,4}A = \{1,2,3,4\} and B={3,4,5}B = \{3,4,5\}.

SymbolRead aloudMeaningResult
A∪BA \cup BA union Bin A, or in B, or both{1,2,3,4,5}\{1,2,3,4,5\}
A∩BA \cap BA intersect Bin both A and B{3,4}\{3,4\}
A∖BA \setminus BA minus Bin A but not in B{1,2}\{1,2\}
B∖AB \setminus AB minus Ain B but not in A{5}\{5\}

Notice that A∖B≠B∖AA \setminus B \ne B \setminus A: difference depends on the order, union and intersection do not. Notice also that the sizes fit together: ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣=4+3−2=5|A \cup B| = |A| + |B| - |A \cap B| = 4 + 3 - 2 = 5. (Adding ∣A∣|A| and ∣B∣|B| counts the shared elements twice, so we subtract them once.) Some books write set difference as A−BA - B.

Describing a set by a rule: set-builder notation

Listing works for small sets. For big or infinite sets we describe a rule instead:

{ x∈R:x>0 }\{\,x \in \mathbb{R} : x > 0\,\}

Read it: “the set of all xx in R\mathbb{R} such that xx is greater than 0.” The part before the colon says what kind of thing, the part after says what condition it must satisfy. Many authors write a vertical bar instead of the colon: {x∈R∣x>0}\{x \in \mathbb{R} \mid x > 0\}. It is the same set. It is also a for-loop with an if, which the code cell below shows.

The number sets

Some sets are used so often they have their own letter (drawn in a “blackboard bold” font):

SymbolNameContainsExample
N\mathbb{N}natural numberscounting numbers1,2,3,…1, 2, 3, \dots (some authors start at 0)
Z\mathbb{Z}integerswhole numbers, with signs…,−2,−1,0,1,2,…\dots, -2, -1, 0, 1, 2, \dots
Q\mathbb{Q}rational numbersfractions of integers13\tfrac{1}{3}, −4-4, 0.750.75
R\mathbb{R}real numbersevery point on the number line2\sqrt{2}, π\pi, −0.5-0.5

Each contains the one before: N⊆Z⊆Q⊆R\mathbb{N} \subseteq \mathbb{Z} \subseteq \mathbb{Q} \subseteq \mathbb{R}. And 2∈R\sqrt{2} \in \mathbb{R} but 2∉Q\sqrt{2} \notin \mathbb{Q}.

Intervals (P1.A1) are sets of reals written with brackets: [a,b][a,b] includes both ends, (a,b)(a,b) includes neither, and [a,b)[a,b) includes only aa. For example [0,1]={x∈R:0≤x≤1}[0,1] = \{x \in \mathbb{R} : 0 \le x \le 1\}, the set of valid probabilities.

A last shorthand: to say “the integers from 1 to NN” papers write {1,…,N}\{1,\dots,N\} and some write [N][N]. You will see i∈{1,…,N}i \in \{1,\dots,N\} under sums, the same as i=1i = 1 to NN in P1.A3.

Products of sets, and the shape ℝⁿ

The Cartesian product A×BA \times B is the set of all ordered pairs (a,b)(a, b) with a∈Aa \in A and b∈Bb \in B. With A={0,1}A = \{0,1\} and B={x,y}B = \{x,y\}:

A×B={(0,x), (0,y), (1,x), (1,y)},∣A×B∣=∣A∣⋅∣B∣=4.\begin{gathered} A \times B \\ \quad= \{(0,x),\ (0,y),\ (1,x),\ (1,y)\}, \\ |A \times B| = |A|\cdot|B| = 4. \end{gathered}

Now take the real numbers and multiply the set by itself. R×R\mathbb{R}\times\mathbb{R}, written R2\mathbb{R}^2, is all pairs of real numbers: every point in a plane. R3\mathbb{R}^3 is all triples (space). In general:

Rn=R×⋯×R⏟n times=the set of all listsof n real numbers.\begin{aligned} \mathbb{R}^n &= \underbrace{\mathbb{R}\times\cdots\times\mathbb{R}}_{n\text{ times}} \\ &= \text{the set of all lists} \\ &\quad\text{of } n \text{ real numbers.} \end{aligned}

So “x∈Rn\mathbf{x} \in \mathbb{R}^n” is read “x is a vector with n real entries”, and “(2,−1,0.5)∈R3(2,-1,0.5) \in \mathbb{R}^3” is true. Writing the set tells you the shape of an object, which is half of reading a formula. This is the notation behind vectors (P1.B1): a data point with dd features is x∈Rd\mathbf{x} \in \mathbb{R}^d.

Matrices have two sizes. W∈Rm×n\mathbf{W} \in \mathbb{R}^{m \times n} means “W\mathbf{W} is a table of real numbers with mm rows and nn columns” (P1.B5). In NumPy these are exactly shape == (m, n).

Another set you will meet is {0,1}n\{0,1\}^n: all length-nn lists of zeros and ones, such as (1,0,1)(1,0,1). There are 2n2^n of them (23=82^3 = 8). A label vector with a 1 for the correct class and 0 elsewhere (a “one-hot” vector) lives in a set like this.

Functions in notation

From P1.A1, a function sends each input to one output. The notation packs three facts into one line:

f:X→Yf : X \to Y

Read: “f maps X to Y.” X is the domain (allowed inputs) and Y is where the outputs live. It tells you the types, not the rule. So

  • f:R→Rf:\mathbb{R}\to\mathbb{R} takes one number and returns one number (like x2x^2);
  • f:Rn→Rf:\mathbb{R}^n\to\mathbb{R} takes a vector of nn numbers and returns one number. A loss function has this type: many parameters in, one score out;
  • f:Rn→Rmf:\mathbb{R}^n\to\mathbb{R}^m takes a vector and returns a vector (a layer of a network).

To give the rule, use the maps-to arrow with a tail: x↦x2x \mapsto x^2 reads “x maps to x squared”. Together: f:R→R, x↦2x+1f:\mathbb{R}\to\mathbb{R},\ x\mapsto 2x+1. (Do not mix up the arrows: →\to links sets, ↦\mapsto links elements. The plain arrow is also used for “tends to” in limits.)

Parameters after a semicolon. A model has inputs and parameters. Many papers write f(x;θ)f(\mathbf{x};\boldsymbol\theta): the input x\mathbf{x} comes first, then a semicolon, then the parameters θ\boldsymbol\theta that training adjusts. The semicolon only says “these are the knobs, not the input”. Example: f(x;θ)=θxf(x;\theta) = \theta x with θ=1.5\theta = 1.5 sends x=2x=2 to 33. Also N(x;μ,σ2)\mathcal{N}(x;\mu,\sigma^2), the normal density in the Deep Learning book’s notation, puts the variable before the semicolon and its parameters after.

Composition. f∘gf \circ g is read “f after g” or “f composed with g”:

(f∘g)(x)=f(g(x)).(f \circ g)(x) = f\bigl(g(x)\bigr).

Apply gg first, then ff. With f(x)=x+1f(x) = x+1 and g(x)=2xg(x) = 2x: (f∘g)(3)=f(6)=7(f\circ g)(3) = f(6) = 7, but (g∘f)(3)=g(4)=8(g\circ f)(3) = g(4) = 8. The order matters. A neural network is a composition of layers, so you will see this a lot.

Logic: the symbols for “all”, “some” and “implies”

Statements about every element, or some element, have short symbols.

SymbolReadExample (true or false?)
∀\forallfor all, for every∀x∈R: x2≥0\forall x \in \mathbb{R}:\ x^2 \ge 0 is true
∃\existsthere exists, for some∃x∈R: x2=4\exists x \in \mathbb{R}:\ x^2 = 4 is true (x=2x=2)
¬P\neg Pnot P¬(3∈{1,2})\neg(3 \in \{1,2\}) is true
P⇒QP \Rightarrow QP implies Q, if P then Q (a logical statement, not “P causes Q”; it only says Q is never false when P is true)x>2⇒x>1x > 2 \Rightarrow x > 1 is true; the reverse is false
P⇔QP \Leftrightarrow QP if and only if Q (“iff”)x2=4⇔(x=2 or x=−2)x^2 = 4 \Leftrightarrow (x = 2 \text{ or } x = -2)
P∧Q, P∨QP \wedge Q,\ P \vee QP and Q; P or Q (or means “at least one”)

To disprove a “for all” you need only one counterexample: “∀x∈R:x2>0\forall x \in \mathbb{R}: x^2 > 0” is false because x=0x = 0 gives 00. To prove an “exists” you need one example. The negation of “for all x, P” is “there exists x with not P”.

Words papers use in place of symbols:

  • s.t. (or “such that”, or a colon or bar): introduces a condition. “Minimize f(x)f(x) s.t. x≥1x \ge 1” means: minimize ff only over the xx that satisfy x≥1x\ge1.
  • w.r.t. “with respect to”: which variable something is measured against. “The gradient of the loss w.r.t. the weights” (P1.C4, P1.C5).
  • i.i.d. “independent and identically distributed”: every data point is drawn independently from the same distribution. Its full meaning is in Part 1D.
  • WLOG “without loss of generality”, and iff “if and only if”.
  • Definitions. An equals sign can be a claim (“these two are equal”) or a definition (“let this symbol mean that”). Authors mark definitions with :=:=, ≜\triangleq or ≡\equiv, or just with “=” plus the word “define”. (≡\equiv has other meanings too, such as “equal for every input”, so read the context.) The conventions vary, so look for the word “let”, “define” or “where”.

The ML dialect

This section lists the marks you will see most. Use it as a reference; the cheat sheet below has all of them.

Max versus argmax

max⁡k pk  is the largest value;arg⁡max⁡k pk  is the kwhere that value happens.\begin{gathered} \max_k\, p_k \ \text{ is the largest value;} \\ \arg\max_k\, p_k \ \text{ is the } k \\ \quad\text{where that value happens.} \end{gathered}

Take class probabilities p=(0.659,0.242,0.099)p = (0.659, 0.242, 0.099) for cat, dog, bird. The max is 0.6590.659 (a probability). The argmax is “cat”, the first class (position 1 in math, index 0 in Python). The max is a value, the argmax is a location. Using one for the other is a common mistake, so keep it in mind: a loss goes down to a minimum value, but training wants the argmin (which parameters give it).

For arg⁡min⁡θL(θ)\arg\min_\theta \mathcal{L}(\theta), the subscript θ\theta says what is searched over. Take the one-weight model f(x;θ)=θxf(x;\theta) = \theta x and data (1,2),(2,3),(3,5)(1,2),(2,3),(3,5). For three candidates the average squared error is:

θ\theta11.52
L(θ)\mathcal{L}(\theta)20.16670.6667

Among these three, min⁡=0.1667\min = 0.1667 and arg⁡min⁡=1.5\arg\min = 1.5. (Over all real numbers, the best is 23/14≈1.64323/14 \approx 1.643, with loss ≈0.0714\approx 0.0714.)

Ties. If two inputs share the maximum, “the argmax” is really a set of both. Papers often still write == as if it were one. NumPy’s np.argmax returns the first index among ties: np.argmax([3, 7, 7, 1]) is 1, though positions 1 and 2 both hold the max 7.

Marks on letters and symbols

MarkUsual meaningExample
hat y^\hat{y}, θ^\hat\thetaan estimate or prediction, as opposed to the true valuey^\hat{y} is the model’s output, yy the true target
bar xˉ\bar{x}usually the meanxˉ=1N∑ixi\bar{x} = \frac1N\sum_i x_i
x(i)x^{(i)} and xjx_jsuperscript in parentheses = the ii-th example; subscript = the jj-th feature (entry). When each example is a single number, as in this course’s early formulas, xix_i simply means the ii-th examplex3(2)x^{(2)}_3 = feature 3 of example 2
x⊤\mathbf{x}^\toptransposea⊤b=∑iaibi\mathbf{a}^\top\mathbf{b} = \sum_i a_ib_i
∥x∥\lVert\mathbf{x}\rVertlength (norm); L2 unless subscripted∥(3,4)∥=5\lVert(3,4)\rVert = 5
⌊x⌋\lfloor x\rfloor, ⌈x⌉\lceil x\rceilround down, round up⌊2.7⌋=2\lfloor 2.7\rfloor = 2, ⌈2.1⌉=3\lceil 2.1\rceil = 3, ⌊−2.5⌋=−3\lfloor -2.5\rfloor = -3
1[cond]\mathbb{1}[\text{cond}]indicator: 1 if the condition is true, 0 if false1[3>2]=1\mathbb{1}[3 > 2] = 1
O(⋅)O(\cdot)growth rate of a cost (P1.G4)a sum over NN items is O(N)O(N)

The x(i)x^{(i)} versus xjx_j convention is common (the Deep Learning textbook by Goodfellow, Bengio and Courville writes x(i)x^{(i)} for the ii-th example), but papers differ: always check. A bold letter is a vector, a capital bold letter a matrix, as in this course’s notation table. And norms are taught fully in P1.B4 and the transpose in P1.B10.

The indicator is a handy trick: the number of values above 2 in (1,3,5)(1,3,5) is ∑i1[xi>2]=0+1+1=2\sum_i \mathbb{1}[x_i > 2] = 0 + 1 + 1 = 2. In Python, True counts as 1.

Four relation symbols: ≈, ∝, ∼, ≪

  • ≈\approx means “approximately equal”: π≈3.14\pi \approx 3.14.
  • ∝\propto means “proportional to”: equal up to a constant factor that does not depend on the thing we care about. In Bayes’ rule, p(θ∣D)∝p(D∣θ) p(θ)p(\theta \mid D) \propto p(D \mid \theta)\,p(\theta): we drop the constant p(D)p(D) because it does not change with θ\theta. So ∝\propto is exact up to a constant, not “approximately”.
  • ∼\sim in probability means “is distributed as” or “is drawn from”: ε∼N(0,1)\varepsilon \sim \mathcal{N}(0,1) says the random number ε\varepsilon follows a normal distribution with mean 0 and variance 1. Outside probability a tilde can mean “is similar to” or “is of the order of”, and some texts use it for “approximately”. Read the context.
  • ≪\ll and ≫\gg mean “much smaller” and “much larger”.

Probability and logs

p(x)p(x) (or P(A)\mathbb{P}(A)) is a probability; p(y∣x)p(y \mid x) is read “the probability of y given x”: the vertical bar means “given” (P1.D5). E[X]\mathbb{E}[X] is the expectation, the average value of a random quantity (P1.D4). A subscript says what is averaged over: Ex∼p[f(x)]\mathbb{E}_{x\sim p}[f(x)].

log. In ML papers, log⁡x\log x with no base almost always means the natural log ln⁡x\ln x (base ee). The Deep Learning book’s notation page says exactly this (“natural logarithm of xx”). It is a convention, not a rule: in some fields log⁡\log means base 10 or base 2. In NumPy, np.log is natural, np.log10 is base 10. If it matters (it does when you quote a loss in “bits”), check.

Greek letters in ML

Greek letters are used as names because there are not enough Latin ones. They are conventions, and the same letter often has several jobs:

LetterOften means
θ\thetathe parameters of a model (all of them, as one vector)
η\etathe learning rate (some books use α\alpha)
λ\lambdaregularization strength; also eigenvalues
σ\sigmaeither the sigmoid function or a standard deviation: context decides
μ\muthe mean of a distribution
ε\varepsilona small number (e.g. to avoid dividing by zero) or noise
α, β, γ\alpha,\ \beta,\ \gammageneric coefficients; γ\gamma is a common discount factor in reinforcement learning
Δ, δ\Delta,\ \deltaa change; a small change or an error signal
π\pithe number 3.14159…, but a policy in reinforcement learning

How to read a formula

When you meet a formula you do not know, use these steps.

  1. Find where the symbols are defined. Look for “where”, “let”, “define”, the notation section, or a figure legend. Do not guess.
  2. Write down the type and shape of every symbol. Is it a number, a vector in Rn\mathbb{R}^n, a matrix, a set, a function, a probability? Use the sets above.
  3. Read the outermost operator first. Is the whole thing a fraction, a sum, an argmin, a product, an equation? That tells you the sentence’s main verb. Then work inwards.
  4. Unroll. Replace a Σ by its first two terms and the last (P1.A3); replace arg⁡min⁡\arg\min by “try every candidate”.
  5. Check with small numbers. Use N=2N = 2 or 33 and easy values. If you can compute it, you understand it.
  6. Say it aloud in plain English.

Try it on the formulas below: tap each part to see what it is.

Translate a formula

ℒ(θ): the average loss

Type: a single number (a scalar)

The loss over the whole data set, as a function of the parameters θ. Calligraphic ℒ is the course notation for the average over data (plain L is one example).

Read aloud: The loss of theta is one over N times the sum, for i from 1 to N, of the squared difference between f of x-i with parameters theta, and y-i.

How to read it: Outermost operator: "1/N times a sum" so it is an average. Inside: a squared error for one example i. Check with numbers: N = 3, model θx, θ = 1.5, data (1,2), (2,3), (3,5): errors −0.5, 0, −0.5, squares 0.25, 0, 0.25, average 1/6 ≈ 0.1667.

Translate a formula. Pick one of five formulas, then tap each part (or use Previous part and Next part). The card shows what the part means, what type of thing it is, and how to say it. Below are the formula read aloud and a worked check with numbers. The formulas are drawn as plain text so each part can be tapped.

Worked example 1: the loss and its argmin

Take L(θ)=1N∑i=1N(f(xi;θ)−yi)2\mathcal{L}(\theta) = \frac1N\sum_{i=1}^{N}(f(x_i;\theta)-y_i)^2 with f(x;θ)=θxf(x;\theta) = \theta x and three examples x=(1,2,3)x = (1,2,3), y=(2,3,5)y = (2,3,5).

  1. Types. θ∈R\theta \in \mathbb{R} (one weight), xi,yi∈Rx_i, y_i \in \mathbb{R}, N=3N = 3, and L:R→R\mathcal{L}: \mathbb{R}\to\mathbb{R}.
  2. Outermost. 1N×\frac1N \times a sum, so an average of NN squared errors.
  3. Unroll for θ=1.5\theta = 1.5: predictions 1.5,3,4.51.5, 3, 4.5; errors −0.5,0,−0.5-0.5, 0, -0.5; squares 0.25,0,0.250.25, 0, 0.25; sum 0.50.5; divide by 3: ≈0.1667\approx 0.1667.
  4. argmin. Doing this for θ=1\theta = 1 and θ=2\theta = 2 gives 22 and 0.66670.6667, so among the three, θ^=arg⁡min⁡θL(θ)=1.5\hat\theta = \arg\min_\theta \mathcal{L}(\theta) = 1.5. The formula in the opening of the lesson is exactly this.

Worked example 2: softmax and cross-entropy

Scores (logits) z=(2,1,0.1)∈R3\mathbf{z} = (2, 1, 0.1) \in \mathbb{R}^3 for cat, dog, bird. The softmax formula softmax⁡(z)k=ezk/∑jezj\operatorname{softmax}(\mathbf{z})_k = e^{z_k}/\sum_j e^{z_j}:

  1. Types. z∈R3\mathbf{z} \in \mathbb{R}^3, and the output is a vector with 3 entries; the index kk picks one entry and jj is a dummy index (P1.A3).
  2. Outermost: a fraction. Top: e2,e1,e0.1=7.389,2.718,1.105e^{2}, e^{1}, e^{0.1} = 7.389, 2.718, 1.105. Bottom: their sum =11.212= 11.212.
  3. Result: softmax⁡(z)=(0.659, 0.242, 0.099)\operatorname{softmax}(\mathbf{z}) = (0.659,\ 0.242,\ 0.099), which adds to 1.
  4. Prediction. y^=arg⁡max⁡ksoftmax⁡(z)k\hat{y} = \arg\max_k \operatorname{softmax}(\mathbf{z})_k = cat, the same class as arg⁡max⁡kzk\arg\max_k z_k: softmax keeps the order.
  5. Cross-entropy with a one-hot true label y=(1,0,0)\mathbf{y} = (1,0,0): L=−∑kyklog⁡p^k=−log⁡0.659≈0.417L = -\sum_k y_k\log\hat p_k = -\log 0.659 \approx 0.417 (natural log). Only the correct class’s term is nonzero.

You will meet softmax in P3.A8 and the cross-entropy again with likelihood in P1.D10. Here the goal is only to read them.

Your cheat sheet

Here is every symbol from this lesson in one place. Search it, filter it by category, tap a symbol to expand it, or press Print to get a clean one- or two-page sheet with everything expanded.

Notation cheat sheet

66 of 66 symbols. Tap a symbol to see its meaning.

  • Read aloud: the set containing a, b and c

    Meaning: A set is a collection of distinct things. Order and repeats do not matter.

    Example: {1, 2, 2, 3} = {3, 2, 1}, a set with 3 elements

  • Read aloud: x is in S / x belongs to S

    Meaning: x is an element (member) of the set S.

    Example: 3 ∈ {1, 2, 3} is true

  • Read aloud: x is not in S

    Meaning: x is not an element of S.

    Example: 5 ∉ {1, 2, 3} is true

  • Read aloud: A is a subset of B

    Meaning: Every element of A is also in B. A set is a subset of itself. Some authors write ⊂ for the same thing, others for a strict subset: check.

    Example: {1, 2} ⊆ {1, 2, 3}

  • Read aloud: A union B

    Meaning: Everything that is in A or in B (or both).

    Example: {1, 2, 3, 4} ∪ {3, 4, 5} = {1, 2, 3, 4, 5}

  • Read aloud: A intersect B

    Meaning: Only what is in both A and B.

    Example: {1, 2, 3, 4} ∩ {3, 4, 5} = {3, 4}

  • Read aloud: A minus B

    Meaning: The elements of A that are not in B. Order matters.

    Example: {1, 2, 3, 4} \ {3, 4, 5} = {1, 2}

  • Read aloud: the empty set

    Meaning: The set with no elements. It is a subset of every set.

    Example: |∅| = 0

  • Read aloud: size of S / number of elements of S

    Meaning: How many elements S has (its cardinality). For numbers, |x| means absolute value: read the context.

    Example: |{1, 2, 3, 4}| = 4

  • Read aloud: the set of all x in ℝ such that x is greater than 0

    Meaning: Set-builder notation: {what kind of thing : condition it must satisfy}. Many authors write a bar | instead of the colon.

    Example: {n ∈ ℤ : n is even} = {…, −2, 0, 2, …}

  • Read aloud: the naturals, integers, rationals, reals

    Meaning: ℕ counting numbers (whether ℕ includes 0 depends on the author), ℤ whole numbers with signs, ℚ fractions, ℝ the whole number line.

    Example: −2 ∈ ℤ, 1/3 ∈ ℚ, √2 ∈ ℝ but √2 ∉ ℚ

  • Read aloud: positive reals, non-negative reals

    Meaning: Conventions vary: ℝ⁺ sometimes includes 0 and sometimes does not. ℝ≥0 is unambiguous.

    Example: 0 ∈ ℝ≥0; whether 0 ∈ ℝ⁺ depends on the book

  • Read aloud: closed interval, open interval

    Meaning: All real numbers from a to b. Square bracket includes the end, round excludes it. Mixed forms like [a, b) also exist.

    Example: [0, 1] contains 0 and 1; (0, 1) contains neither

  • Read aloud: the integers 1 to N

    Meaning: A common shorthand for index sets. The form [N] is used in some papers (not all); check its definition.

    Example: [3] = {1, 2, 3}

  • Read aloud: A cross B (Cartesian product)

    Meaning: All ordered pairs (a, b) with a in A and b in B.

    Example: {0, 1} × {x, y} has 2 · 2 = 4 pairs

  • Read aloud: R n

    Meaning: All lists of n real numbers: vectors with n entries. It is ℝ × ℝ × … × ℝ (n times).

    Example: (2, −1, 0.5) ∈ ℝ³

  • Read aloud: R m by n

    Meaning: All matrices with m rows and n columns of real numbers: the shape of a matrix.

    Example: a 2 × 3 table of reals is in ℝ^(2×3)

  • Read aloud: zero-one to the n

    Meaning: All length-n lists whose entries are 0 or 1, so 2ⁿ of them.

    Example: {0, 1}³ has 8 elements, such as (1, 0, 1)

  • Read aloud: f maps X to Y

    Meaning: f takes an input from X (its domain) and returns an output in Y. It says nothing about the formula.

    Example: f: ℝⁿ → ℝ takes a vector and returns one number

  • Read aloud: x maps to x squared

    Meaning: The arrow with a tail names what one input turns into: a formula for the function.

    Example: x ↦ 2x + 1 sends 3 to 7

  • Read aloud: f of x, parametrized by theta

    Meaning: The input is before the semicolon; the parameters (the knobs that training adjusts) are after it.

    Example: f(x; θ) = θx: input x, parameter θ

  • Read aloud: f after g / f composed with g

    Meaning: (f ∘ g)(x) = f(g(x)): apply g first, then f.

    Example: f(x) = x + 1, g(x) = 2x: (f ∘ g)(3) = 7 but (g ∘ f)(3) = 8

  • Read aloud: for all / for every

    Meaning: The claim holds for every element of the set.

    Example: ∀ x ∈ ℝ: x² ≥ 0

  • Read aloud: there exists

    Meaning: At least one element makes the claim true.

    Example: ∃ x ∈ ℝ: x² = 4 (x = 2 works)

  • Read aloud: P implies Q / if P then Q

    Meaning: Whenever P is true, Q is true. It does not say Q implies P.

    Example: x > 2 ⇒ x > 1 is true, but x > 1 ⇒ x > 2 is false

  • Read aloud: P if and only if Q

    Meaning: P and Q are true together or false together: each implies the other.

    Example: x² = 4 ⇔ x = 2 or x = −2

  • Read aloud: not P

    Meaning: True exactly when P is false. Some texts write ~P instead.

    Example: ¬(3 ∈ {1, 2}) is true

  • Read aloud: P and Q; P or Q

    Meaning: ∧ is "both", ∨ is "at least one" (inclusive or).

    Example: (2 > 1) ∧ (2 < 3) is true

  • Read aloud: such that / subject to

    Meaning: Introduces a condition. In optimization, "minimize f(x) s.t. g(x) = 0" means minimize f only among x that satisfy g.

    Example: min x² s.t. x ≥ 1 has the answer 1

  • Read aloud: with respect to

    Meaning: Which variable something is measured against, e.g. the derivative or gradient of the loss w.r.t. the weights.

    Example: ∂L/∂w: the change in L w.r.t. w

  • Read aloud: independent and identically distributed

    Meaning: Each data point is drawn independently from the same distribution. Full meaning in Part 1D.

    Example: training examples are usually assumed i.i.d.

  • Read aloud: without loss of generality

    Meaning: We pick a convenient case; the other cases work the same way.

    Example: WLOG assume x ≥ 0

  • Read aloud: is defined to be

    Meaning: A definition, not a claim. Authors differ: some use = for definitions, and ≡ can also mean "identical for all inputs".

    Example: p̂ := exp(z) / Σ exp(z)

  • Read aloud: end of proof

    Meaning: Marks the end of a proof.

  • Read aloud: the maximum, the minimum

    Meaning: The largest (smallest) VALUE.

    Example: max over (3, 7, 2) is 7

  • Read aloud: arg max: the argument that gives the largest value

    Meaning: The LOCATION (input) where the max (min) happens, not the value. If there is a tie, the argmax is a set; NumPy returns the first.

    Example: argmax over (3, 7, 2) is position 2 (1-based), the max is 7

  • Read aloud: is approximately

    Meaning: Close to, but not equal.

    Example: π ≈ 3.14

  • Read aloud: is proportional to

    Meaning: Equal up to a constant factor that does not depend on the variable of interest.

    Example: p(y | x) ∝ p(x | y) p(y)

  • Read aloud: x is distributed as p / x is drawn from p

    Meaning: In probability, "∼" says which distribution a random variable has. In other contexts a tilde can mean "is similar to" or "is on the order of": read the context.

    Example: ε ∼ 𝒩(0, 1)

  • Read aloud: y hat, theta hat

    Meaning: A hat marks an estimate or prediction (what the model produces), as opposed to the true value.

    Example: ŷ is the prediction, y the true target

  • Read aloud: x bar

    Meaning: Usually the mean (average) of x. A bar can mean other things in some papers.

    Example: x̄ = (1/N) Σ xᵢ

  • Read aloud: x superscript i; x sub j

    Meaning: A common convention: parenthesized superscript = the i-th example, subscript = the j-th feature (entry). Papers vary, so check.

    Example: xⱼ⁽ⁱ⁾ is feature j of example i

  • Read aloud: x transpose

    Meaning: Flip rows and columns. For a vector, it turns a column into a row.

    Example: aᵀb = Σ aᵢbᵢ

  • Read aloud: norm of x

    Meaning: The length of a vector. Without a subscript, usually the L2 (Euclidean) norm.

    Example: ‖(3, 4)‖ = 5

  • Read aloud: absolute value of x

    Meaning: For a number, its size ignoring sign. For a set, the number of elements.

    Example: |−3| = 3

  • Read aloud: floor, ceiling

    Meaning: Round down, round up to a whole number.

    Example: ⌊2.7⌋ = 2, ⌈2.1⌉ = 3, ⌊−2.5⌋ = −3

  • Read aloud: expectation of X

    Meaning: The average value of a random quantity. Subscripts say what is averaged over. (P1.D4)

    Example: 𝔼ₓ∼p[f(x)]

  • Read aloud: probability of x; of A; of y given x

    Meaning: Probability (density). The bar "|" inside p(·) is read "given".

    Example: p(y | x): how likely y is once x is known

  • Read aloud: indicator of cond

    Meaning: 1 if the condition is true, 0 if false. Also written 1_cond or I[cond].

    Example: 𝟙[3 > 2] = 1, 𝟙[3 < 2] = 0

  • Read aloud: log (usually natural log)

    Meaning: In ML papers log with no base usually means the natural log (ln). Check: in some fields it means base 10 or base 2.

    Example: np.log(np.e) = 1.0; np.log10 is base 10

  • Read aloud: big-oh of

    Meaning: An upper bound on how fast a cost grows as the input gets big, ignoring constant factors. (P1.G4)

    Example: a sum over N items costs O(N)

  • Read aloud: element-wise product / Hadamard

    Meaning: Multiply two arrays entry by entry.

    Example: (1, 2, 3) ⊙ (4, 5, 6) = (4, 10, 18)

  • Read aloud: the set of pairs x i, y i for i from 1 to N

    Meaning: A training set: N examples, each an input with its target.

    Example: N = 3 examples: (1, 2), (2, 3), (3, 5)

  • Read aloud: theta

    Meaning: Very often: all the parameters of a model, as one vector.

    Example: f(x; θ)

  • Read aloud: eta

    Meaning: Usually the learning rate (step size). Some books use α instead.

    Example: θ ← θ − η ∇L

  • Read aloud: lambda

    Meaning: Often the strength of regularization; also eigenvalues in linear algebra.

    Example: L + λ‖θ‖²

  • Read aloud: sigma

    Meaning: Context! Either the sigmoid function or a standard deviation. Capital Σ is the sum sign.

    Example: σ(z) = 1/(1 + e^(−z)) vs 𝒩(μ, σ²)

  • Read aloud: mu

    Meaning: Usually the mean of a distribution.

    Example: 𝒩(μ, σ²)

  • Read aloud: epsilon

    Meaning: A small number (for example to avoid dividing by 0) or a noise term.

    Example: x / (s + ε)

  • Read aloud: alpha, beta

    Meaning: Generic coefficients. Both are used for many things: learning rate, momentum or decay rates (Adam uses β₁, β₂), mixing weights. Always check the paper.

    Example: check the definition near the formula

  • Read aloud: gamma

    Meaning: Often a discount factor in reinforcement learning, or a scale parameter.

    Example: γ = 0.99

  • Read aloud: delta

    Meaning: Small δ: a small change or an error signal. Capital Δ: a difference or change.

    Example: Δx = x₂ − x₁

  • Read aloud: pi

    Meaning: The number 3.14159… but in reinforcement learning also a policy.

    Example: π ≈ 3.14159

  • Read aloud: phi

    Meaning: Often a feature map or another function; also used for parameters.

    Example: φ(x): the features of x

  • Read aloud: tau

    Meaning: Often a temperature or a time constant; in reinforcement learning, a trajectory.

    Example: softmax(z / τ)

  • Read aloud: nabla / del / grad

    Meaning: The gradient (vector of slopes), taught in Part 1C. Not a Greek letter but used alongside them.

    Example: ∇L

Notation cheat sheet. Type in the search box or choose a category (Sets, Logic, Functions, ML conventions, Greek letters). Each row shows the symbol and how to read it aloud; tap it to see the meaning and an example. 'Print the full sheet' prints every symbol with all entries expanded and no buttons.

Try it in Python

Sets, membership, max versus argmax and ties all exist in Python and NumPy. Run the cell, then change the sets and the probabilities. Is np.argmax of [7, 7] still the first index?

Try it: sets, max vs argmax, ties, argmin of a loss

Runs real Python in your browser. First run downloads about 9 MB (once; your browser keeps it).

Challenge: make two entries tie for the maximum, for example with p = np.array([0.659, 0.242, 0.659]), and check which index argmax reports. Then write a set-builder comprehension for {x∈{1,…,10}:x is odd}\{x \in \{1,\dots,10\} : x \text{ is odd}\}.

Intuition

Notation is a compressed sentence. ∀\forall, ∃\exists and ∈\in are the grammar words; Σ\Sigma, arg⁡min⁡\arg\min and E\mathbb{E} are the verbs. A set tells you the kind of thing a symbol is (a number, a vector of length nn, a matrix), and that is half of understanding a formula. Where the picture breaks: unlike a programming language, math notation has no compiler, so authors reuse letters and leave things implicit, which is why you check the definitions.

Math

A set is determined by its elements; A=BA = B iff A⊆BA \subseteq B and B⊆AB \subseteq A. For finite sets, ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B| and ∣A×B∣=∣A∣∣B∣|A \times B| = |A||B|, so ∣{0,1}n∣=2n|\{0,1\}^n| = 2^n.

For a function f:X→Rf : X \to \mathbb{R} and a set S⊆XS \subseteq X (finite and non-empty),

max⁡x∈Sf(x)∈R,arg⁡max⁡x∈Sf(x)={ x∈S:f(x)≥f(x′)for all x′∈S }⊆S.\begin{gathered} \max_{x\in S} f(x) \in \mathbb{R}, \\ \arg\max_{x\in S} f(x) \\ \quad= \{\,x \in S : f(x) \ge f(x') \\ \qquad\text{for all } x' \in S\,\} \\ \quad\subseteq S. \end{gathered}

So the argmax is a set (usually with one element); and arg⁡min⁡xf(x)=arg⁡max⁡x(−f(x))\arg\min_x f(x) = \arg\max_x \bigl(-f(x)\bigr).

Because exp⁡\exp is increasing, arg⁡max⁡ksoftmax⁡(z)k=arg⁡max⁡kzk\arg\max_k \operatorname{softmax}(\mathbf z)_k = \arg\max_k z_k.

Code

A, B = {1, 2, 3, 4}, {3, 4, 5}
A | B, A & B, A - B, len(A)    # {1,2,3,4,5} {3,4} {1,2} 4
3 in A, {1, 2} <= A            # True True

import numpy as np
p = np.array([0.659, 0.242, 0.099])
p.max(), p.argmax()            # 0.659 (value), 0 (index)
np.argmax([3, 7, 7, 1])        # 1 : the first of the ties

The cell above runs these and more.

Go deeper Where the notation comes from, and one more family of symbols

Nobody sat down and designed this notation: it grew over centuries and is still evolving, which is why authors differ. Most of the set symbols (∈\in, ∪\cup, ∩\cap and the blackboard-bold number sets) are fairly modern, from the 19th and 20th centuries.

Two more families you will meet later: the ∥⋅∥p\lVert\cdot\rVert_p norms (P1.B4) with a subscript for the type of norm, and the partial derivative ∂L/∂w\partial L/\partial w (P1.C4). Both follow the same rule as everything here: the shape of the symbol tells you its type; the definition tells you the details.

Putting it together

A set is a collection of distinct things, with ∈\in, ⊆\subseteq, ∪\cup, ∩\cap, ∖\setminus, ∅\varnothing and ∣S∣|S| to talk about them, and set-builder notation {x∈S:condition}\{x \in S : \text{condition}\} to describe big ones. Rn\mathbb{R}^n is the set of vectors with nn entries, Rm×n\mathbb{R}^{m\times n} the set of m×nm\times n matrices, and f:Rn→Rf:\mathbb{R}^n\to\mathbb{R} says what goes in and out. max⁡\max gives a value, arg⁡max⁡\arg\max the place. Hats mean estimates, bars means, ∝\propto “proportional to”, ∼\sim “distributed as”. And since notation varies, you read a formula by finding its definitions, writing down the types, reading the outermost operator, unrolling, and checking with numbers.

Check your understanding

  1. Let A={1,2,3,4}A = \{1,2,3,4\} and B={3,4,5}B = \{3,4,5\}. What is A∩BA \cap B?

  2. The probabilities of three classes (in positions 1, 2, 3) are (0.1,0.7,0.2)(0.1, 0.7, 0.2). What is the argmax over the position kk?

  3. Which statement is true?

  4. What does f:R3→Rf : \mathbb{R}^3 \to \mathbb{R} say?

  5. In an ML paper, ε∼N(0,1)\varepsilon \sim \mathcal{N}(0, 1). What does the “∼\sim" most likely mean?

Exercises

  1. Let A={2,4,6,8}A = \{2,4,6,8\} and B={4,8,12}B = \{4,8,12\}. Find A∪BA\cup B, A∩BA\cap B, A∖BA\setminus B, B∖AB\setminus A, ∣A∣|A| and ∣A∪B∣|A\cup B|.
    Show answerA∪B={2,4,6,8,12}A\cup B = \{2,4,6,8,12\}; A∩B={4,8}A\cap B = \{4,8\}; A∖B={2,6}A\setminus B = \{2,6\}; B∖A={12}B\setminus A = \{12\}; ∣A∣=4|A| = 4; ∣A∪B∣=5=4+3−2|A\cup B| = 5 = 4 + 3 - 2.
  2. True or false: 3∈{1,2,3}3 \in \{1,2,3\}; {3}∈{1,2,3}\{3\} \in \{1,2,3\}; {3}⊆{1,2,3}\{3\} \subseteq \{1,2,3\}; ∅⊆{1,2,3}\varnothing \subseteq \{1,2,3\}.
    Show answerTrue; false (the set {3}\{3\} is not an element); true; true (the empty set is a subset of every set).
  3. Write in set-builder notation the set of even integers between 1 and 10, and list it.
    Show answer{n∈{1,…,10}:n is even}={2,4,6,8,10}\{n \in \{1,\dots,10\} : n \text{ is even}\} = \{2,4,6,8,10\}.
  4. How many elements are in {0,1}4\{0,1\}^4? Is (1,0,1,1)(1,0,1,1) in it?
    Show answer24=162^4 = 16. Yes: each entry is 0 or 1.
  5. A data matrix has N=100N = 100 examples and d=5d = 5 features, one example per row. Which set is it in? And one example x\mathbf{x}?
    Show answerThe matrix is in R100×5\mathbb{R}^{100\times5} (N×dN\times d); one example is x∈R5\mathbf{x}\in\mathbb{R}^5.
  6. Let f(x)=x+1f(x) = x + 1 and g(x)=2xg(x) = 2x. Compute (f∘g)(5)(f\circ g)(5) and (g∘f)(5)(g\circ f)(5).
    Show answer(f∘g)(5)=f(10)=11(f\circ g)(5) = f(10) = 11 and (g∘f)(5)=g(6)=12(g\circ f)(5) = g(6) = 12.
  7. Is “∀x∈R: x>0⇒x2>0\forall x\in\mathbb{R}:\ x > 0 \Rightarrow x^2 > 0” true? And “∃x∈R: x2=−1\exists x\in\mathbb{R}:\ x^2 = -1”?
    Show answerThe first is true: a positive number squared is positive. The second is false: no real number squares to −1-1.
  8. For p=(0.2,0.5,0.3)p = (0.2, 0.5, 0.3), give max⁡\max, arg⁡max⁡\arg\max (positions numbered from 1), and arg⁡min⁡\arg\min.
    Show answermax⁡=0.5\max = 0.5; arg⁡max⁡\arg\max = position 2; arg⁡min⁡\arg\min = position 1 (value 0.2).
  9. In NumPy, what is np.argmax([4, 9, 9, 2]), and why is the answer not “1 and 2”?
    Show answerIt is 1: NumPy returns only the first index among ties (the positions of the maximum 9 are 1 and 2, counting from 0). Mathematically the argmax is the set {1,2}\{1,2\}.
  10. With f(x;θ)=θxf(x;\theta) = \theta x and data (1,2),(2,3),(3,5)(1,2),(2,3),(3,5), compute L(2)\mathcal{L}(2).
    Show answerErrors 0,1,10, 1, 1; squares 0,1,10, 1, 1; mean 2/3≈0.66672/3 \approx 0.6667.
  11. Read aloud: y^=arg⁡max⁡k p(k∣x)\hat{y} = \arg\max_{k}\ p(k \mid \mathbf{x}). Name the type of each symbol.
    Show answer“y hat is the class k that makes the probability of k given x largest.” y^\hat y is a predicted class label, kk ranges over the classes, x∈Rd\mathbf{x}\in\mathbb{R}^d is the input, and p(k∣x)p(k\mid\mathbf{x}) is a probability between 0 and 1.
  12. Compute ∑i1[xi≥3]\sum_{i}\mathbb{1}[x_i \ge 3] for x=(1,3,5,2,4)x = (1,3,5,2,4).
    Show answer0+1+1+0+1=30+1+1+0+1 = 3.
  13. A paper writes “log⁡100\log 100” and gets 4.6054.605. Which base did it use, and what would base 10 give?
    Show answerBase ee (natural log): ln⁡100≈4.605\ln 100 \approx 4.605. Base 10 gives exactly 22. Always check the paper.
  14. What does ∝\propto mean in p(θ∣D)∝p(D∣θ) p(θ)p(\theta\mid D)\propto p(D\mid\theta)\,p(\theta)? Why can we drop p(D)p(D)?
    Show answer“Proportional to”: the two sides differ by a constant factor. p(D)p(D) does not depend on θ\theta, so it is the same constant for every θ\theta and does not change which θ\theta is largest.
  15. Use the cheat sheet widget: find all the entries that mention “learning rate”.
    Show answerType “learning rate” in the search box. Two entries match: η\eta (the usual learning rate) and α,β\alpha, \beta (generic coefficients, one of whose uses is a learning rate). The count under the box shows how many entries match.

Key takeaways

  • A set is an unordered collection of distinct things. x∈Sx \in S means x is a member, A⊆BA \subseteq B means A sits inside B, A∪BA \cup B is everything in either, A∩BA \cap B is what they share, A∖BA \setminus B is what is in A but not in B, and ∣S∣|S| is the number of elements.
  • Rn\mathbb{R}^n is the set of all lists of n real numbers (vectors), Rm×n\mathbb{R}^{m\times n} is the set of m-by-n matrices, and {0,1}n\{0,1\}^n is the set of length-n lists of zeros and ones. These are the 'shape' of the data.
  • f:Rn→Rf:\mathbb{R}^n\to\mathbb{R} says what goes in and what comes out; x↦x2x \mapsto x^2 gives the rule; f(x;θ)f(x;\theta) puts the input before the semicolon and the parameters after; f∘gf\circ g means apply g first.
  • max⁡\max returns the largest value; arg⁡max⁡\arg\max returns where it happens. Training minimizes a loss and reports the argmin, a prediction is often an argmax.
  • Notation is a dialect, not a law: ℕ with or without 0, ∼ as 'distributed as' or 'similar to', σ as sigmoid or standard deviation, log as natural log. Check the paper's own definitions, and read a formula by finding the types, reading the outermost operator, unrolling, and testing with numbers.
Found a mistake? Tell us