Skip to content

Mathematical Foundations

Anurag Prasad edited this page Nov 8, 2026 · 6 revisions

Mathematical Notation and Cheat Sheet

One page of notation and identities used throughout the wiki. Derivations are in Module 01, 02 and 03.

Notation

Symbol Meaning
$x,\ \mathbf{x},\ X$ scalar, vector, matrix/tensor (bold lower-case = column vector)
$\mathbf{x}^\top\mathbf{y}$ dot product; $\lVert\mathbf{x}\rVert_p$ is the $\ell_p$ norm, $\lVert A\rVert_F$ Frobenius norm
$A\odot B$ elementwise (Hadamard) product
$W^{(\ell)},\mathbf{b}^{(\ell)}$ weights and bias of layer $\ell$ (shape $n_\ell\times n_{\ell-1}$)
$\mathbf{z}^{(\ell)},\ \mathbf{a}^{(\ell)}$ pre-activation and post-activation: $\mathbf{a}=\phi(\mathbf{z})$
$\theta$ all trainable parameters; $\eta$ learning rate; $\lambda$ regularisation strength
$L,\ \ell$ total loss, per-example loss
$\nabla_\theta L$ gradient (same shape as $\theta$); $J$ Jacobian; $H$ Hessian
$B,\ T,\ d,\ h$ batch size, sequence length, model width, number of heads
$d_k,\ d_{ff}$ key/query width, feed-forward hidden width
$\mathbb{E},\ \operatorname{Var},\ \operatorname{Cov}$ expectation, variance, covariance
$p,\ q$ distributions; $p_\theta$ is a model
$D_{KL}(p\Vert q)$ KL divergence; $H(p)$ entropy; $H(p,q)$ cross-entropy; $I(X;Y)$ mutual information
$\sigma(\cdot)$ logistic sigmoid (not a standard deviation, unless written $\sigma_i$ for singular values or $\sigma^2$ for variance)
$\mathcal{N}(\mu,\Sigma)$ Gaussian distribution
$\mathbf{1}[\cdot]$ indicator function
$\bar\alpha_t$ cumulative product of $(1-\beta_s)$ in diffusion models

Linear algebra

  • $(AB)^\top=B^\top A^\top$; $\ (AB)^{-1}=B^{-1}A^{-1}$; $\ \operatorname{tr}(AB)=\operatorname{tr}(BA)$; $\ \lVert A\rVert_F^2=\operatorname{tr}(A^\top A)$.
  • Eigendecomposition (symmetric): $A=Q\Lambda Q^\top$. SVD: $A=U\Sigma V^\top$, $\ \sigma_i=\sqrt{\lambda_i(A^\top A)}$.
  • Best rank-$k$ approximation: truncate the SVD; error $\sqrt{\sum_{i>k}\sigma_i^2}$ (Frobenius).
  • Condition number $\kappa(A)=\sigma_{\max}/\sigma_{\min}$. PSD $\Leftrightarrow$ all eigenvalues $\ge0$.
  • Cauchy–Schwarz: $\lvert\mathbf{x}^\top\mathbf{y}\rvert\le\lVert\mathbf{x}\rVert\lVert\mathbf{y}\rVert$.

Calculus and gradients

Function Gradient
$\mathbf{a}^\top\mathbf{x}$ $\mathbf{a}$
$\mathbf{x}^\top A\mathbf{x}$ $(A+A^\top)\mathbf{x}$
$\tfrac12\lVert X\mathbf{w}-\mathbf{y}\rVert^2$ $X^\top(X\mathbf{w}-\mathbf{y})$
$\lVert\mathbf{x}\rVert_2$ $\mathbf{x}/\lVert\mathbf{x}\rVert_2$
$Y=XW$ with $G=\partial L/\partial Y$ $\partial L/\partial W=X^\top G,\ \ \partial L/\partial X=GW^\top$
softmax cross-entropy $\partial L/\partial\mathbf{z}=\mathbf{p}-\mathbf{y}$
sigmoid $\sigma'=\sigma(1-\sigma)$
$\tanh$ $1-\tanh^2$

Chain rule: $J_{g\circ f}=J_gJ_f$. Taylor: $f(\mathbf{x}+\boldsymbol\delta)\approx f+\nabla f^\top\boldsymbol\delta+\tfrac12\boldsymbol\delta^\top H\boldsymbol\delta$.

Probability and information

  • Bayes: $P(A\mid B)=P(B\mid A)P(A)/P(B)$. Var$(X)=\mathbb{E}[X^2]-(\mathbb{E}X)^2$.
  • $H(p,q)=H(p)+D_{KL}(p\Vert q)$; $\ D_{KL}\ge0$ (Jensen). $I(X;Y)=D_{KL}(p(x,y)\Vert p(x)p(y))$.
  • Gaussian KL: $D_{KL}(\mathcal{N}(\mu_1,\sigma_1^2)\Vert\mathcal{N}(\mu_2,\sigma_2^2))=\ln\frac{\sigma_2}{\sigma_1}+\frac{\sigma_1^2+(\mu_1-\mu_2)^2}{2\sigma_2^2}-\frac12$.
  • Bias–variance: $\mathrm{MSE}=\text{bias}^2+\text{variance}+\sigma^2_{\text{noise}}$.

Handy numbers

Quantity Value
$\sigma'(0)$ $0.25$
He init std $\sqrt{2/n_{in}}$
Xavier init std $\sqrt{2/(n_{in}+n_{out})}$
Transformer layer parameters $\approx12d^2$ (with $d_{ff}=4d$)
Training compute $\approx6ND$ FLOPs
Adam memory (mixed precision) $\approx16$ bytes per parameter

Self-check (answers in the linked modules)

  1. What is the shape of $\partial L/\partial W$ if $W\in\mathbb{R}^{m\times n}$? (02)
  2. Why is $\hat{\mathbf{y}}=XW$ with no nonlinearity no more expressive with depth? (05)
  3. What does $D_{KL}(p\Vert q)=0$ imply? (03)
  4. Which singular value controls the spectral norm of $A$? (01)

🎓 Deep Learning Hub

🏠 Home · 🗺️ Curriculum · 🧭 Learning paths

❓ Question bank · 📖 Glossary · 📚 References

Jump to module:

01 02 03 04 05 06 07 08 09 10 11 12

13 14 15 16 17 18 19 20 21 22 23 24

Part 1 · Mathematical foundations
Part 2 · Neural network fundamentals
Part 3 · Training deep networks
Part 4 · Core architectures
Part 5 · Representation and generative learning
Part 6 · Specialised, modern and responsible deep learning
Reference and meta

Clone this wiki locally