Notation

Clear, consistent notation makes it much easier to connect mathematical ideas to code across a book that spans linear algebra, calculus, probability, optimization, and modern neural architectures. Throughout this book, we adhere to a uniform typographic hierarchy: lowercase italic letters (xx) denote scalars, bold lowercase letters (x\mathbf{x}) denote vectors, bold uppercase letters (X\mathbf{X}) denote matrices, sans-serif uppercase letters (X\mathsf{X}) denote higher-order tensors, calligraphic letters (X\mathcal{X}) denote sets, and uppercase italic letters (XX) denote random variables.

In the reference lists below, the indefinite article "a" indicates a general typographic convention (for example, "xx: a scalar" means that lowercase italic letters generally represent scalars), whereas the definite article "the" indicates a symbol with a specific fixed meaning, such as "R\mathbb{R}: the set of real numbers".

Because the alphabet is finite, a few standard letters carry more than one meaning across subfields. In every case, the syntactic form and context of the symbol disambiguate it: for example, the sigmoid function σ(⋅)\sigma(\cdot) takes a parenthesized argument, a standard deviation σX\sigma_X carries a random variable as a subscript, a singular value σi(X)\sigma_i(\mathbf{X}) is indexed and applied to a matrix, and the noise schedule σt\sigma_t of a diffusion model is indexed by time tt. We note potential ambiguities explicitly below. Chapters that introduce a larger domain-specific vocabulary also open with a dedicated notation table, including optimization (Table 23.1), information theory (Table 25.1.1), dynamics (Table 26.1), reinforcement learning (Table 14.1.1), generative adversarial networks (Table 16.1), and diffusion models (Table 17.2.1). The final sections of this chapter summarize the core notation for several advanced topics.

Numerical Objects#

  • xx: a scalar
  • x\mathbf{x}: a vector (by default a column vector)
  • (x1,…,xn)(x_1, \ldots, x_n): the column vector with entries x1,…,xnx_1, \ldots, x_n written inline; a matrix row is written the same way in running text, as in "the rows (0,1,2)(0, 1, 2) and (3,4,5)(3, 4, 5)"
  • X\mathbf{X}: a matrix
  • X\mathsf{X}: a tensor with more than two axes
  • I\mathbf{I}: the identity matrix of a contextually determined dimension (a square matrix with 11 on the main diagonal and 00 everywhere else)
  • 0\mathbf{0}, 1\mathbf{1}: the vectors of all zeros and all ones of a contextually determined dimension
  • xix_i: the ithi^\textrm{th} element of vector x\mathbf{x}
  • xijx_{ij}, [X]i,j[\mathbf{X}]_{i,j}: the element of matrix X\mathbf{X} at row ii and column jj

Set Theory#

  • X\mathcal{X}: a set
  • R\mathbb{R}: the set of real numbers
  • Rn\mathbb{R}^n: the set of nn-dimensional real vectors
  • Ra×b\mathbb{R}^{a\times b}: the set of real matrices with aa rows and bb columns
  • ∣X∣|\mathcal{X}|: the cardinality (number of elements) of set X\mathcal{X}
  • A∪B\mathcal{A}\cup\mathcal{B}: the union of sets A\mathcal{A} and B\mathcal{B}
  • A∩B\mathcal{A}\cap\mathcal{B}: the intersection of sets A\mathcal{A} and B\mathcal{B}
  • A∖B\mathcal{A}\setminus\mathcal{B}: the set difference (the elements of A\mathcal{A} that do not belong to B\mathcal{B})

Functions and Operators#

  • f(⋅)f(\cdot): a function
  • log⁡(⋅)\log(\cdot): the natural logarithm (base ee)
  • log⁡2(⋅)\log_2(\cdot): the base-22 logarithm
  • exp⁡(⋅)\exp(\cdot): the exponential function
  • σ(⋅)\sigma(\cdot): the logistic sigmoid function, σ(x)=1/(1+e−x)\sigma(x) = 1/(1 + e^{-x})
  • softmax(o)\mathrm{softmax}(\mathbf{o}): the softmax vector with entries exp⁡(oi)/∑jexp⁡(oj)\exp(o_i) / \sum_j \exp(o_j)
  • 1(⋅)\mathbf{1}(\cdot): the indicator function, equal to 11 when its Boolean argument is true and 00 otherwise (distinguished from the all-ones vector 1\mathbf{1} by taking an argument)
  • argmax⁡xf(x)\operatorname{argmax}_x f(x), argmin⁡xf(x)\operatorname{argmin}_x f(x): a value of xx that maximizes or minimizes f(x)f(x)
  • ∑\sum: summation over a collection of elements
  • ∏\prod: product over a collection of elements
  • O(⋅)O(\cdot): an asymptotic upper bound up to a constant factor, as in a cost of O(n2)O(n^2) operations
  • ∝\propto: proportional to (the two sides differ by a constant factor independent of the variable of interest)
  • =def\stackrel{\textrm{def}}{=}: equality by definition of the symbol on the left-hand side

Linear Algebra#

  • (⋅)⊤(\cdot)^\top: the transpose of a vector or matrix
  • X−1\mathbf{X}^{-1}: the inverse of square matrix X\mathbf{X}
  • X+\mathbf{X}^{+}: the Moore–Penrose pseudoinverse of matrix X\mathbf{X}
  • ⟨x,y⟩\langle \mathbf{x}, \mathbf{y} \rangle: the inner (dot) product of vectors x\mathbf{x} and y\mathbf{y}, also written x⊤y\mathbf{x}^\top \mathbf{y}
  • ⊙\odot: the Hadamard (elementwise) product
  • [⋅,⋅][\cdot, \cdot]: concatenation of vectors or matrices
  • ∥⋅∥p\|\cdot\|_p: the ℓp\ell_p vector norm
  • ∥⋅∥\|\cdot\|: the Euclidean (ℓ2\ell_2) norm
  • ∥X∥2\|\mathbf{X}\|_2: the spectral (operator) norm of matrix X\mathbf{X}, equal to its largest singular value
  • ∥X∥F\|\mathbf{X}\|_F: the Frobenius norm of matrix X\mathbf{X}, equal to the ℓ2\ell_2 norm of its entries
  • ∥X∥∗\|\mathbf{X}\|_*: the nuclear (trace) norm of matrix X\mathbf{X}, equal to the sum of its singular values
  • diag⁡(x)\operatorname{diag}(\mathbf{x}): the diagonal matrix with the entries of vector x\mathbf{x} on its main diagonal
  • rank⁡X\operatorname{rank}\mathbf{X}, tr⁡X\operatorname{tr}\mathbf{X}, det⁡X\det\mathbf{X}: the rank, trace, and determinant of matrix X\mathbf{X}
  • λi\lambda_i, λmax⁡(X)\lambda_{\max}(\mathbf{X}): an eigenvalue of a square matrix, and the largest eigenvalue of a symmetric matrix X\mathbf{X}
  • σi(X)\sigma_i(\mathbf{X}): the ithi^\textrm{th} largest singular value of matrix X\mathbf{X} (not to be confused with the sigmoid function σ(⋅)\sigma(\cdot))
  • κ(X)\kappa(\mathbf{X}): the condition number of matrix X\mathbf{X}, equal to the ratio of its largest to its smallest nonzero singular value
  • ρ(X)\rho(\mathbf{X}): the spectral radius of a square matrix X\mathbf{X}, equal to the largest absolute value (modulus) among its eigenvalues (not to be confused with the correlation coefficient ρ(X,Y)\rho(X, Y) below)
  • X⪰0\mathbf{X}\succeq 0, X≻0\mathbf{X}\succ 0: the symmetric matrix X\mathbf{X} is positive semidefinite (X⪰0\mathbf{X}\succeq 0) or positive definite (X≻0\mathbf{X}\succ 0)

Calculus#

  • dydx\frac{dy}{dx}, f′(x)f'(x): the derivative of yy with respect to xx, and the derivative of ff evaluated at xx
  • ∂y∂x\frac{\partial y}{\partial x}: the partial derivative of yy with respect to xx
  • ∇xy\nabla_{\mathbf{x}} y: the gradient of scalar yy with respect to vector x\mathbf{x}
  • J\mathbf{J}, ∂f∂x\frac{\partial \mathbf{f}}{\partial \mathbf{x}}: the Jacobian matrix of vector-valued function f\mathbf{f} with respect to x\mathbf{x}
  • ∇2f\nabla^2 f: the Hessian matrix of ff, containing its second-order partial derivatives
  • ∇⋅f\nabla \cdot \mathbf{f}, Δf\Delta f: the divergence of vector field f\mathbf{f} and the Laplacian of scalar function ff
  • ∫abf(x) dx\int_a^b f(x) \,dx: the definite integral of ff from aa to bb with respect to xx
  • ∫f(x) dx\int f(x) \,dx: the indefinite integral (antiderivative) of ff with respect to xx

Probability and Information Theory#

  • XX: a random variable
  • PP: a probability distribution
  • X∼PX \sim P: the random variable XX follows distribution PP
  • P(X=x)P(X=x): the probability assigned to the event that random variable XX takes the value xx
  • P(X∣Y)P(X \mid Y): the conditional probability distribution of XX given YY
  • p(⋅)p(\cdot): a probability density function (PDF) or probability mass function (PMF) associated with distribution PP
  • E[X]\mathbb{E}[X]: the expectation of random variable XX
  • Ex∼P[f(x)]\mathbb{E}_{x \sim P}[f(x)]: the expectation of f(x)f(x) when xx is drawn from distribution PP
  • X⊥YX \perp Y: random variables XX and YY are statistically independent
  • X⊥Y∣ZX \perp Y \mid Z: random variables XX and YY are conditionally independent given ZZ
  • σ\sigma, σX\sigma_X: a standard deviation in general, and the standard deviation of random variable XX in particular
  • Var(X)\textrm{Var}(X): the variance of random variable XX, equal to σX2\sigma^2_X
  • Cov(X,Y)\textrm{Cov}(X, Y): the covariance of random variables XX and YY
  • Σ\boldsymbol{\Sigma}: a covariance matrix
  • ρ(X,Y)\rho(X, Y): the Pearson correlation coefficient between XX and YY, equal to Cov(X,Y)σXσY\frac{\textrm{Cov}(X, Y)}{\sigma_X \sigma_Y}
  • N(μ,σ2)\mathcal{N}(\mu, \sigma^2): the univariate Gaussian (normal) distribution with mean μ\mu and variance σ2\sigma^2; N(μ,Σ)\mathcal{N}(\boldsymbol{\mu}, \boldsymbol{\Sigma}) denotes its multivariate form
  • H(X)H(X), h(X)h(X): the Shannon entropy of a discrete random variable XX, and the differential entropy of a continuous random variable XX
  • I(X;Y)I(X; Y): the mutual information between random variables XX and YY
  • DKL(P∥Q)D_{\textrm{KL}}(P\|Q): the Kullback–Leibler (KL) divergence (relative entropy) from distribution PP to distribution QQ

Data, Models, and Training#

  • nn: the number of examples in a dataset
  • dd: the number of input features (dimensionality of an example)
  • x(i)\mathbf{x}^{(i)}, y(i)y^{(i)}: the feature vector and target label of the ithi^\textrm{th} example
  • D\mathcal{D}: a dataset, such as {(x(i),y(i))}i=1n\{(\mathbf{x}^{(i)}, y^{(i)})\}_{i=1}^n
  • X∈Rn×d\mathbf{X} \in \mathbb{R}^{n \times d}: a design matrix or minibatch matrix, arranged with one example per row
  • B\mathcal{B}: a minibatch of examples, of size ∣B∣|\mathcal{B}|
  • y^\hat{y}: a model's prediction of target yy
  • w\mathbf{w}, bb: the weight vector and scalar bias of a linear model
  • W(ℓ)\mathbf{W}^{(\ell)}, b(ℓ)\mathbf{b}^{(\ell)}: the weight matrix and bias vector of layer ℓ\ell, as in W(1)\mathbf{W}^{(1)}
  • θ\theta, θ\boldsymbol{\theta}: the parameters of a model (written in bold θ\boldsymbol{\theta} when collected into a single vector)
  • ll, ℓ\ell: a per-example loss function
  • LL: the empirical loss averaged over a dataset or minibatch
  • η\eta: the learning rate (step size) of a gradient-based optimizer
  • λ\lambda: the regularization strength of an ℓ2\ell_2 weight-decay penalty λ2∥w∥2\frac{\lambda}{2}\|\mathbf{w}\|^2
  • tt, TT: a discrete or continuous time step tt, and the total length TT of a sequence
  • xt\mathbf{x}_t, ht\mathbf{h}_t: the input and hidden state at time step tt

Attention and Transformers#

These symbols are introduced in Chapter 10 and used throughout Chapter 11 and the chapters that build on it.

  • q\mathbf{q}, ki\mathbf{k}_i, vi\mathbf{v}_i: a query vector, and the key and value vectors of item ii (Section 10.1)
  • a(q,k)a(\mathbf{q}, \mathbf{k}): an attention scoring function, such as q⊤k/d\mathbf{q}^\top \mathbf{k} / \sqrt{d} for scaled dot-product attention
  • α(q,ki)\alpha(\mathbf{q}, \mathbf{k}_i): the attention weight assigned to key ii, obtained by applying the softmax function to the scores across all keys
  • Q\mathbf{Q}, K\mathbf{K}, V\mathbf{V}: the stacked matrices of nn queries, mm keys, and mm values (one per row), which scaled dot-product attention maps to softmax(QK⊤/d) V\mathrm{softmax}(\mathbf{Q}\mathbf{K}^\top / \sqrt{d})\,\mathbf{V} (Section 10.2)
  • dd, dvd_v: the dimension (width) of queries and keys (dd), and of values (dvd_v)
  • HH, dhd_h: the number of attention heads and the per-head dimension, dh=d/Hd_h = d/H (Section 10.3)

State Space Models#

These symbols are introduced in Chapter 12.

  • A\mathbf{A}, B\mathbf{B}, C\mathbf{C}, DD: the state transition matrix, input projection, output readout, and feedthrough (skip) term of a state space model (Section 12.4.1.1)
  • NN: the latent state dimension per channel
  • λn\lambda_n: the nthn^\textrm{th} diagonal entry (rate) of a diagonal state matrix, whose corresponding state component decays by eΔλne^{\Delta \lambda_n} per step
  • Δ\Delta, Δt\Delta_t: the discretization step size (Section 12.4.1.2), and its input-dependent (selective) counterpart in Mamba (Section 12.5)
  • St∈Rdv×dk\mathbf{S}_t \in \mathbb{R}^{d_v \times d_k}: a matrix-valued recurrent state updated via outer products vtkt⊤\mathbf{v}_t \mathbf{k}_t^\top and read with a query qt\mathbf{q}_t (Section 12.6); here the key dimension is written dkd_k alongside the value dimension dvd_v
  • βt\beta_t: the write strength (learning rate) of the delta update rule (Section 12.7)

Reinforcement Learning#

These symbols are used across Chapter 14 and Chapter 15; Table 14.1.1 provides a complete listing along with the section where each symbol is defined.

  • S\mathcal{S}, A\mathcal{A}: the state space and action space
  • sts_t, ata_t, rtr_t: the state, action, and scalar reward at time step tt
  • P(s′∣s,a)P(s' \mid s, a): the Markov transition kernel giving the probability of transitioning to state s′s' from state ss under action aa
  • r(s,a)r(s, a): the expected immediate reward for taking action aa in state ss
  • γ\gamma: the discount factor, γ∈[0,1)\gamma \in [0, 1)
  • τ\tau, R(τ)R(\tau): a trajectory (s0,a0,r0,s1,…)(s_0, a_0, r_0, s_1, \ldots) and its discounted return R(τ)=∑tγtrtR(\tau) = \sum_t \gamma^t r_t
  • π(a∣s)\pi(a \mid s): a stochastic policy giving the probability of selecting action aa in state ss; for a deterministic policy, π(s)\pi(s) denotes the chosen action
  • πθ\pi_\theta, J(θ)J(\theta): a parameterized policy with parameters θ\theta, and its expected discounted return
  • Vπ(s)V^\pi(s), Qπ(s,a)Q^\pi(s, a): the state-value and action-value functions under policy π\pi (the expected return starting from state ss, and starting from state ss after taking action aa)
  • V∗V^*, Q∗Q^*: the optimal state-value and action-value functions
  • Aπ(s,a)A^\pi(s, a): the advantage function, Aπ(s,a)=Qπ(s,a)−Vπ(s)A^\pi(s, a) = Q^\pi(s, a) - V^\pi(s)
  • δt\delta_t: the temporal-difference (TD) error at step tt
  • ϵ\epsilon: the exploration probability in ϵ\epsilon-greedy action selection

Generative Adversarial Networks#

These symbols belong to Chapter 16; Table 16.1 lists every symbol along with its defining section and common alternatives in the literature.

  • pp, qq, mm: the true data density, the generator's model density, and their equal mixture m=12(p+q)m = \tfrac12(p + q)
  • x∼px \sim p, x′∼qx' \sim q: a real sample drawn from the data distribution and a synthetic sample drawn from the generator
  • yy: the binary source label of a sample (y=1y = 1 for real data and y=0y = 0 for generated samples)
  • zz, GG: the latent noise variable and the generator network, producing x′=G(z)x' = G(z)
  • DD: the critic's (or discriminator's) realness logit, so that σ(D(x))\sigma(D(x)) represents the estimated probability that sample xx is real
  • VV: the value function of the minimax log-loss game
  • ρ=p/q\rho = p/q, λ=log⁡ρ\lambda = \log \rho: the likelihood ratio (density ratio) and log-density ratio
  • η=p/(p+q)\eta = p/(p + q): the Bayes-optimal class posterior probability that a sample is real (note that within Chapter 16, the optimizer step size is written hh rather than η\eta)
  • ff, DfD_f: a divergence function and its ff-divergence
  • Φ\Phi, dRpd_{\mathrm{Rp}}: the pairing (relativistic) objective and its value at the optimal critic
  • γ\gamma, R1R_1, R2R_2: the gradient-penalty weight and the zero-centered gradient penalties evaluated on real data (R1R_1) and generated samples (R2R_2)
  • cc: a conditioning variable, such as a class label or text prompt

Diffusion Models#

These symbols belong to Chapter 17 and match the conventions of Chapter 26 (Table 26.1). Throughout this book, we use a single unified time direction: clean data reside at t=0t = 0, pure noise resides at t=1t = 1, and generative samplers integrate backward from t=1t = 1 down to t=0t = 0. (Note that some flow-matching papers reverse this convention; see Section 17.2.) The chapter collects its symbols, with the notations papers use for them, in Table 17.2.1.

  • x0\mathbf{x}_0, ϵ\boldsymbol{\epsilon}: a clean data point and an independent standard Gaussian noise vector, ϵ∼N(0,I)\boldsymbol{\epsilon} \sim \mathcal{N}(\mathbf{0}, \mathbf{I})
  • xt=αtx0+σtϵ\mathbf{x}_t = \alpha_t \mathbf{x}_0 + \sigma_t \boldsymbol{\epsilon}: the noisy state at time t∈[0,1]t \in [0, 1] along a Gaussian probability path
  • αt\alpha_t, σt\sigma_t: the signal and noise schedule coefficients along the path (distinct from a learning rate or the standard deviation of the data)
  • αˉt=αt2\bar\alpha_t = \alpha_t^2, β(t)\beta(t): the squared signal coefficient of the variance-preserving path and its rate (Section 17.2)
  • kk, TT, βk\beta_k: a step of the DDPM chain, the number of steps, and the variance added at step kk (Section 17.2)
  • λt=log⁡(αt2/σt2)\lambda_t = \log(\alpha_t^2 / \sigma_t^2): the log signal-to-noise ratio (log-SNR), which decreases monotonically from +∞+\infty at clean data (t=0t=0) to −∞-\infty at pure noise (t=1t=1)
  • ptp_t, ∇log⁡pt\nabla \log p_t: the marginal density of xt\mathbf{x}_t at time tt and its score function
  • x^0\hat{\mathbf{x}}_0, ϵ^\hat{\boldsymbol{\epsilon}}: the posterior expectations E[x0∣xt]\mathbb{E}[\mathbf{x}_0 \mid \mathbf{x}_t] and E[ϵ∣xt]\mathbb{E}[\boldsymbol{\epsilon} \mid \mathbf{x}_t] predicted by a denoising network
  • ut\mathbf{u}_t, uθ\mathbf{u}_{\boldsymbol{\theta}}, u^\hat{\mathbf{u}}: the probability-flow velocity field that transports samples along the path, a neural network parameterized by θ\boldsymbol{\theta} trained to approximate it, and that network's predicted velocity
  • xˉ=xt/αt\bar{\mathbf{x}} = \mathbf{x}_t / \alpha_t, σˉ=σt/αt\bar\sigma = \sigma_t / \alpha_t: the coordinates in which every Gaussian path reads xˉ=x0+σˉϵ\bar{\mathbf{x}} = \mathbf{x}_0 + \bar\sigma \boldsymbol{\epsilon} and the samplers take their steps (Section 17.3); here the bar means division by αt\alpha_t, not the square it denotes in αˉt=αt2\bar\alpha_t = \alpha_t^2
  • v=αtϵ−σtx0\mathbf{v} = \alpha_t \boldsymbol{\epsilon} - \sigma_t \mathbf{x}_0: the target vector in v\mathbf{v}-prediction (Section 17.2)
  • u~\tilde{\mathbf{u}}: the classifier-free guided velocity field (Section 17.4.4.2)
  • uˉ(xt,s,t)\bar{\mathbf{u}}(\mathbf{x}_t, s, t), uref\mathbf{u}_{\textrm{ref}}: the average velocity between times tt and ss, and the reference velocity (either a teacher model's prediction u^\hat{\mathbf{u}} or the conditional velocity ϵ−x0\boldsymbol{\epsilon} - \mathbf{x}_0) used in few-step distillation losses (Section 17.8)
  • cc, γ\gamma: a conditioning signal and the guidance scale (Section 17.4.4.2)

Discussions