[
  {
    "id": "azuma_hoeffding",
    "title": "Azuma–Hoeffding inequality",
    "field": "probability",
    "latex": "P\\big(|M_n-M_0|\\ge t\\big)\\le2\\exp\\!\\Big(-\\frac{t^2}{2\\sum_ic_i^2}\\Big)",
    "plain": "bounded-difference martingales concentrate",
    "symbols": "|Mᵢ − Mᵢ₋₁| ≤ cᵢ",
    "notes": "",
    "related": [
      "mcdiarmid",
      "hoeffding"
    ]
  },
  {
    "id": "bayes",
    "title": "Bayes' theorem",
    "field": "probability",
    "latex": "P(A\\mid B) = \\frac{P(B\\mid A)\\,P(A)}{P(B)}",
    "plain": "P(A|B) = P(B|A)·P(A) / P(B)",
    "symbols": "P(A) prior, P(B|A) likelihood, P(A|B) posterior, P(B) evidence",
    "notes": "With the law of total probability, P(B) = Σ P(B|Aᵢ)P(Aᵢ).",
    "related": [
      "total_probability",
      "map_estimate"
    ]
  },
  {
    "id": "bernoulli",
    "title": "Bernoulli distribution",
    "field": "probability",
    "latex": "P(X=x) = p^{x}(1-p)^{1-x},\\quad x\\in\\{0,1\\}",
    "plain": "P(X = x) = pˣ (1−p)¹⁻ˣ",
    "symbols": "p = probability of success",
    "notes": "Mean p, variance p(1−p).",
    "related": [
      "binomial"
    ]
  },
  {
    "id": "bernoulli_mean",
    "title": "Bernoulli distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=p",
    "plain": "E[X] = p",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "bernoulli_variance"
    ]
  },
  {
    "id": "bernoulli_variance",
    "title": "Bernoulli distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=p(1-p)",
    "plain": "Var(X) = p(1 − p)",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "bernoulli_mean"
    ]
  },
  {
    "id": "beta_pdf",
    "title": "beta distribution",
    "field": "probability",
    "latex": "f(x) = \\frac{x^{\\alpha-1}(1-x)^{\\beta-1}}{B(\\alpha,\\beta)},\\quad B(\\alpha,\\beta)=\\frac{\\Gamma(\\alpha)\\Gamma(\\beta)}{\\Gamma(\\alpha+\\beta)}",
    "plain": "f(x) = x^(α−1) (1−x)^(β−1) / B(α,β)",
    "symbols": "α, β > 0; x ∈ [0,1]",
    "notes": "Conjugate prior for the Bernoulli/binomial success probability.",
    "related": [
      "bernoulli",
      "binomial",
      "bayes"
    ]
  },
  {
    "id": "beta_mean",
    "title": "beta distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\frac{\\alpha}{\\alpha+\\beta}",
    "plain": "E[X] = α/(α+β)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "beta_variance"
    ]
  },
  {
    "id": "beta_variance",
    "title": "beta distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{\\alpha\\beta}{(\\alpha+\\beta)^2(\\alpha+\\beta+1)}",
    "plain": "Var(X) = αβ / ((α+β)²(α+β+1))",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "beta_mean"
    ]
  },
  {
    "id": "beta_binomial_mean",
    "title": "beta-binomial distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\frac{n\\alpha}{\\alpha+\\beta}",
    "plain": "E[X] = nα/(α+β)",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "beta_binomial_variance"
    ]
  },
  {
    "id": "beta_binomial_pmf",
    "title": "beta-binomial distribution: probability mass",
    "field": "probability",
    "latex": "P(X=k)=\\binom nk\\frac{B(k+\\alpha,\\,n-k+\\beta)}{B(\\alpha,\\beta)}",
    "plain": "P(X = k) = C(n,k) B(k+α, n−k+β) / B(α, β)",
    "symbols": "",
    "notes": "A binomial whose success probability is itself Beta(α, β): overdispersed relative to the binomial.",
    "related": [
      "beta_binomial_mean"
    ]
  },
  {
    "id": "beta_binomial_variance",
    "title": "beta-binomial distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{n\\alpha\\beta(\\alpha+\\beta+n)}{(\\alpha+\\beta)^2(\\alpha+\\beta+1)}",
    "plain": "Var(X) = nαβ(α+β+n) / ((α+β)²(α+β+1))",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "beta_binomial_mean"
    ]
  },
  {
    "id": "binomial",
    "title": "binomial distribution",
    "field": "probability",
    "latex": "P(X=k) = \\binom{n}{k}p^{k}(1-p)^{n-k}",
    "plain": "P(X = k) = C(n,k) pᵏ (1−p)ⁿ⁻ᵏ",
    "symbols": "n trials, k successes, p = success probability",
    "notes": "Mean np, variance np(1−p).",
    "related": [
      "bernoulli",
      "poisson"
    ]
  },
  {
    "id": "binomial_mean",
    "title": "binomial distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=np",
    "plain": "E[X] = np",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "binomial_variance"
    ]
  },
  {
    "id": "binomial_mgf",
    "title": "binomial distribution: moment generating function",
    "field": "probability",
    "latex": "M_X(t)=\\big(1-p+pe^{t}\\big)^n",
    "plain": "M(t) = (1 − p + p eᵗ)ⁿ",
    "symbols": "",
    "notes": "",
    "related": [
      "binomial_mean"
    ]
  },
  {
    "id": "binomial_variance",
    "title": "binomial distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=np(1-p)",
    "plain": "Var(X) = np(1 − p)",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "binomial_mean"
    ]
  },
  {
    "id": "birth_death",
    "title": "birth–death chain stationary distribution",
    "field": "probability",
    "latex": "\\pi_k=\\pi_0\\prod_{i=1}^{k}\\frac{\\lambda_{i-1}}{\\mu_i}\\quad\\Rightarrow\\quad M/M/1:\\ \\pi_k=(1-\\rho)\\rho^k",
    "plain": "πₖ = π₀ Π λ_{i−1}/μᵢ",
    "symbols": "",
    "notes": "",
    "related": [
      "mm1_queue"
    ]
  },
  {
    "id": "brownian_motion",
    "title": "Brownian motion (Wiener process)",
    "field": "probability",
    "latex": "W_0=0,\\quad W_t-W_s\\sim\\mathcal N(0,\\,t-s),\\quad \\operatorname{Cov}(W_s,W_t)=\\min(s,t)",
    "plain": "increments are independent N(0, t − s);  Cov(Wₛ, Wₜ) = min(s, t)",
    "symbols": "",
    "notes": "Continuous but nowhere differentiable; the limit of a scaled random walk.",
    "related": [
      "random_walk",
      "gbm"
    ]
  },
  {
    "id": "categorical",
    "title": "categorical distribution",
    "field": "probability",
    "latex": "P(X=k)=p_k,\\quad \\sum_k p_k=1",
    "plain": "P(X = k) = pₖ",
    "symbols": "",
    "notes": "One draw from K classes; the output of a softmax classifier. Log-likelihood of one observation is log pₖ.",
    "related": [
      "softmax",
      "multinomial_pmf"
    ]
  },
  {
    "id": "cauchy_cdf",
    "title": "Cauchy distribution: cumulative distribution function",
    "field": "probability",
    "latex": "F(x)=\\tfrac12+\\frac1\\pi\\arctan\\!\\Big(\\frac{x-x_0}{\\gamma}\\Big)",
    "plain": "F(x) = ½ + arctan((x − x₀)/γ)/π",
    "symbols": "",
    "notes": "Verified against numerical integration of the density up to x.",
    "related": [
      "cauchy_pdf"
    ]
  },
  {
    "id": "cauchy_pdf",
    "title": "Cauchy distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{1}{\\pi\\gamma\\Big[1+\\big(\\frac{x-x_0}{\\gamma}\\big)^2\\Big]}",
    "plain": "f(x) = 1 / (πγ [1 + ((x − x₀)/γ)²])",
    "symbols": "",
    "notes": "No mean and no variance (the integrals diverge): sample averages of Cauchy data do not settle down.",
    "related": [
      "cauchy_cdf"
    ]
  },
  {
    "id": "chain_rule_probability",
    "title": "chain rule of probability",
    "field": "probability",
    "latex": "P(A_1,\\dots,A_n) = \\prod_{i=1}^{n} P(A_i \\mid A_1,\\dots,A_{i-1})",
    "plain": "P(A₁,…,Aₙ) = Πᵢ P(Aᵢ | A₁,…,Aᵢ₋₁)",
    "symbols": "",
    "notes": "The basis of autoregressive language models.",
    "related": [
      "bayes"
    ]
  },
  {
    "id": "pdf_transformation",
    "title": "change of variables for densities",
    "field": "probability",
    "latex": "Y=g(X)\\ \\Rightarrow\\ f_Y(y)=f_X\\big(g^{-1}(y)\\big)\\Big|\\frac{d\\,g^{-1}(y)}{dy}\\Big|",
    "plain": "f_Y(y) = f_X(g⁻¹(y))·|d g⁻¹/dy|",
    "symbols": "",
    "notes": "Example: Y = 2X for X ~ Exp(1) gives f_Y = ½ e^(−y/2).",
    "related": [
      "flow_change_of_variables"
    ]
  },
  {
    "id": "chapman_kolmogorov",
    "title": "Chapman–Kolmogorov equations",
    "field": "probability",
    "latex": "P^{(m+n)}=P^{(m)}P^{(n)},\\qquad P^{(n)}=P^n",
    "plain": "the n-step transition matrix is the n-th power of P",
    "symbols": "",
    "notes": "",
    "related": [
      "markov_stationary"
    ]
  },
  {
    "id": "chebyshev",
    "title": "Chebyshev's inequality",
    "field": "probability",
    "latex": "P\\big(|X-\\mu|\\ge k\\sigma\\big)\\le \\frac{1}{k^2}",
    "plain": "P(|X − μ| ≥ kσ) ≤ 1/k²",
    "symbols": "k > 0",
    "notes": "Needs only a finite variance.",
    "related": [
      "markov_inequality"
    ]
  },
  {
    "id": "chi_square_cdf",
    "title": "chi-square distribution: cumulative distribution function",
    "field": "probability",
    "latex": "F(x)=1-e^{-x/2}\\Big(1+\\frac x2\\Big)\\quad(k=4)",
    "plain": "F(x) = 1 − e^(−x/2)(1 + x/2)   for k = 4",
    "symbols": "",
    "notes": "Verified against numerical integration of the density up to x.",
    "related": [
      "chi_square_pdf"
    ]
  },
  {
    "id": "chi_square_pdf",
    "title": "chi-square distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{x^{k/2-1}e^{-x/2}}{2^{k/2}\\Gamma(k/2)}",
    "plain": "f(x) = x^(k/2−1) e^(−x/2) / (2^(k/2) Γ(k/2))",
    "symbols": "",
    "notes": "The sum of k squared independent standard normals. Gamma with shape k/2 and scale 2.",
    "related": [
      "chi_square_mean"
    ]
  },
  {
    "id": "chi_square_mean",
    "title": "chi-square distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=k",
    "plain": "E[X] = k",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "chi_square_variance"
    ]
  },
  {
    "id": "chi_square_mgf",
    "title": "chi-square distribution: moment generating function",
    "field": "probability",
    "latex": "M_X(t)=(1-2t)^{-k/2}\\quad(t<1/2)",
    "plain": "M(t) = (1 − 2t)^(−k/2)",
    "symbols": "",
    "notes": "",
    "related": [
      "chi_square_mean"
    ]
  },
  {
    "id": "chi_square_variance",
    "title": "chi-square distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=2k",
    "plain": "Var(X) = 2k",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "chi_square_mean"
    ]
  },
  {
    "id": "compound_poisson",
    "title": "compound Poisson process",
    "field": "probability",
    "latex": "S_t=\\sum_{i=1}^{N_t}Y_i:\\quad \\mathbb E S_t=\\lambda t\\,\\mathbb E Y,\\quad \\operatorname{Var}S_t=\\lambda t\\,\\mathbb E[Y^2]",
    "plain": "E S = λt·E[Y];  Var S = λt·E[Y²]",
    "symbols": "",
    "notes": "Insurance claims and call-centre loads.",
    "related": [
      "wald_identity"
    ]
  },
  {
    "id": "uniform_cdf",
    "title": "continuous uniform distribution: cumulative distribution function",
    "field": "probability",
    "latex": "F(x)=\\frac{x-a}{b-a}",
    "plain": "F(x) = (x − a)/(b − a)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density up to x.",
    "related": [
      "uniform_pdf"
    ]
  },
  {
    "id": "uniform_pdf",
    "title": "continuous uniform distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{1}{b-a}\\quad(a\\le x\\le b)",
    "plain": "f(x) = 1/(b − a) on [a, b]",
    "symbols": "",
    "notes": "Every value in [a, b] is equally likely. Maximum entropy on a bounded interval.",
    "related": [
      "uniform_mean"
    ]
  },
  {
    "id": "uniform_mean",
    "title": "continuous uniform distribution: mean",
    "field": "probability",
    "latex": "\\mu=\\frac{a+b}{2}",
    "plain": "μ = (a + b)/2",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "uniform_variance"
    ]
  },
  {
    "id": "uniform_variance",
    "title": "continuous uniform distribution: variance",
    "field": "probability",
    "latex": "\\sigma^2=\\frac{(b-a)^2}{12}",
    "plain": "σ² = (b − a)²/12",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "uniform_mean"
    ]
  },
  {
    "id": "covariance",
    "title": "covariance",
    "field": "probability",
    "latex": "\\operatorname{Cov}(X,Y) = \\mathbb{E}[XY] - \\mathbb{E}[X]\\,\\mathbb{E}[Y]",
    "plain": "Cov(X,Y) = E[XY] − E[X]E[Y]",
    "symbols": "",
    "notes": "Zero covariance does not imply independence. Cov(X,X) = Var(X).",
    "related": [
      "pearson",
      "variance"
    ]
  },
  {
    "id": "cumulant_generating",
    "title": "cumulant generating function",
    "field": "probability",
    "latex": "K_X(t)=\\ln M_X(t),\\quad \\kappa_1=\\mathbb E[X],\\ \\kappa_2=\\operatorname{Var}(X)",
    "plain": "K(t) = ln M(t);  κ₁ = mean, κ₂ = variance",
    "symbols": "",
    "notes": "Cumulants of independent sums add. For a normal, all cumulants above the second vanish.",
    "related": [
      "mgf_moments"
    ]
  },
  {
    "id": "convolution_densities",
    "title": "density of a sum of independent variables",
    "field": "probability",
    "latex": "f_{X+Y}(z)=\\int f_X(x)\\,f_Y(z-x)\\,dx",
    "plain": "f_{X+Y} = f_X ∗ f_Y",
    "symbols": "",
    "notes": "Two Uniform(0, 1) give the triangular density.",
    "related": [
      "convolution",
      "normal_sum"
    ]
  },
  {
    "id": "order_statistic_density",
    "title": "density of an order statistic",
    "field": "probability",
    "latex": "f_{(k)}(x)=\\frac{n!}{(k-1)!\\,(n-k)!}F(x)^{k-1}\\big(1-F(x)\\big)^{n-k}f(x)",
    "plain": "f₍ₖ₎ = n!/((k−1)!(n−k)!) F^(k−1) (1 − F)^(n−k) f",
    "symbols": "",
    "notes": "",
    "related": [
      "order_statistics"
    ]
  },
  {
    "id": "detailed_balance",
    "title": "detailed balance and reversibility",
    "field": "probability",
    "latex": "\\pi_iP_{ij}=\\pi_jP_{ji}\\ \\ \\Rightarrow\\ \\ \\boldsymbol\\pi P=\\boldsymbol\\pi",
    "plain": "πᵢPᵢⱼ = πⱼPⱼᵢ",
    "symbols": "",
    "notes": "The condition that Metropolis–Hastings enforces so that π is the stationary distribution.",
    "related": [
      "metropolis_hastings",
      "markov_stationary"
    ]
  },
  {
    "id": "dirichlet_pdf",
    "title": "Dirichlet distribution",
    "field": "probability",
    "latex": "f(\\mathbf p)=\\frac{\\Gamma(\\alpha_0)}{\\prod_k\\Gamma(\\alpha_k)}\\prod_k p_k^{\\alpha_k-1},\\quad \\alpha_0=\\sum_k\\alpha_k",
    "plain": "f(p) = Γ(α₀)/ΠΓ(αₖ) · Π pₖ^(αₖ−1)",
    "symbols": "",
    "notes": "Mean αₖ/α₀. The conjugate prior of the categorical and multinomial; the multivariate beta.",
    "related": [
      "beta_mean",
      "multinomial_pmf"
    ]
  },
  {
    "id": "discrete_uniform_mean",
    "title": "discrete uniform distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\frac{n+1}{2}",
    "plain": "E[X] = (n + 1)/2",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "discrete_uniform_variance"
    ]
  },
  {
    "id": "discrete_uniform_pmf",
    "title": "discrete uniform distribution: probability mass",
    "field": "probability",
    "latex": "P(X=k)=\\frac1n,\\ k=1,\\dots,n",
    "plain": "P(X = k) = 1/n",
    "symbols": "",
    "notes": "A fair die has n = 6.",
    "related": [
      "discrete_uniform_mean"
    ]
  },
  {
    "id": "discrete_uniform_variance",
    "title": "discrete uniform distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{n^2-1}{12}",
    "plain": "Var(X) = (n² − 1)/12",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "discrete_uniform_mean"
    ]
  },
  {
    "id": "expectation",
    "title": "expected value",
    "field": "probability",
    "latex": "\\mathbb{E}[X] = \\sum_x x\\,p(x) \\qquad \\mathbb{E}[X] = \\int x\\,f(x)\\,dx",
    "plain": "E[X] = Σₓ x·p(x)        (continuous: ∫ x f(x) dx)",
    "symbols": "p(x) = probability mass, f(x) = density",
    "notes": "Linear: E[aX + bY] = aE[X] + bE[Y], always, even when X and Y are dependent.",
    "related": [
      "variance",
      "law_total_expectation"
    ]
  },
  {
    "id": "exponential",
    "title": "exponential distribution",
    "field": "probability",
    "latex": "f(x) = \\lambda e^{-\\lambda x},\\ x\\ge 0 \\qquad F(x) = 1-e^{-\\lambda x}",
    "plain": "f(x) = λ e^(−λx)        F(x) = 1 − e^(−λx)",
    "symbols": "λ = rate; mean 1/λ",
    "notes": "Memoryless: P(X > s+t | X > s) = P(X > t).",
    "related": [
      "poisson"
    ]
  },
  {
    "id": "exponential_mean",
    "title": "exponential distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\frac1\\lambda",
    "plain": "E[X] = 1/λ",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "exponential_variance"
    ]
  },
  {
    "id": "exponential_mgf",
    "title": "exponential distribution: moment generating function",
    "field": "probability",
    "latex": "M_X(t)=\\frac{\\lambda}{\\lambda-t}\\quad(t<\\lambda)",
    "plain": "M(t) = λ/(λ − t)",
    "symbols": "",
    "notes": "",
    "related": [
      "exponential_mean"
    ]
  },
  {
    "id": "exponential_variance",
    "title": "exponential distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac1{\\lambda^2}",
    "plain": "Var(X) = 1/λ²",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "exponential_mean"
    ]
  },
  {
    "id": "extreme_value_limit",
    "title": "extreme value limit (maximum of exponentials)",
    "field": "probability",
    "latex": "P\\big(\\max_{i\\le n}X_i-\\ln n\\le x\\big)\\to\\exp\\!\\big(-e^{-x}\\big)\\qquad(X_i\\sim\\mathrm{Exp}(1))",
    "plain": "the maximum of n exponentials is asymptotically Gumbel",
    "symbols": "",
    "notes": "",
    "related": [
      "gumbel_pdf"
    ]
  },
  {
    "id": "f_dist_pdf",
    "title": "F distribution distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{1}{x\\,B(d_1/2,d_2/2)}\\sqrt{\\frac{(d_1x)^{d_1}\\,d_2^{d_2}}{(d_1x+d_2)^{d_1+d_2}}}",
    "plain": "f(x) = √( (d₁x)^d₁ d₂^d₂ / (d₁x+d₂)^(d₁+d₂) ) / (x B(d₁/2, d₂/2))",
    "symbols": "",
    "notes": "The ratio of two scaled chi-squares; the null distribution of the ANOVA F statistic.",
    "related": [
      "f_dist_mean"
    ]
  },
  {
    "id": "f_dist_mean",
    "title": "F distribution distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\frac{d_2}{d_2-2}\\ \\ (d_2>2)",
    "plain": "E[X] = d₂/(d₂ − 2)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "f_dist_variance"
    ]
  },
  {
    "id": "f_dist_variance",
    "title": "F distribution distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{2d_2^2(d_1+d_2-2)}{d_1(d_2-2)^2(d_2-4)}\\ \\ (d_2>4)",
    "plain": "Var(X) = 2d₂²(d₁+d₂−2) / (d₁(d₂−2)²(d₂−4))",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "f_dist_mean"
    ]
  },
  {
    "id": "random_walk_hitting",
    "title": "gambler's-ruin hitting time",
    "field": "probability",
    "latex": "\\mathbb E[T]=i(N-i)\\quad\\text{for a symmetric walk on }\\{0,\\dots,N\\}\\text{ started at }i",
    "plain": "E[T] = i(N − i)",
    "symbols": "",
    "notes": "",
    "related": [
      "gamblers_ruin"
    ]
  },
  {
    "id": "gamma_cdf",
    "title": "gamma distribution: cumulative distribution function",
    "field": "probability",
    "latex": "F(x)=1-e^{-x/\\theta}\\sum_{j=0}^{k-1}\\frac{(x/\\theta)^j}{j!}\\ \\ (k\\in\\mathbb N)",
    "plain": "F(x) = 1 − e^(−x/θ) Σ_{j<k} (x/θ)ʲ/j!   (integer k, the Erlang case)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density up to x.",
    "related": [
      "gamma_pdf"
    ]
  },
  {
    "id": "gamma_pdf",
    "title": "gamma distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{x^{k-1}e^{-x/\\theta}}{\\Gamma(k)\\,\\theta^{k}}",
    "plain": "f(x) = x^(k−1) e^(−x/θ) / (Γ(k) θᵏ)",
    "symbols": "",
    "notes": "Shape k, scale θ. The sum of k independent exponentials (mean θ) is gamma. Some texts use rate β = 1/θ.",
    "related": [
      "gamma_mean"
    ]
  },
  {
    "id": "gamma_mean",
    "title": "gamma distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=k\\theta",
    "plain": "E[X] = kθ",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "gamma_variance"
    ]
  },
  {
    "id": "gamma_mgf",
    "title": "gamma distribution: moment generating function",
    "field": "probability",
    "latex": "M_X(t)=(1-\\theta t)^{-k}\\quad(t<1/\\theta)",
    "plain": "M(t) = (1 − θt)^(−k)",
    "symbols": "",
    "notes": "The product of independent gamma MGFs with common θ adds the shapes.",
    "related": [
      "gamma_mean"
    ]
  },
  {
    "id": "gamma_variance",
    "title": "gamma distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=k\\theta^2",
    "plain": "Var(X) = kθ²",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "gamma_mean"
    ]
  },
  {
    "id": "gbm",
    "title": "geometric Brownian motion",
    "field": "probability",
    "latex": "dS=\\mu S\\,dt+\\sigma S\\,dW,\\quad S_t=S_0\\exp\\!\\big((\\mu-\\tfrac12\\sigma^2)t+\\sigma W_t\\big),\\quad \\mathbb E S_t=S_0e^{\\mu t}",
    "plain": "S_t = S₀ exp((μ − σ²/2)t + σW_t);  E S_t = S₀ e^(μt)",
    "symbols": "",
    "notes": "The Black–Scholes model of a stock price.",
    "related": [
      "ito_lemma",
      "black_scholes"
    ]
  },
  {
    "id": "geometric_cdf",
    "title": "geometric distribution: cumulative distribution function",
    "field": "probability",
    "latex": "F(k)=1-(1-p)^k",
    "plain": "F(k) = 1 − (1−p)ᵏ",
    "symbols": "",
    "notes": "Verified against summation of the mass function up to k.",
    "related": [
      "geometric_pmf"
    ]
  },
  {
    "id": "geometric_mean",
    "title": "geometric distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\frac1p",
    "plain": "E[X] = 1/p",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "geometric_variance"
    ]
  },
  {
    "id": "geometric_pmf",
    "title": "geometric distribution: probability mass",
    "field": "probability",
    "latex": "P(X=k)=(1-p)^{k-1}p,\\ k\\ge1",
    "plain": "P(X = k) = (1−p)^(k−1) p",
    "symbols": "",
    "notes": "The number of trials up to and including the first success. Memoryless.",
    "related": [
      "geometric_mean"
    ]
  },
  {
    "id": "geometric_variance",
    "title": "geometric distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{1-p}{p^2}",
    "plain": "Var(X) = (1 − p)/p²",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "geometric_mean"
    ]
  },
  {
    "id": "gumbel_cdf",
    "title": "Gumbel (extreme value type I) distribution: cumulative distribution function",
    "field": "probability",
    "latex": "F(x)=\\exp\\!\\big(-e^{-(x-\\mu)/\\beta}\\big)",
    "plain": "F(x) = exp(−e^(−(x−μ)/β))",
    "symbols": "",
    "notes": "Verified against numerical integration of the density up to x.",
    "related": [
      "gumbel_pdf"
    ]
  },
  {
    "id": "gumbel_pdf",
    "title": "Gumbel (extreme value type I) distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac1\\beta\\exp\\!\\big(-(z+e^{-z})\\big),\\ z=\\frac{x-\\mu}{\\beta}",
    "plain": "f(x) = (1/β) exp(−(z + e^(−z))),  z = (x−μ)/β",
    "symbols": "",
    "notes": "Distribution of the maximum of many samples; the Gumbel-softmax trick samples from it.",
    "related": [
      "gumbel_mean"
    ]
  },
  {
    "id": "gumbel_mean",
    "title": "Gumbel (extreme value type I) distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\mu+\\beta\\gamma_E",
    "plain": "E[X] = μ + βγ  (γ ≈ 0.5772, Euler–Mascheroni)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "gumbel_variance"
    ]
  },
  {
    "id": "gumbel_variance",
    "title": "Gumbel (extreme value type I) distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{\\pi^2\\beta^2}{6}",
    "plain": "Var(X) = π²β²/6",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "gumbel_mean"
    ]
  },
  {
    "id": "half_normal_pdf",
    "title": "half-normal distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{\\sqrt2}{\\sigma\\sqrt\\pi}e^{-x^2/2\\sigma^2},\\ x\\ge0",
    "plain": "f(x) = √2/(σ√π) · e^(−x²/2σ²)",
    "symbols": "",
    "notes": "|Z| for Z ~ N(0, σ²).",
    "related": [
      "half_normal_mean"
    ]
  },
  {
    "id": "half_normal_mean",
    "title": "half-normal distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\sigma\\sqrt{\\tfrac2\\pi}",
    "plain": "E[X] = σ√(2/π)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "half_normal_variance"
    ]
  },
  {
    "id": "half_normal_variance",
    "title": "half-normal distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\sigma^2\\Big(1-\\frac2\\pi\\Big)",
    "plain": "Var(X) = σ²(1 − 2/π)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "half_normal_mean"
    ]
  },
  {
    "id": "hoeffding",
    "title": "Hoeffding's inequality",
    "field": "probability",
    "latex": "P\\big(\\bar X-\\mathbb{E}\\bar X\\ge t\\big)\\le \\exp\\!\\left(-\\frac{2nt^2}{(b-a)^2}\\right)",
    "plain": "P( X̄ − E[X̄] ≥ t ) ≤ exp( −2n t² / (b−a)² )",
    "symbols": "Xᵢ independent, in [a, b]; n samples",
    "notes": "Gives finite-sample confidence bounds for bounded variables.",
    "related": [
      "chebyshev"
    ]
  },
  {
    "id": "hypergeometric_mean",
    "title": "hypergeometric distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\frac{nK}{N}",
    "plain": "E[X] = nK/N",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "hypergeometric_variance"
    ]
  },
  {
    "id": "hypergeometric_pmf",
    "title": "hypergeometric distribution: probability mass",
    "field": "probability",
    "latex": "P(X=k)=\\frac{\\binom Kk\\binom{N-K}{n-k}}{\\binom Nn}",
    "plain": "P(X = k) = C(K,k) C(N−K, n−k) / C(N, n)",
    "symbols": "",
    "notes": "Successes when drawing n items without replacement from N containing K successes. The factor (N−n)/(N−1) is the finite-population correction.",
    "related": [
      "hypergeometric_mean"
    ]
  },
  {
    "id": "hypergeometric_variance",
    "title": "hypergeometric distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=n\\frac KN\\Big(1-\\frac KN\\Big)\\frac{N-n}{N-1}",
    "plain": "Var(X) = n (K/N)(1 − K/N)(N − n)/(N − 1)",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "hypergeometric_mean"
    ]
  },
  {
    "id": "inverse_gamma_pdf",
    "title": "inverse gamma distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{\\beta^{\\alpha}}{\\Gamma(\\alpha)}x^{-\\alpha-1}e^{-\\beta/x}",
    "plain": "f(x) = βᵅ/Γ(α) · x^(−α−1) e^(−β/x)",
    "symbols": "",
    "notes": "Conjugate prior for the variance of a normal.",
    "related": [
      "inverse_gamma_mean"
    ]
  },
  {
    "id": "inverse_gamma_mean",
    "title": "inverse gamma distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\frac{\\beta}{\\alpha-1}\\ \\ (\\alpha>1)",
    "plain": "E[X] = β/(α − 1)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "inverse_gamma_variance"
    ]
  },
  {
    "id": "inverse_gamma_variance",
    "title": "inverse gamma distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{\\beta^2}{(\\alpha-1)^2(\\alpha-2)}\\ \\ (\\alpha>2)",
    "plain": "Var(X) = β² / ((α−1)²(α−2))",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "inverse_gamma_mean"
    ]
  },
  {
    "id": "ito_lemma",
    "title": "Itô's lemma",
    "field": "probability",
    "latex": "df(t,X)=\\Big(f_t+\\mu f_x+\\tfrac12\\sigma^2f_{xx}\\Big)dt+\\sigma f_x\\,dW",
    "plain": "df = (f_t + μf_x + ½σ²f_xx)dt + σf_x dW",
    "symbols": "",
    "notes": "The extra ½σ²f_xx term is why ln S has drift μ − σ²/2 for geometric Brownian motion.",
    "related": [
      "gbm"
    ]
  },
  {
    "id": "jensen_inequality",
    "title": "Jensen's inequality",
    "field": "probability",
    "latex": "f(\\mathbb{E}[X])\\le \\mathbb{E}[f(X)]\\quad (f\\ \\text{convex})",
    "plain": "f(E[X]) ≤ E[f(X)]  for convex f",
    "symbols": "",
    "notes": "Reverses for concave f. Gives KL ≥ 0.",
    "related": [
      "kl_divergence"
    ]
  },
  {
    "id": "conditional_density",
    "title": "joint, marginal and conditional densities",
    "field": "probability",
    "latex": "f_X(x)=\\int f_{X,Y}(x,y)\\,dy,\\qquad f_{X\\mid Y}(x\\mid y)=\\frac{f_{X,Y}(x,y)}{f_Y(y)},\\qquad X\\perp Y\\iff f_{X,Y}=f_Xf_Y",
    "plain": "marginalise, divide, and independence factorises",
    "symbols": "",
    "notes": "",
    "related": [
      "bayes"
    ]
  },
  {
    "id": "laplace_cdf",
    "title": "Laplace (double exponential) distribution: cumulative distribution function",
    "field": "probability",
    "latex": "F(x)=1-\\tfrac12e^{-(x-\\mu)/b}\\quad(x\\ge\\mu)",
    "plain": "F(x) = 1 − ½ e^(−(x−μ)/b)   for x ≥ μ",
    "symbols": "",
    "notes": "Verified against numerical integration of the density up to x.",
    "related": [
      "laplace_pdf"
    ]
  },
  {
    "id": "laplace_pdf",
    "title": "Laplace (double exponential) distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{1}{2b}e^{-|x-\\mu|/b}",
    "plain": "f(x) = e^(−|x−μ|/b) / (2b)",
    "symbols": "",
    "notes": "The Bayesian reading of the L1 penalty (lasso) is a Laplace prior on the weights.",
    "related": [
      "laplace_mean"
    ]
  },
  {
    "id": "laplace_mean",
    "title": "Laplace (double exponential) distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\mu",
    "plain": "E[X] = μ",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "laplace_variance"
    ]
  },
  {
    "id": "laplace_variance",
    "title": "Laplace (double exponential) distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=2b^2",
    "plain": "Var(X) = 2b²",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "laplace_mean"
    ]
  },
  {
    "id": "law_total_expectation",
    "title": "law of iterated expectation",
    "field": "probability",
    "latex": "\\mathbb{E}[Y] = \\mathbb{E}\\big[\\mathbb{E}[Y\\mid X]\\big]",
    "plain": "E[Y] = E[ E[Y|X] ]",
    "symbols": "",
    "notes": "Also called the tower property.",
    "related": [
      "expectation",
      "total_variance"
    ]
  },
  {
    "id": "total_probability",
    "title": "law of total probability",
    "field": "probability",
    "latex": "P(B) = \\sum_i P(B\\mid A_i)\\,P(A_i)",
    "plain": "P(B) = Σᵢ P(B|Aᵢ)·P(Aᵢ)",
    "symbols": "A₁…Aₙ partition the sample space",
    "notes": "",
    "related": [
      "bayes"
    ]
  },
  {
    "id": "total_variance",
    "title": "law of total variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(Y) = \\mathbb{E}[\\operatorname{Var}(Y\\mid X)] + \\operatorname{Var}(\\mathbb{E}[Y\\mid X])",
    "plain": "Var(Y) = E[Var(Y|X)] + Var(E[Y|X])",
    "symbols": "",
    "notes": "Within-group variance plus between-group variance.",
    "related": [
      "variance"
    ]
  },
  {
    "id": "lognormal_cdf",
    "title": "log-normal distribution: cumulative distribution function",
    "field": "probability",
    "latex": "F(x)=\\tfrac12\\Big[1+\\operatorname{erf}\\!\\Big(\\frac{\\ln x-\\mu}{\\sigma\\sqrt2}\\Big)\\Big]",
    "plain": "F(x) = ½[1 + erf((ln x − μ)/(σ√2))]",
    "symbols": "",
    "notes": "Verified against numerical integration of the density up to x.",
    "related": [
      "lognormal_pdf"
    ]
  },
  {
    "id": "lognormal_pdf",
    "title": "log-normal distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{1}{x\\sigma\\sqrt{2\\pi}}\\exp\\!\\Big(-\\frac{(\\ln x-\\mu)^2}{2\\sigma^2}\\Big),\\ x>0",
    "plain": "f(x) = exp(−(ln x − μ)²/2σ²) / (xσ√2π)",
    "symbols": "",
    "notes": "X is log-normal if ln X is normal. Models positive, multiplicative quantities.",
    "related": [
      "lognormal_mean"
    ]
  },
  {
    "id": "lognormal_mean",
    "title": "log-normal distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=e^{\\mu+\\sigma^2/2}",
    "plain": "E[X] = exp(μ + σ²/2)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "lognormal_variance"
    ]
  },
  {
    "id": "lognormal_variance",
    "title": "log-normal distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\big(e^{\\sigma^2}-1\\big)e^{2\\mu+\\sigma^2}",
    "plain": "Var(X) = (e^σ² − 1) e^(2μ+σ²)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "lognormal_mean"
    ]
  },
  {
    "id": "logistic_cdf",
    "title": "logistic distribution: cumulative distribution function",
    "field": "probability",
    "latex": "F(x)=\\frac{1}{1+e^{-(x-\\mu)/s}}",
    "plain": "F(x) = 1/(1 + e^(−(x−μ)/s))",
    "symbols": "",
    "notes": "Verified against numerical integration of the density up to x.",
    "related": [
      "logistic_pdf"
    ]
  },
  {
    "id": "logistic_pdf",
    "title": "logistic distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{e^{-(x-\\mu)/s}}{s\\big(1+e^{-(x-\\mu)/s}\\big)^2}",
    "plain": "f(x) = e^(−z) / (s(1 + e^(−z))²),  z = (x−μ)/s",
    "symbols": "",
    "notes": "Its cdf is the sigmoid, which is why logistic regression uses it.",
    "related": [
      "logistic_mean"
    ]
  },
  {
    "id": "logistic_mean",
    "title": "logistic distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\mu",
    "plain": "E[X] = μ",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "logistic_variance"
    ]
  },
  {
    "id": "logistic_variance",
    "title": "logistic distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{s^2\\pi^2}{3}",
    "plain": "Var(X) = s²π²/3",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "logistic_mean"
    ]
  },
  {
    "id": "lyapunov_inequality",
    "title": "Lyapunov's moment inequality",
    "field": "probability",
    "latex": "\\big(\\mathbb E|X|^r\\big)^{1/r}\\le\\big(\\mathbb E|X|^s\\big)^{1/s}\\quad(0<r<s)",
    "plain": "(E|X|ʳ)^(1/r) ≤ (E|X|ˢ)^(1/s)",
    "symbols": "",
    "notes": "Higher moments dominate: E|X| ≤ √(E X²).",
    "related": [
      "jensen_inequality"
    ]
  },
  {
    "id": "markov_inequality",
    "title": "Markov's inequality",
    "field": "probability",
    "latex": "P(X\\ge a)\\le \\frac{\\mathbb{E}[X]}{a}\\quad (X\\ge0,\\ a>0)",
    "plain": "P(X ≥ a) ≤ E[X] / a",
    "symbols": "",
    "notes": "Loose, but needs only the mean.",
    "related": [
      "chebyshev",
      "hoeffding"
    ]
  },
  {
    "id": "maxwell_pdf",
    "title": "Maxwell–Boltzmann distribution: density",
    "field": "probability",
    "latex": "f(x)=\\sqrt{\\tfrac2\\pi}\\,\\frac{x^2e^{-x^2/2a^2}}{a^3}",
    "plain": "f(x) = √(2/π) x² e^(−x²/2a²) / a³",
    "symbols": "",
    "notes": "The speed of a particle whose three velocity components are independent N(0, a²).",
    "related": [
      "maxwell_mean"
    ]
  },
  {
    "id": "maxwell_mean",
    "title": "Maxwell–Boltzmann distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=2a\\sqrt{\\tfrac2\\pi}",
    "plain": "E[X] = 2a√(2/π)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "maxwell_variance"
    ]
  },
  {
    "id": "maxwell_variance",
    "title": "Maxwell–Boltzmann distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{a^2(3\\pi-8)}{\\pi}",
    "plain": "Var(X) = a²(3π − 8)/π",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "maxwell_mean"
    ]
  },
  {
    "id": "mgf_moments",
    "title": "moments from the moment generating function",
    "field": "probability",
    "latex": "\\mathbb E[X^n]=M_X^{(n)}(0)=\\frac{d^n}{dt^n}M_X(t)\\Big|_{t=0}",
    "plain": "E[Xⁿ] = M⁽ⁿ⁾(0)",
    "symbols": "",
    "notes": "Differentiate the MGF n times and set t = 0.",
    "related": [
      "normal_mgf",
      "cumulant_generating"
    ]
  },
  {
    "id": "multinomial_pmf",
    "title": "multinomial distribution",
    "field": "probability",
    "latex": "P(\\mathbf x)=\\frac{n!}{\\prod_k x_k!}\\prod_k p_k^{x_k}",
    "plain": "P(x) = n!/(Π xₖ!) · Π pₖ^(xₖ)",
    "symbols": "",
    "notes": "Mean npₖ, variance npₖ(1−pₖ), covariance −npᵢpⱼ.",
    "related": [
      "binomial",
      "dirichlet_pdf",
      "categorical"
    ]
  },
  {
    "id": "mvn_pdf",
    "title": "multivariate normal density",
    "field": "probability",
    "latex": "f(\\mathbf{x}) = (2\\pi)^{-k/2}\\,|\\Sigma|^{-1/2}\\exp\\!\\left(-\\tfrac12(\\mathbf{x}-\\boldsymbol\\mu)^{\\top}\\Sigma^{-1}(\\mathbf{x}-\\boldsymbol\\mu)\\right)",
    "plain": "f(x) = (2π)^(−k/2) |Σ|^(−1/2) exp( −½ (x−μ)ᵀ Σ⁻¹ (x−μ) )",
    "symbols": "k = dimension, μ = mean vector, Σ = covariance matrix (positive definite)",
    "notes": "",
    "related": [
      "gaussian_pdf"
    ]
  },
  {
    "id": "mvn_conditional",
    "title": "multivariate normal: conditional distribution",
    "field": "probability",
    "latex": "\\boldsymbol\\mu_{1|2}=\\boldsymbol\\mu_1+\\Sigma_{12}\\Sigma_{22}^{-1}(\\mathbf x_2-\\boldsymbol\\mu_2),\\quad \\Sigma_{1|2}=\\Sigma_{11}-\\Sigma_{12}\\Sigma_{22}^{-1}\\Sigma_{21}",
    "plain": "μ₁|₂ = μ₁ + Σ₁₂ Σ₂₂⁻¹ (x₂ − μ₂);  Σ₁|₂ = Σ₁₁ − Σ₁₂ Σ₂₂⁻¹ Σ₂₁",
    "symbols": "",
    "notes": "Conditioning a Gaussian gives a Gaussian whose covariance does not depend on the observed value. The basis of Gaussian processes and Kalman filters.",
    "related": [
      "mvn_pdf",
      "gp_posterior"
    ]
  },
  {
    "id": "mvn_marginal",
    "title": "multivariate normal: marginal and linear maps",
    "field": "probability",
    "latex": "\\mathbf x\\sim\\mathcal N(\\boldsymbol\\mu,\\Sigma)\\ \\Rightarrow\\ A\\mathbf x+\\mathbf b\\sim\\mathcal N\\big(A\\boldsymbol\\mu+\\mathbf b,\\ A\\Sigma A^{\\top}\\big)",
    "plain": "x ~ N(μ, Σ)  ⇒  Ax + b ~ N(Aμ + b, AΣAᵀ)",
    "symbols": "",
    "notes": "Marginals are sub-vectors of μ and sub-blocks of Σ.",
    "related": [
      "mvn_conditional"
    ]
  },
  {
    "id": "negative_binomial_mean",
    "title": "negative binomial distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\frac{r(1-p)}{p}",
    "plain": "E[X] = r(1 − p)/p",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "negative_binomial_variance"
    ]
  },
  {
    "id": "negative_binomial_pmf",
    "title": "negative binomial distribution: probability mass",
    "field": "probability",
    "latex": "P(X=k)=\\binom{k+r-1}{k}(1-p)^k p^r",
    "plain": "P(X = k) = C(k+r−1, k) (1−p)ᵏ pʳ",
    "symbols": "",
    "notes": "The number of failures before the r-th success. A gamma–Poisson mixture, so it models overdispersed counts.",
    "related": [
      "negative_binomial_mean"
    ]
  },
  {
    "id": "negative_binomial_variance",
    "title": "negative binomial distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{r(1-p)}{p^2}",
    "plain": "Var(X) = r(1 − p)/p²",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "negative_binomial_mean"
    ]
  },
  {
    "id": "gaussian_pdf",
    "title": "normal (Gaussian) density",
    "field": "probability",
    "latex": "f(x) = \\frac{1}{\\sigma\\sqrt{2\\pi}}\\exp\\!\\left(-\\frac{(x-\\mu)^2}{2\\sigma^2}\\right)",
    "plain": "f(x) = 1/(σ√2π) · exp( −(x−μ)² / 2σ² )",
    "symbols": "μ = mean, σ = standard deviation",
    "notes": "Maximum entropy distribution for a given mean and variance.",
    "related": [
      "mvn_pdf",
      "normal_cdf",
      "gaussian_entropy"
    ]
  },
  {
    "id": "normal_approx_binomial",
    "title": "normal approximation of the binomial",
    "field": "probability",
    "latex": "\\operatorname{Bin}(n,p)\\approx\\mathcal N\\big(np,\\ np(1-p)\\big),\\qquad P(X\\le k)\\approx\\Phi\\!\\Big(\\frac{k+\\frac12-np}{\\sqrt{np(1-p)}}\\Big)",
    "plain": "P(X ≤ k) ≈ Φ((k + ½ − np)/√(np(1−p)))",
    "symbols": "",
    "notes": "The ½ is the continuity correction. Use when np and n(1−p) are both at least 10.",
    "related": [
      "binomial_mean",
      "normal_cdf"
    ]
  },
  {
    "id": "normal_cdf",
    "title": "normal cumulative distribution",
    "field": "probability",
    "latex": "\\Phi(x) = \\tfrac12\\left[1+\\operatorname{erf}\\!\\left(\\frac{x}{\\sqrt2}\\right)\\right]",
    "plain": "Φ(x) = ½ [ 1 + erf(x/√2) ]",
    "symbols": "",
    "notes": "Φ(1.96) ≈ 0.975, the source of the 95% interval.",
    "related": [
      "gaussian_pdf",
      "z_score"
    ]
  },
  {
    "id": "normal_characteristic_function",
    "title": "normal distribution: characteristic function",
    "field": "probability",
    "latex": "\\varphi_X(t)=\\mathbb E[e^{itX}]=\\exp\\!\\big(i\\mu t-\\tfrac12\\sigma^2t^2\\big)",
    "plain": "φ(t) = exp(iμt − σ²t²/2)",
    "symbols": "",
    "notes": "The characteristic function always exists, even for the Cauchy.",
    "related": [
      "normal_mgf"
    ]
  },
  {
    "id": "normal_mean",
    "title": "normal distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\mu",
    "plain": "E[X] = μ",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "normal_variance"
    ]
  },
  {
    "id": "normal_mgf",
    "title": "normal distribution: moment generating function",
    "field": "probability",
    "latex": "M_X(t)=\\mathbb E[e^{tX}]=\\exp\\!\\big(\\mu t+\\tfrac12\\sigma^2t^2\\big)",
    "plain": "M(t) = exp(μt + σ²t²/2)",
    "symbols": "",
    "notes": "Derivatives at 0 give the moments.",
    "related": [
      "normal_mean"
    ]
  },
  {
    "id": "normal_variance",
    "title": "normal distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\sigma^2",
    "plain": "Var(X) = σ²",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "normal_mean"
    ]
  },
  {
    "id": "ou_process",
    "title": "Ornstein–Uhlenbeck process",
    "field": "probability",
    "latex": "dX=\\theta(\\mu-X)\\,dt+\\sigma\\,dW,\\quad \\mathbb E X_t=\\mu+(x_0-\\mu)e^{-\\theta t},\\quad \\operatorname{Var}(X_\\infty)=\\frac{\\sigma^2}{2\\theta}",
    "plain": "mean-reverting;  stationary variance σ²/(2θ)",
    "symbols": "",
    "notes": "The continuous-time AR(1); also the forward process of the variance-preserving diffusion model.",
    "related": [
      "ar1",
      "brownian_motion"
    ]
  },
  {
    "id": "pareto_cdf",
    "title": "Pareto (type I) distribution: cumulative distribution function",
    "field": "probability",
    "latex": "F(x)=1-\\Big(\\frac{x_m}{x}\\Big)^{\\alpha}",
    "plain": "F(x) = 1 − (x_m/x)ᵅ",
    "symbols": "",
    "notes": "Verified against numerical integration of the density up to x.",
    "related": [
      "pareto_pdf"
    ]
  },
  {
    "id": "pareto_pdf",
    "title": "Pareto (type I) distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{\\alpha x_m^{\\alpha}}{x^{\\alpha+1}},\\ x\\ge x_m",
    "plain": "f(x) = α x_mᵅ / x^(α+1)   for x ≥ x_m",
    "symbols": "",
    "notes": "Heavy-tailed power law: the 80/20 rule.",
    "related": [
      "pareto_mean"
    ]
  },
  {
    "id": "pareto_mean",
    "title": "Pareto (type I) distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\frac{\\alpha x_m}{\\alpha-1}\\ \\ (\\alpha>1)",
    "plain": "E[X] = α x_m/(α − 1)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "pareto_variance"
    ]
  },
  {
    "id": "pareto_variance",
    "title": "Pareto (type I) distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{x_m^2\\alpha}{(\\alpha-1)^2(\\alpha-2)}\\ \\ (\\alpha>2)",
    "plain": "Var(X) = x_m² α / ((α−1)²(α−2))",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "pareto_mean"
    ]
  },
  {
    "id": "pareto_principle",
    "title": "Pareto principle (top share)",
    "field": "probability",
    "latex": "\\text{share of the total held by the top fraction }p=p^{\\,1-1/\\alpha}",
    "plain": "top p of the population holds p^(1 − 1/α) of the total",
    "symbols": "",
    "notes": "α ≈ 1.16 gives the 80/20 rule.",
    "related": [
      "pareto_pdf",
      "gini_coefficient"
    ]
  },
  {
    "id": "poisson_approx_binomial",
    "title": "Poisson approximation of the binomial",
    "field": "probability",
    "latex": "\\binom nk p^k(1-p)^{n-k}\\ \\approx\\ \\frac{(np)^ke^{-np}}{k!}\\quad(n\\text{ large},\\ p\\text{ small})",
    "plain": "Bin(n, p) ≈ Poisson(np)",
    "symbols": "",
    "notes": "Good when n ≥ 20 and p ≤ 0.05.",
    "related": [
      "binomial",
      "poisson"
    ]
  },
  {
    "id": "poisson",
    "title": "Poisson distribution",
    "field": "probability",
    "latex": "P(X=k) = \\frac{\\lambda^{k}e^{-\\lambda}}{k!}",
    "plain": "P(X = k) = λᵏ e^(−λ) / k!",
    "symbols": "λ = rate (the mean and the variance)",
    "notes": "Limit of Binomial(n, λ/n) as n → ∞.",
    "related": [
      "binomial",
      "exponential"
    ]
  },
  {
    "id": "poisson_mean",
    "title": "Poisson distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\lambda",
    "plain": "E[X] = λ",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "poisson_variance"
    ]
  },
  {
    "id": "poisson_mgf",
    "title": "Poisson distribution: moment generating function",
    "field": "probability",
    "latex": "M_X(t)=\\exp\\!\\big(\\lambda(e^{t}-1)\\big)",
    "plain": "M(t) = exp(λ(eᵗ − 1))",
    "symbols": "",
    "notes": "",
    "related": [
      "poisson_mean"
    ]
  },
  {
    "id": "poisson_variance",
    "title": "Poisson distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\lambda",
    "plain": "Var(X) = λ",
    "symbols": "",
    "notes": "Verified against summation of the mass function.",
    "related": [
      "poisson_mean"
    ]
  },
  {
    "id": "poisson_process",
    "title": "Poisson process",
    "field": "probability",
    "latex": "N_t\\sim\\mathrm{Poisson}(\\lambda t),\\qquad T_i\\sim\\mathrm{Exp}(\\lambda)\\ \\text{(inter-arrival times)},\\qquad \\mathbb E[T_i]=\\frac1\\lambda",
    "plain": "N_t ~ Poisson(λt);  waiting times ~ Exp(λ)",
    "symbols": "",
    "notes": "",
    "related": [
      "poisson",
      "exponential"
    ]
  },
  {
    "id": "rayleigh_cdf",
    "title": "Rayleigh distribution: cumulative distribution function",
    "field": "probability",
    "latex": "F(x)=1-e^{-x^2/2\\sigma^2}",
    "plain": "F(x) = 1 − e^(−x²/2σ²)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density up to x.",
    "related": [
      "rayleigh_pdf"
    ]
  },
  {
    "id": "rayleigh_pdf",
    "title": "Rayleigh distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{x}{\\sigma^2}e^{-x^2/2\\sigma^2},\\ x\\ge0",
    "plain": "f(x) = (x/σ²) e^(−x²/2σ²)",
    "symbols": "",
    "notes": "The length of a 2-D vector with independent N(0, σ²) components.",
    "related": [
      "rayleigh_mean"
    ]
  },
  {
    "id": "rayleigh_mean",
    "title": "Rayleigh distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\sigma\\sqrt{\\tfrac\\pi2}",
    "plain": "E[X] = σ√(π/2)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "rayleigh_variance"
    ]
  },
  {
    "id": "rayleigh_variance",
    "title": "Rayleigh distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{4-\\pi}{2}\\sigma^2",
    "plain": "Var(X) = (4 − π)σ²/2",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "rayleigh_mean"
    ]
  },
  {
    "id": "renewal_theorem",
    "title": "renewal theorem",
    "field": "probability",
    "latex": "\\frac{N(t)}t\\to\\frac1\\mu\\ \\text{a.s.},\\qquad \\mathbb E[N(t)]\\approx\\frac t\\mu",
    "plain": "renewals per unit time → 1/μ",
    "symbols": "μ = mean inter-renewal time",
    "notes": "",
    "related": [
      "poisson_process"
    ]
  },
  {
    "id": "sampling_distributions",
    "title": "sampling distributions from normal data",
    "field": "probability",
    "latex": "\\bar X\\sim\\mathcal N\\Big(\\mu,\\frac{\\sigma^2}n\\Big),\\quad \\frac{(n-1)s^2}{\\sigma^2}\\sim\\chi^2_{n-1},\\quad \\frac{\\bar X-\\mu}{s/\\sqrt n}\\sim t_{n-1},\\quad \\frac{s_1^2/\\sigma_1^2}{s_2^2/\\sigma_2^2}\\sim F_{n_1-1,n_2-1}",
    "plain": "x̄ ~ N(μ, σ²/n);  (n − 1)s²/σ² ~ χ²ₙ₋₁;  t and F ratios",
    "symbols": "",
    "notes": "",
    "related": [
      "chi_square_mean",
      "student_t_pdf",
      "f_dist_pdf"
    ]
  },
  {
    "id": "mixing_time",
    "title": "spectral gap and mixing time",
    "field": "probability",
    "latex": "t_{\\text{mix}}(\\varepsilon)\\le\\frac1{\\gamma}\\ln\\frac1{\\varepsilon\\,\\pi_{\\min}},\\qquad \\gamma=1-\\lambda_2",
    "plain": "t_mix ≤ (1/γ) ln(1/(ε π_min))",
    "symbols": "γ = spectral gap",
    "notes": "A larger gap means faster convergence to the stationary distribution.",
    "related": [
      "markov_stationary",
      "gelman_rubin"
    ]
  },
  {
    "id": "student_t_pdf",
    "title": "Student's t distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac{\\Gamma\\!\\big(\\frac{\\nu+1}{2}\\big)}{\\sqrt{\\nu\\pi}\\,\\Gamma\\!\\big(\\frac\\nu2\\big)}\\Big(1+\\frac{x^2}{\\nu}\\Big)^{-\\frac{\\nu+1}{2}}",
    "plain": "f(x) = Γ((ν+1)/2) / (√(νπ) Γ(ν/2)) · (1 + x²/ν)^(−(ν+1)/2)",
    "symbols": "",
    "notes": "Heavier tails than the normal; tends to the normal as ν grows. Used for small-sample inference.",
    "related": [
      "student_t_mean"
    ]
  },
  {
    "id": "student_t_mean",
    "title": "Student's t distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=0\\ \\ (\\nu>1)",
    "plain": "E[X] = 0  (ν > 1)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "student_t_variance"
    ]
  },
  {
    "id": "student_t_variance",
    "title": "Student's t distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{\\nu}{\\nu-2}\\ \\ (\\nu>2)",
    "plain": "Var(X) = ν/(ν−2)  (ν > 2)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "student_t_mean"
    ]
  },
  {
    "id": "normal_sum",
    "title": "sum of independent normals",
    "field": "probability",
    "latex": "X_i\\sim\\mathcal N(\\mu_i,\\sigma_i^2)\\ \\Rightarrow\\ \\sum_i a_iX_i\\sim\\mathcal N\\Big(\\sum_i a_i\\mu_i,\\ \\sum_i a_i^2\\sigma_i^2\\Big)",
    "plain": "Σ aᵢXᵢ ~ N(Σ aᵢμᵢ, Σ aᵢ²σᵢ²)",
    "symbols": "",
    "notes": "Variances add, standard deviations do not.",
    "related": [
      "gaussian_pdf"
    ]
  },
  {
    "id": "triangular_pdf",
    "title": "triangular distribution: density",
    "field": "probability",
    "latex": "f(x)=\\begin{cases}\\frac{2(x-a)}{(b-a)(c-a)}&a\\le x<c\\\\[2pt]\\frac{2(b-x)}{(b-a)(b-c)}&c\\le x\\le b\\end{cases}",
    "plain": "f(x) = 2(x−a)/((b−a)(c−a)) for x < c;  2(b−x)/((b−a)(b−c)) for x ≥ c",
    "symbols": "",
    "notes": "Min a, max b, mode c: a quick model when only those three are known.",
    "related": [
      "triangular_mean"
    ]
  },
  {
    "id": "triangular_mean",
    "title": "triangular distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\frac{a+b+c}{3}",
    "plain": "E[X] = (a + b + c)/3",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "triangular_variance"
    ]
  },
  {
    "id": "triangular_variance",
    "title": "triangular distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\frac{a^2+b^2+c^2-ab-ac-bc}{18}",
    "plain": "Var(X) = (a²+b²+c²−ab−ac−bc)/18",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "triangular_mean"
    ]
  },
  {
    "id": "uniform_mgf",
    "title": "uniform distribution: moment generating function",
    "field": "probability",
    "latex": "M_X(t)=\\frac{e^{tb}-e^{ta}}{t\\,(b-a)}\\quad(t\\ne0)",
    "plain": "M(t) = (e^(tb) − e^(ta)) / (t(b − a))",
    "symbols": "",
    "notes": "",
    "related": [
      "uniform_mean"
    ]
  },
  {
    "id": "union_bound",
    "title": "union bound and Bonferroni inequalities",
    "field": "probability",
    "latex": "P\\Big(\\bigcup_iA_i\\Big)\\le\\sum_iP(A_i),\\qquad \\sum_iP(A_i)-\\sum_{i<j}P(A_i\\cap A_j)\\le P\\Big(\\bigcup_iA_i\\Big)",
    "plain": "P(∪Aᵢ) ≤ ΣP(Aᵢ)",
    "symbols": "",
    "notes": "The workhorse of learning-theory proofs.",
    "related": [
      "inclusion_exclusion",
      "generalization_finite"
    ]
  },
  {
    "id": "variance",
    "title": "variance and standard deviation",
    "field": "probability",
    "latex": "\\operatorname{Var}(X) = \\mathbb{E}[X^2] - \\mathbb{E}[X]^2 \\qquad \\sigma = \\sqrt{\\operatorname{Var}(X)}",
    "plain": "Var(X) = E[X²] − E[X]²        σ = √Var(X)",
    "symbols": "σ = standard deviation",
    "notes": "Var(aX + b) = a² Var(X). Variances of independent variables add.",
    "related": [
      "expectation",
      "covariance",
      "sample_variance"
    ]
  },
  {
    "id": "variance_of_sum",
    "title": "variance of a sum",
    "field": "probability",
    "latex": "\\operatorname{Var}(aX+bY)=a^2\\operatorname{Var}X+b^2\\operatorname{Var}Y+2ab\\operatorname{Cov}(X,Y),\\qquad \\operatorname{Var}\\Big(\\sum_iX_i\\Big)=\\sum_i\\operatorname{Var}X_i\\ \\text{(independent)}",
    "plain": "Var(aX + bY) = a²Var X + b²Var Y + 2ab Cov(X, Y)",
    "symbols": "",
    "notes": "",
    "related": [
      "covariance",
      "variance"
    ]
  },
  {
    "id": "wald_identity",
    "title": "Wald's identity",
    "field": "probability",
    "latex": "\\mathbb E\\Big[\\sum_{i=1}^{N}X_i\\Big]=\\mathbb E[N]\\,\\mathbb E[X]",
    "plain": "E[S_N] = E[N]·E[X]",
    "symbols": "N a stopping time",
    "notes": "",
    "related": [
      "compound_poisson"
    ]
  },
  {
    "id": "weibull_cdf",
    "title": "Weibull distribution: cumulative distribution function",
    "field": "probability",
    "latex": "F(x)=1-e^{-(x/\\lambda)^k}",
    "plain": "F(x) = 1 − e^(−(x/λ)ᵏ)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density up to x.",
    "related": [
      "weibull_pdf"
    ]
  },
  {
    "id": "weibull_pdf",
    "title": "Weibull distribution: density",
    "field": "probability",
    "latex": "f(x)=\\frac k\\lambda\\Big(\\frac x\\lambda\\Big)^{k-1}e^{-(x/\\lambda)^k}",
    "plain": "f(x) = (k/λ)(x/λ)^(k−1) e^(−(x/λ)ᵏ)",
    "symbols": "",
    "notes": "Failure times; k < 1 decreasing hazard, k > 1 increasing hazard, k = 1 exponential.",
    "related": [
      "weibull_mean"
    ]
  },
  {
    "id": "weibull_mean",
    "title": "Weibull distribution: mean",
    "field": "probability",
    "latex": "\\mathbb E[X]=\\lambda\\,\\Gamma\\!\\big(1+\\tfrac1k\\big)",
    "plain": "E[X] = λ Γ(1 + 1/k)",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "weibull_variance"
    ]
  },
  {
    "id": "weibull_variance",
    "title": "Weibull distribution: variance",
    "field": "probability",
    "latex": "\\operatorname{Var}(X)=\\lambda^2\\Big[\\Gamma\\!\\big(1+\\tfrac2k\\big)-\\Gamma\\!\\big(1+\\tfrac1k\\big)^2\\Big]",
    "plain": "Var(X) = λ²[Γ(1 + 2/k) − Γ(1 + 1/k)²]",
    "symbols": "",
    "notes": "Verified against numerical integration of the density.",
    "related": [
      "weibull_mean"
    ]
  },
  {
    "id": "zipf_law",
    "title": "Zipf's law",
    "field": "probability",
    "latex": "f(k)=\\frac{k^{-s}}{\\sum_{n=1}^{N}n^{-s}},\\qquad f(k)\\propto\\frac1{k^{s}}",
    "plain": "frequency of the k-th most common item ∝ 1/k^s",
    "symbols": "",
    "notes": "Word frequencies follow it with s ≈ 1.",
    "related": [
      "pareto_pdf"
    ]
  },
  {
    "id": "laplace_smoothing",
    "title": "additive (Laplace) smoothing",
    "field": "statistics",
    "latex": "\\hat p_k=\\frac{c_k+\\alpha}{N+\\alpha K}",
    "plain": "p̂ₖ = (cₖ + α)/(N + αK)",
    "symbols": "α = 1 is Laplace's rule of succession",
    "notes": "Avoids zero probabilities for unseen events (naive Bayes, n-gram models).",
    "related": [
      "dirichlet_multinomial_update"
    ]
  },
  {
    "id": "aic",
    "title": "Akaike information criterion",
    "field": "statistics",
    "latex": "\\mathrm{AIC}=2k-2\\ln\\hat L",
    "plain": "AIC = 2k − 2 ln L̂",
    "symbols": "k = parameters, L̂ = maximised likelihood",
    "notes": "Lower is better.",
    "related": [
      "bic"
    ]
  },
  {
    "id": "ar1",
    "title": "AR(1) process",
    "field": "statistics",
    "latex": "x_t=\\phi x_{t-1}+\\varepsilon_t,\\quad \\operatorname{Var}(x_t)=\\frac{\\sigma^2}{1-\\phi^2},\\quad \\rho_k=\\phi^k\\quad(|\\phi|<1)",
    "plain": "xₜ = φxₜ₋₁ + εₜ;  Var = σ²/(1 − φ²);  ρₖ = φᵏ",
    "symbols": "",
    "notes": "Stationary only if |φ| < 1; φ = 1 is a random walk.",
    "related": [
      "random_walk",
      "yule_walker"
    ]
  },
  {
    "id": "arch1",
    "title": "ARCH(1) and GARCH(1,1) variance",
    "field": "statistics",
    "latex": "\\sigma_t^2=\\omega+\\alpha\\varepsilon_{t-1}^2+\\beta\\sigma_{t-1}^2",
    "plain": "σₜ² = ω + αεₜ₋₁² + βσₜ₋₁²",
    "symbols": "β = 0 gives ARCH(1)",
    "notes": "Stationary variance ω/(1 − α − β).",
    "related": [
      "ewma_volatility"
    ]
  },
  {
    "id": "autocorrelation",
    "title": "autocorrelation function",
    "field": "statistics",
    "latex": "\\hat\\rho_k=\\frac{\\sum_{t=1}^{n-k}(x_t-\\bar x)(x_{t+k}-\\bar x)}{\\sum_{t=1}^{n}(x_t-\\bar x)^2}",
    "plain": "ρ̂ₖ = Σ (xₜ − x̄)(xₜ₊ₖ − x̄) / Σ (xₜ − x̄)²",
    "symbols": "k = lag",
    "notes": "",
    "related": [
      "durbin_watson",
      "ljung_box"
    ]
  },
  {
    "id": "ate",
    "title": "average treatment effect",
    "field": "statistics",
    "latex": "\\mathrm{ATE}=\\mathbb E[Y(1)-Y(0)]=\\mathbb E[Y\\mid T=1]-\\mathbb E[Y\\mid T=0]\\ \\ (\\text{randomised})",
    "plain": "ATE = E[Y(1) − Y(0)];  difference in means when T is randomised",
    "symbols": "",
    "notes": "Without randomisation, confounding makes the difference in means biased.",
    "related": [
      "ipw_ate",
      "backdoor_adjustment"
    ]
  },
  {
    "id": "backdoor_adjustment",
    "title": "backdoor adjustment",
    "field": "statistics",
    "latex": "P\\big(y\\mid\\operatorname{do}(x)\\big)=\\sum_zP(y\\mid x,z)\\,P(z)",
    "plain": "P(y | do(x)) = Σ_z P(y | x, z) P(z)",
    "symbols": "Z blocks all backdoor paths from X to Y",
    "notes": "Pearl's adjustment formula; conditioning on a collider or mediator would break it.",
    "related": [
      "ate",
      "bayes"
    ]
  },
  {
    "id": "bayes_factor",
    "title": "Bayes factor and posterior odds",
    "field": "statistics",
    "latex": "\\mathrm{BF}_{10}=\\frac{p(D\\mid H_1)}{p(D\\mid H_0)},\\qquad \\frac{P(H_1\\mid D)}{P(H_0\\mid D)}=\\mathrm{BF}_{10}\\cdot\\frac{P(H_1)}{P(H_0)}",
    "plain": "posterior odds = Bayes factor × prior odds",
    "symbols": "",
    "notes": "Above 10 is usually called strong evidence for H₁.",
    "related": [
      "bayes"
    ]
  },
  {
    "id": "bayesian_ab",
    "title": "Bayesian A/B test",
    "field": "statistics",
    "latex": "p_A\\sim\\mathrm{Beta}(1+s_A,1+f_A),\\quad P(p_B>p_A)\\approx\\frac1M\\sum_m\\mathbf 1\\big[p_B^{(m)}>p_A^{(m)}\\big]",
    "plain": "compare posterior samples of each arm's conversion rate",
    "symbols": "",
    "notes": "",
    "related": [
      "beta_binomial_update"
    ]
  },
  {
    "id": "bic",
    "title": "Bayesian information criterion",
    "field": "statistics",
    "latex": "\\mathrm{BIC}=k\\ln n-2\\ln\\hat L",
    "plain": "BIC = k ln n − 2 ln L̂",
    "symbols": "n = number of observations",
    "notes": "Penalises complexity more than AIC when n > 7.",
    "related": [
      "aic"
    ]
  },
  {
    "id": "benjamini_hochberg",
    "title": "Benjamini–Hochberg (false discovery rate)",
    "field": "statistics",
    "latex": "\\text{reject all } p_{(i)}\\text{ with } i\\le k,\\quad k=\\max\\Big\\{i:\\ p_{(i)}\\le\\frac{i}{m}q\\Big\\}",
    "plain": "k = max{i : p₍ᵢ₎ ≤ (i/m)q}; reject the k smallest",
    "symbols": "q = target false discovery rate",
    "notes": "Controls the expected share of false discoveries, not the chance of any.",
    "related": [
      "holm",
      "bonferroni"
    ]
  },
  {
    "id": "bernstein_inequality",
    "title": "Bernstein's inequality",
    "field": "statistics",
    "latex": "P\\Big(\\sum_i(X_i-\\mathbb E X_i)\\ge t\\Big)\\le\\exp\\!\\Big(-\\frac{t^2/2}{\\sum_i\\operatorname{Var}(X_i)+Mt/3}\\Big)",
    "plain": "P(Σ(Xᵢ − EXᵢ) ≥ t) ≤ exp(−(t²/2)/(ΣVar + Mt/3))",
    "symbols": "|Xᵢ − EXᵢ| ≤ M",
    "notes": "Tighter than Hoeffding when the variance is small.",
    "related": [
      "hoeffding"
    ]
  },
  {
    "id": "berry_esseen",
    "title": "Berry–Esseen bound",
    "field": "statistics",
    "latex": "\\sup_x\\big|F_n(x)-\\Phi(x)\\big|\\le\\frac{C\\,\\rho}{\\sigma^3\\sqrt n},\\quad \\rho=\\mathbb E|X-\\mu|^3,\\ C\\le0.4748",
    "plain": "sup|Fₙ − Φ| ≤ Cρ/(σ³√n)",
    "symbols": "",
    "notes": "A quantitative CLT: the normal approximation error shrinks like 1/√n.",
    "related": [
      "clt_standardised_mean"
    ]
  },
  {
    "id": "beta_binomial_update",
    "title": "Beta–binomial conjugate update",
    "field": "statistics",
    "latex": "\\theta\\sim\\mathrm{Beta}(\\alpha,\\beta),\\ x\\text{ successes in }n\\ \\Rightarrow\\ \\theta\\mid x\\sim\\mathrm{Beta}(\\alpha+x,\\ \\beta+n-x)",
    "plain": "posterior = Beta(α + x, β + n − x)",
    "symbols": "",
    "notes": "Posterior mean (α + x)/(α + β + n): a weighted average of prior mean and sample proportion.",
    "related": [
      "beta_mean",
      "map_estimate",
      "laplace_smoothing"
    ]
  },
  {
    "id": "estimator_mse",
    "title": "bias, variance and MSE of an estimator",
    "field": "statistics",
    "latex": "\\operatorname{Bias}(\\hat\\theta)=\\mathbb E\\hat\\theta-\\theta,\\qquad \\mathrm{MSE}(\\hat\\theta)=\\operatorname{Var}(\\hat\\theta)+\\operatorname{Bias}(\\hat\\theta)^2",
    "plain": "MSE = Var + Bias²",
    "symbols": "",
    "notes": "A little bias can buy a lot of variance reduction (ridge, James–Stein).",
    "related": [
      "bias_variance",
      "james_stein"
    ]
  },
  {
    "id": "bias_variance",
    "title": "bias–variance decomposition",
    "field": "statistics",
    "latex": "\\mathbb{E}\\big[(y-\\hat f(x))^2\\big]=\\operatorname{Bias}[\\hat f]^2+\\operatorname{Var}[\\hat f]+\\sigma^2",
    "plain": "E[(y − f̂)²] = Bias² + Variance + σ²",
    "symbols": "σ² = irreducible noise",
    "notes": "Flexible models trade bias for variance.",
    "related": [
      "mse"
    ]
  },
  {
    "id": "bland_altman",
    "title": "Bland–Altman limits of agreement",
    "field": "statistics",
    "latex": "\\bar d\\pm1.96\\,s_d",
    "plain": "d̄ ± 1.96 s_d",
    "symbols": "d = difference between two measurement methods",
    "notes": "",
    "related": [
      "cohens_kappa"
    ]
  },
  {
    "id": "bonferroni",
    "title": "Bonferroni correction",
    "field": "statistics",
    "latex": "\\alpha_{\\text{each}}=\\frac{\\alpha}{m}",
    "plain": "α_each = α / m",
    "symbols": "m = number of tests",
    "notes": "Controls the family-wise error rate; conservative.",
    "related": [
      "t_statistic"
    ]
  },
  {
    "id": "bootstrap_se",
    "title": "bootstrap standard error",
    "field": "statistics",
    "latex": "\\widehat{\\mathrm{SE}}_{\\text{boot}}=\\sqrt{\\frac1{B-1}\\sum_{b=1}^{B}\\big(\\hat\\theta^{*}_b-\\bar{\\hat\\theta}^{*}\\big)^2}",
    "plain": "SE_boot = std of the statistic over B resamples",
    "symbols": "θ̂*_b = statistic on resample b",
    "notes": "Resample the data with replacement B times.",
    "related": [
      "jackknife_variance"
    ]
  },
  {
    "id": "box_cox",
    "title": "Box–Cox transformation",
    "field": "statistics",
    "latex": "y^{(\\lambda)}=\\begin{cases}\\dfrac{y^\\lambda-1}{\\lambda}&\\lambda\\ne0\\\\[2pt]\\ln y&\\lambda=0\\end{cases}",
    "plain": "(yᵏ − 1)/λ, or ln y when λ = 0",
    "symbols": "y > 0",
    "notes": "Stabilises variance and makes data more normal.",
    "related": [
      "logarithm_rules"
    ]
  },
  {
    "id": "cantelli",
    "title": "Cantelli's inequality",
    "field": "statistics",
    "latex": "P(X-\\mu\\ge t)\\le\\frac{\\sigma^2}{\\sigma^2+t^2}",
    "plain": "P(X − μ ≥ t) ≤ σ²/(σ² + t²)",
    "symbols": "",
    "notes": "The one-sided Chebyshev.",
    "related": [
      "chebyshev"
    ]
  },
  {
    "id": "clt_standardised_mean",
    "title": "central limit theorem (standardised mean)",
    "field": "statistics",
    "latex": "Z_n=\\frac{\\sqrt{n}\\,(\\bar X_n-\\mu)}{\\sigma}\\ \\xrightarrow{d}\\ \\mathcal N(0,1)",
    "plain": "Zₙ = √n (X̄ₙ − μ) / σ  →  N(0, 1)",
    "symbols": "X̄ₙ = sample mean, μ and σ = true mean and standard deviation",
    "notes": "Needs i.i.d. samples with finite variance.",
    "related": [
      "standard_error",
      "z_score"
    ]
  },
  {
    "id": "chernoff_bound",
    "title": "Chernoff bound (binomial tail)",
    "field": "statistics",
    "latex": "P(X\\ge(1+\\delta)\\mu)\\le\\exp\\!\\Big(-\\frac{\\delta^2\\mu}{2+\\delta}\\Big)",
    "plain": "P(X ≥ (1 + δ)μ) ≤ exp(−δ²μ/(2 + δ))",
    "symbols": "X a sum of independent Bernoulli variables, μ = E[X]",
    "notes": "",
    "related": [
      "hoeffding",
      "markov_inequality"
    ]
  },
  {
    "id": "chi_square_gof",
    "title": "chi-square goodness of fit",
    "field": "statistics",
    "latex": "\\chi^2=\\sum_i\\frac{(O_i-E_i)^2}{E_i},\\quad \\nu=k-1-m",
    "plain": "χ² = Σ (Oᵢ − Eᵢ)²/Eᵢ",
    "symbols": "O observed counts, E expected counts, m fitted parameters",
    "notes": "Needs expected counts of about 5 or more.",
    "related": [
      "chi_square_independence"
    ]
  },
  {
    "id": "chi_square_independence",
    "title": "chi-square test of independence",
    "field": "statistics",
    "latex": "E_{ij}=\\frac{R_iC_j}{N},\\qquad \\chi^2=\\sum_{ij}\\frac{(O_{ij}-E_{ij})^2}{E_{ij}},\\quad \\nu=(r-1)(c-1)",
    "plain": "Eᵢⱼ = RᵢCⱼ/N;  χ² = Σ (Oᵢⱼ − Eᵢⱼ)²/Eᵢⱼ",
    "symbols": "R, C = row and column totals",
    "notes": "",
    "related": [
      "chi_square_gof",
      "cramers_v"
    ]
  },
  {
    "id": "coefficient_of_variation",
    "title": "coefficient of variation",
    "field": "statistics",
    "latex": "\\mathrm{CV}=\\frac{\\sigma}{\\mu}",
    "plain": "CV = σ/μ",
    "symbols": "",
    "notes": "Unit-free spread; meaningful only for positive ratio-scale data.",
    "related": [
      "variance"
    ]
  },
  {
    "id": "cohens_d",
    "title": "Cohen's d (effect size)",
    "field": "statistics",
    "latex": "d=\\frac{\\mu_1-\\mu_2}{s_{\\text{pooled}}}",
    "plain": "d = (μ₁ − μ₂) / s_pooled",
    "symbols": "",
    "notes": "About 0.2 small, 0.5 medium, 0.8 large (rules of thumb).",
    "related": [
      "t_statistic"
    ]
  },
  {
    "id": "cohens_kappa",
    "title": "Cohen's kappa",
    "field": "statistics",
    "latex": "\\kappa=\\frac{p_o-p_e}{1-p_e}",
    "plain": "κ = (p_o − p_e)/(1 − p_e)",
    "symbols": "p_o = observed agreement, p_e = agreement expected by chance",
    "notes": "0 is chance-level agreement, 1 is perfect.",
    "related": [
      "icc"
    ]
  },
  {
    "id": "ci_difference_means",
    "title": "confidence interval for a difference of means",
    "field": "statistics",
    "latex": "(\\bar x_1-\\bar x_2)\\pm t_{\\nu,1-\\alpha/2}\\sqrt{\\frac{s_1^2}{n_1}+\\frac{s_2^2}{n_2}}",
    "plain": "(x̄₁ − x̄₂) ± t·√(s₁²/n₁ + s₂²/n₂)",
    "symbols": "",
    "notes": "",
    "related": [
      "welch_t_test"
    ]
  },
  {
    "id": "confidence_interval_mean",
    "title": "confidence interval for a mean",
    "field": "statistics",
    "latex": "\\bar x \\pm z_{1-\\alpha/2}\\,\\frac{s}{\\sqrt n}",
    "plain": "x̄ ± z · s/√n",
    "symbols": "z = 1.96 for 95%; use t instead of z for small n",
    "notes": "Frequentist: 95% of such intervals contain the true mean.",
    "related": [
      "standard_error",
      "t_statistic"
    ]
  },
  {
    "id": "ci_variance",
    "title": "confidence interval for a variance",
    "field": "statistics",
    "latex": "\\Big(\\frac{(n-1)s^2}{\\chi^2_{1-\\alpha/2,\\,n-1}},\\ \\frac{(n-1)s^2}{\\chi^2_{\\alpha/2,\\,n-1}}\\Big)",
    "plain": "((n−1)s²/χ²_upper, (n−1)s²/χ²_lower)",
    "symbols": "χ² quantiles with n − 1 degrees of freedom",
    "notes": "Sensitive to non-normality.",
    "related": [
      "sample_variance"
    ]
  },
  {
    "id": "odds_ratio_ci",
    "title": "confidence interval for an odds ratio",
    "field": "statistics",
    "latex": "\\exp\\Big(\\ln\\widehat{\\mathrm{OR}}\\pm z_{1-\\alpha/2}\\sqrt{\\tfrac1a+\\tfrac1b+\\tfrac1c+\\tfrac1d}\\Big)",
    "plain": "exp(ln OR ± z√(1/a + 1/b + 1/c + 1/d))",
    "symbols": "",
    "notes": "",
    "related": [
      "odds_ratio"
    ]
  },
  {
    "id": "cooks_distance",
    "title": "Cook's distance",
    "field": "statistics",
    "latex": "D_i=\\frac{e_i^2}{p\\,s^2}\\cdot\\frac{h_{ii}}{(1-h_{ii})^2}",
    "plain": "Dᵢ = eᵢ²/(p s²) · hᵢᵢ/(1 − hᵢᵢ)²",
    "symbols": "eᵢ = residual, p = parameters",
    "notes": "Large values flag influential points (rule of thumb: > 4/n).",
    "related": [
      "hat_matrix"
    ]
  },
  {
    "id": "aicc",
    "title": "corrected AIC",
    "field": "statistics",
    "latex": "\\mathrm{AIC}_c=\\mathrm{AIC}+\\frac{2k(k+1)}{n-k-1}",
    "plain": "AICc = AIC + 2k(k + 1)/(n − k − 1)",
    "symbols": "",
    "notes": "Use when n/k is below about 40.",
    "related": [
      "aic",
      "bic"
    ]
  },
  {
    "id": "ols_covariance",
    "title": "covariance of the OLS estimator (Gauss–Markov)",
    "field": "statistics",
    "latex": "\\operatorname{Var}(\\hat\\beta)=\\sigma^2(X^{\\top}X)^{-1}",
    "plain": "Var(β̂) = σ²(XᵀX)⁻¹",
    "symbols": "",
    "notes": "OLS is the best linear unbiased estimator when errors are uncorrelated with constant variance.",
    "related": [
      "ols",
      "slope_standard_error"
    ]
  },
  {
    "id": "cox_hazard",
    "title": "Cox proportional hazards model",
    "field": "statistics",
    "latex": "h(t\\mid\\mathbf x)=h_0(t)\\,\\exp\\big(\\boldsymbol\\beta^{\\top}\\mathbf x\\big)",
    "plain": "h(t|x) = h₀(t) exp(βᵀx)",
    "symbols": "h₀ = baseline hazard",
    "notes": "exp(β) is the hazard ratio for a one-unit increase in x.",
    "related": [
      "hazard_function"
    ]
  },
  {
    "id": "cramers_v",
    "title": "Cramér's V",
    "field": "statistics",
    "latex": "V=\\sqrt{\\frac{\\chi^2/N}{\\min(r-1,\\,c-1)}}",
    "plain": "V = √( (χ²/N) / min(r−1, c−1) )",
    "symbols": "",
    "notes": "Effect size for association between categorical variables, from 0 to 1.",
    "related": [
      "chi_square_independence",
      "phi_coefficient"
    ]
  },
  {
    "id": "cramer_rao",
    "title": "Cramér–Rao bound",
    "field": "statistics",
    "latex": "\\operatorname{Var}(\\hat\\theta)\\ge\\frac{1}{n\\,I(\\theta)}",
    "plain": "Var(θ̂) ≥ 1 / (n·I(θ))",
    "symbols": "for any unbiased estimator",
    "notes": "",
    "related": [
      "fisher_information_bernoulli"
    ]
  },
  {
    "id": "cronbach_alpha",
    "title": "Cronbach's alpha",
    "field": "statistics",
    "latex": "\\alpha=\\frac{k}{k-1}\\Big(1-\\frac{\\sum_i\\sigma_i^2}{\\sigma_T^2}\\Big)",
    "plain": "α = (k/(k−1))(1 − Σσᵢ²/σ_T²)",
    "symbols": "k items, σ_T² = variance of the total score",
    "notes": "A reliability measure of internal consistency.",
    "related": [
      "icc"
    ]
  },
  {
    "id": "cuped",
    "title": "CUPED variance reduction",
    "field": "statistics",
    "latex": "Y^{*}=Y-\\theta\\,(X-\\mathbb E X),\\quad \\theta=\\frac{\\operatorname{Cov}(X,Y)}{\\operatorname{Var}X},\\quad \\operatorname{Var}(Y^{*})=(1-\\rho^2)\\operatorname{Var}(Y)",
    "plain": "adjust the metric with a pre-experiment covariate",
    "symbols": "",
    "notes": "A correlation of 0.7 halves the variance.",
    "related": [
      "control_variates"
    ]
  },
  {
    "id": "cusum",
    "title": "CUSUM change detection",
    "field": "statistics",
    "latex": "S_t=\\max\\big(0,\\ S_{t-1}+x_t-\\mu_0-k\\big),\\qquad \\text{alarm if }S_t>h",
    "plain": "Sₜ = max(0, Sₜ₋₁ + xₜ − μ₀ − k);  alarm when Sₜ > h",
    "symbols": "k = allowance, h = threshold",
    "notes": "Detects a small sustained shift faster than a Shewhart chart.",
    "related": [
      "sprt"
    ]
  },
  {
    "id": "delta_method",
    "title": "delta method",
    "field": "statistics",
    "latex": "\\sqrt n\\big(g(\\hat\\theta)-g(\\theta)\\big)\\xrightarrow{d}\\mathcal N\\big(0,\\ g'(\\theta)^2\\sigma^2\\big)",
    "plain": "Var(g(θ̂)) ≈ g′(θ)² Var(θ̂)",
    "symbols": "",
    "notes": "Propagates uncertainty through a smooth function.",
    "related": [
      "standard_error"
    ]
  },
  {
    "id": "design_effect",
    "title": "design effect (cluster sampling)",
    "field": "statistics",
    "latex": "\\mathrm{deff}=1+(m-1)\\rho,\\qquad n_{\\text{eff}}=\\frac{n}{\\mathrm{deff}}",
    "plain": "deff = 1 + (m − 1)ρ",
    "symbols": "m = cluster size, ρ = intraclass correlation",
    "notes": "Correlated observations carry less information than independent ones.",
    "related": [
      "icc"
    ]
  },
  {
    "id": "deviance",
    "title": "deviance",
    "field": "statistics",
    "latex": "D=2\\big(\\ell_{\\text{saturated}}-\\ell_{\\text{model}}\\big)",
    "plain": "D = 2(ℓ_saturated − ℓ_model)",
    "symbols": "",
    "notes": "For the normal it is the residual sum of squares; compare nested models by the drop in deviance (≈ χ²).",
    "related": [
      "likelihood_ratio_test"
    ]
  },
  {
    "id": "diff_in_diff",
    "title": "difference-in-differences",
    "field": "statistics",
    "latex": "\\hat\\tau=\\big(\\bar Y_{T,\\text{post}}-\\bar Y_{T,\\text{pre}}\\big)-\\big(\\bar Y_{C,\\text{post}}-\\bar Y_{C,\\text{pre}}\\big)",
    "plain": "τ̂ = (treated: post − pre) − (control: post − pre)",
    "symbols": "",
    "notes": "Needs parallel trends.",
    "related": [
      "ate"
    ]
  },
  {
    "id": "dirichlet_multinomial_update",
    "title": "Dirichlet–multinomial conjugate update",
    "field": "statistics",
    "latex": "\\mathbf p\\sim\\mathrm{Dir}(\\boldsymbol\\alpha),\\ \\text{counts }\\mathbf x\\ \\Rightarrow\\ \\mathbf p\\mid\\mathbf x\\sim\\mathrm{Dir}(\\boldsymbol\\alpha+\\mathbf x)",
    "plain": "posterior = Dir(α + x)",
    "symbols": "",
    "notes": "Posterior mean (αₖ + xₖ)/(α₀ + n): additive smoothing.",
    "related": [
      "laplace_smoothing"
    ]
  },
  {
    "id": "durbin_watson",
    "title": "Durbin–Watson statistic",
    "field": "statistics",
    "latex": "d=\\frac{\\sum_{t=2}^{n}(e_t-e_{t-1})^2}{\\sum_{t=1}^{n}e_t^2}\\approx2(1-\\hat\\rho_1)",
    "plain": "d = Σ(eₜ − eₜ₋₁)²/Σeₜ² ≈ 2(1 − ρ̂₁)",
    "symbols": "",
    "notes": "Near 2 means no first-order autocorrelation.",
    "related": [
      "autocorrelation"
    ]
  },
  {
    "id": "dkw_inequality",
    "title": "Dvoretzky–Kiefer–Wolfowitz inequality",
    "field": "statistics",
    "latex": "P\\Big(\\sup_x|F_n(x)-F(x)|>\\varepsilon\\Big)\\le 2e^{-2n\\varepsilon^2}",
    "plain": "P(sup|Fₙ − F| > ε) ≤ 2 exp(−2nε²)",
    "symbols": "",
    "notes": "Gives a distribution-free confidence band for a cdf.",
    "related": [
      "empirical_cdf"
    ]
  },
  {
    "id": "ridge_df",
    "title": "effective degrees of freedom of ridge",
    "field": "statistics",
    "latex": "\\mathrm{df}(\\lambda)=\\operatorname{tr}\\big[X(X^{\\top}X+\\lambda I)^{-1}X^{\\top}\\big]=\\sum_j\\frac{d_j^2}{d_j^2+\\lambda}",
    "plain": "df(λ) = Σ dⱼ²/(dⱼ² + λ)",
    "symbols": "dⱼ = singular values of X",
    "notes": "Falls from p (λ = 0) toward 0 as λ grows.",
    "related": [
      "ridge_regression"
    ]
  },
  {
    "id": "empirical_cdf",
    "title": "empirical distribution function",
    "field": "statistics",
    "latex": "F_n(x)=\\frac1n\\sum_{i=1}^{n}\\mathbf 1[x_i\\le x]",
    "plain": "Fₙ(x) = (1/n) Σ 1[xᵢ ≤ x]",
    "symbols": "",
    "notes": "Converges uniformly to F (Glivenko–Cantelli); DKW: P(sup|Fₙ − F| > ε) ≤ 2e^(−2nε²).",
    "related": [
      "ks_statistic",
      "dkw_inequality"
    ]
  },
  {
    "id": "eta_squared",
    "title": "eta squared (effect size)",
    "field": "statistics",
    "latex": "\\eta^2=\\frac{\\mathrm{SS}_B}{\\mathrm{SS}_T}",
    "plain": "η² = SS_B / SS_T",
    "symbols": "",
    "notes": "The share of variance explained by group membership.",
    "related": [
      "anova_f",
      "cohens_d"
    ]
  },
  {
    "id": "ewma_volatility",
    "title": "EWMA volatility (RiskMetrics)",
    "field": "statistics",
    "latex": "\\sigma_t^2=\\lambda\\sigma_{t-1}^2+(1-\\lambda)r_{t-1}^2",
    "plain": "σₜ² = λσₜ₋₁² + (1 − λ)rₜ₋₁²",
    "symbols": "λ = 0.94 for daily data",
    "notes": "",
    "related": [
      "arch1",
      "exponential_smoothing"
    ]
  },
  {
    "id": "finite_population_correction",
    "title": "finite population correction",
    "field": "statistics",
    "latex": "\\mathrm{fpc}=\\sqrt{\\frac{N-n}{N-1}},\\qquad n_{\\mathrm{adj}}=\\frac{n}{1+\\frac{n-1}N}",
    "plain": "fpc = √((N − n)/(N − 1))",
    "symbols": "N = population size",
    "notes": "Matters once the sample is more than about 5% of the population.",
    "related": [
      "sample_size_proportion",
      "hypergeometric_variance"
    ]
  },
  {
    "id": "fisher_information_bernoulli",
    "title": "Fisher information (Bernoulli)",
    "field": "statistics",
    "latex": "I(p)=\\mathbb{E}\\!\\left[\\left(\\frac{\\partial}{\\partial p}\\ln f(X;p)\\right)^{2}\\right]=\\frac{1}{p(1-p)}",
    "plain": "I(p) = E[(∂ ln f/∂p)²] = 1 / (p(1−p))",
    "symbols": "",
    "notes": "Larger information means a sharper likelihood and a more precise estimate.",
    "related": [
      "cramer_rao"
    ]
  },
  {
    "id": "fisher_z",
    "title": "Fisher z-transformation of a correlation",
    "field": "statistics",
    "latex": "z=\\operatorname{artanh}(r)=\\tfrac12\\ln\\frac{1+r}{1-r},\\qquad \\mathrm{SE}=\\frac1{\\sqrt{n-3}}",
    "plain": "z = ½ ln((1 + r)/(1 − r));  SE = 1/√(n − 3)",
    "symbols": "",
    "notes": "Makes r approximately normal; build the interval on z and transform back with tanh.",
    "related": [
      "pearson"
    ]
  },
  {
    "id": "fisher_exact_2x2",
    "title": "Fisher's exact test (one table)",
    "field": "statistics",
    "latex": "p=\\frac{\\binom{a+b}{a}\\binom{c+d}{c}}{\\binom{n}{a+c}}",
    "plain": "p = C(a+b, a) C(c+d, c) / C(n, a+c)",
    "symbols": "table [[a, b], [c, d]], n = a+b+c+d",
    "notes": "The hypergeometric probability of this exact table given the margins; sum over equal or more extreme tables for the p-value.",
    "related": [
      "hypergeometric_pmf"
    ]
  },
  {
    "id": "fisher_combined",
    "title": "Fisher's method for combining p-values",
    "field": "statistics",
    "latex": "X^2=-2\\sum_{i=1}^{k}\\ln p_i\\ \\sim\\ \\chi^2_{2k}",
    "plain": "X² = −2 Σ ln pᵢ  ~  χ²(2k)",
    "symbols": "",
    "notes": "",
    "related": [
      "stouffer_z"
    ]
  },
  {
    "id": "frisch_waugh",
    "title": "Frisch–Waugh–Lovell theorem",
    "field": "statistics",
    "latex": "\\hat\\beta_1=\\frac{\\tilde x^{\\top}\\tilde y}{\\tilde x^{\\top}\\tilde x},\\quad \\tilde x=M_2x,\\ \\tilde y=M_2y,\\ M_2=I-X_2(X_2^{\\top}X_2)^{-1}X_2^{\\top}",
    "plain": "partial out the controls from both x and y, then regress the residuals",
    "symbols": "",
    "notes": "Explains what 'controlling for' means.",
    "related": [
      "ols",
      "projection_matrix"
    ]
  },
  {
    "id": "gamma_poisson_update",
    "title": "gamma–Poisson conjugate update",
    "field": "statistics",
    "latex": "\\lambda\\sim\\mathrm{Gamma}(\\alpha,\\beta),\\ \\sum x_i=s\\text{ over }n\\ \\Rightarrow\\ \\lambda\\mid x\\sim\\mathrm{Gamma}(\\alpha+s,\\ \\beta+n)",
    "plain": "posterior = Gamma(α + Σxᵢ, β + n)  (rate parameterisation)",
    "symbols": "",
    "notes": "Posterior mean (α + s)/(β + n).",
    "related": [
      "poisson_mean",
      "beta_binomial_update"
    ]
  },
  {
    "id": "gls",
    "title": "generalised least squares",
    "field": "statistics",
    "latex": "\\hat\\beta=(X^{\\top}\\Sigma^{-1}X)^{-1}X^{\\top}\\Sigma^{-1}\\mathbf y,\\quad \\operatorname{Var}(\\hat\\beta)=(X^{\\top}\\Sigma^{-1}X)^{-1}",
    "plain": "β̂ = (XᵀΣ⁻¹X)⁻¹ XᵀΣ⁻¹y",
    "symbols": "Σ = error covariance",
    "notes": "",
    "related": [
      "wls"
    ]
  },
  {
    "id": "geometric_average",
    "title": "geometric mean",
    "field": "statistics",
    "latex": "\\bar x_g=\\Big(\\prod_i x_i\\Big)^{1/n}=\\exp\\!\\Big(\\frac1n\\sum_i\\ln x_i\\Big)",
    "plain": "x̄_g = (Π xᵢ)^(1/n)",
    "symbols": "xᵢ > 0",
    "notes": "The right average for growth rates and ratios.",
    "related": [
      "harmonic_mean",
      "am_gm"
    ]
  },
  {
    "id": "glm_links",
    "title": "GLM link functions",
    "field": "statistics",
    "latex": "g(\\mu)=\\eta=\\mathbf x^{\\top}\\boldsymbol\\beta:\\quad \\text{identity }\\mu,\\ \\ \\text{log }\\ln\\mu,\\ \\ \\text{logit }\\ln\\frac\\mu{1-\\mu},\\ \\ \\text{probit }\\Phi^{-1}(\\mu)",
    "plain": "identity μ;  log ln μ;  logit ln(μ/(1−μ));  probit Φ⁻¹(μ)",
    "symbols": "",
    "notes": "Normal ↔ identity, Poisson ↔ log, Bernoulli ↔ logit or probit.",
    "related": [
      "logit",
      "poisson_loglik"
    ]
  },
  {
    "id": "harmonic_mean",
    "title": "harmonic mean",
    "field": "statistics",
    "latex": "\\bar x_h=\\frac{n}{\\sum_i 1/x_i}",
    "plain": "x̄_h = n / Σ (1/xᵢ)",
    "symbols": "xᵢ > 0",
    "notes": "The right average for rates (speed over equal distances) and the basis of the F₁ score.",
    "related": [
      "geometric_mean",
      "f1_score"
    ]
  },
  {
    "id": "hat_matrix",
    "title": "hat matrix and leverage",
    "field": "statistics",
    "latex": "H=X(X^{\\top}X)^{-1}X^{\\top},\\qquad \\hat{\\mathbf y}=H\\mathbf y,\\quad h_{ii}\\in[0,1],\\ \\ \\sum_ih_{ii}=p",
    "plain": "H = X(XᵀX)⁻¹Xᵀ;  ŷ = Hy;  Σ hᵢᵢ = p",
    "symbols": "p = number of columns of X",
    "notes": "hᵢᵢ is the leverage of observation i.",
    "related": [
      "cooks_distance",
      "loocv_shortcut"
    ]
  },
  {
    "id": "hazard_function",
    "title": "hazard and survival functions",
    "field": "statistics",
    "latex": "S(t)=1-F(t),\\qquad h(t)=\\frac{f(t)}{S(t)},\\qquad H(t)=\\int_0^t h=-\\ln S(t)",
    "plain": "S = 1 − F;  h = f/S;  H = −ln S",
    "symbols": "",
    "notes": "The hazard is the instantaneous failure rate among survivors.",
    "related": [
      "weibull_cdf",
      "kaplan_meier"
    ]
  },
  {
    "id": "hedges_g",
    "title": "Hedges' g",
    "field": "statistics",
    "latex": "g=d\\Big(1-\\frac{3}{4(n_1+n_2)-9}\\Big)",
    "plain": "g = d·(1 − 3/(4(n₁+n₂) − 9))",
    "symbols": "d = Cohen's d",
    "notes": "Removes the small-sample bias of d.",
    "related": [
      "cohens_d"
    ]
  },
  {
    "id": "holm",
    "title": "Holm–Bonferroni procedure",
    "field": "statistics",
    "latex": "\\text{reject } H_{(i)}\\text{ while } p_{(i)}\\le\\frac{\\alpha}{m-i+1}",
    "plain": "reject H₍ᵢ₎ while p₍ᵢ₎ ≤ α/(m − i + 1), in order of increasing p",
    "symbols": "",
    "notes": "Controls the family-wise error rate; uniformly more powerful than Bonferroni.",
    "related": [
      "bonferroni",
      "benjamini_hochberg"
    ]
  },
  {
    "id": "holt_linear",
    "title": "Holt's linear trend method",
    "field": "statistics",
    "latex": "\\ell_t=\\alpha y_t+(1-\\alpha)(\\ell_{t-1}+b_{t-1}),\\ \\ b_t=\\beta(\\ell_t-\\ell_{t-1})+(1-\\beta)b_{t-1},\\ \\ \\hat y_{t+h}=\\ell_t+hb_t",
    "plain": "level and trend recursions; forecast ℓₜ + h·bₜ",
    "symbols": "",
    "notes": "",
    "related": [
      "exponential_smoothing"
    ]
  },
  {
    "id": "horvitz_thompson",
    "title": "Horvitz–Thompson estimator",
    "field": "statistics",
    "latex": "\\hat T=\\sum_{i\\in s}\\frac{y_i}{\\pi_i}",
    "plain": "T̂ = Σ yᵢ/πᵢ",
    "symbols": "πᵢ = inclusion probability",
    "notes": "Unbiased for the population total under any design.",
    "related": [
      "importance_sampling"
    ]
  },
  {
    "id": "iv_wald",
    "title": "instrumental-variable estimator",
    "field": "statistics",
    "latex": "\\hat\\beta_{IV}=\\frac{\\operatorname{Cov}(Y,Z)}{\\operatorname{Cov}(X,Z)}",
    "plain": "β̂_IV = Cov(Y, Z)/Cov(X, Z)",
    "symbols": "Z affects Y only through X",
    "notes": "The Wald estimator; two-stage least squares generalises it.",
    "related": [
      "simple_regression",
      "late"
    ]
  },
  {
    "id": "late",
    "title": "intention-to-treat and LATE",
    "field": "statistics",
    "latex": "\\mathrm{LATE}=\\frac{\\mathrm{ITT}}{\\text{compliance rate}}=\\frac{\\mathbb E[Y\\mid Z=1]-\\mathbb E[Y\\mid Z=0]}{\\mathbb E[T\\mid Z=1]-\\mathbb E[T\\mid Z=0]}",
    "plain": "LATE = ITT / (share of compliers)",
    "symbols": "",
    "notes": "",
    "related": [
      "iv_wald"
    ]
  },
  {
    "id": "iqr",
    "title": "interquartile range",
    "field": "statistics",
    "latex": "\\mathrm{IQR}=Q_3-Q_1,\\qquad \\text{outlier fences: } Q_1-1.5\\,\\mathrm{IQR},\\ Q_3+1.5\\,\\mathrm{IQR}",
    "plain": "IQR = Q₃ − Q₁;  fences Q₁ − 1.5 IQR, Q₃ + 1.5 IQR",
    "symbols": "",
    "notes": "",
    "related": [
      "mad",
      "percentile"
    ]
  },
  {
    "id": "icc",
    "title": "intraclass correlation (one-way)",
    "field": "statistics",
    "latex": "\\mathrm{ICC}(1)=\\frac{\\mathrm{MS}_B-\\mathrm{MS}_W}{\\mathrm{MS}_B+(k-1)\\mathrm{MS}_W}",
    "plain": "ICC(1) = (MS_B − MS_W)/(MS_B + (k−1)MS_W)",
    "symbols": "k = ratings per subject",
    "notes": "",
    "related": [
      "cohens_kappa",
      "design_effect"
    ]
  },
  {
    "id": "ipw_ate",
    "title": "inverse-propensity weighting",
    "field": "statistics",
    "latex": "\\hat\\tau=\\frac1n\\sum_i\\Big(\\frac{T_iY_i}{e(X_i)}-\\frac{(1-T_i)Y_i}{1-e(X_i)}\\Big)",
    "plain": "τ̂ = (1/n) Σ (TᵢYᵢ/e(Xᵢ) − (1 − Tᵢ)Yᵢ/(1 − e(Xᵢ)))",
    "symbols": "e(x) = propensity score P(T = 1 | x)",
    "notes": "Reweights units to mimic a randomised experiment.",
    "related": [
      "ate",
      "horvitz_thompson"
    ]
  },
  {
    "id": "jackknife_variance",
    "title": "jackknife variance estimate",
    "field": "statistics",
    "latex": "\\widehat{\\operatorname{Var}}_{\\text{jack}}=\\frac{n-1}{n}\\sum_{i=1}^{n}\\big(\\hat\\theta_{(-i)}-\\bar\\theta_{(\\cdot)}\\big)^2",
    "plain": "Var_jack = ((n−1)/n) Σ (θ̂₍₋ᵢ₎ − mean)²",
    "symbols": "θ̂₍₋ᵢ₎ = statistic leaving out observation i",
    "notes": "",
    "related": [
      "bootstrap_se"
    ]
  },
  {
    "id": "james_stein",
    "title": "James–Stein estimator",
    "field": "statistics",
    "latex": "\\hat\\theta_{JS}=\\Big(1-\\frac{(p-2)\\sigma^2}{\\|\\mathbf x\\|^2}\\Big)\\mathbf x",
    "plain": "θ̂ = (1 − (p − 2)σ²/‖x‖²) x",
    "symbols": "p ≥ 3 means",
    "notes": "Shrinking toward 0 beats the raw estimate in total squared error when p ≥ 3: the origin of shrinkage and regularisation.",
    "related": [
      "ridge_regression"
    ]
  },
  {
    "id": "jeffreys_prior",
    "title": "Jeffreys prior",
    "field": "statistics",
    "latex": "\\pi(\\theta)\\propto\\sqrt{I(\\theta)}",
    "plain": "π(θ) ∝ √I(θ)",
    "symbols": "I = Fisher information",
    "notes": "Invariant under reparameterisation. For a Bernoulli, Beta(½, ½).",
    "related": [
      "fisher_information_bernoulli"
    ]
  },
  {
    "id": "kaplan_meier",
    "title": "Kaplan–Meier estimator",
    "field": "statistics",
    "latex": "\\hat S(t)=\\prod_{t_i\\le t}\\Big(1-\\frac{d_i}{n_i}\\Big)",
    "plain": "Ŝ(t) = Π (1 − dᵢ/nᵢ)",
    "symbols": "dᵢ = events, nᵢ = at risk at time tᵢ",
    "notes": "Handles censored observations.",
    "related": [
      "hazard_function"
    ]
  },
  {
    "id": "kendall_tau",
    "title": "Kendall's tau",
    "field": "statistics",
    "latex": "\\tau=\\frac{C-D}{\\binom n2}",
    "plain": "τ = (C − D)/C(n, 2)",
    "symbols": "C, D = concordant and discordant pairs",
    "notes": "",
    "related": [
      "spearman_rho"
    ]
  },
  {
    "id": "ks_statistic",
    "title": "Kolmogorov–Smirnov statistic",
    "field": "statistics",
    "latex": "D_n=\\sup_x\\big|F_n(x)-F(x)\\big|",
    "plain": "D_n = sup_x |Fₙ(x) − F(x)|",
    "symbols": "Fₙ = empirical cdf",
    "notes": "Distribution-free under the null; reject for large √n·Dₙ.",
    "related": [
      "empirical_cdf"
    ]
  },
  {
    "id": "kruskal_wallis",
    "title": "Kruskal–Wallis H",
    "field": "statistics",
    "latex": "H=\\frac{12}{N(N+1)}\\sum_g\\frac{R_g^2}{n_g}-3(N+1)",
    "plain": "H = 12/(N(N+1)) Σ R_g²/n_g − 3(N + 1)",
    "symbols": "R_g = rank sum of group g",
    "notes": "Nonparametric one-way ANOVA.",
    "related": [
      "anova_f"
    ]
  },
  {
    "id": "kurtosis",
    "title": "kurtosis (excess)",
    "field": "statistics",
    "latex": "\\gamma_2=\\mathbb E\\Big[\\Big(\\frac{X-\\mu}{\\sigma}\\Big)^4\\Big]-3",
    "plain": "γ₂ = E[((X − μ)/σ)⁴] − 3",
    "symbols": "",
    "notes": "Zero for the normal. Positive means heavier tails than the normal.",
    "related": [
      "skewness"
    ]
  },
  {
    "id": "lasso_soft_threshold",
    "title": "lasso solution for an orthonormal design",
    "field": "statistics",
    "latex": "\\hat\\beta_j=\\operatorname{sign}(\\hat\\beta_j^{\\mathrm{OLS}})\\big(|\\hat\\beta_j^{\\mathrm{OLS}}|-\\lambda\\big)_+",
    "plain": "β̂ⱼ = sign(β̂_OLS)(|β̂_OLS| − λ)₊",
    "symbols": "(·)₊ = max(·, 0)",
    "notes": "The soft-thresholding operator: small coefficients become exactly zero.",
    "related": [
      "l1_penalty",
      "proximal_l1"
    ]
  },
  {
    "id": "law_of_large_numbers",
    "title": "law of large numbers",
    "field": "statistics",
    "latex": "P\\big(|\\bar X_n-\\mu|\\ge\\varepsilon\\big)\\le\\frac{\\sigma^2}{n\\varepsilon^2}\\ \\xrightarrow{n\\to\\infty}\\ 0",
    "plain": "P(|X̄ₙ − μ| ≥ ε) ≤ σ²/(nε²) → 0",
    "symbols": "",
    "notes": "Weak law via Chebyshev. The strong law says X̄ₙ → μ with probability 1.",
    "related": [
      "chebyshev",
      "clt_standardised_mean"
    ]
  },
  {
    "id": "rule_of_thumb_batch",
    "title": "learning curves and the 1/√n rule",
    "field": "statistics",
    "latex": "\\text{error}\\propto\\frac1{\\sqrt n}\\ (\\text{noise-limited}),\\qquad \\text{quadrupling the data halves the standard error}",
    "plain": "standard error ∝ 1/√n",
    "symbols": "",
    "notes": "",
    "related": [
      "monte_carlo_error",
      "standard_error"
    ]
  },
  {
    "id": "loocv_shortcut",
    "title": "leave-one-out residual shortcut",
    "field": "statistics",
    "latex": "e_{(-i)}=\\frac{e_i}{1-h_{ii}},\\qquad \\mathrm{PRESS}=\\sum_i\\Big(\\frac{e_i}{1-h_{ii}}\\Big)^2",
    "plain": "e₍₋ᵢ₎ = eᵢ/(1 − hᵢᵢ)",
    "symbols": "",
    "notes": "Exact leave-one-out error for linear smoothers without refitting.",
    "related": [
      "hat_matrix"
    ]
  },
  {
    "id": "likelihood_function",
    "title": "likelihood and log-likelihood",
    "field": "statistics",
    "latex": "L(\\theta)=\\prod_if(x_i;\\theta),\\quad \\ell(\\theta)=\\sum_i\\ln f(x_i;\\theta),\\quad \\hat\\theta=\\arg\\max_\\theta\\ell,\\ \\ \\ell'(\\hat\\theta)=0",
    "plain": "L(θ) = Π f(xᵢ; θ);  ℓ = Σ ln f",
    "symbols": "",
    "notes": "Bernoulli: p̂ = (number of successes)/n.",
    "related": [
      "mle_gaussian",
      "fisher_information"
    ]
  },
  {
    "id": "likelihood_ratio_test",
    "title": "likelihood ratio test",
    "field": "statistics",
    "latex": "-2\\ln\\Lambda=2\\big(\\ell(\\hat\\theta_1)-\\ell(\\hat\\theta_0)\\big)\\ \\xrightarrow{d}\\ \\chi^2_{q}",
    "plain": "−2 ln Λ = 2(ℓ(θ̂₁) − ℓ(θ̂₀)) → χ²(q)",
    "symbols": "q = difference in free parameters (Wilks' theorem)",
    "notes": "",
    "related": [
      "aic"
    ]
  },
  {
    "id": "ljung_box",
    "title": "Ljung–Box statistic",
    "field": "statistics",
    "latex": "Q=n(n+2)\\sum_{k=1}^{h}\\frac{\\hat\\rho_k^2}{n-k}\\ \\sim\\ \\chi^2_h",
    "plain": "Q = n(n + 2) Σ ρ̂ₖ²/(n − k)",
    "symbols": "",
    "notes": "Tests whether residual autocorrelations are jointly zero.",
    "related": [
      "autocorrelation"
    ]
  },
  {
    "id": "logit",
    "title": "log-odds (logit)",
    "field": "statistics",
    "latex": "\\operatorname{logit}(p)=\\ln\\frac{p}{1-p},\\qquad \\sigma(\\operatorname{logit}(p))=p",
    "plain": "logit(p) = ln( p / (1 − p) )",
    "symbols": "",
    "notes": "The inverse of the sigmoid. Logistic regression is linear in the log-odds.",
    "related": [
      "sigmoid",
      "logistic_regression"
    ]
  },
  {
    "id": "logrank",
    "title": "log-rank statistic",
    "field": "statistics",
    "latex": "\\chi^2=\\frac{(O_1-E_1)^2}{V},\\quad E_1=\\sum_t\\frac{n_{1t}d_t}{n_t}",
    "plain": "χ² = (O₁ − E₁)²/V",
    "symbols": "",
    "notes": "Compares survival curves of two groups.",
    "related": [
      "kaplan_meier"
    ]
  },
  {
    "id": "logistic_loglik",
    "title": "logistic regression log-likelihood",
    "field": "statistics",
    "latex": "\\ell(\\mathbf w)=\\sum_i\\big[y_i\\log p_i+(1-y_i)\\log(1-p_i)\\big],\\quad p_i=\\sigma(\\mathbf w^{\\top}\\mathbf x_i)",
    "plain": "ℓ(w) = Σ [yᵢ log pᵢ + (1 − yᵢ) log(1 − pᵢ)]",
    "symbols": "",
    "notes": "Concave in w; maximised by Newton / IRLS.",
    "related": [
      "logistic_irls",
      "binary_cross_entropy"
    ]
  },
  {
    "id": "ma1",
    "title": "MA(1) process",
    "field": "statistics",
    "latex": "x_t=\\varepsilon_t+\\theta\\varepsilon_{t-1},\\quad \\rho_1=\\frac{\\theta}{1+\\theta^2},\\ \\rho_k=0\\ (k\\ge2)",
    "plain": "xₜ = εₜ + θεₜ₋₁;  ρ₁ = θ/(1 + θ²)",
    "symbols": "",
    "notes": "",
    "related": [
      "ar1"
    ]
  },
  {
    "id": "mallows_cp",
    "title": "Mallows' Cp",
    "field": "statistics",
    "latex": "C_p=\\frac{\\mathrm{SSE}_p}{\\hat\\sigma^2}-n+2p",
    "plain": "Cp = SSE_p/σ̂² − n + 2p",
    "symbols": "",
    "notes": "A good subset model has Cp close to p.",
    "related": [
      "aic"
    ]
  },
  {
    "id": "mann_whitney_u",
    "title": "Mann–Whitney U",
    "field": "statistics",
    "latex": "U_1=R_1-\\frac{n_1(n_1+1)}{2},\\quad z=\\frac{U-n_1n_2/2}{\\sqrt{n_1n_2(n_1+n_2+1)/12}}",
    "plain": "U₁ = R₁ − n₁(n₁+1)/2;  z = (U − n₁n₂/2)/√(n₁n₂(n₁+n₂+1)/12)",
    "symbols": "R₁ = rank sum of group 1",
    "notes": "Distribution-free alternative to the two-sample t test.",
    "related": [
      "welch_t_test"
    ]
  },
  {
    "id": "map_estimate",
    "title": "maximum a posteriori (Gaussian mean, Gaussian prior)",
    "field": "statistics",
    "latex": "\\hat\\mu_{\\mathrm{MAP}}=\\frac{\\frac{n}{\\sigma^2}\\bar x+\\frac{1}{\\tau^2}\\mu_0}{\\frac{n}{\\sigma^2}+\\frac{1}{\\tau^2}}",
    "plain": "μ̂_MAP = ( (n/σ²) x̄ + μ₀/τ² ) / ( n/σ² + 1/τ² )",
    "symbols": "likelihood N(μ, σ²), prior N(μ₀, τ²), n samples with mean x̄",
    "notes": "A precision-weighted average of the data mean and the prior mean; the prior fades as n grows.",
    "related": [
      "bayes",
      "mle_gaussian",
      "l2_penalty"
    ]
  },
  {
    "id": "mle_gaussian",
    "title": "maximum likelihood estimates of a Gaussian",
    "field": "statistics",
    "latex": "\\hat\\mu=\\frac1n\\sum x_i,\\qquad \\hat\\sigma^2=\\frac1n\\sum (x_i-\\hat\\mu)^2",
    "plain": "μ̂ = (1/n) Σ xᵢ        σ̂² = (1/n) Σ (xᵢ − μ̂)²",
    "symbols": "",
    "notes": "σ̂² is biased (divides by n); see sample_variance.",
    "related": [
      "sample_variance"
    ]
  },
  {
    "id": "mcdiarmid",
    "title": "McDiarmid's inequality",
    "field": "statistics",
    "latex": "P\\big(f-\\mathbb Ef\\ge t\\big)\\le\\exp\\!\\Big(-\\frac{2t^2}{\\sum_ic_i^2}\\Big)",
    "plain": "P(f − Ef ≥ t) ≤ exp(−2t²/Σcᵢ²)",
    "symbols": "changing coordinate i alters f by at most cᵢ",
    "notes": "Bounded differences; underlies many generalisation bounds.",
    "related": [
      "hoeffding"
    ]
  },
  {
    "id": "mcnemar",
    "title": "McNemar's test",
    "field": "statistics",
    "latex": "\\chi^2=\\frac{(b-c)^2}{b+c}\\quad(\\nu=1)",
    "plain": "χ² = (b − c)²/(b + c)",
    "symbols": "b, c = discordant pairs",
    "notes": "Compares two classifiers (or paired binary outcomes) on the same test set.",
    "related": [
      "paired_t_test"
    ]
  },
  {
    "id": "median_def",
    "title": "median",
    "field": "statistics",
    "latex": "\\tilde x=\\begin{cases}x_{((n+1)/2)}&n\\text{ odd}\\\\ \\tfrac12\\big(x_{(n/2)}+x_{(n/2+1)}\\big)&n\\text{ even}\\end{cases}",
    "plain": "median = middle order statistic (average of the middle two if n is even)",
    "symbols": "x₍ᵢ₎ = i-th smallest",
    "notes": "Minimises Σ|xᵢ − c|; robust to outliers.",
    "related": [
      "sample_mean",
      "mad"
    ]
  },
  {
    "id": "mad",
    "title": "median absolute deviation",
    "field": "statistics",
    "latex": "\\mathrm{MAD}=\\operatorname{median}\\big(|x_i-\\tilde x|\\big),\\qquad \\hat\\sigma\\approx1.4826\\,\\mathrm{MAD}",
    "plain": "MAD = median(|xᵢ − median|);  σ̂ ≈ 1.4826·MAD",
    "symbols": "",
    "notes": "A robust spread; the 1.4826 factor makes it consistent with σ for normal data.",
    "related": [
      "median_def",
      "iqr"
    ]
  },
  {
    "id": "mediation",
    "title": "mediation (product of coefficients)",
    "field": "statistics",
    "latex": "\\text{indirect effect}=a\\,b,\\qquad \\text{total}=c'+ab",
    "plain": "indirect = a·b;  total = direct + indirect",
    "symbols": "a: X → M, b: M → Y given X",
    "notes": "",
    "related": [
      "ate"
    ]
  },
  {
    "id": "mde",
    "title": "minimum detectable effect",
    "field": "statistics",
    "latex": "\\mathrm{MDE}=(z_{1-\\alpha/2}+z_{1-\\beta})\\,\\sigma\\sqrt{\\frac2n}",
    "plain": "MDE = (z_{α/2} + z_β) σ √(2/n)",
    "symbols": "n per arm",
    "notes": "",
    "related": [
      "sample_size_two_means",
      "power_z_test"
    ]
  },
  {
    "id": "logistic_irls",
    "title": "Newton / IRLS step for logistic regression",
    "field": "statistics",
    "latex": "\\mathbf w\\leftarrow\\mathbf w+(X^{\\top}RX)^{-1}X^{\\top}(\\mathbf y-\\mathbf p),\\quad R=\\operatorname{diag}\\big(p_i(1-p_i)\\big)",
    "plain": "w ← w + (XᵀRX)⁻¹ Xᵀ(y − p)",
    "symbols": "",
    "notes": "Converges in a handful of iterations.",
    "related": [
      "logistic_loglik",
      "newton_method_multi"
    ]
  },
  {
    "id": "neyman_allocation",
    "title": "Neyman allocation",
    "field": "statistics",
    "latex": "n_h=n\\,\\frac{N_h S_h}{\\sum_k N_kS_k}",
    "plain": "n_h = n · N_h S_h / Σ N_k S_k",
    "symbols": "",
    "notes": "Optimal stratified sample sizes for a fixed total n.",
    "related": [
      "srs_variance"
    ]
  },
  {
    "id": "probit",
    "title": "normal quantiles (probit)",
    "field": "statistics",
    "latex": "z_p=\\Phi^{-1}(p),\\qquad P(|Z|<k)=\\operatorname{erf}\\!\\Big(\\frac k{\\sqrt2}\\Big)\\ \\ (\\approx68\\%,\\ 95\\%,\\ 99.7\\%\\text{ for }k=1,2,3)",
    "plain": "z_p = Φ⁻¹(p);  68–95–99.7 rule",
    "symbols": "",
    "notes": "z₀.₉₇₅ = 1.96, z₀.₉₅ = 1.645, z₀.₉₉₅ = 2.576.",
    "related": [
      "normal_cdf",
      "z_score"
    ]
  },
  {
    "id": "normal_normal_update",
    "title": "normal–normal conjugate update (known variance)",
    "field": "statistics",
    "latex": "\\mu\\mid x\\sim\\mathcal N\\Big(\\frac{\\mu_0/\\tau^2+n\\bar x/\\sigma^2}{1/\\tau^2+n/\\sigma^2},\\ \\Big(\\frac1{\\tau^2}+\\frac n{\\sigma^2}\\Big)^{-1}\\Big)",
    "plain": "precision-weighted mean; posterior precision = prior precision + n/σ²",
    "symbols": "prior N(μ₀, τ²), data variance σ²",
    "notes": "",
    "related": [
      "map_estimate"
    ]
  },
  {
    "id": "odds_probability",
    "title": "odds and probability",
    "field": "statistics",
    "latex": "\\text{odds}=\\frac p{1-p},\\qquad p=\\frac{\\text{odds}}{1+\\text{odds}},\\qquad \\text{log-odds}=\\ln\\frac p{1-p}",
    "plain": "odds = p/(1 − p);  p = odds/(1 + odds)",
    "symbols": "",
    "notes": "",
    "related": [
      "logit",
      "odds_ratio"
    ]
  },
  {
    "id": "odds_ratio",
    "title": "odds ratio and relative risk",
    "field": "statistics",
    "latex": "\\mathrm{OR}=\\frac{ad}{bc},\\qquad \\mathrm{RR}=\\frac{a/(a+b)}{c/(c+d)}",
    "plain": "OR = ad/(bc);  RR = (a/(a+b)) / (c/(c+d))",
    "symbols": "table [[a, b], [c, d]]: exposed (events a, none b), unexposed (events c, none d)",
    "notes": "OR approximates RR only when events are rare.",
    "related": [
      "logit"
    ]
  },
  {
    "id": "t_statistic",
    "title": "one-sample t statistic",
    "field": "statistics",
    "latex": "t=\\frac{\\bar x-\\mu_0}{s/\\sqrt n}",
    "plain": "t = (x̄ − μ₀) / (s/√n)",
    "symbols": "μ₀ = hypothesised mean; n − 1 degrees of freedom",
    "notes": "",
    "related": [
      "z_score",
      "standard_error"
    ]
  },
  {
    "id": "one_sample_z",
    "title": "one-sample z test",
    "field": "statistics",
    "latex": "z=\\frac{\\bar x-\\mu_0}{\\sigma/\\sqrt n}",
    "plain": "z = (x̄ − μ₀)/(σ/√n)",
    "symbols": "σ known",
    "notes": "",
    "related": [
      "t_statistic",
      "p_value_z"
    ]
  },
  {
    "id": "anova_f",
    "title": "one-way ANOVA F statistic",
    "field": "statistics",
    "latex": "F=\\frac{\\mathrm{SS}_B/(k-1)}{\\mathrm{SS}_W/(N-k)},\\quad \\mathrm{SS}_B=\\sum_g n_g(\\bar x_g-\\bar x)^2,\\ \\mathrm{SS}_W=\\sum_g\\sum_i(x_{gi}-\\bar x_g)^2",
    "plain": "F = (SS_B/(k−1)) / (SS_W/(N−k))",
    "symbols": "k groups, N observations",
    "notes": "",
    "related": [
      "eta_squared",
      "f_dist_mean"
    ]
  },
  {
    "id": "regression_f_stat",
    "title": "overall regression F statistic",
    "field": "statistics",
    "latex": "F=\\frac{R^2/p}{(1-R^2)/(n-p-1)}",
    "plain": "F = (R²/p) / ((1 − R²)/(n − p − 1))",
    "symbols": "p predictors",
    "notes": "",
    "related": [
      "r_squared",
      "anova_f"
    ]
  },
  {
    "id": "paired_t_test",
    "title": "paired t test",
    "field": "statistics",
    "latex": "t=\\frac{\\bar d}{s_d/\\sqrt n},\\quad d_i=x_i-y_i",
    "plain": "t = d̄ / (s_d/√n)",
    "symbols": "dᵢ = paired differences",
    "notes": "A one-sample t test on the differences.",
    "related": [
      "t_statistic"
    ]
  },
  {
    "id": "paley_zygmund",
    "title": "Paley–Zygmund inequality",
    "field": "statistics",
    "latex": "P\\big(X>\\theta\\,\\mathbb E X\\big)\\ge(1-\\theta)^2\\frac{(\\mathbb E X)^2}{\\mathbb E[X^2]}",
    "plain": "P(X > θEX) ≥ (1 − θ)² (EX)²/E[X²]",
    "symbols": "X ≥ 0, 0 ≤ θ ≤ 1",
    "notes": "A lower bound on how often X is not small.",
    "related": [
      "markov_inequality"
    ]
  },
  {
    "id": "pearson",
    "title": "Pearson correlation",
    "field": "statistics",
    "latex": "\\rho_{XY} = \\frac{\\operatorname{Cov}(X,Y)}{\\sigma_X\\,\\sigma_Y}",
    "plain": "ρ = Cov(X,Y) / (σₓ σᵧ)",
    "symbols": "ρ ∈ [−1, 1]",
    "notes": "Measures linear association only. A perfect nonlinear relationship can give ρ = 0.",
    "related": [
      "covariance",
      "r_squared"
    ]
  },
  {
    "id": "percentile",
    "title": "percentile (linear interpolation)",
    "field": "statistics",
    "latex": "x_{(p)}=x_{(\\lfloor h\\rfloor)}+(h-\\lfloor h\\rfloor)\\big(x_{(\\lfloor h\\rfloor+1)}-x_{(\\lfloor h\\rfloor)}\\big),\\quad h=1+(n-1)\\tfrac p{100}",
    "plain": "h = 1 + (n−1)p/100; interpolate between the neighbouring order statistics",
    "symbols": "",
    "notes": "The default of NumPy and R type 7.",
    "related": [
      "iqr"
    ]
  },
  {
    "id": "permutation_p",
    "title": "permutation test p-value",
    "field": "statistics",
    "latex": "p=\\frac{1+\\#\\{b:\\ T^{*}_b\\ge T_{\\text{obs}}\\}}{1+B}",
    "plain": "p = (1 + #{T*_b ≥ T_obs}) / (1 + B)",
    "symbols": "",
    "notes": "The +1 counts the observed data as one permutation, so p is never 0.",
    "related": [
      "bootstrap_se"
    ]
  },
  {
    "id": "phi_coefficient",
    "title": "phi coefficient (2×2)",
    "field": "statistics",
    "latex": "\\phi=\\frac{ad-bc}{\\sqrt{(a+b)(c+d)(a+c)(b+d)}}",
    "plain": "φ = (ad − bc)/√((a+b)(c+d)(a+c)(b+d))",
    "symbols": "2×2 table [[a, b], [c, d]]",
    "notes": "The same as the Matthews correlation coefficient.",
    "related": [
      "mcc",
      "cramers_v"
    ]
  },
  {
    "id": "poisson_loglik",
    "title": "Poisson regression log-likelihood",
    "field": "statistics",
    "latex": "\\ell=\\sum_i\\big[y_i\\log\\mu_i-\\mu_i-\\log y_i!\\big],\\quad \\mu_i=e^{\\mathbf w^{\\top}\\mathbf x_i}",
    "plain": "ℓ = Σ [yᵢ log μᵢ − μᵢ − log yᵢ!]",
    "symbols": "",
    "notes": "Log link keeps the mean positive.",
    "related": [
      "poisson",
      "glm_links"
    ]
  },
  {
    "id": "pooled_variance",
    "title": "pooled variance",
    "field": "statistics",
    "latex": "s_p^2=\\frac{(n_1-1)s_1^2+(n_2-1)s_2^2}{n_1+n_2-2}",
    "plain": "s_p² = ((n₁−1)s₁² + (n₂−1)s₂²) / (n₁ + n₂ − 2)",
    "symbols": "",
    "notes": "Assumes equal population variances.",
    "related": [
      "pooled_t_test",
      "welch_t_test"
    ]
  },
  {
    "id": "power_z_test",
    "title": "power of a one-sided z test",
    "field": "statistics",
    "latex": "\\text{power}=\\Phi\\!\\Big(\\frac{\\delta\\sqrt n}{\\sigma}-z_{1-\\alpha}\\Big)",
    "plain": "power = Φ(δ√n/σ − z_{1−α})",
    "symbols": "δ = true effect, σ = standard deviation",
    "notes": "",
    "related": [
      "type_errors",
      "sample_size_two_means"
    ]
  },
  {
    "id": "pinball_loss",
    "title": "quantile (pinball) loss",
    "field": "statistics",
    "latex": "\\rho_\\tau(u)=u\\big(\\tau-\\mathbf 1[u<0]\\big)",
    "plain": "ρ_τ(u) = u(τ − 1[u < 0]),  u = y − ŷ",
    "symbols": "",
    "notes": "Minimised by the τ-quantile; the loss of quantile regression.",
    "related": [
      "mae"
    ]
  },
  {
    "id": "random_walk",
    "title": "random walk",
    "field": "statistics",
    "latex": "x_t=x_{t-1}+\\varepsilon_t\\ \\Rightarrow\\ \\operatorname{Var}(x_t)=t\\,\\sigma^2",
    "plain": "xₜ = xₜ₋₁ + εₜ;  Var(xₜ) = tσ²",
    "symbols": "",
    "notes": "Non-stationary: variance grows linearly; difference it to get white noise.",
    "related": [
      "ar1"
    ]
  },
  {
    "id": "ratio_estimator",
    "title": "ratio estimator",
    "field": "statistics",
    "latex": "\\hat\\mu_y=\\frac{\\bar y}{\\bar x}\\,\\mu_x",
    "plain": "μ̂_y = (ȳ/x̄) μ_x",
    "symbols": "μ_x = known population mean of x",
    "notes": "Beats ȳ when x and y are strongly correlated.",
    "related": [
      "srs_variance"
    ]
  },
  {
    "id": "number_needed_to_treat",
    "title": "risk difference and number needed to treat",
    "field": "statistics",
    "latex": "\\mathrm{ARR}=p_c-p_t,\\qquad \\mathrm{NNT}=\\frac1{\\mathrm{ARR}}",
    "plain": "ARR = p_control − p_treated;  NNT = 1/ARR",
    "symbols": "",
    "notes": "",
    "related": [
      "odds_ratio"
    ]
  },
  {
    "id": "rule_of_three",
    "title": "rule of three",
    "field": "statistics",
    "latex": "\\text{0 events in }n\\text{ trials}\\ \\Rightarrow\\ p<\\frac3n\\ \\text{ with 95\\% confidence}",
    "plain": "upper 95% bound on a rate after zero events ≈ 3/n",
    "symbols": "",
    "notes": "",
    "related": [
      "wilson_interval"
    ]
  },
  {
    "id": "welford",
    "title": "running mean and variance (Welford)",
    "field": "statistics",
    "latex": "\\delta=x_n-\\bar x_{n-1},\\ \\ \\bar x_n=\\bar x_{n-1}+\\frac{\\delta}{n},\\ \\ M_n=M_{n-1}+\\delta\\,(x_n-\\bar x_n),\\ \\ s^2=\\frac{M_n}{n-1}",
    "plain": "δ = xₙ − x̄ₙ₋₁;  x̄ₙ = x̄ₙ₋₁ + δ/n;  Mₙ = Mₙ₋₁ + δ(xₙ − x̄ₙ)",
    "symbols": "",
    "notes": "One pass, numerically stable; works for streaming data.",
    "related": [
      "sample_variance"
    ]
  },
  {
    "id": "sample_covariance_matrix",
    "title": "sample covariance matrix",
    "field": "statistics",
    "latex": "S=\\frac1{n-1}\\sum_{i=1}^{n}(\\mathbf x_i-\\bar{\\mathbf x})(\\mathbf x_i-\\bar{\\mathbf x})^{\\top}",
    "plain": "S = (1/(n−1)) Σ (xᵢ − x̄)(xᵢ − x̄)ᵀ",
    "symbols": "",
    "notes": "Positive semi-definite; rank at most n − 1.",
    "related": [
      "covariance",
      "pca_objective"
    ]
  },
  {
    "id": "sample_mean",
    "title": "sample mean",
    "field": "statistics",
    "latex": "\\bar x=\\frac1n\\sum_{i=1}^{n}x_i",
    "plain": "x̄ = (1/n) Σ xᵢ",
    "symbols": "",
    "notes": "The least-squares estimate of a location: it minimises Σ(xᵢ − c)².",
    "related": [
      "weighted_mean",
      "median_def"
    ]
  },
  {
    "id": "sample_size_two_means",
    "title": "sample size for comparing two means",
    "field": "statistics",
    "latex": "n=\\frac{2\\,(z_{1-\\alpha/2}+z_{1-\\beta})^2\\,\\sigma^2}{\\delta^2}\\ \\text{per group}",
    "plain": "n = 2 (z_{1−α/2} + z_{1−β})² σ² / δ²  per group",
    "symbols": "δ = smallest difference worth detecting, σ = standard deviation",
    "notes": "z = 1.96 for α = 0.05 (two-sided), 0.8416 for 80% power.",
    "related": [
      "type_errors",
      "cohens_d"
    ]
  },
  {
    "id": "sample_size_proportion",
    "title": "sample size to estimate a proportion",
    "field": "statistics",
    "latex": "n=\\frac{z^2\\,p(1-p)}{E^2}",
    "plain": "n = z² p(1−p)/E²",
    "symbols": "E = margin of error; use p = 0.5 if unknown",
    "notes": "",
    "related": [
      "finite_population_correction"
    ]
  },
  {
    "id": "sample_variance",
    "title": "sample variance (Bessel's correction)",
    "field": "statistics",
    "latex": "s^2=\\frac{1}{n-1}\\sum_{i=1}^{n}(x_i-\\bar x)^2",
    "plain": "s² = (1/(n−1)) Σ (xᵢ − x̄)²",
    "symbols": "n − 1 makes it an unbiased estimator of σ²",
    "notes": "",
    "related": [
      "variance",
      "mle_gaussian"
    ]
  },
  {
    "id": "srm_check",
    "title": "sample-ratio mismatch check",
    "field": "statistics",
    "latex": "\\chi^2=\\sum_i\\frac{(O_i-E_i)^2}{E_i}\\ \\ \\text{against the intended allocation}",
    "plain": "χ² test on the arm sizes",
    "symbols": "",
    "notes": "A tiny p-value means the assignment is broken and results are untrustworthy.",
    "related": [
      "chi_square_gof"
    ]
  },
  {
    "id": "sprt",
    "title": "sequential probability ratio test",
    "field": "statistics",
    "latex": "\\Lambda_n=\\sum_i\\ln\\frac{f_1(x_i)}{f_0(x_i)};\\quad \\text{accept }H_1\\text{ if }\\Lambda_n\\ge\\ln\\frac{1-\\beta}\\alpha,\\quad \\text{accept }H_0\\text{ if }\\Lambda_n\\le\\ln\\frac\\beta{1-\\alpha}",
    "plain": "stop as soon as the log-likelihood ratio leaves (ln(β/(1−α)), ln((1−β)/α))",
    "symbols": "",
    "notes": "Needs on average fewer samples than any fixed-sample test of the same error rates (Wald–Wolfowitz).",
    "related": [
      "likelihood_ratio_test"
    ]
  },
  {
    "id": "exponential_smoothing",
    "title": "simple exponential smoothing",
    "field": "statistics",
    "latex": "\\hat y_{t+1}=\\alpha y_t+(1-\\alpha)\\hat y_t",
    "plain": "ŷₜ₊₁ = αyₜ + (1 − α)ŷₜ",
    "symbols": "0 < α < 1",
    "notes": "Equivalent to an exponentially weighted moving average.",
    "related": [
      "holt_linear",
      "ewma_volatility"
    ]
  },
  {
    "id": "simple_regression",
    "title": "simple linear regression",
    "field": "statistics",
    "latex": "\\hat\\beta_1=\\frac{\\sum(x_i-\\bar x)(y_i-\\bar y)}{\\sum(x_i-\\bar x)^2}=r\\frac{s_y}{s_x},\\qquad \\hat\\beta_0=\\bar y-\\hat\\beta_1\\bar x",
    "plain": "β̂₁ = Σ(xᵢ−x̄)(yᵢ−ȳ)/Σ(xᵢ−x̄)² = r·s_y/s_x;  β̂₀ = ȳ − β̂₁x̄",
    "symbols": "",
    "notes": "",
    "related": [
      "ols",
      "pearson"
    ]
  },
  {
    "id": "skewness",
    "title": "skewness",
    "field": "statistics",
    "latex": "\\gamma_1=\\mathbb E\\Big[\\Big(\\frac{X-\\mu}{\\sigma}\\Big)^3\\Big]",
    "plain": "γ₁ = E[((X − μ)/σ)³]",
    "symbols": "",
    "notes": "Zero for symmetric distributions; positive means a long right tail.",
    "related": [
      "kurtosis"
    ]
  },
  {
    "id": "slutsky",
    "title": "Slutsky's theorem",
    "field": "statistics",
    "latex": "X_n\\xrightarrow{d}X,\\ Y_n\\xrightarrow{p}c\\ \\Rightarrow\\ X_n+Y_n\\xrightarrow{d}X+c,\\ \\ X_nY_n\\xrightarrow{d}cX",
    "plain": "Xₙ → X in distribution, Yₙ → c in probability ⇒ Xₙ + Yₙ → X + c, XₙYₙ → cX",
    "symbols": "",
    "notes": "Why replacing σ by s in a z statistic is harmless for large n.",
    "related": [
      "clt_standardised_mean"
    ]
  },
  {
    "id": "spearman_rho",
    "title": "Spearman's rank correlation",
    "field": "statistics",
    "latex": "\\rho_s=1-\\frac{6\\sum_i d_i^2}{n(n^2-1)}",
    "plain": "ρ_s = 1 − 6Σdᵢ²/(n(n² − 1))",
    "symbols": "dᵢ = rank difference (no ties)",
    "notes": "Pearson correlation of the ranks; detects monotone, not just linear, relationships.",
    "related": [
      "pearson",
      "kendall_tau"
    ]
  },
  {
    "id": "standard_error_proportion",
    "title": "standard error of a proportion",
    "field": "statistics",
    "latex": "\\mathrm{SE}(\\hat p)=\\sqrt{\\frac{\\hat p(1-\\hat p)}{n}}",
    "plain": "SE = √(p̂(1 − p̂)/n)",
    "symbols": "",
    "notes": "",
    "related": [
      "wald_interval_proportion"
    ]
  },
  {
    "id": "standard_error",
    "title": "standard error of the mean",
    "field": "statistics",
    "latex": "\\mathrm{SE}(\\bar X)=\\frac{\\sigma}{\\sqrt n}",
    "plain": "SE = σ / √n",
    "symbols": "",
    "notes": "Replace σ with the sample standard deviation s when σ is unknown.",
    "related": [
      "confidence_interval_mean",
      "clt_standardised_mean"
    ]
  },
  {
    "id": "slope_standard_error",
    "title": "standard error of the regression slope",
    "field": "statistics",
    "latex": "\\mathrm{SE}(\\hat\\beta_1)=\\frac{s}{\\sqrt{\\sum(x_i-\\bar x)^2}},\\quad s^2=\\frac{\\sum(y_i-\\hat y_i)^2}{n-2}",
    "plain": "SE(β̂₁) = s/√Σ(xᵢ − x̄)²",
    "symbols": "",
    "notes": "",
    "related": [
      "simple_regression"
    ]
  },
  {
    "id": "stouffer_z",
    "title": "Stouffer's Z method",
    "field": "statistics",
    "latex": "Z=\\frac{\\sum_i w_iz_i}{\\sqrt{\\sum_i w_i^2}}",
    "plain": "Z = Σ wᵢzᵢ / √(Σ wᵢ²)",
    "symbols": "zᵢ = Φ⁻¹(1 − pᵢ); weights often √nᵢ",
    "notes": "",
    "related": [
      "fisher_combined"
    ]
  },
  {
    "id": "sufficient_statistic",
    "title": "sufficiency (Fisher–Neyman factorisation)",
    "field": "statistics",
    "latex": "f(x;\\theta)=g\\big(T(x),\\theta\\big)\\,h(x)\\ \\iff\\ T\\text{ is sufficient for }\\theta",
    "plain": "f(x; θ) = g(T(x), θ) h(x)",
    "symbols": "",
    "notes": "For i.i.d. Bernoulli data the count of successes Σ xᵢ is sufficient. Rao–Blackwell: conditioning an estimator on a sufficient statistic never increases its variance.",
    "related": [
      "likelihood_function"
    ]
  },
  {
    "id": "t_interval_small",
    "title": "t-based confidence interval",
    "field": "statistics",
    "latex": "\\bar x\\pm t_{n-1,\\,1-\\alpha/2}\\frac{s}{\\sqrt n}",
    "plain": "x̄ ± t·s/√n",
    "symbols": "",
    "notes": "Use the t quantile (2.262 for n = 10 at 95%), not 1.96, for small samples.",
    "related": [
      "confidence_interval_mean",
      "student_t_pdf"
    ]
  },
  {
    "id": "tukey_hsd",
    "title": "Tukey's HSD",
    "field": "statistics",
    "latex": "q=\\frac{\\bar x_i-\\bar x_j}{\\sqrt{\\mathrm{MS}_W/n}}",
    "plain": "q = (x̄ᵢ − x̄ⱼ)/√(MS_W/n)",
    "symbols": "n = per-group size",
    "notes": "Post-hoc pairwise comparisons after an ANOVA, controlling the family-wise error.",
    "related": [
      "anova_f",
      "holm"
    ]
  },
  {
    "id": "two_proportion_z",
    "title": "two-proportion z test",
    "field": "statistics",
    "latex": "z=\\frac{\\hat p_1-\\hat p_2}{\\sqrt{\\hat p(1-\\hat p)\\big(\\frac1{n_1}+\\frac1{n_2}\\big)}},\\quad \\hat p=\\frac{x_1+x_2}{n_1+n_2}",
    "plain": "z = (p̂₁ − p̂₂)/√(p̂(1−p̂)(1/n₁ + 1/n₂))",
    "symbols": "",
    "notes": "A/B tests on conversion rates.",
    "related": [
      "standard_error_proportion"
    ]
  },
  {
    "id": "pooled_t_test",
    "title": "two-sample t test (pooled)",
    "field": "statistics",
    "latex": "t=\\frac{\\bar x_1-\\bar x_2}{s_p\\sqrt{1/n_1+1/n_2}},\\quad \\nu=n_1+n_2-2",
    "plain": "t = (x̄₁ − x̄₂)/(s_p√(1/n₁ + 1/n₂))",
    "symbols": "",
    "notes": "Assumes equal variances.",
    "related": [
      "pooled_variance",
      "welch_t_test"
    ]
  },
  {
    "id": "p_value_z",
    "title": "two-sided p-value from a z statistic",
    "field": "statistics",
    "latex": "p=2\\big(1-\\Phi(|z|)\\big)",
    "plain": "p = 2 (1 − Φ(|z|))",
    "symbols": "Φ = standard normal cdf",
    "notes": "The probability, under the null, of a result at least this extreme. It is not the probability the null is true.",
    "related": [
      "normal_cdf",
      "t_statistic",
      "type_errors"
    ]
  },
  {
    "id": "type_errors",
    "title": "type I and II errors, and power",
    "field": "statistics",
    "latex": "\\alpha=P(\\text{reject }H_0\\mid H_0),\\quad \\beta=P(\\text{fail to reject}\\mid H_1),\\quad \\text{power}=1-\\beta",
    "plain": "α = P(reject H₀ | H₀ true);  β = P(keep H₀ | H₁ true);  power = 1 − β",
    "symbols": "",
    "notes": "Type I = false positive, type II = false negative. Lowering α lowers power unless n grows.",
    "related": [
      "p_value_z",
      "sample_size_two_means",
      "bonferroni"
    ]
  },
  {
    "id": "vif",
    "title": "variance inflation factor",
    "field": "statistics",
    "latex": "\\mathrm{VIF}_j=\\frac1{1-R_j^2}",
    "plain": "VIFⱼ = 1/(1 − Rⱼ²)",
    "symbols": "Rⱼ² = R² from regressing predictor j on the others",
    "notes": "Above about 10 signals harmful multicollinearity.",
    "related": [
      "ols"
    ]
  },
  {
    "id": "srs_variance",
    "title": "variance of a sample mean (simple random sampling)",
    "field": "statistics",
    "latex": "\\operatorname{Var}(\\bar x)=\\Big(1-\\frac nN\\Big)\\frac{S^2}n",
    "plain": "Var(x̄) = (1 − n/N) S²/n",
    "symbols": "S² = population variance (N − 1 divisor)",
    "notes": "",
    "related": [
      "finite_population_correction"
    ]
  },
  {
    "id": "combined_variance",
    "title": "variance of combined groups",
    "field": "statistics",
    "latex": "\\sigma^2=\\frac{\\sum_g n_g(\\sigma_g^2+(\\mu_g-\\mu)^2)}{\\sum_g n_g}",
    "plain": "σ² = Σ n_g (σ_g² + (μ_g − μ)²) / Σ n_g",
    "symbols": "μ = overall mean",
    "notes": "Within-group plus between-group spread.",
    "related": [
      "total_variance"
    ]
  },
  {
    "id": "wald_interval_proportion",
    "title": "Wald interval for a proportion",
    "field": "statistics",
    "latex": "\\hat p\\pm z_{1-\\alpha/2}\\sqrt{\\frac{\\hat p(1-\\hat p)}{n}}",
    "plain": "p̂ ± z√(p̂(1−p̂)/n)",
    "symbols": "",
    "notes": "Poor for small n or p near 0 or 1; prefer Wilson.",
    "related": [
      "wilson_interval"
    ]
  },
  {
    "id": "wald_test",
    "title": "Wald test",
    "field": "statistics",
    "latex": "W=\\frac{(\\hat\\theta-\\theta_0)^2}{\\widehat{\\operatorname{Var}}(\\hat\\theta)}\\ \\sim\\ \\chi^2_1",
    "plain": "W = (θ̂ − θ₀)²/Var(θ̂)",
    "symbols": "",
    "notes": "The square of a z statistic.",
    "related": [
      "likelihood_ratio_test"
    ]
  },
  {
    "id": "wls",
    "title": "weighted least squares",
    "field": "statistics",
    "latex": "\\hat\\beta=(X^{\\top}WX)^{-1}X^{\\top}W\\mathbf y,\\quad W=\\operatorname{diag}(w_i)",
    "plain": "β̂ = (XᵀWX)⁻¹ XᵀWy",
    "symbols": "wᵢ ∝ 1/Var(εᵢ)",
    "notes": "Optimal when errors are independent with unequal variances.",
    "related": [
      "ols",
      "gls"
    ]
  },
  {
    "id": "weighted_mean",
    "title": "weighted mean",
    "field": "statistics",
    "latex": "\\bar x_w=\\frac{\\sum_i w_ix_i}{\\sum_i w_i}",
    "plain": "x̄_w = Σ wᵢxᵢ / Σ wᵢ",
    "symbols": "wᵢ = weights",
    "notes": "",
    "related": [
      "sample_mean"
    ]
  },
  {
    "id": "welch_t_test",
    "title": "Welch's t test",
    "field": "statistics",
    "latex": "t=\\frac{\\bar x_1-\\bar x_2}{\\sqrt{s_1^2/n_1+s_2^2/n_2}},\\qquad \\nu\\approx\\frac{\\big(s_1^2/n_1+s_2^2/n_2\\big)^2}{\\frac{(s_1^2/n_1)^2}{n_1-1}+\\frac{(s_2^2/n_2)^2}{n_2-1}}",
    "plain": "t = (x̄₁ − x̄₂)/√(s₁²/n₁ + s₂²/n₂);  ν = Welch–Satterthwaite",
    "symbols": "",
    "notes": "Does not assume equal variances; prefer it by default.",
    "related": [
      "pooled_t_test"
    ]
  },
  {
    "id": "wilcoxon_signed_rank",
    "title": "Wilcoxon signed-rank statistic",
    "field": "statistics",
    "latex": "W=\\sum_{i:\\,d_i>0}R_i,\\qquad \\mathbb E[W]=\\frac{n(n+1)}{4},\\ \\ \\operatorname{Var}(W)=\\frac{n(n+1)(2n+1)}{24}",
    "plain": "W = Σ ranks of positive differences; E[W] = n(n+1)/4",
    "symbols": "",
    "notes": "Nonparametric paired test.",
    "related": [
      "paired_t_test"
    ]
  },
  {
    "id": "wilson_interval",
    "title": "Wilson score interval",
    "field": "statistics",
    "latex": "\\frac{\\hat p+\\frac{z^2}{2n}\\pm z\\sqrt{\\frac{\\hat p(1-\\hat p)}{n}+\\frac{z^2}{4n^2}}}{1+\\frac{z^2}n}",
    "plain": "Wilson: (p̂ + z²/2n ± z√(p̂(1−p̂)/n + z²/4n²)) / (1 + z²/n)",
    "symbols": "",
    "notes": "Behaves well for small n and extreme proportions.",
    "related": [
      "wald_interval_proportion"
    ]
  },
  {
    "id": "yule_walker",
    "title": "Yule–Walker equations (AR(2))",
    "field": "statistics",
    "latex": "\\begin{pmatrix}1&\\rho_1\\\\ \\rho_1&1\\end{pmatrix}\\begin{pmatrix}\\phi_1\\\\ \\phi_2\\end{pmatrix}=\\begin{pmatrix}\\rho_1\\\\ \\rho_2\\end{pmatrix}",
    "plain": "[[1, ρ₁], [ρ₁, 1]] [φ₁, φ₂] = [ρ₁, ρ₂]",
    "symbols": "",
    "notes": "Estimates AR coefficients from autocorrelations.",
    "related": [
      "ar1"
    ]
  },
  {
    "id": "z_score",
    "title": "z-score",
    "field": "statistics",
    "latex": "z=\\frac{x-\\mu}{\\sigma}",
    "plain": "z = (x − μ) / σ",
    "symbols": "",
    "notes": "Standardises a value to units of standard deviations from the mean.",
    "related": [
      "normal_cdf"
    ]
  },
  {
    "id": "sidak",
    "title": "Šidák correction",
    "field": "statistics",
    "latex": "\\alpha_{\\text{each}}=1-(1-\\alpha)^{1/m}",
    "plain": "α_each = 1 − (1 − α)^(1/m)",
    "symbols": "",
    "notes": "Slightly less conservative than Bonferroni (exact for independent tests).",
    "related": [
      "bonferroni",
      "holm"
    ]
  },
  {
    "id": "bhattacharyya",
    "title": "Bhattacharyya coefficient and distance",
    "field": "information",
    "latex": "\\mathrm{BC}=\\sum_x\\sqrt{p(x)q(x)},\\qquad D_B=-\\ln\\mathrm{BC}",
    "plain": "BC = Σ √(pq);  D_B = −ln BC",
    "symbols": "",
    "notes": "",
    "related": [
      "hellinger"
    ]
  },
  {
    "id": "binary_entropy",
    "title": "binary entropy",
    "field": "information",
    "latex": "H_b(p)=-p\\log p-(1-p)\\log(1-p)",
    "plain": "H(p) = −p log p − (1−p) log(1−p)",
    "symbols": "",
    "notes": "Peaks at p = ½ (1 bit).",
    "related": [
      "entropy"
    ]
  },
  {
    "id": "bits_nats",
    "title": "bits and nats",
    "field": "information",
    "latex": "1\\ \\text{nat}=\\frac1{\\ln2}\\ \\text{bits}\\approx1.4427\\ \\text{bits},\\qquad \\mathrm{PPL}=2^{H_{\\text{bits}}}=e^{H_{\\text{nats}}}",
    "plain": "bits = nats / ln 2;  PPL = 2^(bits) = e^(nats)",
    "symbols": "",
    "notes": "Most deep-learning libraries report nats; papers on compression report bits.",
    "related": [
      "perplexity"
    ]
  },
  {
    "id": "channel_capacity_bec",
    "title": "capacity of a binary erasure channel",
    "field": "information",
    "latex": "C=1-\\varepsilon",
    "plain": "C = 1 − ε",
    "symbols": "ε = erasure probability",
    "notes": "",
    "related": [
      "channel_capacity_bsc"
    ]
  },
  {
    "id": "channel_capacity_bsc",
    "title": "capacity of a binary symmetric channel",
    "field": "information",
    "latex": "C=1-H_b(p)\\ \\text{bits per use}",
    "plain": "C = 1 − H_b(p)",
    "symbols": "p = crossover probability",
    "notes": "",
    "related": [
      "binary_entropy",
      "channel_capacity_bec"
    ]
  },
  {
    "id": "entropy_chain_rule",
    "title": "chain rule for entropy",
    "field": "information",
    "latex": "H(X,Y)=H(X)+H(Y\\mid X)",
    "plain": "H(X,Y) = H(X) + H(Y|X)",
    "symbols": "",
    "notes": "Generalises to H(X₁…Xₙ) = Σ H(Xᵢ | X₁…Xᵢ₋₁): the basis of autoregressive likelihoods.",
    "related": [
      "joint_entropy",
      "conditional_entropy"
    ]
  },
  {
    "id": "chi_square_divergence",
    "title": "chi-square divergence",
    "field": "information",
    "latex": "\\chi^2(p\\|q)=\\sum_x\\frac{(p(x)-q(x))^2}{q(x)}",
    "plain": "χ²(p‖q) = Σ (p − q)²/q",
    "symbols": "",
    "notes": "",
    "related": [
      "kl_divergence"
    ]
  },
  {
    "id": "conditional_entropy",
    "title": "conditional entropy",
    "field": "information",
    "latex": "H(Y\\mid X)=H(X,Y)-H(X)",
    "plain": "H(Y|X) = H(X,Y) − H(X)",
    "symbols": "",
    "notes": "Remaining uncertainty about Y once X is known.",
    "related": [
      "mutual_information",
      "entropy"
    ]
  },
  {
    "id": "cross_entropy",
    "title": "cross-entropy",
    "field": "information",
    "latex": "H(p,q)=-\\sum_x p(x)\\log q(x)",
    "plain": "H(p,q) = −Σₓ p(x) log q(x)",
    "symbols": "p = true distribution, q = model distribution",
    "notes": "H(p,q) = H(p) + KL(p‖q). With one-hot p it is the log-loss −log q(true class).",
    "related": [
      "kl_divergence",
      "entropy",
      "softmax_cross_entropy"
    ]
  },
  {
    "id": "cross_entropy_gaussians",
    "title": "cross-entropy between Gaussians",
    "field": "information",
    "latex": "H(p,q)=\\tfrac12\\ln(2\\pi\\sigma_q^2)+\\frac{\\sigma_p^2+(\\mu_p-\\mu_q)^2}{2\\sigma_q^2}",
    "plain": "H(p, q) = ½ ln(2πσ_q²) + (σ_p² + (μ_p − μ_q)²)/(2σ_q²)",
    "symbols": "",
    "notes": "Equals h(p) + KL(p‖q).",
    "related": [
      "kl_gaussians",
      "gaussian_entropy"
    ]
  },
  {
    "id": "data_processing_inequality",
    "title": "data processing inequality",
    "field": "information",
    "latex": "X\\to Y\\to Z\\ \\Rightarrow\\ I(X;Z)\\le I(X;Y)",
    "plain": "X → Y → Z  ⇒  I(X;Z) ≤ I(X;Y)",
    "symbols": "Markov chain",
    "notes": "Processing cannot create information. Example: two binary symmetric channels in a row.",
    "related": [
      "mutual_information"
    ]
  },
  {
    "id": "gaussian_entropy",
    "title": "differential entropy of a Gaussian",
    "field": "information",
    "latex": "h(X)=\\tfrac12\\ln\\!\\big(2\\pi e\\,\\sigma^2\\big)",
    "plain": "h = ½ ln(2πe σ²)",
    "symbols": "",
    "notes": "Differential entropy can be negative.",
    "related": [
      "gaussian_pdf",
      "entropy"
    ]
  },
  {
    "id": "entropy_mvn",
    "title": "differential entropy of a multivariate Gaussian",
    "field": "information",
    "latex": "h(\\mathbf x)=\\tfrac12\\ln\\big((2\\pi e)^k|\\Sigma|\\big)",
    "plain": "h = ½ ln((2πe)ᵏ |Σ|)",
    "symbols": "k = dimension",
    "notes": "",
    "related": [
      "gaussian_entropy"
    ]
  },
  {
    "id": "entropy_rate_markov",
    "title": "entropy rate of a Markov chain",
    "field": "information",
    "latex": "H=-\\sum_i\\pi_i\\sum_jP_{ij}\\log P_{ij}",
    "plain": "H = −Σᵢ πᵢ Σⱼ Pᵢⱼ log Pᵢⱼ",
    "symbols": "π = stationary distribution",
    "notes": "",
    "related": [
      "markov_stationary"
    ]
  },
  {
    "id": "f_divergence",
    "title": "f-divergence",
    "field": "information",
    "latex": "D_f(p\\|q)=\\sum_xq(x)\\,f\\!\\Big(\\frac{p(x)}{q(x)}\\Big),\\quad f\\text{ convex},\\ f(1)=0",
    "plain": "D_f(p‖q) = Σ q f(p/q)",
    "symbols": "",
    "notes": "f(t) = t log t gives KL, ½|t − 1| gives TV, (√t − 1)² gives (twice) squared Hellinger.",
    "related": [
      "kl_divergence",
      "total_variation"
    ]
  },
  {
    "id": "fano_inequality",
    "title": "Fano's inequality",
    "field": "information",
    "latex": "H(X\\mid Y)\\le H_b(P_e)+P_e\\log(|\\mathcal X|-1)",
    "plain": "H(X|Y) ≤ H_b(Pₑ) + Pₑ log(|X| − 1)",
    "symbols": "Pₑ = error probability of any estimator of X from Y",
    "notes": "Links the error of any classifier to the information left about the label.",
    "related": [
      "binary_entropy"
    ]
  },
  {
    "id": "fisher_information",
    "title": "Fisher information",
    "field": "information",
    "latex": "I(\\theta)=\\mathbb E\\Big[\\Big(\\frac{\\partial\\ln f(X;\\theta)}{\\partial\\theta}\\Big)^2\\Big]=-\\mathbb E\\Big[\\frac{\\partial^2\\ln f(X;\\theta)}{\\partial\\theta^2}\\Big]",
    "plain": "I(θ) = E[(∂ ln f/∂θ)²] = −E[∂² ln f/∂θ²]",
    "symbols": "",
    "notes": "For n i.i.d. samples it is n·I(θ).",
    "related": [
      "fisher_information_bernoulli",
      "cramer_rao",
      "natural_gradient"
    ]
  },
  {
    "id": "fisher_gaussian",
    "title": "Fisher information of a Gaussian (μ, σ)",
    "field": "information",
    "latex": "I(\\mu,\\sigma)=\\begin{pmatrix}1/\\sigma^2&0\\\\0&2/\\sigma^2\\end{pmatrix}",
    "plain": "I(μ, σ) = diag(1/σ², 2/σ²)",
    "symbols": "",
    "notes": "",
    "related": [
      "fisher_information"
    ]
  },
  {
    "id": "hellinger",
    "title": "Hellinger distance",
    "field": "information",
    "latex": "H^2(p,q)=1-\\sum_x\\sqrt{p(x)q(x)}",
    "plain": "H²(p, q) = 1 − Σ √(p q)",
    "symbols": "",
    "notes": "A symmetric divergence between 0 and 1.",
    "related": [
      "bhattacharyya",
      "total_variation"
    ]
  },
  {
    "id": "information_bottleneck",
    "title": "information bottleneck",
    "field": "information",
    "latex": "\\min_{p(t\\mid x)}\\ I(X;T)-\\beta\\,I(T;Y)",
    "plain": "min I(X;T) − β I(T;Y)",
    "symbols": "T = compressed representation of X, β = trade-off",
    "notes": "Keep what predicts Y, forget the rest of X.",
    "related": [
      "mutual_information"
    ]
  },
  {
    "id": "surprisal",
    "title": "information content (surprisal)",
    "field": "information",
    "latex": "I(x)=-\\log_2p(x)\\ \\text{bits}",
    "plain": "I(x) = −log₂ p(x)",
    "symbols": "",
    "notes": "Entropy is the expected surprisal.",
    "related": [
      "entropy"
    ]
  },
  {
    "id": "jensen_shannon",
    "title": "Jensen–Shannon divergence",
    "field": "information",
    "latex": "\\mathrm{JS}(p,q)=\\tfrac12 D_{\\mathrm{KL}}(p\\|m)+\\tfrac12 D_{\\mathrm{KL}}(q\\|m),\\quad m=\\tfrac12(p+q)",
    "plain": "JS(p,q) = ½ KL(p‖m) + ½ KL(q‖m),   m = (p+q)/2",
    "symbols": "",
    "notes": "Symmetric and bounded by ln 2 (nats).",
    "related": [
      "kl_divergence"
    ]
  },
  {
    "id": "joint_entropy",
    "title": "joint entropy",
    "field": "information",
    "latex": "H(X,Y)=-\\sum_{x,y}p(x,y)\\log p(x,y)",
    "plain": "H(X,Y) = −Σ p(x,y) log p(x,y)",
    "symbols": "",
    "notes": "",
    "related": [
      "entropy_chain_rule"
    ]
  },
  {
    "id": "kl_mvn",
    "title": "KL divergence between multivariate Gaussians",
    "field": "information",
    "latex": "D_{\\mathrm{KL}}=\\tfrac12\\Big[\\operatorname{tr}(\\Sigma_1^{-1}\\Sigma_0)+(\\boldsymbol\\mu_1-\\boldsymbol\\mu_0)^{\\top}\\Sigma_1^{-1}(\\boldsymbol\\mu_1-\\boldsymbol\\mu_0)-k+\\ln\\frac{|\\Sigma_1|}{|\\Sigma_0|}\\Big]",
    "plain": "KL(N₀‖N₁) = ½[tr(Σ₁⁻¹Σ₀) + Δμᵀ Σ₁⁻¹ Δμ − k + ln(|Σ₁|/|Σ₀|)]",
    "symbols": "",
    "notes": "",
    "related": [
      "kl_gaussians"
    ]
  },
  {
    "id": "kl_gaussians",
    "title": "KL divergence between two Gaussians",
    "field": "information",
    "latex": "D_{\\mathrm{KL}}\\big(\\mathcal N(\\mu_1,\\sigma_1^2)\\,\\|\\,\\mathcal N(\\mu_2,\\sigma_2^2)\\big)=\\ln\\frac{\\sigma_2}{\\sigma_1}+\\frac{\\sigma_1^2+(\\mu_1-\\mu_2)^2}{2\\sigma_2^2}-\\frac12",
    "plain": "KL = ln(σ₂/σ₁) + (σ₁² + (μ₁−μ₂)²) / (2σ₂²) − ½",
    "symbols": "",
    "notes": "Closed form used in VAEs and variational inference.",
    "related": [
      "kl_divergence",
      "vae_kl"
    ]
  },
  {
    "id": "kraft_inequality",
    "title": "Kraft inequality",
    "field": "information",
    "latex": "\\sum_i2^{-\\ell_i}\\le1",
    "plain": "Σ 2^(−ℓᵢ) ≤ 1",
    "symbols": "ℓᵢ = codeword lengths",
    "notes": "A prefix code with these lengths exists iff it holds.",
    "related": [
      "source_coding_theorem"
    ]
  },
  {
    "id": "kl_divergence",
    "title": "Kullback–Leibler divergence",
    "field": "information",
    "latex": "D_{\\mathrm{KL}}(p\\,\\|\\,q)=\\sum_x p(x)\\log\\frac{p(x)}{q(x)}",
    "plain": "KL(p‖q) = Σₓ p(x) log( p(x)/q(x) )",
    "symbols": "",
    "notes": "Not symmetric and not a metric. ≥ 0, and 0 only when p = q.",
    "related": [
      "cross_entropy",
      "jensen_shannon",
      "kl_gaussians"
    ]
  },
  {
    "id": "mmd",
    "title": "maximum mean discrepancy",
    "field": "information",
    "latex": "\\mathrm{MMD}^2=\\mathbb E\\,k(x,x')+\\mathbb E\\,k(y,y')-2\\,\\mathbb E\\,k(x,y)",
    "plain": "MMD² = E k(x,x′) + E k(y,y′) − 2 E k(x,y)",
    "symbols": "k = kernel, e.g. RBF",
    "notes": "Zero iff the distributions match (for a characteristic kernel).",
    "related": [
      "rbf_kernel"
    ]
  },
  {
    "id": "maxent_distribution",
    "title": "maximum-entropy distribution",
    "field": "information",
    "latex": "\\max_pH(p)\\ \\text{s.t. }\\mathbb E[f_k]=c_k\\ \\Rightarrow\\ p(x)\\propto\\exp\\Big(\\sum_k\\lambda_kf_k(x)\\Big)",
    "plain": "p(x) ∝ exp(Σ λₖ fₖ(x))",
    "symbols": "",
    "notes": "Fixed mean and variance gives the normal; fixed mean on [0, ∞) gives the exponential; nothing fixed gives the uniform.",
    "related": [
      "entropy"
    ]
  },
  {
    "id": "min_entropy",
    "title": "min-entropy",
    "field": "information",
    "latex": "H_\\infty(X)=-\\log\\max_xp(x)",
    "plain": "H∞ = −log maxₓ p(x)",
    "symbols": "",
    "notes": "The probability of guessing the most likely outcome; used in cryptography.",
    "related": [
      "renyi_entropy"
    ]
  },
  {
    "id": "mdl",
    "title": "minimum description length",
    "field": "information",
    "latex": "\\mathrm{MDL}=L(\\text{model})+L(\\text{data}\\mid\\text{model})",
    "plain": "MDL = L(model) + L(data | model)",
    "symbols": "lengths in bits",
    "notes": "A model is good if it compresses the data including its own description. BIC is an asymptotic form.",
    "related": [
      "bic"
    ]
  },
  {
    "id": "mutual_information",
    "title": "mutual information",
    "field": "information",
    "latex": "I(X;Y)=\\sum_{x,y}p(x,y)\\log\\frac{p(x,y)}{p(x)\\,p(y)}",
    "plain": "I(X;Y) = Σ p(x,y) log( p(x,y) / (p(x)p(y)) )",
    "symbols": "",
    "notes": "Zero iff X and Y are independent. I(X;Y) = H(X) − H(X|Y).",
    "related": [
      "entropy",
      "conditional_entropy"
    ]
  },
  {
    "id": "mi_from_entropies",
    "title": "mutual information from entropies",
    "field": "information",
    "latex": "I(X;Y)=H(X)+H(Y)-H(X,Y)=H(X)-H(X\\mid Y)",
    "plain": "I(X;Y) = H(X) + H(Y) − H(X,Y)",
    "symbols": "",
    "notes": "",
    "related": [
      "mutual_information"
    ]
  },
  {
    "id": "mi_gaussian",
    "title": "mutual information of a bivariate Gaussian",
    "field": "information",
    "latex": "I(X;Y)=-\\tfrac12\\ln\\big(1-\\rho^2\\big)",
    "plain": "I(X;Y) = −½ ln(1 − ρ²)",
    "symbols": "ρ = correlation",
    "notes": "Zero at ρ = 0 and infinite at |ρ| = 1.",
    "related": [
      "pearson",
      "mutual_information"
    ]
  },
  {
    "id": "natural_gradient",
    "title": "natural gradient",
    "field": "information",
    "latex": "\\theta\\leftarrow\\theta-\\eta\\,F^{-1}\\nabla_\\theta L",
    "plain": "θ ← θ − η F⁻¹ ∇L",
    "symbols": "F = Fisher information matrix",
    "notes": "Steepest descent in the geometry of the model's distribution, invariant to reparameterisation.",
    "related": [
      "fisher_information"
    ]
  },
  {
    "id": "psnr",
    "title": "peak signal-to-noise ratio",
    "field": "information",
    "latex": "\\mathrm{PSNR}=10\\log_{10}\\frac{\\mathrm{MAX}^2}{\\mathrm{MSE}}",
    "plain": "PSNR = 10 log₁₀(MAX²/MSE)",
    "symbols": "MAX = largest pixel value (255 for 8-bit)",
    "notes": "Higher is better; common for image and video reconstruction.",
    "related": [
      "snr_db",
      "mse"
    ]
  },
  {
    "id": "perplexity",
    "title": "perplexity",
    "field": "information",
    "latex": "\\mathrm{PPL}=\\exp\\!\\Big(-\\frac1N\\sum_{i=1}^{N}\\log q(x_i)\\Big)",
    "plain": "PPL = exp( −(1/N) Σ log q(xᵢ) )",
    "symbols": "q(xᵢ) = probability the model gave the observed token",
    "notes": "The effective number of equally likely choices per token. Lower is better.",
    "related": [
      "cross_entropy"
    ]
  },
  {
    "id": "pinsker",
    "title": "Pinsker's inequality",
    "field": "information",
    "latex": "\\mathrm{TV}(p,q)\\le\\sqrt{\\tfrac12D_{\\mathrm{KL}}(p\\|q)}",
    "plain": "TV ≤ √(KL/2)  (KL in nats)",
    "symbols": "",
    "notes": "Small KL forces small TV.",
    "related": [
      "total_variation",
      "kl_divergence"
    ]
  },
  {
    "id": "rate_distortion_gaussian",
    "title": "rate–distortion function (Gaussian)",
    "field": "information",
    "latex": "R(D)=\\tfrac12\\log_2\\frac{\\sigma^2}{D}\\quad(0<D\\le\\sigma^2)",
    "plain": "R(D) = ½ log₂(σ²/D)",
    "symbols": "",
    "notes": "Bits per sample needed to describe a Gaussian to squared error D.",
    "related": [
      "shannon_hartley"
    ]
  },
  {
    "id": "renyi_entropy",
    "title": "Rényi entropy",
    "field": "information",
    "latex": "H_\\alpha(X)=\\frac1{1-\\alpha}\\log\\sum_xp(x)^\\alpha",
    "plain": "H_α = (1/(1 − α)) log Σ p(x)^α",
    "symbols": "α ≥ 0, α ≠ 1",
    "notes": "α → 1 gives Shannon, α = 2 collision entropy, α → ∞ min-entropy.",
    "related": [
      "entropy",
      "tsallis_entropy",
      "min_entropy"
    ]
  },
  {
    "id": "entropy",
    "title": "Shannon entropy",
    "field": "information",
    "latex": "H(X)=-\\sum_x p(x)\\log p(x)",
    "plain": "H(X) = −Σₓ p(x) log p(x)",
    "symbols": "log base 2 gives bits, base e gives nats",
    "notes": "Maximised by the uniform distribution (log n). Zero when the outcome is certain.",
    "related": [
      "cross_entropy",
      "binary_entropy"
    ]
  },
  {
    "id": "shannon_hartley",
    "title": "Shannon–Hartley capacity (AWGN)",
    "field": "information",
    "latex": "C=B\\log_2\\Big(1+\\frac SN\\Big)\\ \\text{bits/s}",
    "plain": "C = B log₂(1 + S/N)",
    "symbols": "B = bandwidth in Hz, S/N = signal-to-noise power ratio",
    "notes": "Per channel use: ½ log₂(1 + SNR).",
    "related": [
      "channel_capacity_bsc",
      "snr_db"
    ]
  },
  {
    "id": "snr_db",
    "title": "signal-to-noise ratio in decibels",
    "field": "information",
    "latex": "\\mathrm{SNR}_{\\mathrm{dB}}=10\\log_{10}\\frac{P_s}{P_n}=20\\log_{10}\\frac{A_s}{A_n}",
    "plain": "SNR_dB = 10 log₁₀(P_s/P_n) = 20 log₁₀(A_s/A_n)",
    "symbols": "P = power, A = amplitude",
    "notes": "",
    "related": [
      "shannon_hartley",
      "psnr"
    ]
  },
  {
    "id": "sinkhorn",
    "title": "Sinkhorn iterations (entropic optimal transport)",
    "field": "information",
    "latex": "K=e^{-C/\\varepsilon},\\quad u\\leftarrow\\frac{a}{Kv},\\quad v\\leftarrow\\frac{b}{K^{\\top}u},\\quad P=\\operatorname{diag}(u)K\\operatorname{diag}(v)",
    "plain": "K = exp(−C/ε);  u ← a/(Kv);  v ← b/(Kᵀu);  P = diag(u) K diag(v)",
    "symbols": "a, b = marginals, C = cost matrix",
    "notes": "The plan P has marginals a and b at convergence.",
    "related": [
      "wasserstein_1d"
    ]
  },
  {
    "id": "source_coding_theorem",
    "title": "source coding theorem",
    "field": "information",
    "latex": "H(X)\\le\\bar L<H(X)+1\\ \\text{bits}",
    "plain": "H(X) ≤ L̄ < H(X) + 1",
    "symbols": "L̄ = expected code length of an optimal prefix code",
    "notes": "Entropy is the compression limit. Equality when all probabilities are powers of ½.",
    "related": [
      "entropy",
      "kraft_inequality"
    ]
  },
  {
    "id": "total_variation",
    "title": "total variation distance",
    "field": "information",
    "latex": "\\mathrm{TV}(p,q)=\\tfrac12\\sum_x|p(x)-q(x)|=\\sup_A|p(A)-q(A)|",
    "plain": "TV = ½ Σ |p − q|",
    "symbols": "",
    "notes": "The largest difference in probability of any event. Bounded in [0, 1].",
    "related": [
      "kl_divergence",
      "pinsker"
    ]
  },
  {
    "id": "tsallis_entropy",
    "title": "Tsallis entropy",
    "field": "information",
    "latex": "S_q=\\frac{1-\\sum_xp(x)^q}{q-1}",
    "plain": "S_q = (1 − Σ p(x)^q)/(q − 1)",
    "symbols": "",
    "notes": "Non-extensive; q → 1 gives Shannon (in nats).",
    "related": [
      "renyi_entropy"
    ]
  },
  {
    "id": "wasserstein_1d",
    "title": "Wasserstein-1 distance (1-D)",
    "field": "information",
    "latex": "W_1(p,q)=\\int|F_p(x)-F_q(x)|\\,dx",
    "plain": "W₁ = ∫ |F_p − F_q| dx",
    "symbols": "",
    "notes": "The cost of moving mass; unlike KL it stays finite and informative for disjoint supports.",
    "related": [
      "wasserstein_gaussian"
    ]
  },
  {
    "id": "wasserstein_gaussian",
    "title": "Wasserstein-2 distance between Gaussians (1-D)",
    "field": "information",
    "latex": "W_2^2\\big(\\mathcal N(\\mu_1,\\sigma_1^2),\\mathcal N(\\mu_2,\\sigma_2^2)\\big)=(\\mu_1-\\mu_2)^2+(\\sigma_1-\\sigma_2)^2",
    "plain": "W₂² = (μ₁ − μ₂)² + (σ₁ − σ₂)²",
    "symbols": "",
    "notes": "The multivariate case adds a matrix-square-root term; used in the FID.",
    "related": [
      "wasserstein_1d",
      "fid"
    ]
  },
  {
    "id": "rotation_2d",
    "title": "2-D rotation matrix",
    "field": "linear-algebra",
    "latex": "R(\\theta)=\\begin{pmatrix}\\cos\\theta&-\\sin\\theta\\\\ \\sin\\theta&\\cos\\theta\\end{pmatrix}",
    "plain": "R(θ) = [[cos θ, −sin θ], [sin θ, cos θ]]",
    "symbols": "counter-clockwise by θ",
    "notes": "",
    "related": [
      "orthogonal_matrix",
      "rodrigues"
    ]
  },
  {
    "id": "cauchy_schwarz",
    "title": "Cauchy–Schwarz inequality",
    "field": "linear-algebra",
    "latex": "|\\mathbf x\\cdot\\mathbf y|\\le\\|\\mathbf x\\|\\,\\|\\mathbf y\\|",
    "plain": "|x·y| ≤ ‖x‖ ‖y‖",
    "symbols": "",
    "notes": "Equality iff the vectors are parallel.",
    "related": [
      "dot_product",
      "cosine_similarity"
    ]
  },
  {
    "id": "cayley_hamilton",
    "title": "Cayley–Hamilton theorem",
    "field": "linear-algebra",
    "latex": "p(A)=0,\\quad p(\\lambda)=\\det(\\lambda I-A);\\ \\ \\text{for }2\\times2:\\ A^2-\\operatorname{tr}(A)A+\\det(A)I=0",
    "plain": "A² − tr(A)A + det(A)I = 0  (2×2)",
    "symbols": "",
    "notes": "A matrix satisfies its own characteristic equation.",
    "related": [
      "eigen",
      "trace"
    ]
  },
  {
    "id": "cholesky",
    "title": "Cholesky decomposition",
    "field": "linear-algebra",
    "latex": "A=LL^{\\top}\\quad(A\\succ0,\\ L\\text{ lower triangular})",
    "plain": "A = L Lᵀ",
    "symbols": "",
    "notes": "Twice as fast as LU for symmetric positive-definite systems; used to sample from N(μ, Σ).",
    "related": [
      "lu_note",
      "qr_decomposition"
    ]
  },
  {
    "id": "condition_number",
    "title": "condition number",
    "field": "linear-algebra",
    "latex": "\\kappa(A)=\\frac{\\sigma_{\\max}(A)}{\\sigma_{\\min}(A)}",
    "plain": "κ(A) = σ_max / σ_min",
    "symbols": "",
    "notes": "Large κ: small input errors become large output errors; slows gradient descent.",
    "related": [
      "svd",
      "gd_rate_strongly_convex"
    ]
  },
  {
    "id": "conjugate_gradient",
    "title": "conjugate gradient method",
    "field": "linear-algebra",
    "latex": "\\alpha_k=\\frac{\\mathbf r_k^{\\top}\\mathbf r_k}{\\mathbf p_k^{\\top}A\\mathbf p_k},\\ \\mathbf x_{k+1}=\\mathbf x_k+\\alpha_k\\mathbf p_k,\\ \\mathbf r_{k+1}=\\mathbf r_k-\\alpha_kA\\mathbf p_k,\\ \\beta_k=\\frac{\\mathbf r_{k+1}^{\\top}\\mathbf r_{k+1}}{\\mathbf r_k^{\\top}\\mathbf r_k},\\ \\mathbf p_{k+1}=\\mathbf r_{k+1}+\\beta_k\\mathbf p_k",
    "plain": "CG: αₖ = rᵀr/(pᵀAp); x += αp; r −= αAp; β = rₙₑwᵀrₙₑw/rᵀr; p = r + βp",
    "symbols": "A symmetric positive definite",
    "notes": "Solves an n×n system in at most n steps in exact arithmetic.",
    "related": [
      "quadratic_minimizer"
    ]
  },
  {
    "id": "cosine_similarity",
    "title": "cosine similarity",
    "field": "linear-algebra",
    "latex": "\\cos\\theta=\\frac{\\mathbf x\\cdot\\mathbf y}{\\|\\mathbf x\\|\\,\\|\\mathbf y\\|}",
    "plain": "cos θ = x·y / (‖x‖‖y‖)",
    "symbols": "",
    "notes": "Ignores magnitude; 1 = same direction, 0 = orthogonal.",
    "related": [
      "dot_product",
      "infonce"
    ]
  },
  {
    "id": "cramers_rule",
    "title": "Cramer's rule",
    "field": "linear-algebra",
    "latex": "x_i=\\frac{\\det A_i}{\\det A}",
    "plain": "xᵢ = det(Aᵢ)/det(A)",
    "symbols": "Aᵢ = A with column i replaced by b",
    "notes": "Elegant, but far slower than elimination for large systems.",
    "related": [
      "determinant_2x2"
    ]
  },
  {
    "id": "cross_product",
    "title": "cross product and triple product",
    "field": "linear-algebra",
    "latex": "\\mathbf a\\times\\mathbf b=\\begin{pmatrix}a_2b_3-a_3b_2\\\\ a_3b_1-a_1b_3\\\\ a_1b_2-a_2b_1\\end{pmatrix},\\quad \\|\\mathbf a\\times\\mathbf b\\|=\\|\\mathbf a\\|\\|\\mathbf b\\|\\sin\\theta",
    "plain": "a × b = (a₂b₃ − a₃b₂, a₃b₁ − a₁b₃, a₁b₂ − a₂b₁)",
    "symbols": "",
    "notes": "The triple product a·(b×c) equals det[a b c] = the signed volume of the parallelepiped.",
    "related": [
      "dot_product"
    ]
  },
  {
    "id": "trace_cyclic",
    "title": "cyclic property of the trace",
    "field": "linear-algebra",
    "latex": "\\operatorname{tr}(AB)=\\operatorname{tr}(BA),\\qquad \\operatorname{tr}(ABC)=\\operatorname{tr}(CAB)",
    "plain": "tr(AB) = tr(BA)",
    "symbols": "",
    "notes": "Lets you rearrange quadratic forms: xᵀAx = tr(A xxᵀ).",
    "related": [
      "trace"
    ]
  },
  {
    "id": "derivative_inverse",
    "title": "derivative of a matrix inverse",
    "field": "linear-algebra",
    "latex": "\\frac{d}{dt}A(t)^{-1}=-A^{-1}\\frac{dA}{dt}A^{-1}",
    "plain": "d(A⁻¹) = −A⁻¹ (dA) A⁻¹",
    "symbols": "",
    "notes": "",
    "related": [
      "grad_logdet"
    ]
  },
  {
    "id": "determinant_2x2",
    "title": "determinant (2×2)",
    "field": "linear-algebra",
    "latex": "\\det\\begin{pmatrix}a&b\\\\c&d\\end{pmatrix}=ad-bc",
    "plain": "det = ad − bc",
    "symbols": "",
    "notes": "Zero iff the matrix is singular.",
    "related": [
      "inverse_2x2"
    ]
  },
  {
    "id": "determinant_3x3",
    "title": "determinant (3×3, rule of Sarrus)",
    "field": "linear-algebra",
    "latex": "\\det\\begin{pmatrix}a&b&c\\\\d&e&f\\\\g&h&i\\end{pmatrix}=aei+bfg+cdh-ceg-bdi-afh",
    "plain": "det = aei + bfg + cdh − ceg − bdi − afh",
    "symbols": "",
    "notes": "",
    "related": [
      "determinant_2x2"
    ]
  },
  {
    "id": "det_trace_eigen",
    "title": "determinant and trace from eigenvalues",
    "field": "linear-algebra",
    "latex": "\\det A=\\prod_i\\lambda_i,\\qquad \\operatorname{tr}A=\\sum_i\\lambda_i",
    "plain": "det A = Π λᵢ;  tr A = Σ λᵢ",
    "symbols": "",
    "notes": "",
    "related": [
      "trace",
      "eigen"
    ]
  },
  {
    "id": "kron_det",
    "title": "determinant of a Kronecker product",
    "field": "linear-algebra",
    "latex": "\\det(A\\otimes B)=\\det(A)^{m}\\det(B)^{n}\\quad(A\\in\\mathbb R^{n\\times n},\\ B\\in\\mathbb R^{m\\times m})",
    "plain": "det(A ⊗ B) = det(A)ᵐ det(B)ⁿ",
    "symbols": "",
    "notes": "",
    "related": [
      "kronecker_product"
    ]
  },
  {
    "id": "det_properties",
    "title": "determinant properties",
    "field": "linear-algebra",
    "latex": "\\det(AB)=\\det A\\det B,\\quad \\det A^{\\top}=\\det A,\\quad \\det A^{-1}=\\frac1{\\det A},\\quad \\det(cA)=c^n\\det A",
    "plain": "det(AB) = det A det B;  det(A⁻¹) = 1/det A;  det(cA) = cⁿ det A",
    "symbols": "",
    "notes": "",
    "related": [
      "determinant_2x2"
    ]
  },
  {
    "id": "dot_product",
    "title": "dot product",
    "field": "linear-algebra",
    "latex": "\\mathbf{x}\\cdot\\mathbf{y}=\\sum_i x_i y_i=\\|\\mathbf x\\|\\|\\mathbf y\\|\\cos\\theta",
    "plain": "x·y = Σ xᵢyᵢ = ‖x‖‖y‖ cos θ",
    "symbols": "θ = angle between the vectors",
    "notes": "Zero iff orthogonal.",
    "related": [
      "cosine_similarity"
    ]
  },
  {
    "id": "eckart_young",
    "title": "Eckart–Young theorem (low-rank approximation)",
    "field": "linear-algebra",
    "latex": "\\min_{\\operatorname{rank}B\\le k}\\|A-B\\|_F^2=\\sum_{i>k}\\sigma_i^2,\\quad B=U_k\\Sigma_kV_k^{\\top}",
    "plain": "‖A − A_k‖_F² = Σ_{i>k} σᵢ²",
    "symbols": "",
    "notes": "The truncated SVD is the best rank-k approximation in both Frobenius and spectral norm.",
    "related": [
      "svd",
      "pca_objective"
    ]
  },
  {
    "id": "eigen",
    "title": "eigenvalue equation",
    "field": "linear-algebra",
    "latex": "A\\mathbf v=\\lambda\\mathbf v",
    "plain": "A v = λ v",
    "symbols": "v ≠ 0 eigenvector, λ eigenvalue",
    "notes": "Eigenvalues solve det(A − λI) = 0.",
    "related": [
      "trace",
      "svd",
      "pca_objective"
    ]
  },
  {
    "id": "l2_norm",
    "title": "Euclidean (L2) norm",
    "field": "linear-algebra",
    "latex": "\\|\\mathbf x\\|_2=\\sqrt{\\sum_i x_i^2}",
    "plain": "‖x‖₂ = √(Σ xᵢ²)",
    "symbols": "",
    "notes": "",
    "related": [
      "l1_norm",
      "lp_norm"
    ]
  },
  {
    "id": "explained_variance_ratio",
    "title": "explained variance ratio",
    "field": "linear-algebra",
    "latex": "\\mathrm{EVR}_k=\\frac{\\lambda_k}{\\sum_j\\lambda_j}",
    "plain": "EVR_k = λ_k / Σⱼ λⱼ",
    "symbols": "",
    "notes": "",
    "related": [
      "pca_objective"
    ]
  },
  {
    "id": "frobenius_norm",
    "title": "Frobenius norm",
    "field": "linear-algebra",
    "latex": "\\|A\\|_F=\\sqrt{\\sum_{i,j}A_{ij}^2}=\\sqrt{\\operatorname{tr}(A^\\top A)}",
    "plain": "‖A‖_F = √(Σᵢⱼ Aᵢⱼ²)",
    "symbols": "",
    "notes": "",
    "related": [
      "spectral_norm"
    ]
  },
  {
    "id": "gershgorin",
    "title": "Gershgorin circle theorem",
    "field": "linear-algebra",
    "latex": "\\lambda\\in\\bigcup_i\\Big\\{z:\\ |z-a_{ii}|\\le\\sum_{j\\ne i}|a_{ij}|\\Big\\}",
    "plain": "every eigenvalue lies in a disc centred at aᵢᵢ with radius Σⱼ≠ᵢ |aᵢⱼ|",
    "symbols": "",
    "notes": "A quick bound on the spectrum; strict diagonal dominance implies invertibility.",
    "related": [
      "eigen"
    ]
  },
  {
    "id": "grad_linear_form",
    "title": "gradient of a linear form",
    "field": "linear-algebra",
    "latex": "\\nabla_{\\mathbf x}\\,\\mathbf a^{\\top}\\mathbf x=\\mathbf a",
    "plain": "∇ₓ aᵀx = a",
    "symbols": "",
    "notes": "",
    "related": [
      "grad_quadratic_form"
    ]
  },
  {
    "id": "grad_quadratic_form",
    "title": "gradient of a quadratic form",
    "field": "linear-algebra",
    "latex": "\\nabla_{\\mathbf x}\\,\\mathbf x^{\\top}A\\mathbf x=(A+A^{\\top})\\mathbf x",
    "plain": "∇ₓ xᵀAx = (A + Aᵀ)x",
    "symbols": "",
    "notes": "2Ax when A is symmetric.",
    "related": [
      "grad_linear_form",
      "hessian_quadratic"
    ]
  },
  {
    "id": "grad_trace",
    "title": "gradient of a trace",
    "field": "linear-algebra",
    "latex": "\\frac{\\partial}{\\partial X}\\operatorname{tr}(AX)=A^{\\top},\\qquad \\frac{\\partial}{\\partial X}\\operatorname{tr}(X^{\\top}AX)=(A+A^{\\top})X",
    "plain": "∂/∂X tr(AX) = Aᵀ;  ∂/∂X tr(XᵀAX) = (A + Aᵀ)X",
    "symbols": "",
    "notes": "",
    "related": [
      "grad_quadratic_form"
    ]
  },
  {
    "id": "grad_logdet",
    "title": "gradient of log-determinant",
    "field": "linear-algebra",
    "latex": "\\frac{\\partial}{\\partial X}\\ln\\det X=X^{-\\top}",
    "plain": "∂/∂X ln det X = X⁻ᵀ",
    "symbols": "",
    "notes": "Appears in Gaussian log-likelihoods.",
    "related": [
      "mvn_pdf"
    ]
  },
  {
    "id": "gram_matrix",
    "title": "Gram matrix",
    "field": "linear-algebra",
    "latex": "G=X^{\\top}X,\\quad G_{ij}=\\mathbf x_i\\cdot\\mathbf x_j,\\quad G\\succeq0",
    "plain": "G = XᵀX;  Gᵢⱼ = xᵢ·xⱼ",
    "symbols": "",
    "notes": "Positive semi-definite. Kernel methods work with G (or K) instead of X.",
    "related": [
      "rbf_kernel"
    ]
  },
  {
    "id": "gram_schmidt",
    "title": "Gram–Schmidt orthogonalisation",
    "field": "linear-algebra",
    "latex": "\\mathbf u_k=\\mathbf v_k-\\sum_{j<k}\\operatorname{proj}_{\\mathbf u_j}(\\mathbf v_k),\\qquad \\mathbf e_k=\\frac{\\mathbf u_k}{\\|\\mathbf u_k\\|}",
    "plain": "subtract the projections onto earlier vectors, then normalise",
    "symbols": "",
    "notes": "Classical Gram–Schmidt is unstable; use modified Gram–Schmidt or Householder QR.",
    "related": [
      "projection",
      "qr_decomposition"
    ]
  },
  {
    "id": "graph_laplacian",
    "title": "graph Laplacian",
    "field": "linear-algebra",
    "latex": "L=D-A,\\qquad \\mathbf x^{\\top}L\\mathbf x=\\sum_{(i,j)\\in E}(x_i-x_j)^2",
    "plain": "L = D − A;  xᵀLx = Σ over edges (xᵢ − xⱼ)²",
    "symbols": "D = degree matrix, A = adjacency",
    "notes": "Eigenvalue 0 for each connected component; the second-smallest eigenvalue (Fiedler value) measures connectivity.",
    "related": [
      "normalized_laplacian"
    ]
  },
  {
    "id": "hadamard_product",
    "title": "Hadamard (element-wise) product",
    "field": "linear-algebra",
    "latex": "(A\\circ B)_{ij}=A_{ij}B_{ij}",
    "plain": "(A ∘ B)ᵢⱼ = Aᵢⱼ Bᵢⱼ",
    "symbols": "",
    "notes": "Schur product theorem: the Hadamard product of two PSD matrices is PSD. Gating in LSTMs and attention masks use it.",
    "related": [
      "matrix_product"
    ]
  },
  {
    "id": "hessian_quadratic",
    "title": "Hessian of a quadratic",
    "field": "linear-algebra",
    "latex": "\\nabla^2\\Big(\\tfrac12\\mathbf x^{\\top}A\\mathbf x-\\mathbf b^{\\top}\\mathbf x\\Big)=\\tfrac12(A+A^{\\top})",
    "plain": "∇²(½xᵀAx − bᵀx) = A for symmetric A",
    "symbols": "",
    "notes": "Convex iff A is positive semi-definite.",
    "related": [
      "grad_quadratic_form"
    ]
  },
  {
    "id": "householder",
    "title": "Householder reflection",
    "field": "linear-algebra",
    "latex": "H=I-2\\frac{\\mathbf v\\mathbf v^{\\top}}{\\mathbf v^{\\top}\\mathbf v}",
    "plain": "H = I − 2vvᵀ/(vᵀv)",
    "symbols": "",
    "notes": "Orthogonal and symmetric; used in QR to zero out columns.",
    "related": [
      "qr_decomposition"
    ]
  },
  {
    "id": "induced_norms",
    "title": "induced 1- and ∞-norms",
    "field": "linear-algebra",
    "latex": "\\|A\\|_1=\\max_j\\sum_i|a_{ij}|,\\qquad \\|A\\|_\\infty=\\max_i\\sum_j|a_{ij}|",
    "plain": "‖A‖₁ = max column sum;  ‖A‖∞ = max row sum",
    "symbols": "",
    "notes": "",
    "related": [
      "spectral_norm"
    ]
  },
  {
    "id": "inverse_2x2",
    "title": "inverse (2×2)",
    "field": "linear-algebra",
    "latex": "\\begin{pmatrix}a&b\\\\c&d\\end{pmatrix}^{-1}=\\frac{1}{ad-bc}\\begin{pmatrix}d&-b\\\\-c&a\\end{pmatrix}",
    "plain": "A⁻¹ = (1/(ad−bc)) · [[d, −b], [−c, a]]",
    "symbols": "",
    "notes": "Prefer solving linear systems to forming an inverse numerically.",
    "related": [
      "determinant_2x2"
    ]
  },
  {
    "id": "jacobi_iteration",
    "title": "Jacobi and Gauss–Seidel iteration",
    "field": "linear-algebra",
    "latex": "x^{(k+1)}_i=\\frac1{a_{ii}}\\Big(b_i-\\sum_{j\\ne i}a_{ij}x^{(k)}_j\\Big);\\qquad \\text{converges iff }\\rho(M)<1",
    "plain": "xᵢ ← (bᵢ − Σⱼ≠ᵢ aᵢⱼxⱼ)/aᵢᵢ",
    "symbols": "",
    "notes": "Guaranteed for strictly diagonally dominant matrices.",
    "related": [
      "conjugate_gradient",
      "lu_note"
    ]
  },
  {
    "id": "kronecker_product",
    "title": "Kronecker product",
    "field": "linear-algebra",
    "latex": "A\\otimes B=\\begin{pmatrix}a_{11}B&\\cdots&a_{1n}B\\\\ \\vdots&\\ddots&\\vdots\\\\ a_{m1}B&\\cdots&a_{mn}B\\end{pmatrix},\\qquad (A\\otimes B)(C\\otimes D)=AC\\otimes BD",
    "plain": "(A ⊗ B)(C ⊗ D) = AC ⊗ BD",
    "symbols": "",
    "notes": "(A ⊗ B)⁻¹ = A⁻¹ ⊗ B⁻¹; eigenvalues are products λᵢ(A)μⱼ(B).",
    "related": [
      "vec_identity",
      "kron_det"
    ]
  },
  {
    "id": "l1_norm",
    "title": "L1 norm (Manhattan)",
    "field": "linear-algebra",
    "latex": "\\|\\mathbf x\\|_1=\\sum_i |x_i|",
    "plain": "‖x‖₁ = Σ |xᵢ|",
    "symbols": "",
    "notes": "Promotes sparsity when used as a penalty.",
    "related": [
      "l2_norm",
      "l1_penalty"
    ]
  },
  {
    "id": "least_squares_qr",
    "title": "least squares via QR",
    "field": "linear-algebra",
    "latex": "\\min_\\beta\\|X\\beta-\\mathbf y\\|\\ \\Rightarrow\\ R\\beta=Q^{\\top}\\mathbf y",
    "plain": "Rβ = Qᵀy",
    "symbols": "X = QR",
    "notes": "Avoids squaring the condition number as the normal equations do.",
    "related": [
      "ols",
      "qr_decomposition"
    ]
  },
  {
    "id": "lp_norm",
    "title": "Lp norm",
    "field": "linear-algebra",
    "latex": "\\|\\mathbf x\\|_p=\\Big(\\sum_i |x_i|^p\\Big)^{1/p}",
    "plain": "‖x‖ₚ = ( Σ |xᵢ|ᵖ )^(1/p)",
    "symbols": "p ≥ 1",
    "notes": "p → ∞ gives the max norm.",
    "related": [
      "l1_norm",
      "l2_norm",
      "linf_norm"
    ]
  },
  {
    "id": "lu_note",
    "title": "LU decomposition and solving",
    "field": "linear-algebra",
    "latex": "PA=LU,\\quad A\\mathbf x=\\mathbf b\\ \\Rightarrow\\ L\\mathbf y=P\\mathbf b,\\ U\\mathbf x=\\mathbf y",
    "plain": "PA = LU;  solve Ly = Pb, then Ux = y",
    "symbols": "",
    "notes": "O(n³) once, then O(n²) per right-hand side.",
    "related": [
      "cholesky"
    ]
  },
  {
    "id": "mahalanobis",
    "title": "Mahalanobis distance",
    "field": "linear-algebra",
    "latex": "d_M(\\mathbf x,\\boldsymbol\\mu)=\\sqrt{(\\mathbf x-\\boldsymbol\\mu)^{\\top}\\Sigma^{-1}(\\mathbf x-\\boldsymbol\\mu)}",
    "plain": "d_M = √((x − μ)ᵀ Σ⁻¹ (x − μ))",
    "symbols": "",
    "notes": "Distance in units of standard deviation, accounting for correlations. Σ = I gives the Euclidean distance.",
    "related": [
      "mvn_pdf",
      "l2_norm"
    ]
  },
  {
    "id": "matrix_determinant_lemma",
    "title": "matrix determinant lemma",
    "field": "linear-algebra",
    "latex": "\\det(A+\\mathbf u\\mathbf v^{\\top})=\\big(1+\\mathbf v^{\\top}A^{-1}\\mathbf u\\big)\\det A",
    "plain": "det(A + uvᵀ) = (1 + vᵀA⁻¹u) det A",
    "symbols": "",
    "notes": "",
    "related": [
      "sherman_morrison"
    ]
  },
  {
    "id": "matrix_exponential",
    "title": "matrix exponential",
    "field": "linear-algebra",
    "latex": "e^{A}=\\sum_{k=0}^{\\infty}\\frac{A^k}{k!},\\qquad \\frac{d}{dt}e^{tA}=Ae^{tA}",
    "plain": "e^A = Σ Aᵏ/k!",
    "symbols": "",
    "notes": "Solves x′ = Ax: x(t) = e^(tA) x₀.",
    "related": [
      "matrix_power_eig"
    ]
  },
  {
    "id": "matrix_power_eig",
    "title": "matrix power via eigendecomposition",
    "field": "linear-algebra",
    "latex": "A^{k}=Q\\Lambda^{k}Q^{\\top}",
    "plain": "Aᵏ = QΛᵏQᵀ",
    "symbols": "",
    "notes": "Also f(A) = Q f(Λ) Qᵀ for any function f.",
    "related": [
      "eigen_symmetric",
      "matrix_exponential"
    ]
  },
  {
    "id": "matrix_product",
    "title": "matrix product (entry)",
    "field": "linear-algebra",
    "latex": "(AB)_{ij}=\\sum_k A_{ik}B_{kj}",
    "plain": "(AB)ᵢⱼ = Σₖ Aᵢₖ Bₖⱼ",
    "symbols": "A is m×n, B is n×p, AB is m×p",
    "notes": "Not commutative in general.",
    "related": [
      "dot_product"
    ]
  },
  {
    "id": "linf_norm",
    "title": "max (L∞) norm",
    "field": "linear-algebra",
    "latex": "\\|\\mathbf x\\|_\\infty=\\max_i |x_i|",
    "plain": "‖x‖∞ = maxᵢ |xᵢ|",
    "symbols": "",
    "notes": "",
    "related": [
      "lp_norm"
    ]
  },
  {
    "id": "quadratic_minimizer",
    "title": "minimiser of a quadratic",
    "field": "linear-algebra",
    "latex": "\\min_{\\mathbf x}\\tfrac12\\mathbf x^{\\top}A\\mathbf x-\\mathbf b^{\\top}\\mathbf x\\ \\Rightarrow\\ \\mathbf x^*=A^{-1}\\mathbf b,\\quad f(\\mathbf x^*)=-\\tfrac12\\mathbf b^{\\top}A^{-1}\\mathbf b",
    "plain": "x* = A⁻¹b;  f(x*) = −½ bᵀA⁻¹b",
    "symbols": "A ≻ 0",
    "notes": "",
    "related": [
      "hessian_quadratic",
      "conjugate_gradient"
    ]
  },
  {
    "id": "pseudoinverse",
    "title": "Moore–Penrose pseudoinverse",
    "field": "linear-algebra",
    "latex": "A^{+}=V\\Sigma^{+}U^{\\top}=(A^{\\top}A)^{-1}A^{\\top}\\ (\\text{full column rank})",
    "plain": "A⁺ = VΣ⁺Uᵀ = (AᵀA)⁻¹Aᵀ",
    "symbols": "",
    "notes": "Gives the minimum-norm least-squares solution x = A⁺b.",
    "related": [
      "ols",
      "svd"
    ]
  },
  {
    "id": "normalized_laplacian",
    "title": "normalised graph Laplacian",
    "field": "linear-algebra",
    "latex": "\\mathcal L=I-D^{-1/2}AD^{-1/2}",
    "plain": "L_sym = I − D^(−1/2) A D^(−1/2)",
    "symbols": "",
    "notes": "Eigenvalues in [0, 2]. The GCN propagation matrix is a renormalised version.",
    "related": [
      "graph_laplacian",
      "gcn_propagation"
    ]
  },
  {
    "id": "nuclear_norm",
    "title": "nuclear norm",
    "field": "linear-algebra",
    "latex": "\\|A\\|_*=\\sum_i\\sigma_i(A)",
    "plain": "‖A‖_* = Σ σᵢ",
    "symbols": "",
    "notes": "The convex surrogate for rank; used in matrix completion.",
    "related": [
      "spectral_norm",
      "frobenius_norm"
    ]
  },
  {
    "id": "ols",
    "title": "ordinary least squares (normal equations)",
    "field": "linear-algebra",
    "latex": "\\hat\\beta=(X^{\\top}X)^{-1}X^{\\top}y",
    "plain": "β̂ = (XᵀX)⁻¹ Xᵀ y",
    "symbols": "X = design matrix, y = targets",
    "notes": "Minimises ‖y − Xβ‖². Solve the system; do not invert.",
    "related": [
      "ridge_regression",
      "linear_regression"
    ]
  },
  {
    "id": "orthogonal_matrix",
    "title": "orthogonal matrix",
    "field": "linear-algebra",
    "latex": "Q^{\\top}Q=QQ^{\\top}=I,\\quad \\det Q=\\pm1,\\quad \\|Q\\mathbf x\\|=\\|\\mathbf x\\|",
    "plain": "QᵀQ = I;  det Q = ±1;  ‖Qx‖ = ‖x‖",
    "symbols": "",
    "notes": "Preserves lengths and angles; all singular values equal 1, so it neither explodes nor vanishes gradients.",
    "related": [
      "rotation_2d"
    ]
  },
  {
    "id": "procrustes",
    "title": "orthogonal Procrustes",
    "field": "linear-algebra",
    "latex": "\\min_{R^{\\top}R=I}\\|RA-B\\|_F\\ \\Rightarrow\\ R=UV^{\\top},\\quad BA^{\\top}=U\\Sigma V^{\\top}",
    "plain": "R = UVᵀ where BAᵀ = UΣVᵀ",
    "symbols": "",
    "notes": "The best rotation aligning one point set to another.",
    "related": [
      "svd",
      "orthogonal_matrix"
    ]
  },
  {
    "id": "projection_matrix",
    "title": "orthogonal projection matrix",
    "field": "linear-algebra",
    "latex": "P=A(A^{\\top}A)^{-1}A^{\\top},\\quad P^2=P=P^{\\top}",
    "plain": "P = A(AᵀA)⁻¹Aᵀ;  P² = P = Pᵀ",
    "symbols": "",
    "notes": "Projects onto the column space of A; I − P projects onto its orthogonal complement.",
    "related": [
      "hat_matrix",
      "projection"
    ]
  },
  {
    "id": "pagerank",
    "title": "PageRank",
    "field": "linear-algebra",
    "latex": "\\mathbf r=d\\,M\\mathbf r+\\frac{1-d}{N}\\mathbf 1",
    "plain": "r = d M r + (1 − d)/N · 1",
    "symbols": "M = column-stochastic link matrix, d ≈ 0.85",
    "notes": "The stationary distribution of a random surfer who sometimes teleports.",
    "related": [
      "markov_stationary",
      "power_iteration"
    ]
  },
  {
    "id": "parallelogram_law",
    "title": "parallelogram law",
    "field": "linear-algebra",
    "latex": "\\|\\mathbf x+\\mathbf y\\|^2+\\|\\mathbf x-\\mathbf y\\|^2=2\\|\\mathbf x\\|^2+2\\|\\mathbf y\\|^2",
    "plain": "‖x + y‖² + ‖x − y‖² = 2‖x‖² + 2‖y‖²",
    "symbols": "",
    "notes": "Holds exactly when the norm comes from an inner product.",
    "related": [
      "l2_norm"
    ]
  },
  {
    "id": "parseval_basis",
    "title": "Parseval's identity for an orthonormal basis",
    "field": "linear-algebra",
    "latex": "\\sum_i\\langle\\mathbf x,\\mathbf e_i\\rangle^2=\\|\\mathbf x\\|^2",
    "plain": "Σ ⟨x, eᵢ⟩² = ‖x‖²",
    "symbols": "",
    "notes": "Energy is preserved by an orthonormal change of basis (and by the unitary DFT).",
    "related": [
      "dft_parseval"
    ]
  },
  {
    "id": "perron_frobenius",
    "title": "Perron–Frobenius theorem",
    "field": "linear-algebra",
    "latex": "A>0\\ \\Rightarrow\\ \\rho(A)=\\lambda_1>0\\ \\text{simple, with a positive eigenvector}",
    "plain": "positive matrix ⇒ spectral radius is a simple, positive eigenvalue with a positive eigenvector",
    "symbols": "",
    "notes": "Row-stochastic matrices have ρ = 1.",
    "related": [
      "markov_stationary"
    ]
  },
  {
    "id": "power_iteration",
    "title": "power iteration",
    "field": "linear-algebra",
    "latex": "\\mathbf v_{k+1}=\\frac{A\\mathbf v_k}{\\|A\\mathbf v_k\\|}\\ \\to\\ \\text{dominant eigenvector}",
    "plain": "vₖ₊₁ = Avₖ/‖Avₖ‖",
    "symbols": "",
    "notes": "Converges at rate |λ₂/λ₁|. The core of PageRank.",
    "related": [
      "rayleigh_quotient",
      "pagerank"
    ]
  },
  {
    "id": "pca_objective",
    "title": "principal component analysis",
    "field": "linear-algebra",
    "latex": "\\max_{\\|\\mathbf w\\|=1}\\ \\mathbf w^{\\top}\\Sigma\\,\\mathbf w\\ \\Rightarrow\\ \\mathbf w=\\text{top eigenvector of }\\Sigma",
    "plain": "max wᵀΣw  s.t. ‖w‖ = 1  →  w = top eigenvector of Σ",
    "symbols": "Σ = covariance matrix",
    "notes": "The maximum equals the largest eigenvalue: the variance captured by that direction.",
    "related": [
      "eigen",
      "svd",
      "explained_variance_ratio"
    ]
  },
  {
    "id": "projection",
    "title": "projection onto a vector",
    "field": "linear-algebra",
    "latex": "\\operatorname{proj}_{\\mathbf u}(\\mathbf v)=\\frac{\\mathbf v\\cdot\\mathbf u}{\\mathbf u\\cdot\\mathbf u}\\,\\mathbf u",
    "plain": "proj_u(v) = (v·u / u·u) u",
    "symbols": "",
    "notes": "",
    "related": [
      "dot_product"
    ]
  },
  {
    "id": "pythagorean_vectors",
    "title": "Pythagorean theorem for orthogonal vectors",
    "field": "linear-algebra",
    "latex": "\\mathbf x\\perp\\mathbf y\\ \\Rightarrow\\ \\|\\mathbf x+\\mathbf y\\|^2=\\|\\mathbf x\\|^2+\\|\\mathbf y\\|^2",
    "plain": "x ⊥ y ⇒ ‖x + y‖² = ‖x‖² + ‖y‖²",
    "symbols": "",
    "notes": "The reason uncorrelated variances add.",
    "related": [
      "dot_product"
    ]
  },
  {
    "id": "qr_decomposition",
    "title": "QR decomposition",
    "field": "linear-algebra",
    "latex": "A=QR\\quad(Q^{\\top}Q=I,\\ R\\text{ upper triangular})",
    "plain": "A = QR",
    "symbols": "",
    "notes": "The stable way to solve least squares: Rβ = Qᵀy.",
    "related": [
      "cholesky",
      "least_squares_qr"
    ]
  },
  {
    "id": "rank_nullity",
    "title": "rank–nullity theorem",
    "field": "linear-algebra",
    "latex": "\\operatorname{rank}(A)+\\operatorname{nullity}(A)=n",
    "plain": "rank(A) + nullity(A) = n",
    "symbols": "n = number of columns",
    "notes": "",
    "related": [
      "svd"
    ]
  },
  {
    "id": "rayleigh_quotient",
    "title": "Rayleigh quotient",
    "field": "linear-algebra",
    "latex": "R(\\mathbf x)=\\frac{\\mathbf x^{\\top}A\\mathbf x}{\\mathbf x^{\\top}\\mathbf x},\\quad \\lambda_{\\min}\\le R(\\mathbf x)\\le\\lambda_{\\max}",
    "plain": "R(x) = xᵀAx / xᵀx",
    "symbols": "A symmetric",
    "notes": "Its extremes are the extreme eigenvalues; the objective behind PCA.",
    "related": [
      "pca_objective",
      "power_iteration"
    ]
  },
  {
    "id": "ridge_regression",
    "title": "ridge regression (closed form)",
    "field": "linear-algebra",
    "latex": "\\hat\\beta=(X^{\\top}X+\\lambda I)^{-1}X^{\\top}y",
    "plain": "β̂ = (XᵀX + λI)⁻¹ Xᵀ y",
    "symbols": "λ ≥ 0 = penalty strength",
    "notes": "Shrinks coefficients; always invertible for λ > 0.",
    "related": [
      "ols",
      "l2_penalty"
    ]
  },
  {
    "id": "rodrigues",
    "title": "Rodrigues' rotation formula",
    "field": "linear-algebra",
    "latex": "R=I+\\sin\\theta\\,K+(1-\\cos\\theta)K^2,\\quad K=[\\mathbf k]_\\times",
    "plain": "R = I + sin θ K + (1 − cos θ) K²",
    "symbols": "k = unit axis, K = its cross-product matrix",
    "notes": "Rotation by θ about an axis in 3-D.",
    "related": [
      "rotation_2d",
      "cross_product"
    ]
  },
  {
    "id": "schatten_norm",
    "title": "Schatten p-norm",
    "field": "linear-algebra",
    "latex": "\\|A\\|_{S_p}=\\Big(\\sum_i\\sigma_i^p\\Big)^{1/p}",
    "plain": "‖A‖_Sp = (Σ σᵢᵖ)^(1/p)",
    "symbols": "",
    "notes": "p = 1 nuclear, p = 2 Frobenius, p = ∞ spectral.",
    "related": [
      "nuclear_norm"
    ]
  },
  {
    "id": "schur_complement",
    "title": "Schur complement",
    "field": "linear-algebra",
    "latex": "\\det\\begin{pmatrix}A&B\\\\C&D\\end{pmatrix}=\\det(A)\\,\\det\\big(D-CA^{-1}B\\big)",
    "plain": "det[[A, B], [C, D]] = det(A) det(D − CA⁻¹B)",
    "symbols": "D − CA⁻¹B = Schur complement of A",
    "notes": "Also appears in block matrix inversion and Gaussian conditioning.",
    "related": [
      "mvn_conditional"
    ]
  },
  {
    "id": "sherman_morrison",
    "title": "Sherman–Morrison formula",
    "field": "linear-algebra",
    "latex": "(A+\\mathbf u\\mathbf v^{\\top})^{-1}=A^{-1}-\\frac{A^{-1}\\mathbf u\\mathbf v^{\\top}A^{-1}}{1+\\mathbf v^{\\top}A^{-1}\\mathbf u}",
    "plain": "(A + uvᵀ)⁻¹ = A⁻¹ − A⁻¹uvᵀA⁻¹ / (1 + vᵀA⁻¹u)",
    "symbols": "",
    "notes": "A rank-one update of an inverse in O(n²): the heart of recursive least squares.",
    "related": [
      "woodbury"
    ]
  },
  {
    "id": "svd",
    "title": "singular value decomposition",
    "field": "linear-algebra",
    "latex": "A=U\\Sigma V^{\\top}",
    "plain": "A = U Σ Vᵀ",
    "symbols": "U, V orthogonal; Σ diagonal with σ₁ ≥ σ₂ ≥ … ≥ 0",
    "notes": "Best rank-k approximation (Eckart–Young): keep the top k singular values.",
    "related": [
      "spectral_norm",
      "pca_objective"
    ]
  },
  {
    "id": "eigen_symmetric",
    "title": "spectral decomposition (symmetric)",
    "field": "linear-algebra",
    "latex": "A=Q\\Lambda Q^{\\top},\\quad Q^{\\top}Q=I,\\ \\Lambda=\\operatorname{diag}(\\lambda_i)",
    "plain": "A = QΛQᵀ",
    "symbols": "",
    "notes": "Real eigenvalues and orthogonal eigenvectors. A is positive definite iff all λ > 0.",
    "related": [
      "eigen",
      "svd"
    ]
  },
  {
    "id": "spectral_norm",
    "title": "spectral norm",
    "field": "linear-algebra",
    "latex": "\\|A\\|_2=\\sigma_{\\max}(A)=\\sqrt{\\lambda_{\\max}(A^\\top A)}",
    "plain": "‖A‖₂ = σ_max(A) = √λ_max(AᵀA)",
    "symbols": "",
    "notes": "The largest factor by which A stretches a vector. Bounds the Lipschitz constant of a linear layer.",
    "related": [
      "svd",
      "frobenius_norm"
    ]
  },
  {
    "id": "markov_stationary",
    "title": "stationary distribution of a Markov chain",
    "field": "linear-algebra",
    "latex": "\\boldsymbol\\pi P=\\boldsymbol\\pi,\\quad \\sum_i\\pi_i=1",
    "plain": "πP = π",
    "symbols": "P = row-stochastic transition matrix",
    "notes": "The left eigenvector for eigenvalue 1. For a two-state chain π = (b, a)/(a + b) with switch rates a, b.",
    "related": [
      "pagerank",
      "entropy_rate_markov"
    ]
  },
  {
    "id": "norm_submultiplicative",
    "title": "submultiplicativity of matrix norms",
    "field": "linear-algebra",
    "latex": "\\|AB\\|\\le\\|A\\|\\,\\|B\\|",
    "plain": "‖AB‖ ≤ ‖A‖ ‖B‖",
    "symbols": "",
    "notes": "Why the product of layers' spectral norms bounds a network's Lipschitz constant.",
    "related": [
      "spectral_norm",
      "lipschitz"
    ]
  },
  {
    "id": "trace",
    "title": "trace",
    "field": "linear-algebra",
    "latex": "\\operatorname{tr}(A)=\\sum_i A_{ii}=\\sum_i\\lambda_i",
    "plain": "tr(A) = Σ Aᵢᵢ = Σ λᵢ",
    "symbols": "λᵢ = eigenvalues",
    "notes": "Cyclic: tr(ABC) = tr(BCA).",
    "related": [
      "eigen"
    ]
  },
  {
    "id": "vec_identity",
    "title": "vec identity",
    "field": "linear-algebra",
    "latex": "\\operatorname{vec}(AXB)=\\big(B^{\\top}\\otimes A\\big)\\operatorname{vec}(X)",
    "plain": "vec(AXB) = (Bᵀ ⊗ A) vec(X)",
    "symbols": "vec stacks columns",
    "notes": "Turns a matrix equation into an ordinary linear system.",
    "related": [
      "kronecker_product"
    ]
  },
  {
    "id": "weyl_inequality",
    "title": "Weyl's eigenvalue perturbation bound",
    "field": "linear-algebra",
    "latex": "|\\lambda_i(A+E)-\\lambda_i(A)|\\le\\|E\\|_2",
    "plain": "|λᵢ(A + E) − λᵢ(A)| ≤ ‖E‖₂",
    "symbols": "A, E symmetric",
    "notes": "Eigenvalues of symmetric matrices are well-conditioned.",
    "related": [
      "spectral_norm"
    ]
  },
  {
    "id": "woodbury",
    "title": "Woodbury matrix identity",
    "field": "linear-algebra",
    "latex": "(A+UCV)^{-1}=A^{-1}-A^{-1}U\\big(C^{-1}+VA^{-1}U\\big)^{-1}VA^{-1}",
    "plain": "(A + UCV)⁻¹ = A⁻¹ − A⁻¹U(C⁻¹ + VA⁻¹U)⁻¹VA⁻¹",
    "symbols": "",
    "notes": "Cheap when the update has low rank k ≪ n. Used in Gaussian processes and Kalman filters.",
    "related": [
      "sherman_morrison"
    ]
  },
  {
    "id": "ahm_inequality",
    "title": "AM–GM–HM chain",
    "field": "calculus",
    "latex": "\\min\\le\\mathrm{HM}\\le\\mathrm{GM}\\le\\mathrm{AM}\\le\\mathrm{QM}\\le\\max",
    "plain": "HM ≤ GM ≤ AM ≤ QM (quadratic mean)",
    "symbols": "",
    "notes": "",
    "related": [
      "am_gm",
      "geometric_average",
      "harmonic_mean"
    ]
  },
  {
    "id": "arithmetic_series",
    "title": "arithmetic series",
    "field": "calculus",
    "latex": "\\sum_{k=0}^{n-1}(a+kd)=\\frac n2\\big(2a+(n-1)d\\big)",
    "plain": "Σ (a + kd) = (n/2)(2a + (n − 1)d)",
    "symbols": "",
    "notes": "Gauss: 1 + 2 + … + n = n(n + 1)/2.",
    "related": [
      "sum_powers"
    ]
  },
  {
    "id": "basel_problem",
    "title": "Basel problem and related sums",
    "field": "calculus",
    "latex": "\\sum_{n=1}^\\infty\\frac1{n^2}=\\frac{\\pi^2}6,\\qquad \\sum_{n=0}^\\infty\\frac{(-1)^n}{2n+1}=\\frac\\pi4",
    "plain": "Σ 1/n² = π²/6;  Σ (−1)ⁿ/(2n + 1) = π/4",
    "symbols": "",
    "notes": "",
    "related": [
      "harmonic_series"
    ]
  },
  {
    "id": "bernoulli_inequality",
    "title": "Bernoulli's inequality",
    "field": "calculus",
    "latex": "(1+x)^n\\ge1+nx\\quad(x\\ge-1,\\ n\\ge1)",
    "plain": "(1 + x)ⁿ ≥ 1 + nx",
    "symbols": "",
    "notes": "",
    "related": [
      "binomial_theorem"
    ]
  },
  {
    "id": "beta_function",
    "title": "beta function",
    "field": "calculus",
    "latex": "B(x,y)=\\int_0^1t^{x-1}(1-t)^{y-1}dt=\\frac{\\Gamma(x)\\Gamma(y)}{\\Gamma(x+y)}",
    "plain": "B(x, y) = Γ(x)Γ(y)/Γ(x + y)",
    "symbols": "",
    "notes": "",
    "related": [
      "gamma_function",
      "beta_pdf"
    ]
  },
  {
    "id": "bisection",
    "title": "bisection and secant methods",
    "field": "calculus",
    "latex": "c=\\frac{a+b}2;\\qquad x_{n+1}=x_n-f(x_n)\\frac{x_n-x_{n-1}}{f(x_n)-f(x_{n-1})}",
    "plain": "bisection halves the bracket; secant uses a finite-difference slope",
    "symbols": "",
    "notes": "Bisection gains one bit per step; secant converges superlinearly (order ≈ 1.618).",
    "related": [
      "newton_method"
    ]
  },
  {
    "id": "cauchy_integral_formula",
    "title": "Cauchy integral formula and residues",
    "field": "calculus",
    "latex": "f(a)=\\frac1{2\\pi i}\\oint\\frac{f(z)}{z-a}dz,\\qquad \\oint f=2\\pi i\\sum\\operatorname{Res}",
    "plain": "f(a) = (1/2πi) ∮ f(z)/(z − a) dz",
    "symbols": "",
    "notes": "",
    "related": [
      "euler_identity"
    ]
  },
  {
    "id": "cauchy_schwarz_integral",
    "title": "Cauchy–Schwarz and Hölder inequalities",
    "field": "calculus",
    "latex": "\\Big|\\int fg\\Big|\\le\\|f\\|_p\\|g\\|_q,\\ \\ \\frac1p+\\frac1q=1;\\qquad p=q=2:\\ \\Big(\\int fg\\Big)^2\\le\\int f^2\\int g^2",
    "plain": "|∫fg| ≤ ‖f‖_p ‖g‖_q,  1/p + 1/q = 1",
    "symbols": "",
    "notes": "For expectations: |E[XY]| ≤ √(E[X²]E[Y²]).",
    "related": [
      "cauchy_schwarz",
      "minkowski"
    ]
  },
  {
    "id": "chain_rule",
    "title": "chain rule",
    "field": "calculus",
    "latex": "\\frac{d}{dx}f(g(x))=f'(g(x))\\,g'(x)",
    "plain": "d/dx f(g(x)) = f′(g(x)) · g′(x)",
    "symbols": "",
    "notes": "Backpropagation is the chain rule applied through a computation graph.",
    "related": [
      "backprop_delta",
      "taylor_series"
    ]
  },
  {
    "id": "jacobian_change",
    "title": "change of variables (Jacobian)",
    "field": "calculus",
    "latex": "\\int_{\\Omega}f(\\mathbf x)\\,d\\mathbf x=\\int_{\\Omega'}f(g(\\mathbf u))\\,|\\det J_g(\\mathbf u)|\\,d\\mathbf u",
    "plain": "∫ f(x) dx = ∫ f(g(u)) |det J_g(u)| du",
    "symbols": "J_g = Jacobian matrix of g",
    "notes": "Basis of normalising flows: log p(x) = log p(u) − log|det J|. Polar coordinates: dx dy = r dr dθ.",
    "related": [
      "substitution_rule",
      "flow_change_of_variables"
    ]
  },
  {
    "id": "limit_sinc",
    "title": "classic limits",
    "field": "calculus",
    "latex": "\\lim_{x\\to0}\\frac{\\sin x}{x}=1,\\quad \\lim_{n\\to\\infty}\\Big(1+\\frac1n\\Big)^n=e,\\quad \\lim_{x\\to0}\\frac{e^x-1}{x}=1",
    "plain": "sin x/x → 1;  (1 + 1/n)ⁿ → e;  (eˣ − 1)/x → 1",
    "symbols": "",
    "notes": "",
    "related": [
      "lhopital"
    ]
  },
  {
    "id": "runge_kutta4",
    "title": "classical Runge–Kutta (RK4)",
    "field": "calculus",
    "latex": "k_1=f(t,y),\\ k_2=f(t+\\tfrac h2,y+\\tfrac h2k_1),\\ k_3=f(t+\\tfrac h2,y+\\tfrac h2k_2),\\ k_4=f(t+h,y+hk_3),\\ y_{n+1}=y_n+\\tfrac h6(k_1+2k_2+2k_3+k_4)",
    "plain": "yₙ₊₁ = yₙ + (h/6)(k₁ + 2k₂ + 2k₃ + k₄)",
    "symbols": "",
    "notes": "Fourth-order accurate: global error O(h⁴).",
    "related": [
      "euler_method"
    ]
  },
  {
    "id": "de_moivre",
    "title": "De Moivre's theorem and roots of unity",
    "field": "calculus",
    "latex": "(\\cos\\theta+i\\sin\\theta)^n=\\cos n\\theta+i\\sin n\\theta,\\qquad z^n=1\\Rightarrow z=e^{2\\pi ik/n}",
    "plain": "(cos θ + i sin θ)ⁿ = cos nθ + i sin nθ",
    "symbols": "",
    "notes": "",
    "related": [
      "euler_identity"
    ]
  },
  {
    "id": "derivative_exp_log",
    "title": "derivatives of exp and log",
    "field": "calculus",
    "latex": "\\frac d{dx}e^{x}=e^x,\\quad \\frac d{dx}a^x=a^x\\ln a,\\quad \\frac d{dx}\\ln x=\\frac1x,\\quad \\frac d{dx}\\log_ax=\\frac1{x\\ln a}",
    "plain": "(eˣ)′ = eˣ;  (aˣ)′ = aˣ ln a;  (ln x)′ = 1/x",
    "symbols": "",
    "notes": "",
    "related": [
      "chain_rule"
    ]
  },
  {
    "id": "derivative_hyperbolic",
    "title": "derivatives of hyperbolic functions",
    "field": "calculus",
    "latex": "(\\sinh x)'=\\cosh x,\\quad (\\cosh x)'=\\sinh x,\\quad (\\tanh x)'=1-\\tanh^2x=\\operatorname{sech}^2x",
    "plain": "(sinh)′ = cosh;  (cosh)′ = sinh;  (tanh)′ = 1 − tanh²",
    "symbols": "",
    "notes": "The tanh derivative is why tanh activations saturate.",
    "related": [
      "tanh"
    ]
  },
  {
    "id": "derivative_sigmoid_softplus",
    "title": "derivatives of sigmoid and softplus",
    "field": "calculus",
    "latex": "\\sigma'(x)=\\sigma(x)(1-\\sigma(x)),\\qquad \\operatorname{softplus}'(x)=\\sigma(x)",
    "plain": "σ′ = σ(1 − σ);  softplus′ = σ",
    "symbols": "",
    "notes": "",
    "related": [
      "sigmoid",
      "softplus"
    ]
  },
  {
    "id": "derivative_trig",
    "title": "derivatives of trigonometric functions",
    "field": "calculus",
    "latex": "(\\sin x)'=\\cos x,\\ (\\cos x)'=-\\sin x,\\ (\\tan x)'=\\sec^2x,\\ (\\arcsin x)'=\\frac1{\\sqrt{1-x^2}},\\ (\\arctan x)'=\\frac1{1+x^2}",
    "plain": "(sin x)′ = cos x;  (cos x)′ = −sin x;  (tan x)′ = sec² x;  (arctan x)′ = 1/(1 + x²)",
    "symbols": "",
    "notes": "",
    "related": [
      "chain_rule"
    ]
  },
  {
    "id": "directional_derivative",
    "title": "directional derivative",
    "field": "calculus",
    "latex": "D_{\\mathbf u}f=\\nabla f\\cdot\\mathbf u,\\quad \\|\\mathbf u\\|=1",
    "plain": "D_u f = ∇f · u",
    "symbols": "",
    "notes": "Steepest ascent is along ∇f with rate ‖∇f‖.",
    "related": [
      "gradient_divergence_curl"
    ]
  },
  {
    "id": "divergence_theorem",
    "title": "divergence theorem and Stokes' theorem",
    "field": "calculus",
    "latex": "\\iiint_V\\nabla\\!\\cdot\\mathbf F\\,dV=\\oint_{\\partial V}\\mathbf F\\cdot d\\mathbf S,\\qquad \\iint_S(\\nabla\\times\\mathbf F)\\cdot d\\mathbf S=\\oint_{\\partial S}\\mathbf F\\cdot d\\mathbf r",
    "plain": "∭ ∇·F dV = ∯ F·dS;  ∬ (∇×F)·dS = ∮ F·dr",
    "symbols": "",
    "notes": "Green's theorem is the planar case.",
    "related": [
      "gradient_divergence_curl"
    ]
  },
  {
    "id": "erf_definition",
    "title": "error function",
    "field": "calculus",
    "latex": "\\operatorname{erf}(x)=\\frac2{\\sqrt\\pi}\\int_0^xe^{-t^2}dt,\\qquad \\Phi(x)=\\tfrac12\\big[1+\\operatorname{erf}(x/\\sqrt2)\\big]",
    "plain": "erf(x) = (2/√π) ∫₀ˣ e^(−t²) dt",
    "symbols": "",
    "notes": "",
    "related": [
      "normal_cdf"
    ]
  },
  {
    "id": "euler_method",
    "title": "Euler's method",
    "field": "calculus",
    "latex": "y_{n+1}=y_n+h\\,f(t_n,y_n)",
    "plain": "yₙ₊₁ = yₙ + h f(tₙ, yₙ)",
    "symbols": "",
    "notes": "First-order accurate: global error O(h).",
    "related": [
      "runge_kutta4"
    ]
  },
  {
    "id": "euler_maclaurin",
    "title": "Euler–Maclaurin formula",
    "field": "calculus",
    "latex": "\\sum_{k=a}^{b}f(k)=\\int_a^bf(x)\\,dx+\\frac{f(a)+f(b)}2+\\frac1{12}\\big(f^{(1)}(b)-f^{(1)}(a)\\big)-\\frac1{720}\\big(f^{(3)}(b)-f^{(3)}(a)\\big)+\\cdots",
    "plain": "Σ f(k) = ∫ f + (f(a) + f(b))/2 + (1/12)(f′(b) − f′(a)) − …",
    "symbols": "",
    "notes": "Links sums and integrals; the trapezoid rule with correction terms from Bernoulli numbers. The series is asymptotic, so start the sum where f is smooth.",
    "related": [
      "trapezoid_rule"
    ]
  },
  {
    "id": "finite_differences",
    "title": "finite differences",
    "field": "calculus",
    "latex": "f'(x)\\approx\\frac{f(x+h)-f(x)}h\\ (O(h)),\\quad \\frac{f(x+h)-f(x-h)}{2h}\\ (O(h^2)),\\quad f''(x)\\approx\\frac{f(x+h)-2f(x)+f(x-h)}{h^2}",
    "plain": "forward, central and second differences",
    "symbols": "",
    "notes": "Gradient checking in deep learning uses the central difference with h ≈ 1e-5.",
    "related": [
      "richardson"
    ]
  },
  {
    "id": "ode_linear_first",
    "title": "first-order linear ODE",
    "field": "calculus",
    "latex": "y'+p(x)y=q(x)\\ \\Rightarrow\\ y=\\frac1\\mu\\Big(\\int\\mu q\\,dx+C\\Big),\\ \\ \\mu=e^{\\int p\\,dx};\\qquad y'=ky\\Rightarrow y=y_0e^{kt}",
    "plain": "integrating factor μ = e^(∫p dx)",
    "symbols": "",
    "notes": "",
    "related": [
      "ode_second_order"
    ]
  },
  {
    "id": "sinc_fourier_pair",
    "title": "Fourier transform pairs",
    "field": "calculus",
    "latex": "\\hat f(\\xi)=\\int f(x)e^{-2\\pi ix\\xi}dx;\\quad e^{-\\pi x^2}\\leftrightarrow e^{-\\pi\\xi^2};\\ \\ \\mathbf 1_{[-\\frac12,\\frac12]}\\leftrightarrow\\operatorname{sinc}(\\xi)",
    "plain": "f̂(ξ) = ∫ f(x) e^(−2πixξ) dx;  Gaussian ↔ Gaussian;  box ↔ sinc",
    "symbols": "",
    "notes": "A narrow function has a wide spectrum (uncertainty principle).",
    "related": [
      "dft",
      "convolution_theorem"
    ]
  },
  {
    "id": "fundamental_theorem",
    "title": "fundamental theorem of calculus",
    "field": "calculus",
    "latex": "\\int_a^bf'(x)\\,dx=f(b)-f(a),\\qquad \\frac d{dx}\\int_a^xf(t)\\,dt=f(x)",
    "plain": "∫ₐᵇ f′ = f(b) − f(a)",
    "symbols": "",
    "notes": "",
    "related": [
      "integration_by_parts"
    ]
  },
  {
    "id": "gamma_function",
    "title": "gamma function",
    "field": "calculus",
    "latex": "\\Gamma(z)=\\int_0^\\infty t^{z-1}e^{-t}\\,dt,\\quad \\Gamma(z+1)=z\\,\\Gamma(z),\\quad \\Gamma(n)=(n-1)!,\\quad \\Gamma(\\tfrac12)=\\sqrt\\pi",
    "plain": "Γ(z) = ∫ t^(z−1) e^(−t) dt;  Γ(z + 1) = zΓ(z);  Γ(n) = (n − 1)!",
    "symbols": "",
    "notes": "The factorial for real numbers.",
    "related": [
      "beta_function",
      "stirling"
    ]
  },
  {
    "id": "gaussian_integrals",
    "title": "Gaussian integrals",
    "field": "calculus",
    "latex": "\\int_{-\\infty}^{\\infty}e^{-ax^2}dx=\\sqrt{\\frac\\pi a},\\quad \\int_{-\\infty}^{\\infty}x^2e^{-ax^2}dx=\\frac{\\sqrt\\pi}{2a^{3/2}}",
    "plain": "∫ e^(−ax²) dx = √(π/a);  ∫ x² e^(−ax²) dx = √π/(2a^(3/2))",
    "symbols": "",
    "notes": "",
    "related": [
      "gaussian_integral"
    ]
  },
  {
    "id": "binomial_series",
    "title": "generalised binomial series",
    "field": "calculus",
    "latex": "(1+x)^\\alpha=\\sum_{k=0}^{\\infty}\\binom\\alpha kx^k\\quad(|x|<1),\\qquad \\binom\\alpha k=\\frac{\\alpha(\\alpha-1)\\cdots(\\alpha-k+1)}{k!}",
    "plain": "(1 + x)^α = Σ C(α, k) xᵏ",
    "symbols": "",
    "notes": "First-order: (1 + x)^α ≈ 1 + αx.",
    "related": [
      "binomial_theorem"
    ]
  },
  {
    "id": "gradient_divergence_curl",
    "title": "gradient, divergence and curl",
    "field": "calculus",
    "latex": "\\nabla f=\\Big(\\frac{\\partial f}{\\partial x_i}\\Big),\\quad \\nabla\\!\\cdot\\mathbf F=\\sum_i\\frac{\\partial F_i}{\\partial x_i},\\quad \\nabla\\times\\mathbf F=\\Big(\\partial_yF_z-\\partial_zF_y,\\ \\partial_zF_x-\\partial_xF_z,\\ \\partial_xF_y-\\partial_yF_x\\Big)",
    "plain": "∇f, ∇·F, ∇×F",
    "symbols": "",
    "notes": "Laplacian: ∇²f = ∇·∇f.",
    "related": [
      "divergence_theorem"
    ]
  },
  {
    "id": "harmonic_series",
    "title": "harmonic numbers",
    "field": "calculus",
    "latex": "H_n=\\sum_{k=1}^n\\frac1k\\approx\\ln n+\\gamma+\\frac1{2n},\\quad \\gamma\\approx0.5772",
    "plain": "Hₙ = Σ 1/k ≈ ln n + γ + 1/(2n)",
    "symbols": "",
    "notes": "Diverges, but only logarithmically. The coupon-collector expectation is nHₙ.",
    "related": [
      "coupon_collector"
    ]
  },
  {
    "id": "hessian_matrix",
    "title": "Hessian matrix and second-derivative test",
    "field": "calculus",
    "latex": "H_{ij}=\\frac{\\partial^2f}{\\partial x_i\\partial x_j};\\quad \\nabla f=0,\\ H\\succ0\\Rightarrow\\text{local minimum}",
    "plain": "Hᵢⱼ = ∂²f/∂xᵢ∂xⱼ;  ∇f = 0 and H ≻ 0 ⇒ local minimum",
    "symbols": "",
    "notes": "Eigenvalues of H give the curvature along principal directions; a mix of signs means a saddle.",
    "related": [
      "newton_method_multi"
    ]
  },
  {
    "id": "implicit_differentiation",
    "title": "implicit differentiation",
    "field": "calculus",
    "latex": "F(x,y)=0\\ \\Rightarrow\\ \\frac{dy}{dx}=-\\frac{F_x}{F_y}",
    "plain": "dy/dx = −F_x/F_y",
    "symbols": "",
    "notes": "",
    "related": [
      "chain_rule"
    ]
  },
  {
    "id": "integral_power",
    "title": "integral of a power",
    "field": "calculus",
    "latex": "\\int x^n\\,dx=\\frac{x^{n+1}}{n+1}+C\\ (n\\ne-1),\\qquad \\int\\frac{dx}{x}=\\ln|x|+C",
    "plain": "∫ xⁿ dx = xⁿ⁺¹/(n + 1) + C;  ∫ dx/x = ln|x| + C",
    "symbols": "",
    "notes": "",
    "related": [
      "integral_exp_trig"
    ]
  },
  {
    "id": "integral_exp_trig",
    "title": "integrals of exp and trigonometric functions",
    "field": "calculus",
    "latex": "\\int e^{ax}dx=\\frac{e^{ax}}a,\\ \\int\\sin x\\,dx=-\\cos x,\\ \\int\\cos x\\,dx=\\sin x,\\ \\int\\frac{dx}{1+x^2}=\\arctan x",
    "plain": "∫ e^(ax) = e^(ax)/a;  ∫ sin = −cos;  ∫ cos = sin;  ∫ 1/(1 + x²) = arctan x",
    "symbols": "",
    "notes": "",
    "related": [
      "integral_power"
    ]
  },
  {
    "id": "integration_by_parts",
    "title": "integration by parts",
    "field": "calculus",
    "latex": "\\int u\\,dv=uv-\\int v\\,du",
    "plain": "∫ u dv = uv − ∫ v du",
    "symbols": "",
    "notes": "Example: ∫ x eˣ dx = (x − 1)eˣ + C.",
    "related": [
      "substitution_rule"
    ]
  },
  {
    "id": "jacobian_matrix",
    "title": "Jacobian matrix",
    "field": "calculus",
    "latex": "J_{ij}=\\frac{\\partial f_i}{\\partial x_j}",
    "plain": "Jᵢⱼ = ∂fᵢ/∂xⱼ",
    "symbols": "",
    "notes": "The best linear approximation of a vector function; backpropagation multiplies Jacobians.",
    "related": [
      "chain_rule_multivariate"
    ]
  },
  {
    "id": "lhopital",
    "title": "L'Hôpital's rule",
    "field": "calculus",
    "latex": "\\lim_{x\\to a}\\frac{f(x)}{g(x)}=\\lim_{x\\to a}\\frac{f'(x)}{g'(x)}\\quad\\text{(for }0/0\\text{ or }\\infty/\\infty)",
    "plain": "lim f/g = lim f′/g′",
    "symbols": "",
    "notes": "",
    "related": [
      "limit_sinc"
    ]
  },
  {
    "id": "lagrange_interpolation",
    "title": "Lagrange interpolation",
    "field": "calculus",
    "latex": "p(x)=\\sum_{i}y_i\\prod_{j\\ne i}\\frac{x-x_j}{x_i-x_j}",
    "plain": "p(x) = Σ yᵢ Π_{j≠i} (x − xⱼ)/(xᵢ − xⱼ)",
    "symbols": "",
    "notes": "The unique degree-n polynomial through n + 1 points.",
    "related": [
      "newton_divided_difference"
    ]
  },
  {
    "id": "laplace_transform",
    "title": "Laplace transform pairs",
    "field": "calculus",
    "latex": "\\mathcal L\\{f\\}(s)=\\int_0^\\infty f(t)e^{-st}dt;\\ \\ \\mathcal L\\{1\\}=\\frac1s,\\ \\mathcal L\\{e^{at}\\}=\\frac1{s-a},\\ \\mathcal L\\{t^n\\}=\\frac{n!}{s^{n+1}},\\ \\mathcal L\\{\\sin\\omega t\\}=\\frac\\omega{s^2+\\omega^2}",
    "plain": "L{1} = 1/s;  L{eᵃᵗ} = 1/(s − a);  L{tⁿ} = n!/sⁿ⁺¹;  L{sin ωt} = ω/(s² + ω²)",
    "symbols": "",
    "notes": "",
    "related": [
      "ode_linear_first"
    ]
  },
  {
    "id": "leibniz_integral_rule",
    "title": "Leibniz integral rule",
    "field": "calculus",
    "latex": "\\frac d{dt}\\int_{a(t)}^{b(t)}f(x,t)\\,dx=f(b,t)b'-f(a,t)a'+\\int_{a}^{b}\\frac{\\partial f}{\\partial t}dx",
    "plain": "differentiate under the integral sign",
    "symbols": "",
    "notes": "",
    "related": [
      "fundamental_theorem"
    ]
  },
  {
    "id": "mean_value_theorem",
    "title": "mean value theorem",
    "field": "calculus",
    "latex": "f'(c)=\\frac{f(b)-f(a)}{b-a}\\ \\text{for some }c\\in(a,b)",
    "plain": "f′(c) = (f(b) − f(a))/(b − a)",
    "symbols": "",
    "notes": "",
    "related": [
      "taylor_series"
    ]
  },
  {
    "id": "minkowski",
    "title": "Minkowski inequality (triangle inequality in Lp)",
    "field": "calculus",
    "latex": "\\|f+g\\|_p\\le\\|f\\|_p+\\|g\\|_p\\quad(p\\ge1)",
    "plain": "‖f + g‖_p ≤ ‖f‖_p + ‖g‖_p",
    "symbols": "",
    "notes": "",
    "related": [
      "lp_norm"
    ]
  },
  {
    "id": "chain_rule_multivariate",
    "title": "multivariable chain rule",
    "field": "calculus",
    "latex": "\\frac{\\partial z}{\\partial t}=\\sum_i\\frac{\\partial z}{\\partial x_i}\\frac{\\partial x_i}{\\partial t},\\qquad J_{f\\circ g}=J_f(g)\\,J_g",
    "plain": "∂z/∂t = Σ (∂z/∂xᵢ)(∂xᵢ/∂t);  J_{f∘g} = J_f J_g",
    "symbols": "",
    "notes": "",
    "related": [
      "jacobian_matrix",
      "chain_rule"
    ]
  },
  {
    "id": "cubic_spline_condition",
    "title": "natural cubic spline conditions",
    "field": "calculus",
    "latex": "S\\in C^2,\\ \\ S_i(x_i)=y_i,\\ \\ S''(x_0)=S''(x_n)=0",
    "plain": "piecewise cubics with continuous value, slope and curvature",
    "symbols": "",
    "notes": "",
    "related": [
      "lagrange_interpolation"
    ]
  },
  {
    "id": "newton_divided_difference",
    "title": "Newton divided differences",
    "field": "calculus",
    "latex": "p(x)=f[x_0]+f[x_0,x_1](x-x_0)+f[x_0,x_1,x_2](x-x_0)(x-x_1)+\\cdots,\\quad f[x_i,x_j]=\\frac{f_j-f_i}{x_j-x_i}",
    "plain": "p(x) = f[x₀] + f[x₀,x₁](x − x₀) + …",
    "symbols": "",
    "notes": "",
    "related": [
      "lagrange_interpolation"
    ]
  },
  {
    "id": "newton_method_multi",
    "title": "Newton's method (multivariate)",
    "field": "calculus",
    "latex": "\\mathbf x\\leftarrow\\mathbf x-H^{-1}\\nabla f",
    "plain": "x ← x − H⁻¹ ∇f",
    "symbols": "",
    "notes": "Quadratic convergence near a minimiser; one step solves a quadratic exactly.",
    "related": [
      "newton_method",
      "hessian_matrix"
    ]
  },
  {
    "id": "newton_method",
    "title": "Newton's method (root finding)",
    "field": "calculus",
    "latex": "x_{n+1}=x_n-\\frac{f(x_n)}{f'(x_n)}",
    "plain": "xₙ₊₁ = xₙ − f(xₙ)/f′(xₙ)",
    "symbols": "",
    "notes": "For minimisation apply it to f′: x ← x − f′/f″. Converges quadratically near a simple root.",
    "related": [
      "taylor_series"
    ]
  },
  {
    "id": "power_rule",
    "title": "power rule",
    "field": "calculus",
    "latex": "\\frac{d}{dx}x^n=n\\,x^{n-1}",
    "plain": "d/dx xⁿ = n xⁿ⁻¹",
    "symbols": "",
    "notes": "Holds for any real n.",
    "related": [
      "product_rule"
    ]
  },
  {
    "id": "product_rule",
    "title": "product rule",
    "field": "calculus",
    "latex": "(fg)'=f'g+fg'",
    "plain": "(fg)′ = f′g + fg′",
    "symbols": "",
    "notes": "",
    "related": [
      "quotient_rule",
      "chain_rule"
    ]
  },
  {
    "id": "quotient_rule",
    "title": "quotient rule",
    "field": "calculus",
    "latex": "\\Big(\\frac fg\\Big)'=\\frac{f'g-fg'}{g^2}",
    "plain": "(f/g)′ = (f′g − fg′)/g²",
    "symbols": "",
    "notes": "",
    "related": [
      "product_rule"
    ]
  },
  {
    "id": "ratio_test",
    "title": "ratio and root tests",
    "field": "calculus",
    "latex": "L=\\lim\\Big|\\frac{a_{n+1}}{a_n}\\Big|\\ \\text{or}\\ \\lim|a_n|^{1/n}:\\ L<1\\Rightarrow\\text{converges},\\ L>1\\Rightarrow\\text{diverges}",
    "plain": "L = lim |aₙ₊₁/aₙ| : L < 1 converges, L > 1 diverges",
    "symbols": "",
    "notes": "",
    "related": [
      "geometric_series"
    ]
  },
  {
    "id": "richardson",
    "title": "Richardson extrapolation",
    "field": "calculus",
    "latex": "D\\approx\\frac{4D(h/2)-D(h)}{3}\\quad(\\text{cancels the }h^2\\text{ term})",
    "plain": "D ≈ (4D(h/2) − D(h))/3",
    "symbols": "",
    "notes": "",
    "related": [
      "finite_differences"
    ]
  },
  {
    "id": "ode_second_order",
    "title": "second-order linear ODE with constant coefficients",
    "field": "calculus",
    "latex": "ay''+by'+cy=0:\\ r=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a};\\ \\ y=C_1e^{r_1x}+C_2e^{r_2x}",
    "plain": "characteristic roots r = (−b ± √(b² − 4ac))/2a",
    "symbols": "",
    "notes": "Complex roots α ± iβ give e^(αx)(C₁ cos βx + C₂ sin βx): damped oscillation.",
    "related": [
      "ode_linear_first"
    ]
  },
  {
    "id": "taylor_standard_series",
    "title": "standard Taylor (Maclaurin) series",
    "field": "calculus",
    "latex": "e^x=\\sum\\frac{x^n}{n!},\\ \\sin x=\\sum\\frac{(-1)^nx^{2n+1}}{(2n+1)!},\\ \\cos x=\\sum\\frac{(-1)^nx^{2n}}{(2n)!},\\ \\ln(1+x)=\\sum\\frac{(-1)^{n+1}x^n}{n},\\ \\frac1{1-x}=\\sum x^n",
    "plain": "eˣ, sin, cos, ln(1 + x), 1/(1 − x), (1 + x)^α",
    "symbols": "",
    "notes": "ln(1 + x) and 1/(1 − x) need |x| < 1; the others hold for all x.",
    "related": [
      "taylor_series"
    ]
  },
  {
    "id": "substitution_rule",
    "title": "substitution (change of variables)",
    "field": "calculus",
    "latex": "\\int_a^bf(g(x))\\,g'(x)\\,dx=\\int_{g(a)}^{g(b)}f(u)\\,du",
    "plain": "∫ f(g(x)) g′(x) dx = ∫ f(u) du",
    "symbols": "",
    "notes": "",
    "related": [
      "jacobian_change"
    ]
  },
  {
    "id": "sum_powers",
    "title": "sums of powers of integers",
    "field": "calculus",
    "latex": "\\sum_{k=1}^nk=\\frac{n(n+1)}2,\\quad \\sum k^2=\\frac{n(n+1)(2n+1)}6,\\quad \\sum k^3=\\Big(\\frac{n(n+1)}2\\Big)^2",
    "plain": "Σk = n(n+1)/2;  Σk² = n(n+1)(2n+1)/6;  Σk³ = (n(n+1)/2)²",
    "symbols": "",
    "notes": "",
    "related": [
      "arithmetic_series"
    ]
  },
  {
    "id": "lagrange_error",
    "title": "Taylor remainder (Lagrange form)",
    "field": "calculus",
    "latex": "R_n(x)=\\frac{f^{(n+1)}(\\xi)}{(n+1)!}(x-a)^{n+1}\\ \\text{for some }\\xi\\text{ between }a,x",
    "plain": "Rₙ(x) = f⁽ⁿ⁺¹⁾(ξ)/(n + 1)! · (x − a)ⁿ⁺¹",
    "symbols": "",
    "notes": "Bounds the error of a Taylor polynomial.",
    "related": [
      "taylor_series"
    ]
  },
  {
    "id": "taylor_series",
    "title": "Taylor series",
    "field": "calculus",
    "latex": "f(x)\\approx\\sum_{n=0}^{N}\\frac{f^{(n)}(a)}{n!}(x-a)^n",
    "plain": "f(x) ≈ Σₙ f⁽ⁿ⁾(a) (x−a)ⁿ / n!",
    "symbols": "expansion about a",
    "notes": "Remainder is O((x−a)^(N+1)).",
    "related": [
      "chain_rule",
      "newton_method"
    ]
  },
  {
    "id": "trapezoid_rule",
    "title": "trapezoid and Simpson's rules",
    "field": "calculus",
    "latex": "\\int_a^bf\\approx\\frac h2\\Big[f(a)+2\\sum_{i=1}^{n-1}f(x_i)+f(b)\\Big],\\qquad \\int_a^bf\\approx\\frac h3\\Big[f_0+4f_1+2f_2+\\cdots+4f_{n-1}+f_n\\Big]",
    "plain": "trapezoid: h/2 [f₀ + 2Σfᵢ + fₙ];  Simpson: h/3 [f₀ + 4f₁ + 2f₂ + … + fₙ]",
    "symbols": "",
    "notes": "Errors O(h²) and O(h⁴).",
    "related": [
      "euler_maclaurin"
    ]
  },
  {
    "id": "triangle_inequality",
    "title": "triangle inequality",
    "field": "calculus",
    "latex": "|a+b|\\le|a|+|b|,\\qquad \\big||a|-|b|\\big|\\le|a-b|",
    "plain": "|a + b| ≤ |a| + |b|",
    "symbols": "",
    "notes": "",
    "related": [
      "minkowski"
    ]
  },
  {
    "id": "exp_inequality",
    "title": "useful exponential inequalities",
    "field": "calculus",
    "latex": "1+x\\le e^x,\\qquad \\ln x\\le x-1,\\qquad e^x\\ge1+x+\\tfrac{x^2}2\\ (x\\ge0),\\qquad 1-x\\le e^{-x}",
    "plain": "1 + x ≤ eˣ;  ln x ≤ x − 1",
    "symbols": "",
    "notes": "Used constantly in proofs of concentration bounds.",
    "related": [
      "jensen_inequality"
    ]
  },
  {
    "id": "wallis_product",
    "title": "Wallis product",
    "field": "calculus",
    "latex": "\\frac\\pi2=\\prod_{n=1}^{\\infty}\\frac{4n^2}{4n^2-1}",
    "plain": "π/2 = Π 4n²/(4n² − 1)",
    "symbols": "",
    "notes": "",
    "related": [
      "basel_problem"
    ]
  },
  {
    "id": "young_inequality",
    "title": "Young's inequality",
    "field": "calculus",
    "latex": "ab\\le\\frac{a^p}p+\\frac{b^q}q\\quad\\Big(\\frac1p+\\frac1q=1\\Big)",
    "plain": "ab ≤ aᵖ/p + bᵠ/q",
    "symbols": "",
    "notes": "p = q = 2 gives ab ≤ (a² + b²)/2.",
    "related": [
      "cauchy_schwarz_integral"
    ]
  },
  {
    "id": "amdahl",
    "title": "Amdahl's law",
    "field": "numerical",
    "latex": "S=\\frac1{(1-p)+p/s}",
    "plain": "S = 1/((1 − p) + p/s)",
    "symbols": "p = parallelisable fraction, s = speed-up of that part",
    "notes": "The serial fraction caps the speed-up at 1/(1 − p).",
    "related": [
      "gustafson"
    ]
  },
  {
    "id": "antithetic",
    "title": "antithetic variates",
    "field": "numerical",
    "latex": "\\hat\\theta=\\frac1{2N}\\sum_i\\big[f(U_i)+f(1-U_i)\\big]",
    "plain": "average f(U) and f(1 − U)",
    "symbols": "",
    "notes": "Reduces variance when f is monotone, since the pair is negatively correlated.",
    "related": [
      "control_variates"
    ]
  },
  {
    "id": "bayes_error",
    "title": "Bayes error and optimal classifier",
    "field": "numerical",
    "latex": "h^*(x)=\\arg\\max_kP(y=k\\mid x),\\qquad R^*=1-\\mathbb E_x\\Big[\\max_kP(y=k\\mid x)\\Big]",
    "plain": "h*(x) = argmax P(y = k | x);  R* = 1 − E max P(y|x)",
    "symbols": "",
    "notes": "No classifier can beat it.",
    "related": [
      "bayes"
    ]
  },
  {
    "id": "box_muller",
    "title": "Box–Muller transform",
    "field": "numerical",
    "latex": "Z_0=\\sqrt{-2\\ln U_1}\\,\\cos(2\\pi U_2),\\qquad Z_1=\\sqrt{-2\\ln U_1}\\,\\sin(2\\pi U_2)",
    "plain": "Z₀ = √(−2 ln U₁) cos(2πU₂),  Z₁ = √(−2 ln U₁) sin(2πU₂)",
    "symbols": "U₁, U₂ ~ Uniform(0, 1)",
    "notes": "Two independent standard normals from two uniforms.",
    "related": [
      "inverse_transform_sampling"
    ]
  },
  {
    "id": "catastrophic_cancellation",
    "title": "catastrophic cancellation and stable rewrites",
    "field": "numerical",
    "latex": "1-\\cos x=2\\sin^2\\!\\frac x2,\\qquad \\ln(1+x)\\to\\operatorname{log1p}(x),\\qquad e^x-1\\to\\operatorname{expm1}(x)",
    "plain": "1 − cos x = 2 sin²(x/2);  use log1p, expm1",
    "symbols": "",
    "notes": "Subtracting nearly equal numbers wipes out significant digits.",
    "related": [
      "machine_epsilon"
    ]
  },
  {
    "id": "condition_number_function",
    "title": "condition number of a function",
    "field": "numerical",
    "latex": "\\kappa_f(x)=\\Big|\\frac{x\\,f'(x)}{f(x)}\\Big|,\\qquad \\frac{\\delta f}{f}\\approx\\kappa_f\\frac{\\delta x}x",
    "plain": "κ = |x f′(x)/f(x)|",
    "symbols": "",
    "notes": "How much a relative input error is amplified. √x has κ = ½; subtracting nearby numbers has huge κ.",
    "related": [
      "condition_number"
    ]
  },
  {
    "id": "control_variates",
    "title": "control variates",
    "field": "numerical",
    "latex": "\\hat\\theta=\\bar Y-c\\big(\\bar Z-\\mathbb E Z\\big),\\ \\ c^*=\\frac{\\operatorname{Cov}(Y,Z)}{\\operatorname{Var}Z},\\ \\ \\operatorname{Var}\\hat\\theta=(1-\\rho^2)\\operatorname{Var}\\bar Y",
    "plain": "variance shrinks by a factor (1 − ρ²)",
    "symbols": "",
    "notes": "",
    "related": [
      "antithetic"
    ]
  },
  {
    "id": "cosine_distance",
    "title": "cosine distance and angular distance",
    "field": "numerical",
    "latex": "d_{\\cos}=1-\\cos\\theta,\\qquad d_{\\text{ang}}=\\frac{\\arccos(\\cos\\theta)}\\pi",
    "plain": "d = 1 − cos θ",
    "symbols": "",
    "notes": "Not a metric (no triangle inequality); angular distance is.",
    "related": [
      "cosine_similarity"
    ]
  },
  {
    "id": "knn_error_bound",
    "title": "Cover–Hart bound for nearest neighbours",
    "field": "numerical",
    "latex": "R^*\\le R_{\\mathrm{1NN}}\\le2R^*\\,(1-R^*)",
    "plain": "R* ≤ R_1NN ≤ 2R*(1 − R*)",
    "symbols": "R* = Bayes error",
    "notes": "With enough data, nearest-neighbour error is at most twice the best possible.",
    "related": [
      "bayes_error"
    ]
  },
  {
    "id": "effective_sample_size",
    "title": "effective sample size",
    "field": "numerical",
    "latex": "\\mathrm{ESS}=\\frac{\\big(\\sum_iw_i\\big)^2}{\\sum_iw_i^2}",
    "plain": "ESS = (Σwᵢ)²/Σwᵢ²",
    "symbols": "",
    "notes": "N when the weights are equal, 1 when one weight dominates.",
    "related": [
      "importance_sampling"
    ]
  },
  {
    "id": "fft_complexity",
    "title": "FFT complexity",
    "field": "numerical",
    "latex": "\\text{DFT: }O(N^2)\\ \\ \\longrightarrow\\ \\ \\text{FFT: }O(N\\log_2N)",
    "plain": "DFT O(N²) → FFT O(N log₂ N)",
    "symbols": "",
    "notes": "",
    "related": [
      "dft"
    ]
  },
  {
    "id": "float_formats",
    "title": "floating-point formats",
    "field": "numerical",
    "latex": "x=(-1)^s\\,(1.m)_2\\,2^{e-\\text{bias}};\\quad \\text{float16: 1+5+10 bits, max }65504;\\ \\ \\text{bfloat16: 1+8+7 bits;}\\ \\ \\text{float32: 1+8+23}",
    "plain": "x = (−1)ˢ (1.m)₂ 2^(e − bias)",
    "symbols": "",
    "notes": "bfloat16 keeps float32's range with less precision, which is why it needs no loss scaling.",
    "related": [
      "machine_epsilon"
    ]
  },
  {
    "id": "gelman_rubin",
    "title": "Gelman–Rubin R̂",
    "field": "numerical",
    "latex": "\\hat R=\\sqrt{\\frac{n-1}n+\\frac{B}{nW}}",
    "plain": "R̂ = √((n − 1)/n + B/(nW))",
    "symbols": "B = between-chain variance, W = within-chain variance, n = chain length",
    "notes": "Values close to 1 (below about 1.01) indicate convergence.",
    "related": [
      "mcmc_ess"
    ]
  },
  {
    "id": "gibbs_bivariate_normal",
    "title": "Gibbs sampling (bivariate normal)",
    "field": "numerical",
    "latex": "x\\mid y\\sim\\mathcal N\\big(\\rho y,\\ 1-\\rho^2\\big),\\qquad y\\mid x\\sim\\mathcal N\\big(\\rho x,\\ 1-\\rho^2\\big)",
    "plain": "x | y ~ N(ρy, 1 − ρ²)",
    "symbols": "unit variances, correlation ρ",
    "notes": "Mixing slows as |ρ| → 1.",
    "related": [
      "metropolis_hastings",
      "mvn_conditional"
    ]
  },
  {
    "id": "gustafson",
    "title": "Gustafson's law",
    "field": "numerical",
    "latex": "S=(1-p)+pN",
    "plain": "S = (1 − p) + pN",
    "symbols": "N = processors, p = parallel fraction of the scaled workload",
    "notes": "",
    "related": [
      "amdahl"
    ]
  },
  {
    "id": "hmc_leapfrog",
    "title": "Hamiltonian Monte Carlo leapfrog step",
    "field": "numerical",
    "latex": "p\\leftarrow p-\\tfrac\\varepsilon2\\nabla U(q),\\quad q\\leftarrow q+\\varepsilon p,\\quad p\\leftarrow p-\\tfrac\\varepsilon2\\nabla U(q)",
    "plain": "half-step momentum, full-step position, half-step momentum",
    "symbols": "U = −log π",
    "notes": "Reversible and volume-preserving; the accept step corrects the small energy error.",
    "related": [
      "metropolis_hastings",
      "langevin_dynamics"
    ]
  },
  {
    "id": "hamming_distance",
    "title": "Hamming distance",
    "field": "numerical",
    "latex": "d_H(a,b)=\\sum_i\\mathbf 1[a_i\\ne b_i]",
    "plain": "d_H = number of positions where a and b differ",
    "symbols": "",
    "notes": "",
    "related": [
      "edit_distance"
    ]
  },
  {
    "id": "histogram_bins",
    "title": "histogram bin width rules",
    "field": "numerical",
    "latex": "\\text{Sturges: }k=\\lceil\\log_2n\\rceil+1,\\qquad \\text{Freedman–Diaconis: }h=2\\,\\mathrm{IQR}\\,n^{-1/3}",
    "plain": "k = ⌈log₂ n⌉ + 1;  h = 2 IQR n^(−1/3)",
    "symbols": "",
    "notes": "",
    "related": [
      "kernel_density"
    ]
  },
  {
    "id": "importance_sampling",
    "title": "importance sampling",
    "field": "numerical",
    "latex": "\\mathbb E_p[f]=\\mathbb E_q\\Big[f(x)\\frac{p(x)}{q(x)}\\Big]\\approx\\frac1N\\sum_if(x_i)\\,w_i,\\quad w_i=\\frac{p(x_i)}{q(x_i)}",
    "plain": "E_p[f] ≈ (1/N) Σ f(xᵢ) p(xᵢ)/q(xᵢ)",
    "symbols": "q must cover the support of p·f",
    "notes": "The self-normalised form divides by Σw. Off-policy RL uses the same trick.",
    "related": [
      "effective_sample_size",
      "horvitz_thompson"
    ]
  },
  {
    "id": "inverse_transform_sampling",
    "title": "inverse-transform sampling",
    "field": "numerical",
    "latex": "U\\sim\\mathrm U(0,1)\\ \\Rightarrow\\ X=F^{-1}(U)\\sim F;\\qquad \\text{exponential: }X=-\\frac{\\ln(1-U)}\\lambda",
    "plain": "X = F⁻¹(U)",
    "symbols": "",
    "notes": "",
    "related": [
      "box_muller",
      "exponential"
    ]
  },
  {
    "id": "kahan_summation",
    "title": "Kahan compensated summation",
    "field": "numerical",
    "latex": "y=x_i-c,\\quad t=s+y,\\quad c=(t-s)-y,\\quad s=t",
    "plain": "y = xᵢ − c;  t = s + y;  c = (t − s) − y;  s = t",
    "symbols": "",
    "notes": "Reduces the rounding error of a long sum from O(nε) to O(ε).",
    "related": [
      "machine_epsilon"
    ]
  },
  {
    "id": "kernel_density",
    "title": "kernel density estimate and Silverman's rule",
    "field": "numerical",
    "latex": "\\hat f(x)=\\frac1{nh}\\sum_iK\\Big(\\frac{x-x_i}h\\Big),\\qquad h=0.9\\min\\Big(\\hat\\sigma,\\frac{\\mathrm{IQR}}{1.34}\\Big)n^{-1/5}",
    "plain": "f̂(x) = (1/nh) Σ K((x − xᵢ)/h)",
    "symbols": "K = kernel, e.g. Gaussian",
    "notes": "",
    "related": [
      "histogram_bins"
    ]
  },
  {
    "id": "langevin_dynamics",
    "title": "Langevin dynamics",
    "field": "numerical",
    "latex": "x_{k+1}=x_k-\\tfrac\\varepsilon2\\nabla U(x_k)+\\sqrt\\varepsilon\\,\\xi_k,\\quad \\xi_k\\sim\\mathcal N(0,I)",
    "plain": "x ← x − (ε/2)∇U(x) + √ε ξ",
    "symbols": "",
    "notes": "Samples from exp(−U); the score-based view of diffusion models uses ∇log p in place of −∇U.",
    "related": [
      "hmc_leapfrog",
      "score_matching"
    ]
  },
  {
    "id": "machine_epsilon",
    "title": "machine epsilon and floating-point precision",
    "field": "numerical",
    "latex": "\\epsilon_{\\text{mach}}=2^{-p+1}:\\ \\ \\text{float64 }2^{-52}\\approx2.2\\times10^{-16},\\ \\ \\text{float32 }2^{-23}\\approx1.2\\times10^{-7},\\ \\ \\text{float16 }2^{-10}\\approx9.8\\times10^{-4}",
    "plain": "ε = 2^(−52) (float64), 2^(−23) (float32), 2^(−10) (float16)",
    "symbols": "",
    "notes": "The gap between 1 and the next representable number. Relative rounding error is at most ε/2.",
    "related": [
      "catastrophic_cancellation"
    ]
  },
  {
    "id": "matmul_flops",
    "title": "matrix-multiplication cost",
    "field": "numerical",
    "latex": "\\text{FLOPs}(A_{m\\times n}B_{n\\times p})=2mnp",
    "plain": "FLOPs = 2·m·n·p",
    "symbols": "",
    "notes": "A multiply and an add per term. Strassen: O(n^{log₂7}) ≈ O(n^{2.807}).",
    "related": [
      "transformer_params"
    ]
  },
  {
    "id": "mcmc_ess",
    "title": "MCMC effective sample size",
    "field": "numerical",
    "latex": "\\mathrm{ESS}=\\frac N{1+2\\sum_{k\\ge1}\\rho_k}",
    "plain": "ESS = N/(1 + 2 Σ ρₖ)",
    "symbols": "ρₖ = autocorrelation at lag k",
    "notes": "",
    "related": [
      "autocorrelation",
      "effective_sample_size"
    ]
  },
  {
    "id": "metropolis_hastings",
    "title": "Metropolis–Hastings acceptance",
    "field": "numerical",
    "latex": "\\alpha=\\min\\Big(1,\\ \\frac{\\pi(x')\\,q(x\\mid x')}{\\pi(x)\\,q(x'\\mid x)}\\Big)",
    "plain": "α = min(1, π(x′)q(x|x′)/(π(x)q(x′|x)))",
    "symbols": "π needs to be known only up to a constant",
    "notes": "A symmetric proposal reduces it to min(1, π(x′)/π(x)).",
    "related": [
      "gibbs_bivariate_normal",
      "hmc_leapfrog"
    ]
  },
  {
    "id": "feature_scaling",
    "title": "min–max, standardisation and robust scaling",
    "field": "numerical",
    "latex": "x'=\\frac{x-x_{\\min}}{x_{\\max}-x_{\\min}},\\qquad z=\\frac{x-\\mu}\\sigma,\\qquad x'=\\frac{x-\\operatorname{median}}{\\mathrm{IQR}}",
    "plain": "min–max to [0, 1];  z-score;  robust scaling",
    "symbols": "",
    "notes": "Fit the statistics on the training set only.",
    "related": [
      "z_score",
      "iqr"
    ]
  },
  {
    "id": "monte_carlo_error",
    "title": "Monte Carlo standard error",
    "field": "numerical",
    "latex": "\\mathrm{SE}=\\frac\\sigma{\\sqrt N}",
    "plain": "SE = σ/√N",
    "symbols": "",
    "notes": "Error falls as N^(−½) whatever the dimension: ten times the accuracy costs a hundred times the samples.",
    "related": [
      "standard_error"
    ]
  },
  {
    "id": "nadaraya_watson",
    "title": "Nadaraya–Watson kernel regression",
    "field": "numerical",
    "latex": "\\hat y(x)=\\frac{\\sum_iK_h(x-x_i)\\,y_i}{\\sum_iK_h(x-x_i)}",
    "plain": "ŷ(x) = Σ K(x − xᵢ)yᵢ / Σ K(x − xᵢ)",
    "symbols": "",
    "notes": "A locally weighted average; attention is its soft, learned cousin.",
    "related": [
      "attention",
      "kernel_density"
    ]
  },
  {
    "id": "rejection_sampling",
    "title": "rejection sampling",
    "field": "numerical",
    "latex": "\\text{draw }x\\sim g,\\ u\\sim\\mathrm U(0,1);\\ \\text{accept if }u\\le\\frac{f(x)}{M\\,g(x)};\\qquad \\text{acceptance rate}=\\frac1M",
    "plain": "accept if u ≤ f(x)/(M g(x));  acceptance rate = 1/M",
    "symbols": "f ≤ M g everywhere",
    "notes": "",
    "related": [
      "importance_sampling"
    ]
  },
  {
    "id": "reservoir_sampling",
    "title": "reservoir sampling",
    "field": "numerical",
    "latex": "P(\\text{item }i\\text{ is in the sample of size }k)=\\frac kn",
    "plain": "P(item in sample) = k/n",
    "symbols": "",
    "notes": "Keep item i with probability k/i, replacing a random slot: uniform sample of a stream of unknown length.",
    "related": [
      "monte_carlo_error"
    ]
  },
  {
    "id": "roofline",
    "title": "roofline model",
    "field": "numerical",
    "latex": "P=\\min\\big(P_{\\text{peak}},\\ \\beta\\cdot I\\big),\\qquad I=\\frac{\\text{FLOPs}}{\\text{bytes moved}}",
    "plain": "P = min(P_peak, β·I)",
    "symbols": "β = memory bandwidth, I = arithmetic intensity",
    "notes": "Below the ridge point a kernel is memory-bound; above it compute-bound.",
    "related": [
      "matmul_flops"
    ]
  },
  {
    "id": "moving_average",
    "title": "simple and weighted moving average",
    "field": "numerical",
    "latex": "\\mathrm{SMA}_t=\\frac1w\\sum_{i=0}^{w-1}x_{t-i},\\qquad \\mathrm{WMA}_t=\\frac{\\sum_iw_ix_{t-i}}{\\sum_iw_i}",
    "plain": "average of the last w values",
    "symbols": "",
    "notes": "An FIR low-pass filter. Exponential smoothing weights recent values more.",
    "related": [
      "exponential_smoothing",
      "fir_filter"
    ]
  },
  {
    "id": "logsumexp_stable",
    "title": "stable softmax and log-sum-exp",
    "field": "numerical",
    "latex": "\\operatorname{softmax}(z)_i=\\frac{e^{z_i-m}}{\\sum_je^{z_j-m}},\\qquad \\operatorname{LSE}(z)=m+\\ln\\sum_je^{z_j-m},\\quad m=\\max_jz_j",
    "plain": "subtract max(z) before exponentiating",
    "symbols": "",
    "notes": "Without it, exp(1000) overflows to infinity.",
    "related": [
      "logsumexp",
      "softmax"
    ]
  },
  {
    "id": "hilbert_envelope",
    "title": "analytic signal and envelope",
    "field": "signal",
    "latex": "x_a(t)=x(t)+j\\mathcal H\\{x\\}(t),\\qquad \\text{envelope}=|x_a(t)|,\\quad \\text{phase}=\\arg x_a",
    "plain": "envelope = |x + jH{x}|",
    "symbols": "",
    "notes": "",
    "related": [
      "dft"
    ]
  },
  {
    "id": "nyquist_bandpass",
    "title": "bandpass sampling",
    "field": "signal",
    "latex": "\\frac{2f_H}{n}\\le f_s\\le\\frac{2f_L}{n-1},\\quad 1\\le n\\le\\Big\\lfloor\\frac{f_H}{B}\\Big\\rfloor",
    "plain": "2f_H/n ≤ fs ≤ 2f_L/(n − 1)",
    "symbols": "",
    "notes": "",
    "related": [
      "nyquist"
    ]
  },
  {
    "id": "bilinear_transform",
    "title": "bilinear transform",
    "field": "signal",
    "latex": "s=\\frac2T\\,\\frac{z-1}{z+1}",
    "plain": "s = (2/T)(z − 1)/(z + 1)",
    "symbols": "",
    "notes": "Maps the analogue left half-plane into the unit disc, preserving stability.",
    "related": [
      "z_transform"
    ]
  },
  {
    "id": "butterworth",
    "title": "Butterworth magnitude response",
    "field": "signal",
    "latex": "|H(j\\omega)|^2=\\frac1{1+(\\omega/\\omega_c)^{2n}}",
    "plain": "|H|² = 1/(1 + (ω/ωc)^(2n))",
    "symbols": "",
    "notes": "Maximally flat in the pass band; −3 dB at ωc.",
    "related": [
      "rc_lowpass"
    ]
  },
  {
    "id": "convolution_theorem",
    "title": "convolution theorem",
    "field": "signal",
    "latex": "\\mathcal F\\{f*g\\}=\\mathcal F\\{f\\}\\cdot\\mathcal F\\{g\\}",
    "plain": "DFT(f ∗ g) = DFT(f) · DFT(g)  (circular convolution)",
    "symbols": "",
    "notes": "FFT convolution costs O(N log N) instead of O(N²).",
    "related": [
      "convolution",
      "dft"
    ]
  },
  {
    "id": "cross_correlation",
    "title": "cross-correlation",
    "field": "signal",
    "latex": "r_{xy}[k]=\\sum_nx[n]\\,y[n+k]",
    "plain": "r_xy[k] = Σ x[n] y[n + k]",
    "symbols": "",
    "notes": "The peak lag gives the delay between two signals. Wiener–Khinchin: the PSD is the Fourier transform of the autocorrelation.",
    "related": [
      "autocorrelation",
      "matched_filter"
    ]
  },
  {
    "id": "zero_padding_resolution",
    "title": "DFT frequency bins",
    "field": "signal",
    "latex": "\\Delta f=\\frac{f_s}N,\\qquad f_k=k\\,\\Delta f",
    "plain": "Δf = fs/N;  fₖ = kΔf",
    "symbols": "",
    "notes": "Zero-padding interpolates the spectrum but does not add resolution.",
    "related": [
      "stft"
    ]
  },
  {
    "id": "fir_filter",
    "title": "FIR and IIR filters",
    "field": "signal",
    "latex": "y[n]=\\sum_{k=0}^{M}b_kx[n-k]\\ \\ (\\text{FIR}),\\qquad y[n]=\\sum_kb_kx[n-k]-\\sum_{k\\ge1}a_ky[n-k]\\ \\ (\\text{IIR})",
    "plain": "y[n] = Σ bₖ x[n − k] (− Σ aₖ y[n − k] for IIR)",
    "symbols": "",
    "notes": "FIR filters are always stable and can have linear phase.",
    "related": [
      "convolution",
      "z_transform"
    ]
  },
  {
    "id": "rc_lowpass",
    "title": "first-order low-pass filter",
    "field": "signal",
    "latex": "f_c=\\frac1{2\\pi RC},\\qquad y_n=y_{n-1}+\\alpha(x_n-y_{n-1}),\\ \\ \\alpha=\\frac{\\Delta t}{RC+\\Delta t}",
    "plain": "fc = 1/(2πRC);  yₙ = yₙ₋₁ + α(xₙ − yₙ₋₁)",
    "symbols": "",
    "notes": "The digital version is an exponential moving average.",
    "related": [
      "exponential_smoothing"
    ]
  },
  {
    "id": "fourier_series_square",
    "title": "Fourier series of a square wave",
    "field": "signal",
    "latex": "x(t)=\\frac4\\pi\\sum_{k\\ \\text{odd}}\\frac{\\sin(k\\omega t)}{k},\\qquad c_n=\\frac1T\\int_0^Tx(t)e^{-jn\\omega t}dt",
    "plain": "square wave = (4/π) Σ sin(kωt)/k over odd k",
    "symbols": "",
    "notes": "The partial sums overshoot by about 8.9% at the jump (Gibbs phenomenon).",
    "related": [
      "dft"
    ]
  },
  {
    "id": "haar_wavelet",
    "title": "Haar wavelet transform",
    "field": "signal",
    "latex": "a=\\frac{x_1+x_2}{\\sqrt2},\\qquad d=\\frac{x_1-x_2}{\\sqrt2}",
    "plain": "a = (x₁ + x₂)/√2;  d = (x₁ − x₂)/√2",
    "symbols": "",
    "notes": "Orthonormal: energy is preserved. Recurse on the averages for a multi-level decomposition.",
    "related": [
      "dft_parseval"
    ]
  },
  {
    "id": "chirp",
    "title": "linear chirp",
    "field": "signal",
    "latex": "f(t)=f_0+kt,\\qquad \\phi(t)=2\\pi\\Big(f_0t+\\tfrac12kt^2\\Big)",
    "plain": "f(t) = f₀ + kt;  phase = 2π(f₀t + ½kt²)",
    "symbols": "",
    "notes": "",
    "related": [
      "stft"
    ]
  },
  {
    "id": "matched_filter",
    "title": "matched filter",
    "field": "signal",
    "latex": "h(t)=s(T-t),\\qquad \\mathrm{SNR}_{\\max}=\\frac{2E_s}{N_0}",
    "plain": "h(t) = s(T − t);  SNR_max = 2E/N₀",
    "symbols": "",
    "notes": "Maximises the output SNR for a known signal in white noise.",
    "related": [
      "cross_correlation"
    ]
  },
  {
    "id": "mel_scale",
    "title": "mel scale",
    "field": "signal",
    "latex": "m=2595\\log_{10}\\Big(1+\\frac f{700}\\Big),\\qquad f=700\\big(10^{m/2595}-1\\big)",
    "plain": "m = 2595 log₁₀(1 + f/700)",
    "symbols": "",
    "notes": "Approximates how pitch is perceived; 1000 Hz ≈ 1000 mel.",
    "related": [
      "mfcc"
    ]
  },
  {
    "id": "mfcc",
    "title": "mel-frequency cepstral coefficients",
    "field": "signal",
    "latex": "c_k=\\sum_{m=1}^{M}\\ln E_m\\,\\cos\\!\\Big[\\frac{\\pi k}{M}\\big(m-\\tfrac12\\big)\\Big]",
    "plain": "DCT-II of the log mel-band energies",
    "symbols": "",
    "notes": "",
    "related": [
      "mel_scale"
    ]
  },
  {
    "id": "nyquist",
    "title": "Nyquist rate and aliasing",
    "field": "signal",
    "latex": "f_s\\ge2f_{\\max},\\qquad f_{\\text{alias}}=\\big|f-f_s\\operatorname{round}(f/f_s)\\big|",
    "plain": "fs ≥ 2 f_max;  f_alias = |f − fs·round(f/fs)|",
    "symbols": "",
    "notes": "Sampling below the Nyquist rate folds high frequencies onto low ones.",
    "related": [
      "dft",
      "shannon_hartley"
    ]
  },
  {
    "id": "dft_parseval",
    "title": "Parseval's theorem (DFT)",
    "field": "signal",
    "latex": "\\sum_{n=0}^{N-1}|x_n|^2=\\frac1N\\sum_{k=0}^{N-1}|X_k|^2",
    "plain": "Σ|xₙ|² = (1/N) Σ|Xₖ|²",
    "symbols": "",
    "notes": "Energy is the same in the time and frequency domains.",
    "related": [
      "parseval_basis"
    ]
  },
  {
    "id": "periodogram",
    "title": "periodogram and power spectral density",
    "field": "signal",
    "latex": "\\hat S_{xx}(f_k)=\\frac1{N f_s}\\,|X_k|^2",
    "plain": "Ŝ = |X_k|²/(N·fs)",
    "symbols": "",
    "notes": "Welch's method averages periodograms of windowed segments to cut the variance.",
    "related": [
      "stft"
    ]
  },
  {
    "id": "sqnr",
    "title": "quantisation SNR",
    "field": "signal",
    "latex": "\\mathrm{SQNR}\\approx6.02\\,b+1.76\\ \\text{dB}",
    "plain": "SQNR ≈ 6.02b + 1.76 dB",
    "symbols": "b = bits",
    "notes": "Each extra bit adds about 6 dB.",
    "related": [
      "snr_db",
      "quantization"
    ]
  },
  {
    "id": "stft",
    "title": "short-time Fourier transform",
    "field": "signal",
    "latex": "X(m,k)=\\sum_{n}x[n]\\,w[n-mH]\\,e^{-2\\pi ikn/N}",
    "plain": "windowed DFT slid along the signal with hop H",
    "symbols": "",
    "notes": "Frequency resolution Δf = fs/N, time resolution about N/fs: they trade off.",
    "related": [
      "window_functions",
      "uncertainty_principle"
    ]
  },
  {
    "id": "uncertainty_principle",
    "title": "time–frequency uncertainty principle",
    "field": "signal",
    "latex": "\\Delta t\\,\\Delta f\\ge\\frac1{4\\pi}",
    "plain": "Δt·Δf ≥ 1/(4π)",
    "symbols": "",
    "notes": "Equality for a Gaussian pulse: you cannot localise a signal in both time and frequency.",
    "related": [
      "sinc_fourier_pair"
    ]
  },
  {
    "id": "sinc_interpolation",
    "title": "Whittaker–Shannon interpolation",
    "field": "signal",
    "latex": "x(t)=\\sum_nx[n]\\,\\operatorname{sinc}\\!\\Big(\\frac{t-nT}T\\Big)",
    "plain": "x(t) = Σ x[n] sinc((t − nT)/T)",
    "symbols": "",
    "notes": "Perfect reconstruction of a band-limited signal from its samples.",
    "related": [
      "nyquist"
    ]
  },
  {
    "id": "window_functions",
    "title": "window functions",
    "field": "signal",
    "latex": "w_{\\text{Hann}}[n]=\\tfrac12\\Big(1-\\cos\\frac{2\\pi n}{N-1}\\Big),\\quad w_{\\text{Hamming}}[n]=0.54-0.46\\cos\\frac{2\\pi n}{N-1}",
    "plain": "Hann: ½(1 − cos(2πn/(N − 1)));  Hamming: 0.54 − 0.46 cos(2πn/(N − 1))",
    "symbols": "",
    "notes": "Tapering the edges reduces spectral leakage.",
    "related": [
      "stft"
    ]
  },
  {
    "id": "z_transform",
    "title": "z-transform and stability",
    "field": "signal",
    "latex": "X(z)=\\sum_nx[n]z^{-n},\\qquad H(z)=\\frac{\\sum b_kz^{-k}}{1+\\sum a_kz^{-k}},\\ \\ \\text{stable iff all poles satisfy }|z|<1",
    "plain": "causal LTI system is stable iff its poles lie inside the unit circle",
    "symbols": "",
    "notes": "",
    "related": [
      "fir_filter"
    ]
  },
  {
    "id": "angle_addition",
    "title": "angle addition formulas",
    "field": "geometry",
    "latex": "\\sin(a\\pm b)=\\sin a\\cos b\\pm\\cos a\\sin b,\\quad \\cos(a\\pm b)=\\cos a\\cos b\\mp\\sin a\\sin b,\\quad \\tan(a+b)=\\frac{\\tan a+\\tan b}{1-\\tan a\\tan b}",
    "plain": "sin(a ± b), cos(a ± b), tan(a + b)",
    "symbols": "",
    "notes": "",
    "related": [
      "double_angle"
    ]
  },
  {
    "id": "arc_sector",
    "title": "arc length and sector area",
    "field": "geometry",
    "latex": "s=r\\theta,\\qquad A_{\\text{sector}}=\\tfrac12r^2\\theta\\qquad(\\theta\\text{ in radians})",
    "plain": "s = rθ;  sector area = ½r²θ",
    "symbols": "",
    "notes": "Degrees to radians: θ = d·π/180.",
    "related": [
      "circle_sphere"
    ]
  },
  {
    "id": "circle_sphere",
    "title": "circle and sphere",
    "field": "geometry",
    "latex": "C=2\\pi r,\\ \\ A=\\pi r^2;\\qquad S=4\\pi r^2,\\ \\ V=\\tfrac43\\pi r^3",
    "plain": "circle: C = 2πr, A = πr²;  sphere: S = 4πr², V = (4/3)πr³",
    "symbols": "",
    "notes": "",
    "related": [
      "hypersphere_volume"
    ]
  },
  {
    "id": "complex_polar",
    "title": "complex numbers: modulus, argument and polar form",
    "field": "geometry",
    "latex": "z=a+bi=re^{i\\theta},\\ \\ r=\\sqrt{a^2+b^2},\\ \\theta=\\operatorname{atan2}(b,a),\\quad z_1z_2=r_1r_2e^{i(\\theta_1+\\theta_2)},\\quad \\bar z=re^{-i\\theta}",
    "plain": "|z| = √(a² + b²);  multiply moduli, add arguments",
    "symbols": "",
    "notes": "",
    "related": [
      "de_moivre",
      "euler_identity"
    ]
  },
  {
    "id": "solids",
    "title": "cylinder, cone and pyramid",
    "field": "geometry",
    "latex": "V_{\\text{cyl}}=\\pi r^2h,\\quad V_{\\text{cone}}=\\tfrac13\\pi r^2h,\\quad V_{\\text{pyr}}=\\tfrac13A_bh,\\quad A_{\\text{cone side}}=\\pi r\\sqrt{r^2+h^2}",
    "plain": "cylinder πr²h;  cone ⅓πr²h;  pyramid ⅓A_b h",
    "symbols": "",
    "notes": "",
    "related": [
      "circle_sphere"
    ]
  },
  {
    "id": "distance_formulas",
    "title": "distance and midpoint",
    "field": "geometry",
    "latex": "d=\\sqrt{(x_2-x_1)^2+(y_2-y_1)^2},\\quad M=\\Big(\\frac{x_1+x_2}2,\\frac{y_1+y_2}2\\Big),\\quad d_{\\text{pt-line}}=\\frac{|ax_0+by_0+c|}{\\sqrt{a^2+b^2}}",
    "plain": "Euclidean distance, midpoint, point-to-line distance",
    "symbols": "",
    "notes": "",
    "related": [
      "l2_norm"
    ]
  },
  {
    "id": "double_angle",
    "title": "double- and half-angle formulas",
    "field": "geometry",
    "latex": "\\sin2\\theta=2\\sin\\theta\\cos\\theta,\\quad \\cos2\\theta=\\cos^2\\theta-\\sin^2\\theta=1-2\\sin^2\\theta,\\quad \\sin^2\\tfrac\\theta2=\\frac{1-\\cos\\theta}2",
    "plain": "sin 2θ = 2 sin θ cos θ;  cos 2θ = cos²θ − sin²θ;  sin²(θ/2) = (1 − cos θ)/2",
    "symbols": "",
    "notes": "",
    "related": [
      "pythagorean_identity"
    ]
  },
  {
    "id": "ellipse",
    "title": "ellipse",
    "field": "geometry",
    "latex": "A=\\pi ab,\\qquad P\\approx\\pi\\Big[3(a+b)-\\sqrt{(3a+b)(a+3b)}\\Big],\\qquad e=\\sqrt{1-\\frac{b^2}{a^2}}",
    "plain": "area πab;  perimeter ≈ π[3(a + b) − √((3a + b)(a + 3b))] (Ramanujan)",
    "symbols": "",
    "notes": "",
    "related": [
      "circle_sphere"
    ]
  },
  {
    "id": "haversine",
    "title": "haversine distance",
    "field": "geometry",
    "latex": "d=2R\\arcsin\\sqrt{\\sin^2\\!\\frac{\\Delta\\varphi}2+\\cos\\varphi_1\\cos\\varphi_2\\sin^2\\!\\frac{\\Delta\\lambda}2}",
    "plain": "great-circle distance between two latitude/longitude points",
    "symbols": "R = 6371 km",
    "notes": "",
    "related": [
      "arc_sector"
    ]
  },
  {
    "id": "heron",
    "title": "Heron's formula",
    "field": "geometry",
    "latex": "A=\\sqrt{s(s-a)(s-b)(s-c)},\\quad s=\\tfrac{a+b+c}2;\\qquad A=\\tfrac12ab\\sin C",
    "plain": "A = √(s(s − a)(s − b)(s − c))",
    "symbols": "",
    "notes": "",
    "related": [
      "law_of_sines_cosines"
    ]
  },
  {
    "id": "law_of_sines_cosines",
    "title": "law of sines and cosines",
    "field": "geometry",
    "latex": "\\frac a{\\sin A}=\\frac b{\\sin B}=\\frac c{\\sin C}=2R,\\qquad c^2=a^2+b^2-2ab\\cos C",
    "plain": "a/sin A = b/sin B = c/sin C;  c² = a² + b² − 2ab cos C",
    "symbols": "R = circumradius",
    "notes": "",
    "related": [
      "heron"
    ]
  },
  {
    "id": "logarithm_rules",
    "title": "logarithm and exponent rules",
    "field": "geometry",
    "latex": "\\log(ab)=\\log a+\\log b,\\quad \\log\\frac ab=\\log a-\\log b,\\quad \\log a^n=n\\log a,\\quad a^{m+n}=a^ma^n,\\quad (a^m)^n=a^{mn}",
    "plain": "log(ab) = log a + log b;  log aⁿ = n log a",
    "symbols": "",
    "notes": "",
    "related": [
      "change_of_base"
    ]
  },
  {
    "id": "distance_3d_plane",
    "title": "point-to-plane distance and plane equation",
    "field": "geometry",
    "latex": "d=\\frac{|ax_0+by_0+cz_0+d|}{\\sqrt{a^2+b^2+c^2}},\\qquad \\mathbf n\\cdot(\\mathbf x-\\mathbf x_0)=0",
    "plain": "d = |ax₀ + by₀ + cz₀ + d|/√(a² + b² + c²)",
    "symbols": "",
    "notes": "The same formula gives the margin of a linear classifier.",
    "related": [
      "distance_formulas",
      "svm_margin"
    ]
  },
  {
    "id": "product_to_sum",
    "title": "product-to-sum and sum-to-product",
    "field": "geometry",
    "latex": "\\sin a\\cos b=\\tfrac12[\\sin(a+b)+\\sin(a-b)],\\qquad \\cos a+\\cos b=2\\cos\\frac{a+b}2\\cos\\frac{a-b}2",
    "plain": "sin a cos b = ½[sin(a + b) + sin(a − b)]",
    "symbols": "",
    "notes": "",
    "related": [
      "angle_addition"
    ]
  },
  {
    "id": "pythagorean_identity",
    "title": "Pythagorean trigonometric identities",
    "field": "geometry",
    "latex": "\\sin^2\\theta+\\cos^2\\theta=1,\\qquad 1+\\tan^2\\theta=\\sec^2\\theta,\\qquad 1+\\cot^2\\theta=\\csc^2\\theta",
    "plain": "sin²θ + cos²θ = 1;  1 + tan²θ = sec²θ",
    "symbols": "",
    "notes": "",
    "related": [
      "double_angle"
    ]
  },
  {
    "id": "quadratic_discriminant",
    "title": "quadratic discriminant and vertex",
    "field": "geometry",
    "latex": "\\Delta=b^2-4ac,\\qquad \\text{vertex}\\ \\Big(-\\frac b{2a},\\ c-\\frac{b^2}{4a}\\Big),\\qquad x_1+x_2=-\\frac ba,\\ x_1x_2=\\frac ca",
    "plain": "Δ = b² − 4ac;  vertex at x = −b/2a;  sum of roots −b/a, product c/a",
    "symbols": "",
    "notes": "",
    "related": [
      "quadratic_formula"
    ]
  },
  {
    "id": "regular_polygon",
    "title": "regular polygon",
    "field": "geometry",
    "latex": "A=\\frac n4s^2\\cot\\frac\\pi n,\\qquad \\text{interior angle}=\\frac{(n-2)\\pi}n,\\qquad \\text{diagonals}=\\frac{n(n-3)}2",
    "plain": "A = (n/4)s² cot(π/n);  diagonals = n(n − 3)/2",
    "symbols": "",
    "notes": "",
    "related": [
      "shoelace"
    ]
  },
  {
    "id": "shoelace",
    "title": "shoelace formula (polygon area)",
    "field": "geometry",
    "latex": "A=\\tfrac12\\Big|\\sum_{i=1}^{n}\\big(x_iy_{i+1}-x_{i+1}y_i\\big)\\Big|",
    "plain": "A = ½|Σ (xᵢyᵢ₊₁ − xᵢ₊₁yᵢ)|",
    "symbols": "",
    "notes": "",
    "related": [
      "heron"
    ]
  },
  {
    "id": "cubic_vieta",
    "title": "Vieta's formulas (cubic)",
    "field": "geometry",
    "latex": "x_1+x_2+x_3=-\\frac ba,\\quad x_1x_2+x_1x_3+x_2x_3=\\frac ca,\\quad x_1x_2x_3=-\\frac da",
    "plain": "relations between the roots and the coefficients of ax³ + bx² + cx + d",
    "symbols": "",
    "notes": "",
    "related": [
      "quadratic_discriminant"
    ]
  },
  {
    "id": "hypersphere_volume",
    "title": "volume and surface of the n-ball",
    "field": "geometry",
    "latex": "V_n(r)=\\frac{\\pi^{n/2}}{\\Gamma\\big(\\frac n2+1\\big)}r^n,\\qquad S_{n-1}(r)=\\frac{2\\pi^{n/2}}{\\Gamma(n/2)}r^{n-1}",
    "plain": "Vₙ = π^(n/2) rⁿ/Γ(n/2 + 1)",
    "symbols": "",
    "notes": "In high dimensions nearly all of the volume sits near the surface, and the unit ball's volume tends to 0.",
    "related": [
      "circle_sphere",
      "gamma_function"
    ]
  },
  {
    "id": "knapsack_dp",
    "title": "0/1 knapsack recurrence",
    "field": "discrete",
    "latex": "V[i][w]=\\max\\big(V[i-1][w],\\ v_i+V[i-1][w-w_i]\\big)",
    "plain": "V[i][w] = max(V[i − 1][w], vᵢ + V[i − 1][w − wᵢ])",
    "symbols": "",
    "notes": "O(nW) dynamic programming.",
    "related": [
      "lcs_dp"
    ]
  },
  {
    "id": "a_star",
    "title": "A* search",
    "field": "discrete",
    "latex": "f(n)=g(n)+h(n),\\quad h\\ \\text{admissible: }h(n)\\le h^*(n)\\ \\Rightarrow\\ \\text{optimal}",
    "plain": "f = g + h",
    "symbols": "",
    "notes": "A consistent heuristic never needs to re-open a node.",
    "related": [
      "dijkstra"
    ]
  },
  {
    "id": "absorbing_markov",
    "title": "absorbing Markov chains",
    "field": "discrete",
    "latex": "N=(I-Q)^{-1},\\quad \\mathbb E[\\text{steps to absorption}]=N\\mathbf 1,\\quad B=NR",
    "plain": "fundamental matrix N = (I − Q)⁻¹",
    "symbols": "Q = transient-to-transient block, R = transient-to-absorbing",
    "notes": "",
    "related": [
      "markov_stationary"
    ]
  },
  {
    "id": "amortized_array",
    "title": "amortised cost of a doubling array",
    "field": "discrete",
    "latex": "\\text{total copy cost for }n\\text{ appends}\\le2n,\\qquad \\text{amortised }O(1)",
    "plain": "doubling the capacity gives O(1) amortised appends",
    "symbols": "",
    "notes": "",
    "related": [
      "union_find"
    ]
  },
  {
    "id": "binary_search",
    "title": "binary search",
    "field": "discrete",
    "latex": "\\#\\text{comparisons}\\le\\lceil\\log_2(n+1)\\rceil",
    "plain": "≤ ⌈log₂(n + 1)⌉ comparisons",
    "symbols": "",
    "notes": "",
    "related": [
      "sorting_lower_bound"
    ]
  },
  {
    "id": "pascal_identities",
    "title": "binomial coefficient identities",
    "field": "discrete",
    "latex": "\\binom nk=\\binom{n-1}{k-1}+\\binom{n-1}k,\\quad \\sum_k\\binom nk=2^n,\\quad \\sum_{i=k}^{n}\\binom ik=\\binom{n+1}{k+1},\\quad \\sum_k\\binom mk\\binom n{r-k}=\\binom{m+n}r",
    "plain": "Pascal's rule, row sum 2ⁿ, hockey stick, Vandermonde",
    "symbols": "",
    "notes": "",
    "related": [
      "binomial_theorem"
    ]
  },
  {
    "id": "birthday_problem",
    "title": "birthday problem",
    "field": "discrete",
    "latex": "P(\\text{shared})=1-\\prod_{i=0}^{k-1}\\frac{365-i}{365}\\approx1-e^{-k(k-1)/730}",
    "plain": "P = 1 − Π (365 − i)/365",
    "symbols": "",
    "notes": "23 people give about 50.7%.",
    "related": [
      "hash_collisions"
    ]
  },
  {
    "id": "bloom_filter",
    "title": "Bloom filter false-positive rate",
    "field": "discrete",
    "latex": "p\\approx\\Big(1-e^{-kn/m}\\Big)^k,\\qquad k^*=\\frac mn\\ln2,\\qquad m=-\\frac{n\\ln p}{(\\ln2)^2}",
    "plain": "p ≈ (1 − e^(−kn/m))ᵏ;  best k = (m/n) ln 2",
    "symbols": "m bits, n items, k hashes",
    "notes": "About 9.6 bits per item gives 1% false positives.",
    "related": [
      "hash_collisions"
    ]
  },
  {
    "id": "catalan",
    "title": "Catalan numbers",
    "field": "discrete",
    "latex": "C_n=\\frac1{n+1}\\binom{2n}n,\\qquad C_{n+1}=\\sum_{i=0}^{n}C_iC_{n-i}",
    "plain": "Cₙ = C(2n, n)/(n + 1)",
    "symbols": "",
    "notes": "Counts balanced parentheses, binary trees with n nodes, and triangulations of an (n + 2)-gon.",
    "related": [
      "binomial_theorem"
    ]
  },
  {
    "id": "chinese_remainder",
    "title": "Chinese remainder theorem",
    "field": "discrete",
    "latex": "x\\equiv a_i\\pmod{n_i}\\ (\\gcd(n_i,n_j)=1)\\ \\Rightarrow\\ x\\equiv\\sum_ia_iN_i\\,(N_i^{-1}\\bmod n_i)\\pmod N,\\ \\ N_i=N/n_i",
    "plain": "unique solution mod N = Π nᵢ",
    "symbols": "",
    "notes": "",
    "related": [
      "modular_inverse"
    ]
  },
  {
    "id": "sorting_lower_bound",
    "title": "comparison-sorting lower bound",
    "field": "discrete",
    "latex": "\\#\\text{comparisons}\\ge\\log_2(n!)\\approx n\\log_2n-1.44\\,n",
    "plain": "any comparison sort needs ≥ log₂(n!) comparisons",
    "symbols": "",
    "notes": "",
    "related": [
      "stirling"
    ]
  },
  {
    "id": "graph_counting",
    "title": "counting in graphs",
    "field": "discrete",
    "latex": "\\sum_v\\deg v=2|E|,\\quad |E_{K_n}|=\\frac{n(n-1)}2,\\quad \\text{tree: }|E|=n-1,\\quad \\#\\text{labelled trees}=n^{n-2}",
    "plain": "handshake lemma, complete graph, tree and Cayley's formula",
    "symbols": "",
    "notes": "",
    "related": [
      "euler_polyhedra"
    ]
  },
  {
    "id": "coupon_collector",
    "title": "coupon collector",
    "field": "discrete",
    "latex": "\\mathbb E[T]=nH_n\\approx n\\ln n+\\gamma n,\\qquad \\operatorname{Var}(T)\\le\\frac{\\pi^2}6n^2",
    "plain": "E[T] = n Hₙ",
    "symbols": "",
    "notes": "Collecting all 50 types takes about 225 draws.",
    "related": [
      "harmonic_series"
    ]
  },
  {
    "id": "de_morgan",
    "title": "De Morgan's laws and set identities",
    "field": "discrete",
    "latex": "\\overline{A\\cup B}=\\overline A\\cap\\overline B,\\quad \\overline{A\\cap B}=\\overline A\\cup\\overline B,\\quad |\\mathcal P(S)|=2^{|S|}",
    "plain": "¬(A ∨ B) = ¬A ∧ ¬B;  ¬(A ∧ B) = ¬A ∨ ¬B;  |P(S)| = 2^|S|",
    "symbols": "",
    "notes": "",
    "related": [
      "inclusion_exclusion"
    ]
  },
  {
    "id": "derangements",
    "title": "derangements",
    "field": "discrete",
    "latex": "D_n=n!\\sum_{k=0}^{n}\\frac{(-1)^k}{k!}\\approx\\frac{n!}e,\\qquad D_n=(n-1)(D_{n-1}+D_{n-2})",
    "plain": "Dₙ = n! Σ (−1)ᵏ/k! ≈ n!/e",
    "symbols": "",
    "notes": "The chance a random permutation has no fixed point tends to 1/e.",
    "related": [
      "inclusion_exclusion"
    ]
  },
  {
    "id": "dijkstra",
    "title": "Dijkstra and Bellman–Ford relaxation",
    "field": "discrete",
    "latex": "d[v]\\leftarrow\\min\\big(d[v],\\ d[u]+w(u,v)\\big)",
    "plain": "relax each edge: d[v] = min(d[v], d[u] + w)",
    "symbols": "",
    "notes": "Dijkstra O((V + E) log V) for non-negative weights; Bellman–Ford O(VE) allows negative weights.",
    "related": [
      "floyd_warshall"
    ]
  },
  {
    "id": "divisor_functions",
    "title": "divisor functions",
    "field": "discrete",
    "latex": "\\sigma_k(n)=\\sum_{d\\mid n}d^k,\\quad \\tau(n)=\\prod(e_i+1)\\ \\text{for }n=\\prod p_i^{e_i},\\quad \\sigma(n)=\\prod\\frac{p_i^{e_i+1}-1}{p_i-1}",
    "plain": "number and sum of divisors from the prime factorisation",
    "symbols": "",
    "notes": "",
    "related": [
      "euler_totient"
    ]
  },
  {
    "id": "erlang_b",
    "title": "Erlang B",
    "field": "discrete",
    "latex": "B(c,a)=\\frac{a\\,B(c-1,a)}{c+a\\,B(c-1,a)},\\quad B(0,a)=1",
    "plain": "blocking probability of c servers with offered load a",
    "symbols": "",
    "notes": "",
    "related": [
      "mm1_queue"
    ]
  },
  {
    "id": "gcd_bezout",
    "title": "Euclid's algorithm and Bézout",
    "field": "discrete",
    "latex": "\\gcd(a,b)=\\gcd(b,a\\bmod b),\\qquad ax+by=\\gcd(a,b),\\qquad \\operatorname{lcm}(a,b)=\\frac{ab}{\\gcd(a,b)}",
    "plain": "gcd(a, b) = gcd(b, a mod b);  lcm = ab/gcd",
    "symbols": "",
    "notes": "The extended algorithm finds x, y: the modular inverse when gcd = 1.",
    "related": [
      "modular_inverse"
    ]
  },
  {
    "id": "euler_polyhedra",
    "title": "Euler's formula for planar graphs",
    "field": "discrete",
    "latex": "V-E+F=2,\\qquad E\\le3V-6\\ \\ (V\\ge3)",
    "plain": "V − E + F = 2;  E ≤ 3V − 6",
    "symbols": "",
    "notes": "A cube has V = 8, E = 12, F = 6.",
    "related": [
      "graph_counting"
    ]
  },
  {
    "id": "euler_totient",
    "title": "Euler's totient function",
    "field": "discrete",
    "latex": "\\varphi(n)=n\\prod_{p\\mid n}\\Big(1-\\frac1p\\Big),\\qquad \\varphi(pq)=(p-1)(q-1)",
    "plain": "φ(n) = n Π (1 − 1/p) over primes p | n",
    "symbols": "",
    "notes": "",
    "related": [
      "euler_theorem",
      "rsa"
    ]
  },
  {
    "id": "euler_theorem",
    "title": "Fermat's little theorem and Euler's theorem",
    "field": "discrete",
    "latex": "a^{p-1}\\equiv1\\pmod p,\\qquad a^{\\varphi(n)}\\equiv1\\pmod n\\ \\ (\\gcd(a,n)=1),\\qquad (p-1)!\\equiv-1\\pmod p",
    "plain": "a^(p−1) ≡ 1 (mod p);  a^φ(n) ≡ 1 (mod n);  Wilson: (p − 1)! ≡ −1",
    "symbols": "",
    "notes": "",
    "related": [
      "euler_totient",
      "modular_inverse"
    ]
  },
  {
    "id": "fibonacci_binet",
    "title": "Fibonacci numbers (Binet)",
    "field": "discrete",
    "latex": "F_n=\\frac{\\varphi^n-\\psi^n}{\\sqrt5},\\quad \\varphi=\\frac{1+\\sqrt5}2,\\ \\psi=\\frac{1-\\sqrt5}2,\\quad F_n=F_{n-1}+F_{n-2}",
    "plain": "Fₙ = (φⁿ − ψⁿ)/√5",
    "symbols": "",
    "notes": "",
    "related": [
      "linear_recurrence"
    ]
  },
  {
    "id": "floyd_warshall",
    "title": "Floyd–Warshall",
    "field": "discrete",
    "latex": "d_{ij}^{(k)}=\\min\\big(d_{ij}^{(k-1)},\\ d_{ik}^{(k-1)}+d_{kj}^{(k-1)}\\big)",
    "plain": "all-pairs shortest paths in O(V³)",
    "symbols": "",
    "notes": "",
    "related": [
      "dijkstra"
    ]
  },
  {
    "id": "gamblers_ruin",
    "title": "gambler's ruin",
    "field": "discrete",
    "latex": "P(\\text{reach }N\\text{ from }i)=\\frac{1-(q/p)^i}{1-(q/p)^N}\\ (p\\ne q),\\qquad \\frac iN\\ (p=q)",
    "plain": "P(win) = (1 − (q/p)ⁱ)/(1 − (q/p)^N)",
    "symbols": "",
    "notes": "",
    "related": [
      "random_walk"
    ]
  },
  {
    "id": "hash_collisions",
    "title": "hash collisions (birthday bound)",
    "field": "discrete",
    "latex": "\\mathbb E[\\text{collisions}]=\\binom n2\\frac1m\\approx\\frac{n^2}{2m},\\qquad n\\approx\\sqrt{2m\\ln2}\\ \\text{for a 50\\% chance}",
    "plain": "expected collisions ≈ n²/(2m)",
    "symbols": "",
    "notes": "A 64-bit hash collides among about 5 billion items.",
    "related": [
      "birthday_problem"
    ]
  },
  {
    "id": "huffman_cost",
    "title": "Huffman coding",
    "field": "discrete",
    "latex": "\\text{repeatedly merge the two least probable symbols;}\\quad \\bar L=\\sum_ip_i\\ell_i,\\ \\ H\\le\\bar L<H+1",
    "plain": "merge the two smallest weights until one remains",
    "symbols": "",
    "notes": "",
    "related": [
      "source_coding_theorem",
      "kraft_inequality"
    ]
  },
  {
    "id": "hyperloglog",
    "title": "HyperLogLog and count-min sketch errors",
    "field": "discrete",
    "latex": "\\text{HLL standard error}\\approx\\frac{1.04}{\\sqrt m},\\qquad \\text{CMS: }\\varepsilon=\\frac ew,\\ \\ \\delta=e^{-d}",
    "plain": "HLL error 1.04/√m;  count-min error e/w with probability 1 − e^(−d)",
    "symbols": "",
    "notes": "",
    "related": [
      "bloom_filter"
    ]
  },
  {
    "id": "inclusion_exclusion",
    "title": "inclusion–exclusion",
    "field": "discrete",
    "latex": "|A\\cup B|=|A|+|B|-|A\\cap B|,\\qquad |A\\cup B\\cup C|=\\sum|A_i|-\\sum|A_i\\cap A_j|+|A\\cap B\\cap C|",
    "plain": "|A ∪ B| = |A| + |B| − |A ∩ B|",
    "symbols": "",
    "notes": "",
    "related": [
      "derangements"
    ]
  },
  {
    "id": "kelly_criterion",
    "title": "Kelly criterion",
    "field": "discrete",
    "latex": "f^*=p-\\frac qb=\\frac{bp-q}b,\\qquad f^*=\\frac{\\mu-r}{\\sigma^2}\\ \\text{(continuous)}",
    "plain": "f* = p − q/b",
    "symbols": "p = win probability, q = 1 − p, b = net odds",
    "notes": "Maximises the long-run growth rate of capital; half-Kelly is less volatile.",
    "related": [
      "gamblers_ruin"
    ]
  },
  {
    "id": "linear_recurrence",
    "title": "linear recurrences",
    "field": "discrete",
    "latex": "x_n=c_1x_{n-1}+c_2x_{n-2}\\ \\Rightarrow\\ x_n=A r_1^n+Br_2^n,\\quad r^2=c_1r+c_2",
    "plain": "solve the characteristic equation r² = c₁r + c₂",
    "symbols": "",
    "notes": "A repeated root r gives (A + Bn)rⁿ.",
    "related": [
      "fibonacci_binet",
      "ode_second_order"
    ]
  },
  {
    "id": "lcs_dp",
    "title": "longest common subsequence",
    "field": "discrete",
    "latex": "L[i][j]=\\begin{cases}L[i-1][j-1]+1&a_i=b_j\\\\ \\max(L[i-1][j],L[i][j-1])&\\text{otherwise}\\end{cases}",
    "plain": "dynamic programming over prefixes",
    "symbols": "",
    "notes": "ROUGE-L and diff tools use it.",
    "related": [
      "edit_distance",
      "knapsack_dp"
    ]
  },
  {
    "id": "mm1_queue",
    "title": "M/M/1 queue",
    "field": "discrete",
    "latex": "\\rho=\\frac\\lambda\\mu,\\quad L=\\frac\\rho{1-\\rho},\\quad W=\\frac1{\\mu-\\lambda},\\quad L_q=\\frac{\\rho^2}{1-\\rho},\\quad L=\\lambda W",
    "plain": "ρ = λ/μ;  L = ρ/(1 − ρ);  W = 1/(μ − λ)  (Little's law L = λW)",
    "symbols": "λ = arrival rate, μ = service rate",
    "notes": "Waiting explodes as ρ → 1.",
    "related": [
      "erlang_b"
    ]
  },
  {
    "id": "master_theorem",
    "title": "master theorem",
    "field": "discrete",
    "latex": "T(n)=aT(n/b)+\\Theta(n^d)\\ \\Rightarrow\\ T(n)=\\begin{cases}\\Theta(n^d)&d>\\log_ba\\\\ \\Theta(n^d\\log n)&d=\\log_ba\\\\ \\Theta(n^{\\log_ba})&d<\\log_ba\\end{cases}",
    "plain": "compare d with log_b a",
    "symbols": "",
    "notes": "Merge sort: a = 2, b = 2, d = 1 gives Θ(n log n).",
    "related": [
      "fft_complexity"
    ]
  },
  {
    "id": "matrix_chain",
    "title": "matrix-chain multiplication cost",
    "field": "discrete",
    "latex": "m[i][j]=\\min_{i\\le k<j}\\big(m[i][k]+m[k+1][j]+p_{i-1}p_kp_j\\big)",
    "plain": "optimal parenthesisation by dynamic programming",
    "symbols": "",
    "notes": "(AB)C versus A(BC) can differ enormously in cost.",
    "related": [
      "matmul_flops"
    ]
  },
  {
    "id": "maxflow_mincut",
    "title": "max-flow min-cut theorem",
    "field": "discrete",
    "latex": "\\max\\ \\text{flow}=\\min\\ \\text{cut capacity}",
    "plain": "the value of a maximum flow equals the capacity of a minimum cut",
    "symbols": "",
    "notes": "Ford–Fulkerson / Edmonds–Karp find it by augmenting paths.",
    "related": [
      "dijkstra"
    ]
  },
  {
    "id": "modular_inverse",
    "title": "modular inverse and fast exponentiation",
    "field": "discrete",
    "latex": "a^{-1}\\equiv a^{\\varphi(n)-1}\\ (\\bmod n),\\qquad a^b\\bmod n\\ \\text{by repeated squaring in }O(\\log b)",
    "plain": "a⁻¹ = a^(φ(n) − 1) mod n",
    "symbols": "",
    "notes": "",
    "related": [
      "gcd_bezout",
      "rsa"
    ]
  },
  {
    "id": "monty_hall",
    "title": "Monty Hall",
    "field": "discrete",
    "latex": "P(\\text{win by switching})=\\frac23,\\qquad P(\\text{stay})=\\frac13",
    "plain": "switching wins with probability 2/3",
    "symbols": "",
    "notes": "Bayes: P(car behind the other door | host opens a goat door) = 2/3.",
    "related": [
      "bayes"
    ]
  },
  {
    "id": "order_statistics",
    "title": "order statistics of uniforms",
    "field": "discrete",
    "latex": "\\mathbb E[X_{(k)}]=\\frac k{n+1},\\qquad \\mathbb E[\\max]=\\frac n{n+1},\\qquad \\operatorname{Var}(X_{(k)})=\\frac{k(n+1-k)}{(n+1)^2(n+2)}",
    "plain": "E[X₍ₖ₎] = k/(n + 1)",
    "symbols": "",
    "notes": "",
    "related": [
      "uniform_mean"
    ]
  },
  {
    "id": "permutations_repetition",
    "title": "permutations with repetition",
    "field": "discrete",
    "latex": "\\frac{n!}{n_1!\\,n_2!\\cdots n_k!},\\qquad n^k\\ \\text{(sequences of length }k\\text{ from }n\\text{ symbols)}",
    "plain": "n!/(n₁! n₂! … n_k!)",
    "symbols": "",
    "notes": "MISSISSIPPI has 11!/(4!4!2!1!) = 34 650 arrangements.",
    "related": [
      "combinations"
    ]
  },
  {
    "id": "pigeonhole",
    "title": "pigeonhole principle",
    "field": "discrete",
    "latex": "n\\text{ items in }m\\text{ boxes}\\ \\Rightarrow\\ \\text{some box has at least }\\Big\\lceil\\frac nm\\Big\\rceil",
    "plain": "some box holds ≥ ⌈n/m⌉ items",
    "symbols": "",
    "notes": "",
    "related": [
      "birthday_problem"
    ]
  },
  {
    "id": "prime_number_theorem",
    "title": "prime number theorem",
    "field": "discrete",
    "latex": "\\pi(x)\\sim\\frac x{\\ln x},\\qquad p_n\\sim n\\ln n",
    "plain": "π(x) ≈ x/ln x",
    "symbols": "",
    "notes": "There are about 1/ln x primes near x.",
    "related": [
      "stirling"
    ]
  },
  {
    "id": "rsa",
    "title": "RSA",
    "field": "discrete",
    "latex": "n=pq,\\quad ed\\equiv1\\pmod{\\varphi(n)},\\quad c=m^e\\bmod n,\\quad m=c^d\\bmod n",
    "plain": "n = pq;  e·d ≡ 1 (mod φ(n));  c = mᵉ mod n;  m = cᵈ mod n",
    "symbols": "",
    "notes": "Security rests on the difficulty of factoring n.",
    "related": [
      "euler_totient",
      "modular_inverse"
    ]
  },
  {
    "id": "secretary_problem",
    "title": "secretary problem",
    "field": "discrete",
    "latex": "\\text{reject the first }n/e\\text{ candidates, then take the next best;}\\quad P(\\text{best})\\to\\frac1e\\approx0.368",
    "plain": "reject the first n/e, then take the next record: success probability → 1/e",
    "symbols": "",
    "notes": "",
    "related": [
      "birthday_problem"
    ]
  },
  {
    "id": "shapley_value",
    "title": "Shapley value",
    "field": "discrete",
    "latex": "\\varphi_i=\\sum_{S\\subseteq N\\setminus\\{i\\}}\\frac{|S|!\\,(n-|S|-1)!}{n!}\\big(v(S\\cup\\{i\\})-v(S)\\big)",
    "plain": "average marginal contribution over all orderings",
    "symbols": "",
    "notes": "The basis of SHAP feature attributions.",
    "related": [
      "nash_mixed_2x2"
    ]
  },
  {
    "id": "stars_and_bars",
    "title": "stars and bars",
    "field": "discrete",
    "latex": "\\binom{n+k-1}{k-1}\\ \\text{(non-negative solutions of }x_1+\\cdots+x_k=n),\\qquad \\binom{n-1}{k-1}\\ \\text{(positive)}",
    "plain": "C(n + k − 1, k − 1)",
    "symbols": "",
    "notes": "",
    "related": [
      "combinations"
    ]
  },
  {
    "id": "stirling_second",
    "title": "Stirling numbers of the second kind",
    "field": "discrete",
    "latex": "S(n,k)=kS(n-1,k)+S(n-1,k-1),\\qquad \\text{Bell: }B_n=\\sum_kS(n,k)",
    "plain": "S(n, k) = kS(n − 1, k) + S(n − 1, k − 1)",
    "symbols": "",
    "notes": "S(n, k) counts partitions of n items into k non-empty sets.",
    "related": [
      "catalan"
    ]
  },
  {
    "id": "recurrence_sums",
    "title": "sum of a geometric sequence and compound growth",
    "field": "discrete",
    "latex": "S_n=a\\frac{r^n-1}{r-1},\\qquad A=P\\Big(1+\\frac rn\\Big)^{nt},\\qquad A=Pe^{rt}",
    "plain": "geometric sum; compound interest (n times a year) and continuous compounding",
    "symbols": "",
    "notes": "",
    "related": [
      "geometric_series"
    ]
  },
  {
    "id": "reliability_systems",
    "title": "system reliability",
    "field": "discrete",
    "latex": "R_{\\text{series}}=\\prod_iR_i,\\qquad R_{\\text{parallel}}=1-\\prod_i(1-R_i),\\qquad A=\\frac{\\mathrm{MTBF}}{\\mathrm{MTBF}+\\mathrm{MTTR}}",
    "plain": "series multiplies, parallel multiplies the failure probabilities",
    "symbols": "",
    "notes": "",
    "related": [
      "hazard_function"
    ]
  },
  {
    "id": "tsp_count",
    "title": "travelling-salesman search space",
    "field": "discrete",
    "latex": "\\#\\text{tours}=\\frac{(n-1)!}2\\ \\ (\\text{symmetric}),\\qquad \\text{Held–Karp: }O(n^22^n)",
    "plain": "(n − 1)!/2 distinct tours",
    "symbols": "",
    "notes": "",
    "related": [
      "combinations"
    ]
  },
  {
    "id": "union_find",
    "title": "union–find complexity",
    "field": "discrete",
    "latex": "m\\text{ operations on }n\\text{ elements: }O\\big(m\\,\\alpha(n)\\big),\\quad \\alpha(n)\\le4\\ \\text{for any practical }n",
    "plain": "nearly constant amortised time per operation",
    "symbols": "α = inverse Ackermann",
    "notes": "",
    "related": [
      "amortized_array"
    ]
  },
  {
    "id": "allometric",
    "title": "allometric scaling",
    "field": "science",
    "latex": "Y=aM^{b},\\qquad \\text{Kleiber: }B\\propto M^{3/4}",
    "plain": "Y = a M^b;  Kleiber's law B ∝ M^(3/4)",
    "symbols": "",
    "notes": "Linear in log–log coordinates: log Y = log a + b log M.",
    "related": [
      "pareto_pdf"
    ]
  },
  {
    "id": "arrhenius",
    "title": "Arrhenius equation",
    "field": "science",
    "latex": "k=Ae^{-E_a/RT},\\qquad \\ln\\frac{k_2}{k_1}=\\frac{E_a}R\\Big(\\frac1{T_1}-\\frac1{T_2}\\Big)",
    "plain": "k = A e^(−Ea/RT)",
    "symbols": "",
    "notes": "",
    "related": [
      "first_order_kinetics"
    ]
  },
  {
    "id": "beer_lambert",
    "title": "Beer–Lambert law",
    "field": "science",
    "latex": "A=\\varepsilon c\\ell=-\\log_{10}\\frac I{I_0}",
    "plain": "A = εcℓ = −log₁₀(I/I₀)",
    "symbols": "",
    "notes": "",
    "related": [
      "ph"
    ]
  },
  {
    "id": "bernoulli_fluid",
    "title": "Bernoulli's equation and continuity",
    "field": "science",
    "latex": "p+\\tfrac12\\rho v^2+\\rho gh=\\text{const},\\qquad A_1v_1=A_2v_2,\\qquad \\mathrm{Re}=\\frac{\\rho vL}\\mu",
    "plain": "p + ½ρv² + ρgh = const;  A₁v₁ = A₂v₂;  Re = ρvL/μ",
    "symbols": "",
    "notes": "Re ≲ 2000 laminar, ≳ 4000 turbulent in a pipe.",
    "related": [
      "navier_stokes"
    ]
  },
  {
    "id": "black_scholes",
    "title": "Black–Scholes option price",
    "field": "science",
    "latex": "C=S\\,\\Phi(d_1)-Ke^{-rT}\\Phi(d_2),\\quad d_{1,2}=\\frac{\\ln(S/K)+(r\\pm\\sigma^2/2)T}{\\sigma\\sqrt T},\\quad C-P=S-Ke^{-rT}",
    "plain": "call price and put–call parity",
    "symbols": "",
    "notes": "",
    "related": [
      "normal_cdf"
    ]
  },
  {
    "id": "boltzmann_entropy",
    "title": "Boltzmann entropy and the partition function",
    "field": "science",
    "latex": "S=k_B\\ln W,\\qquad Z=\\sum_ie^{-E_i/k_BT},\\qquad p_i=\\frac{e^{-E_i/k_BT}}Z,\\qquad F=-k_BT\\ln Z",
    "plain": "S = k ln W;  pᵢ = e^(−Eᵢ/kT)/Z;  F = −kT ln Z",
    "symbols": "",
    "notes": "The softmax is a Boltzmann distribution with temperature T; entropy S = −kΣ p ln p.",
    "related": [
      "softmax",
      "entropy",
      "temperature_softmax"
    ]
  },
  {
    "id": "capm",
    "title": "CAPM and value at risk",
    "field": "science",
    "latex": "\\mathbb E[R_i]=r_f+\\beta_i\\big(\\mathbb E[R_m]-r_f\\big),\\qquad \\mathrm{VaR}_\\alpha=\\mu+z_\\alpha\\sigma",
    "plain": "E[R] = r_f + β(E[R_m] − r_f)",
    "symbols": "",
    "notes": "",
    "related": [
      "portfolio_theory"
    ]
  },
  {
    "id": "coulomb",
    "title": "Coulomb's law and electric field",
    "field": "science",
    "latex": "F=\\frac{kq_1q_2}{r^2},\\quad E=\\frac{kq}{r^2},\\quad V=\\frac{kq}r,\\quad k=\\frac1{4\\pi\\varepsilon_0}\\approx8.99\\times10^9",
    "plain": "F = kq₁q₂/r²;  E = kq/r²;  V = kq/r",
    "symbols": "",
    "notes": "",
    "related": [
      "gravitation"
    ]
  },
  {
    "id": "diversity_indices",
    "title": "diversity indices",
    "field": "science",
    "latex": "H'=-\\sum_ip_i\\ln p_i,\\qquad D=1-\\sum_ip_i^2,\\qquad \\text{Hill number }{}^qD=\\Big(\\sum p_i^q\\Big)^{\\frac1{1-q}}",
    "plain": "Shannon index H′ = −Σ pᵢ ln pᵢ;  Simpson D = 1 − Σ pᵢ²",
    "symbols": "",
    "notes": "Shannon entropy by another name.",
    "related": [
      "entropy",
      "gini_impurity"
    ]
  },
  {
    "id": "doubling_time",
    "title": "doubling time and the rule of 72",
    "field": "science",
    "latex": "t_d=\\frac{\\ln2}r\\approx\\frac{72}{r\\%},\\qquad N=N_0e^{rt}",
    "plain": "t_d = ln 2/r ≈ 72/r%",
    "symbols": "",
    "notes": "",
    "related": [
      "logistic_growth"
    ]
  },
  {
    "id": "elasticity_cobb_douglas",
    "title": "elasticity and the Cobb–Douglas function",
    "field": "science",
    "latex": "\\varepsilon=\\frac{\\partial\\ln Q}{\\partial\\ln P}=\\frac{dQ}{dP}\\frac PQ,\\qquad Y=AK^{\\alpha}L^{1-\\alpha}",
    "plain": "ε = (dQ/dP)(P/Q);  Y = A K^α L^(1 − α)",
    "symbols": "",
    "notes": "",
    "related": [
      "allometric"
    ]
  },
  {
    "id": "kinematics",
    "title": "equations of constant acceleration",
    "field": "science",
    "latex": "v=u+at,\\qquad s=ut+\\tfrac12at^2,\\qquad v^2=u^2+2as",
    "plain": "v = u + at;  s = ut + ½at²;  v² = u² + 2as",
    "symbols": "",
    "notes": "",
    "related": [
      "projectile"
    ]
  },
  {
    "id": "crra_utility",
    "title": "expected utility and CRRA",
    "field": "science",
    "latex": "U(W)=\\frac{W^{1-\\gamma}}{1-\\gamma},\\qquad \\mathrm{CE}=U^{-1}\\big(\\mathbb E\\,U(W)\\big),\\qquad \\text{risk premium}=\\mathbb E W-\\mathrm{CE}",
    "plain": "U = W^(1−γ)/(1 − γ);  certainty equivalent",
    "symbols": "",
    "notes": "",
    "related": [
      "jensen_inequality",
      "kelly_criterion"
    ]
  },
  {
    "id": "fermi_bose",
    "title": "Fermi–Dirac and Bose–Einstein distributions",
    "field": "science",
    "latex": "f_{FD}(E)=\\frac1{e^{(E-\\mu)/k_BT}+1},\\qquad f_{BE}(E)=\\frac1{e^{(E-\\mu)/k_BT}-1}",
    "plain": "occupation numbers of fermions and bosons",
    "symbols": "",
    "notes": "At E = μ the Fermi–Dirac occupation is ½.",
    "related": [
      "boltzmann_entropy"
    ]
  },
  {
    "id": "first_law",
    "title": "first law, heat and the Carnot limit",
    "field": "science",
    "latex": "\\Delta U=Q-W,\\qquad Q=mc\\Delta T,\\qquad \\eta_{\\text{Carnot}}=1-\\frac{T_c}{T_h}",
    "plain": "ΔU = Q − W;  Q = mcΔT;  η = 1 − T_c/T_h",
    "symbols": "",
    "notes": "",
    "related": [
      "boltzmann_entropy"
    ]
  },
  {
    "id": "first_order_kinetics",
    "title": "first-order kinetics and half-life",
    "field": "science",
    "latex": "[A]=[A]_0e^{-kt},\\qquad t_{1/2}=\\frac{\\ln2}k",
    "plain": "[A] = [A]₀ e^(−kt);  t½ = ln 2/k",
    "symbols": "",
    "notes": "Also radioactive decay: N = N₀ e^(−λt).",
    "related": [
      "arrhenius"
    ]
  },
  {
    "id": "gibbs_free_energy",
    "title": "Gibbs free energy and equilibrium constant",
    "field": "science",
    "latex": "\\Delta G=\\Delta H-T\\Delta S,\\qquad \\Delta G^0=-RT\\ln K",
    "plain": "ΔG = ΔH − TΔS;  ΔG⁰ = −RT ln K",
    "symbols": "",
    "notes": "",
    "related": [
      "nernst"
    ]
  },
  {
    "id": "gini_coefficient",
    "title": "Gini coefficient and Lorenz curve",
    "field": "science",
    "latex": "G=\\frac{\\sum_i\\sum_j|x_i-x_j|}{2n^2\\bar x}=1-2\\int_0^1L(p)\\,dp",
    "plain": "G = ΣΣ|xᵢ − xⱼ|/(2n²x̄)",
    "symbols": "",
    "notes": "0 is perfect equality; 1 is maximal inequality. Also the Herfindahl index H = Σ sᵢ² for market concentration.",
    "related": [
      "gini_impurity"
    ]
  },
  {
    "id": "gordon_growth",
    "title": "Gordon growth model",
    "field": "science",
    "latex": "P=\\frac{D_1}{r-g}",
    "plain": "P = D₁/(r − g)",
    "symbols": "",
    "notes": "Requires r > g.",
    "related": [
      "npv_irr"
    ]
  },
  {
    "id": "hardy_weinberg",
    "title": "Hardy–Weinberg equilibrium",
    "field": "science",
    "latex": "p^2+2pq+q^2=1,\\qquad p+q=1",
    "plain": "genotype frequencies p², 2pq, q²",
    "symbols": "",
    "notes": "",
    "related": [
      "binomial"
    ]
  },
  {
    "id": "heat_equation",
    "title": "heat, wave and Laplace equations",
    "field": "science",
    "latex": "u_t=\\alpha\\,u_{xx},\\qquad u_{tt}=c^2u_{xx},\\qquad \\nabla^2u=0",
    "plain": "heat u_t = αu_xx;  wave u_tt = c²u_xx;  Laplace ∇²u = 0",
    "symbols": "",
    "notes": "Separation of variables turns each into ordinary differential equations. The heat kernel is a Gaussian with variance 2αt.",
    "related": [
      "navier_stokes"
    ]
  },
  {
    "id": "hooke_spring",
    "title": "Hooke's law and the spring-mass oscillator",
    "field": "science",
    "latex": "F=-kx,\\quad U=\\tfrac12kx^2,\\quad \\omega=\\sqrt{k/m},\\quad T=2\\pi\\sqrt{m/k},\\quad x(t)=A\\cos(\\omega t+\\phi)",
    "plain": "F = −kx;  ω = √(k/m);  T = 2π√(m/k)",
    "symbols": "",
    "notes": "",
    "related": [
      "pendulum"
    ]
  },
  {
    "id": "ideal_gas",
    "title": "ideal gas law and kinetic theory",
    "field": "science",
    "latex": "PV=nRT=Nk_BT,\\qquad v_{\\text{rms}}=\\sqrt{\\frac{3k_BT}m},\\qquad \\bar K=\\tfrac32k_BT",
    "plain": "PV = nRT;  v_rms = √(3kT/m)",
    "symbols": "R = 8.314 J/(mol K)",
    "notes": "",
    "related": [
      "maxwell_boltzmann_speed"
    ]
  },
  {
    "id": "lif_neuron",
    "title": "leaky integrate-and-fire neuron",
    "field": "science",
    "latex": "\\tau_m\\frac{dV}{dt}=-(V-V_{\\text{rest}})+RI,\\qquad \\text{spike when }V\\ge V_{\\text{th}},\\ \\text{then reset}",
    "plain": "τ dV/dt = −(V − V_rest) + RI",
    "symbols": "",
    "notes": "The basic unit of spiking neural networks.",
    "related": [
      "rc_circuit"
    ]
  },
  {
    "id": "logistic_growth",
    "title": "logistic growth",
    "field": "science",
    "latex": "\\frac{dN}{dt}=rN\\Big(1-\\frac NK\\Big),\\qquad N(t)=\\frac K{1+\\frac{K-N_0}{N_0}e^{-rt}}",
    "plain": "dN/dt = rN(1 − N/K);  N(t) = K/(1 + ((K − N₀)/N₀) e^(−rt))",
    "symbols": "",
    "notes": "Exponential growth N₀e^(rt) while N ≪ K; the sigmoid shape of adoption curves.",
    "related": [
      "sigmoid",
      "doubling_time"
    ]
  },
  {
    "id": "lorentz_force",
    "title": "Lorentz force",
    "field": "science",
    "latex": "\\mathbf F=q\\big(\\mathbf E+\\mathbf v\\times\\mathbf B\\big),\\qquad r=\\frac{mv}{qB},\\qquad \\omega_c=\\frac{qB}m",
    "plain": "F = q(E + v × B);  gyroradius r = mv/(qB)",
    "symbols": "",
    "notes": "",
    "related": [
      "cross_product"
    ]
  },
  {
    "id": "lotka_volterra",
    "title": "Lotka–Volterra predator–prey",
    "field": "science",
    "latex": "\\dot x=\\alpha x-\\beta xy,\\quad \\dot y=\\delta xy-\\gamma y,\\qquad (x^*,y^*)=\\Big(\\frac\\gamma\\delta,\\frac\\alpha\\beta\\Big)",
    "plain": "prey x, predators y;  equilibrium (γ/δ, α/β)",
    "symbols": "",
    "notes": "",
    "related": [
      "logistic_growth"
    ]
  },
  {
    "id": "maxwell",
    "title": "Maxwell's equations",
    "field": "science",
    "latex": "\\nabla\\cdot\\mathbf E=\\frac\\rho{\\varepsilon_0},\\quad \\nabla\\cdot\\mathbf B=0,\\quad \\nabla\\times\\mathbf E=-\\frac{\\partial\\mathbf B}{\\partial t},\\quad \\nabla\\times\\mathbf B=\\mu_0\\mathbf J+\\mu_0\\varepsilon_0\\frac{\\partial\\mathbf E}{\\partial t}",
    "plain": "Gauss, Gauss for magnetism, Faraday, Ampère–Maxwell",
    "symbols": "",
    "notes": "The speed of light is c = 1/√(μ₀ε₀).",
    "related": [
      "gradient_divergence_curl"
    ]
  },
  {
    "id": "maxwell_boltzmann_speed",
    "title": "Maxwell–Boltzmann speeds",
    "field": "science",
    "latex": "v_p=\\sqrt{\\frac{2k_BT}m},\\quad \\bar v=\\sqrt{\\frac{8k_BT}{\\pi m}},\\quad v_{\\text{rms}}=\\sqrt{\\frac{3k_BT}m}",
    "plain": "most probable, mean and rms speed",
    "symbols": "",
    "notes": "",
    "related": [
      "maxwell_mean",
      "ideal_gas"
    ]
  },
  {
    "id": "michaelis_menten",
    "title": "Michaelis–Menten kinetics and the Hill equation",
    "field": "science",
    "latex": "v=\\frac{V_{\\max}[S]}{K_m+[S]},\\qquad \\theta=\\frac{[L]^n}{K_d^n+[L]^n}",
    "plain": "v = Vmax[S]/(Km + [S]);  Hill: θ = [L]ⁿ/(K_dⁿ + [L]ⁿ)",
    "symbols": "",
    "notes": "Half the maximum rate at [S] = Km.",
    "related": [
      "sigmoid"
    ]
  },
  {
    "id": "navier_stokes",
    "title": "Navier–Stokes (incompressible)",
    "field": "science",
    "latex": "\\rho\\Big(\\frac{\\partial\\mathbf u}{\\partial t}+(\\mathbf u\\cdot\\nabla)\\mathbf u\\Big)=-\\nabla p+\\mu\\nabla^2\\mathbf u+\\mathbf f,\\qquad \\nabla\\cdot\\mathbf u=0",
    "plain": "momentum balance plus incompressibility",
    "symbols": "",
    "notes": "Also the setting of physics-informed neural networks (PINNs).",
    "related": [
      "bernoulli_fluid",
      "heat_equation"
    ]
  },
  {
    "id": "nernst",
    "title": "Nernst equation",
    "field": "science",
    "latex": "E=E^0-\\frac{RT}{nF}\\ln Q,\\qquad E_{\\text{ion}}=\\frac{RT}{zF}\\ln\\frac{[\\mathrm{ion}]_{out}}{[\\mathrm{ion}]_{in}}",
    "plain": "E = E⁰ − (RT/nF) ln Q",
    "symbols": "",
    "notes": "In neuroscience it gives the equilibrium potential of an ion.",
    "related": [
      "gibbs_free_energy"
    ]
  },
  {
    "id": "npv_irr",
    "title": "net present value and annuities",
    "field": "science",
    "latex": "\\mathrm{NPV}=\\sum_{t=0}^{T}\\frac{C_t}{(1+r)^t},\\qquad PV_{\\text{annuity}}=C\\,\\frac{1-(1+r)^{-n}}r,\\qquad \\text{perpetuity }\\frac Cr",
    "plain": "NPV = Σ Cₜ/(1 + r)ᵗ;  annuity PV = C(1 − (1 + r)⁻ⁿ)/r",
    "symbols": "",
    "notes": "",
    "related": [
      "recurrence_sums"
    ]
  },
  {
    "id": "newton_second",
    "title": "Newton's second law, momentum and impulse",
    "field": "science",
    "latex": "\\mathbf F=m\\mathbf a=\\frac{d\\mathbf p}{dt},\\qquad \\mathbf p=m\\mathbf v,\\qquad \\mathbf J=\\int\\mathbf F\\,dt=\\Delta\\mathbf p",
    "plain": "F = ma = dp/dt;  impulse = Δp",
    "symbols": "",
    "notes": "",
    "related": [
      "kinetic_energy"
    ]
  },
  {
    "id": "gravitation",
    "title": "Newtonian gravitation",
    "field": "science",
    "latex": "F=\\frac{Gm_1m_2}{r^2},\\quad v_{\\text{orb}}=\\sqrt{\\frac{GM}r},\\quad v_{\\text{esc}}=\\sqrt{\\frac{2GM}r},\\quad T^2=\\frac{4\\pi^2a^3}{GM}",
    "plain": "F = Gm₁m₂/r²;  v_orb = √(GM/r);  v_esc = √(2GM/r)",
    "symbols": "G = 6.674×10⁻¹¹ N m²/kg²",
    "notes": "",
    "related": [
      "kinetic_energy"
    ]
  },
  {
    "id": "circuits",
    "title": "Ohm's law and resistor networks",
    "field": "science",
    "latex": "V=IR,\\quad P=IV=I^2R,\\quad R_{\\text{series}}=\\sum R_i,\\quad \\frac1{R_{\\text{par}}}=\\sum\\frac1{R_i}",
    "plain": "V = IR;  P = IV;  series add, parallel add reciprocals",
    "symbols": "",
    "notes": "",
    "related": [
      "rc_circuit"
    ]
  },
  {
    "id": "particle_in_box",
    "title": "particle in a box and hydrogen levels",
    "field": "science",
    "latex": "E_n=\\frac{n^2h^2}{8mL^2},\\qquad E_n^{\\mathrm H}=-\\frac{13.6\\ \\text{eV}}{n^2}",
    "plain": "Eₙ = n²h²/(8mL²);  hydrogen Eₙ = −13.6 eV/n²",
    "symbols": "",
    "notes": "",
    "related": [
      "photon_energy"
    ]
  },
  {
    "id": "ph",
    "title": "pH and the Henderson–Hasselbalch equation",
    "field": "science",
    "latex": "\\mathrm{pH}=-\\log_{10}[\\mathrm H^+],\\qquad \\mathrm{pH}=\\mathrm{p}K_a+\\log_{10}\\frac{[\\mathrm A^-]}{[\\mathrm{HA}]}",
    "plain": "pH = −log₁₀[H⁺];  pH = pKa + log₁₀([A⁻]/[HA])",
    "symbols": "",
    "notes": "",
    "related": [
      "arrhenius"
    ]
  },
  {
    "id": "photon_energy",
    "title": "photon energy and de Broglie wavelength",
    "field": "science",
    "latex": "E=hf=\\frac{hc}\\lambda,\\qquad \\lambda=\\frac hp,\\qquad \\Delta x\\,\\Delta p\\ge\\frac\\hbar2",
    "plain": "E = hf = hc/λ;  λ = h/p;  ΔxΔp ≥ ħ/2",
    "symbols": "h = 6.626×10⁻³⁴ J s",
    "notes": "",
    "related": [
      "uncertainty_principle"
    ]
  },
  {
    "id": "blackbody",
    "title": "Planck, Stefan–Boltzmann and Wien laws",
    "field": "science",
    "latex": "B_\\lambda=\\frac{2hc^2}{\\lambda^5}\\frac1{e^{hc/\\lambda k_BT}-1},\\qquad P=\\sigma AT^4,\\qquad \\lambda_{\\max}=\\frac bT",
    "plain": "blackbody spectrum;  P = σAT⁴;  λ_max = b/T",
    "symbols": "σ = 5.670×10⁻⁸, b = 2.898×10⁻³ m K",
    "notes": "",
    "related": [
      "photon_energy"
    ]
  },
  {
    "id": "portfolio_theory",
    "title": "portfolio return, variance and Sharpe ratio",
    "field": "science",
    "latex": "\\mu_p=\\mathbf w^{\\top}\\boldsymbol\\mu,\\qquad \\sigma_p^2=\\mathbf w^{\\top}\\Sigma\\mathbf w,\\qquad \\mathrm{Sharpe}=\\frac{\\mu_p-r_f}{\\sigma_p}",
    "plain": "μ_p = wᵀμ;  σ_p² = wᵀΣw;  Sharpe = (μ_p − r_f)/σ_p",
    "symbols": "",
    "notes": "Diversification: the covariance terms, not the variances, set the portfolio risk.",
    "related": [
      "variance",
      "covariance"
    ]
  },
  {
    "id": "projectile",
    "title": "projectile motion",
    "field": "science",
    "latex": "R=\\frac{v_0^2\\sin2\\theta}g,\\qquad H=\\frac{v_0^2\\sin^2\\theta}{2g},\\qquad T=\\frac{2v_0\\sin\\theta}g",
    "plain": "range v²sin 2θ/g;  height v²sin²θ/(2g);  time 2v sin θ/g",
    "symbols": "",
    "notes": "Maximum range at 45° (no drag).",
    "related": [
      "kinematics"
    ]
  },
  {
    "id": "rc_circuit",
    "title": "RC and RL circuits",
    "field": "science",
    "latex": "V_C(t)=V_0\\big(1-e^{-t/RC}\\big),\\quad \\tau=RC,\\quad E_C=\\tfrac12CV^2,\\quad E_L=\\tfrac12LI^2",
    "plain": "V(t) = V₀(1 − e^(−t/RC));  τ = RC",
    "symbols": "",
    "notes": "63% charged after one time constant.",
    "related": [
      "circuits",
      "rc_lowpass"
    ]
  },
  {
    "id": "rotation",
    "title": "rotational dynamics",
    "field": "science",
    "latex": "\\tau=I\\alpha,\\quad L=I\\omega,\\quad K_{\\text{rot}}=\\tfrac12I\\omega^2,\\quad I_{\\text{disk}}=\\tfrac12mr^2,\\quad I_{\\text{sphere}}=\\tfrac25mr^2",
    "plain": "τ = Iα;  L = Iω;  K = ½Iω²",
    "symbols": "",
    "notes": "",
    "related": [
      "kinetic_energy"
    ]
  },
  {
    "id": "schrodinger",
    "title": "Schrödinger equation",
    "field": "science",
    "latex": "i\\hbar\\frac{\\partial\\psi}{\\partial t}=\\hat H\\psi,\\qquad \\hat H\\psi=E\\psi,\\quad \\hat H=-\\frac{\\hbar^2}{2m}\\nabla^2+V",
    "plain": "iħ ∂ψ/∂t = Ĥψ;  Ĥψ = Eψ",
    "symbols": "",
    "notes": "|ψ|² is the probability density.",
    "related": [
      "particle_in_box"
    ]
  },
  {
    "id": "pendulum",
    "title": "simple pendulum",
    "field": "science",
    "latex": "T=2\\pi\\sqrt{\\frac Lg}\\quad(\\text{small angles})",
    "plain": "T = 2π√(L/g)",
    "symbols": "",
    "notes": "",
    "related": [
      "hooke_spring"
    ]
  },
  {
    "id": "sir_model",
    "title": "SIR epidemic model",
    "field": "science",
    "latex": "\\dot S=-\\beta SI,\\quad \\dot I=\\beta SI-\\gamma I,\\quad \\dot R=\\gamma I,\\qquad R_0=\\frac\\beta\\gamma,\\quad \\text{herd immunity }1-\\frac1{R_0}",
    "plain": "R₀ = β/γ;  herd-immunity threshold 1 − 1/R₀",
    "symbols": "",
    "notes": "An outbreak grows iff R₀ S/N > 1.",
    "related": [
      "logistic_growth"
    ]
  },
  {
    "id": "relativity",
    "title": "special relativity",
    "field": "science",
    "latex": "E=mc^2,\\quad \\gamma=\\frac1{\\sqrt{1-v^2/c^2}},\\quad \\Delta t=\\gamma\\Delta t_0,\\quad L=\\frac{L_0}\\gamma,\\quad E^2=(pc)^2+(mc^2)^2",
    "plain": "E = mc²;  γ = 1/√(1 − v²/c²);  time dilation, length contraction",
    "symbols": "",
    "notes": "",
    "related": [
      "lorentz_force"
    ]
  },
  {
    "id": "circular_motion",
    "title": "uniform circular motion",
    "field": "science",
    "latex": "a_c=\\frac{v^2}r=\\omega^2r,\\qquad v=\\omega r,\\qquad F_c=\\frac{mv^2}r",
    "plain": "a = v²/r = ω²r",
    "symbols": "",
    "notes": "",
    "related": [
      "newton_second"
    ]
  },
  {
    "id": "wave_basics",
    "title": "waves, Doppler effect and Snell's law",
    "field": "science",
    "latex": "v=f\\lambda,\\quad f'=f\\frac{v\\pm v_o}{v\\mp v_s},\\quad n_1\\sin\\theta_1=n_2\\sin\\theta_2,\\quad \\frac1f=\\frac1{d_o}+\\frac1{d_i}",
    "plain": "v = fλ;  Doppler;  Snell;  thin lens",
    "symbols": "",
    "notes": "",
    "related": [
      "maxwell"
    ]
  },
  {
    "id": "kinetic_energy",
    "title": "work, kinetic and potential energy",
    "field": "science",
    "latex": "W=Fd\\cos\\theta,\\quad K=\\tfrac12mv^2,\\quad U=mgh,\\quad P=\\frac{dW}{dt}=\\mathbf F\\cdot\\mathbf v",
    "plain": "W = Fd cos θ;  K = ½mv²;  U = mgh",
    "symbols": "",
    "notes": "Work–energy theorem: W = ΔK.",
    "related": [
      "newton_second"
    ]
  },
  {
    "id": "bode_gain",
    "title": "Bode magnitude and gain margin",
    "field": "control",
    "latex": "|G(j\\omega)|_{\\text{dB}}=20\\log_{10}|G(j\\omega)|,\\qquad \\text{GM}=\\frac1{|G(j\\omega_{180})|}",
    "plain": "gain in decibels = 20 log₁₀|G|",
    "symbols": "",
    "notes": "",
    "related": [
      "snr_db",
      "butterworth"
    ]
  },
  {
    "id": "controllability",
    "title": "controllability and observability",
    "field": "control",
    "latex": "\\operatorname{rank}\\big[B,\\ AB,\\ \\dots,\\ A^{n-1}B\\big]=n,\\qquad \\operatorname{rank}\\big[C;\\ CA;\\ \\dots;\\ CA^{n-1}\\big]=n",
    "plain": "full-rank controllability / observability matrix",
    "symbols": "",
    "notes": "",
    "related": [
      "lqr"
    ]
  },
  {
    "id": "step_response",
    "title": "first- and second-order step responses",
    "field": "control",
    "latex": "y(t)=1-e^{-t/\\tau},\\qquad \\text{overshoot}=\\exp\\!\\Big(-\\frac{\\pi\\zeta}{\\sqrt{1-\\zeta^2}}\\Big),\\quad t_s\\approx\\frac4{\\zeta\\omega_n}",
    "plain": "first order 1 − e^(−t/τ);  second order: overshoot exp(−πζ/√(1 − ζ²))",
    "symbols": "",
    "notes": "",
    "related": [
      "rc_circuit",
      "ode_second_order"
    ]
  },
  {
    "id": "lqr",
    "title": "linear-quadratic regulator",
    "field": "control",
    "latex": "\\min\\int(\\mathbf x^{\\top}Q\\mathbf x+\\mathbf u^{\\top}R\\mathbf u)dt\\ \\Rightarrow\\ \\mathbf u=-K\\mathbf x,\\ K=R^{-1}B^{\\top}P,\\ \\ A^{\\top}P+PA-PBR^{-1}B^{\\top}P+Q=0",
    "plain": "optimal feedback gain from the algebraic Riccati equation",
    "symbols": "",
    "notes": "Scalar case: P = (a + √(a² + b²q/r))·r/b².",
    "related": [
      "kalman_filter"
    ]
  },
  {
    "id": "lyapunov_equation",
    "title": "Lyapunov stability",
    "field": "control",
    "latex": "\\dot{\\mathbf x}=A\\mathbf x\\ \\text{stable}\\iff\\exists P\\succ0:\\ A^{\\top}P+PA=-Q\\ (Q\\succ0)",
    "plain": "stable iff every eigenvalue of A has negative real part",
    "symbols": "",
    "notes": "",
    "related": [
      "eigen"
    ]
  },
  {
    "id": "pid",
    "title": "PID controller",
    "field": "control",
    "latex": "u(t)=K_pe(t)+K_i\\int_0^te\\,d\\tau+K_d\\frac{de}{dt}",
    "plain": "u = Kp·e + Ki·∫e + Kd·de/dt",
    "symbols": "",
    "notes": "",
    "related": [
      "step_response"
    ]
  },
  {
    "id": "euler_stability",
    "title": "stability region of the Euler method",
    "field": "control",
    "latex": "y'=\\lambda y:\\ \\ y_{n+1}=(1+h\\lambda)y_n,\\quad \\text{stable iff }|1+h\\lambda|<1",
    "plain": "forward Euler is stable for |1 + hλ| < 1",
    "symbols": "",
    "notes": "For λ = −100 the step must be below 0.02. Stiff problems need implicit methods.",
    "related": [
      "euler_method",
      "gradient_descent"
    ]
  },
  {
    "id": "nesterov_rate",
    "title": "accelerated gradient rate",
    "field": "optimization",
    "latex": "f(x_k)-f^*\\le\\frac{2L\\|x_0-x^*\\|^2}{(k+1)^2}",
    "plain": "f(xₖ) − f* ≤ 2L‖x₀ − x*‖²/(k + 1)²",
    "symbols": "",
    "notes": "Optimal for first-order methods on smooth convex functions; plain gradient descent only gets O(1/k).",
    "related": [
      "nesterov"
    ]
  },
  {
    "id": "adadelta",
    "title": "AdaDelta",
    "field": "optimization",
    "latex": "E[g^2]\\leftarrow\\rho E[g^2]+(1-\\rho)g^2,\\quad \\Delta\\theta=-\\frac{\\sqrt{E[\\Delta\\theta^2]+\\epsilon}}{\\sqrt{E[g^2]+\\epsilon}}\\,g,\\quad E[\\Delta\\theta^2]\\leftarrow\\rho E[\\Delta\\theta^2]+(1-\\rho)\\Delta\\theta^2",
    "plain": "Δθ = −√(E[Δθ²] + ε)/√(E[g²] + ε) · g",
    "symbols": "",
    "notes": "No learning rate needed.",
    "related": [
      "rmsprop",
      "adagrad"
    ]
  },
  {
    "id": "adagrad",
    "title": "AdaGrad",
    "field": "optimization",
    "latex": "G\\leftarrow G+g^2,\\quad \\theta\\leftarrow\\theta-\\frac{\\eta\\,g}{\\sqrt G+\\epsilon}",
    "plain": "G ← G + g²;  θ ← θ − η g / (√G + ε)",
    "symbols": "",
    "notes": "Per-parameter step shrinks as gradients accumulate; good for sparse features.",
    "related": [
      "rmsprop",
      "adam"
    ]
  },
  {
    "id": "adam",
    "title": "Adam",
    "field": "optimization",
    "latex": "m\\leftarrow\\beta_1m+(1-\\beta_1)g,\\ v\\leftarrow\\beta_2v+(1-\\beta_2)g^2,\\ \\hat m=\\tfrac{m}{1-\\beta_1^t},\\ \\hat v=\\tfrac{v}{1-\\beta_2^t},\\ \\theta\\leftarrow\\theta-\\eta\\frac{\\hat m}{\\sqrt{\\hat v}+\\epsilon}",
    "plain": "m ← β₁m + (1−β₁)g\nv ← β₂v + (1−β₂)g²\nm̂ = m/(1−β₁ᵗ)   v̂ = v/(1−β₂ᵗ)\nθ ← θ − η m̂ / (√v̂ + ε)",
    "symbols": "defaults β₁ = 0.9, β₂ = 0.999, ε = 1e-8",
    "notes": "The bias correction matters in the first steps.",
    "related": [
      "adamw",
      "momentum",
      "rmsprop"
    ]
  },
  {
    "id": "adamw",
    "title": "AdamW (decoupled weight decay)",
    "field": "optimization",
    "latex": "\\theta\\leftarrow\\theta-\\eta\\left(\\frac{\\hat m}{\\sqrt{\\hat v}+\\epsilon}+\\lambda\\theta\\right)",
    "plain": "θ ← θ − η ( m̂/(√v̂+ε) + λθ )",
    "symbols": "λ = weight decay",
    "notes": "Decay is applied to the weights, not folded into the gradient.",
    "related": [
      "adam",
      "l2_penalty"
    ]
  },
  {
    "id": "admm",
    "title": "ADMM (scaled form, lasso)",
    "field": "optimization",
    "latex": "x\\leftarrow(A^{\\top}A+\\rho I)^{-1}\\big(A^{\\top}b+\\rho(z-u)\\big),\\quad z\\leftarrow S_{\\lambda/\\rho}(x+u),\\quad u\\leftarrow u+x-z",
    "plain": "x-update (ridge solve), z-update (soft-threshold), u-update (dual)",
    "symbols": "",
    "notes": "Splits a hard problem into easy ones; good for distributed and constrained problems.",
    "related": [
      "ista",
      "proximal_l1"
    ]
  },
  {
    "id": "amsgrad",
    "title": "AMSGrad",
    "field": "optimization",
    "latex": "\\hat v_t=\\max(\\hat v_{t-1},v_t),\\quad \\theta\\leftarrow\\theta-\\eta\\frac{m_t}{\\sqrt{\\hat v_t}+\\epsilon}",
    "plain": "v̂ₜ = max(v̂ₜ₋₁, vₜ)",
    "symbols": "",
    "notes": "Keeps the second-moment estimate non-decreasing, fixing a convergence gap in Adam.",
    "related": [
      "adam"
    ]
  },
  {
    "id": "armijo",
    "title": "Armijo (sufficient decrease) condition",
    "field": "optimization",
    "latex": "f(x+tp)\\le f(x)+c_1\\,t\\,\\nabla f(x)^{\\top}p",
    "plain": "f(x + tp) ≤ f(x) + c₁ t ∇fᵀp",
    "symbols": "c₁ ≈ 10⁻⁴",
    "notes": "Backtracking: shrink t by a factor until it holds.",
    "related": [
      "wolfe_conditions"
    ]
  },
  {
    "id": "bfgs_update",
    "title": "BFGS update",
    "field": "optimization",
    "latex": "H_{k+1}=\\Big(I-\\rho s y^{\\top}\\Big)H_k\\Big(I-\\rho y s^{\\top}\\Big)+\\rho ss^{\\top},\\quad \\rho=\\frac1{y^{\\top}s}",
    "plain": "H₊ = (I − ρsyᵀ) H (I − ρysᵀ) + ρssᵀ",
    "symbols": "s = x₊ − x, y = ∇f₊ − ∇f",
    "notes": "Satisfies the secant equation H₊y = s.",
    "related": [
      "newton_method_multi"
    ]
  },
  {
    "id": "convexity_definitions",
    "title": "convexity and strong convexity",
    "field": "optimization",
    "latex": "f(\\theta x+(1-\\theta)y)\\le\\theta f(x)+(1-\\theta)f(y);\\quad f(y)\\ge f(x)+\\nabla f(x)^{\\top}(y-x)+\\tfrac\\mu2\\|y-x\\|^2",
    "plain": "convex: f(θx + (1−θ)y) ≤ θf(x) + (1−θ)f(y);  μ-strongly convex: f(y) ≥ f(x) + ∇f·(y−x) + (μ/2)‖y − x‖²",
    "symbols": "",
    "notes": "",
    "related": [
      "descent_lemma"
    ]
  },
  {
    "id": "lr_cosine_restarts",
    "title": "cosine annealing with warm restarts (SGDR)",
    "field": "optimization",
    "latex": "\\eta_t=\\eta_{\\min}+\\tfrac12(\\eta_{\\max}-\\eta_{\\min})\\Big(1+\\cos\\frac{\\pi T_{\\text{cur}}}{T_i}\\Big)",
    "plain": "η_t = η_min + ½(η_max − η_min)(1 + cos(πT_cur/T_i))",
    "symbols": "T_cur = steps since the last restart",
    "notes": "",
    "related": [
      "lr_cosine"
    ]
  },
  {
    "id": "lr_cosine",
    "title": "cosine learning-rate schedule",
    "field": "optimization",
    "latex": "\\eta_t=\\eta_{\\min}+\\tfrac12(\\eta_{\\max}-\\eta_{\\min})\\left(1+\\cos\\frac{\\pi t}{T}\\right)",
    "plain": "η_t = η_min + ½(η_max − η_min)(1 + cos(πt/T))",
    "symbols": "T = total steps",
    "notes": "",
    "related": [
      "lr_warmup",
      "lr_exponential_decay"
    ]
  },
  {
    "id": "descent_lemma",
    "title": "descent lemma (L-smoothness)",
    "field": "optimization",
    "latex": "f(y)\\le f(x)+\\nabla f(x)^{\\top}(y-x)+\\frac L2\\|y-x\\|^2",
    "plain": "f(y) ≤ f(x) + ∇f(x)·(y−x) + (L/2)‖y−x‖²",
    "symbols": "L = Lipschitz constant of ∇f",
    "notes": "Gives the 1/L step size for gradient descent.",
    "related": [
      "gd_rate_strongly_convex",
      "gradient_descent"
    ]
  },
  {
    "id": "mirror_descent_simplex",
    "title": "entropic mirror descent (exponentiated gradient)",
    "field": "optimization",
    "latex": "x_i\\leftarrow\\frac{x_i\\,e^{-\\eta g_i}}{\\sum_jx_je^{-\\eta g_j}}",
    "plain": "xᵢ ← xᵢ e^(−ηgᵢ) / Σⱼ xⱼ e^(−ηgⱼ)",
    "symbols": "",
    "notes": "Mirror descent with the KL divergence; keeps x on the simplex. The multiplicative-weights update.",
    "related": [
      "projected_gradient",
      "regret_bound"
    ]
  },
  {
    "id": "projection_simplex",
    "title": "Euclidean projection onto the simplex",
    "field": "optimization",
    "latex": "\\Pi(v)=\\max(v-\\tau,0),\\quad \\tau=\\frac{\\sum_{i\\le\\rho}u_i-1}{\\rho},\\ \\ \\rho=\\max\\Big\\{j:u_j-\\frac{\\sum_{i\\le j}u_i-1}j>0\\Big\\}",
    "plain": "sort v descending as u; ρ as above; subtract τ and clip",
    "symbols": "",
    "notes": "Used to keep probabilities valid in constrained optimisation.",
    "related": [
      "projected_gradient"
    ]
  },
  {
    "id": "lr_exponential_decay",
    "title": "exponential learning-rate decay",
    "field": "optimization",
    "latex": "\\eta_t=\\eta_0\\,\\gamma^{t}",
    "plain": "η_t = η₀ γᵗ",
    "symbols": "0 < γ < 1",
    "notes": "",
    "related": [
      "lr_cosine"
    ]
  },
  {
    "id": "ema",
    "title": "exponential moving average",
    "field": "optimization",
    "latex": "\\bar\\theta\\leftarrow\\beta\\bar\\theta+(1-\\beta)\\theta",
    "plain": "θ̄ ← β θ̄ + (1−β) θ",
    "symbols": "β ≈ 0.99–0.9999",
    "notes": "Used for weights (EMA models) and running statistics.",
    "related": [
      "momentum"
    ]
  },
  {
    "id": "fista",
    "title": "FISTA momentum",
    "field": "optimization",
    "latex": "t_{k+1}=\\frac{1+\\sqrt{1+4t_k^2}}2,\\qquad y_{k+1}=x_k+\\frac{t_k-1}{t_{k+1}}(x_k-x_{k-1})",
    "plain": "tₖ₊₁ = (1 + √(1 + 4tₖ²))/2;  yₖ₊₁ = xₖ + ((tₖ − 1)/tₖ₊₁)(xₖ − xₖ₋₁)",
    "symbols": "",
    "notes": "",
    "related": [
      "ista",
      "nesterov_rate"
    ]
  },
  {
    "id": "frank_wolfe",
    "title": "Frank–Wolfe (conditional gradient)",
    "field": "optimization",
    "latex": "s_k=\\arg\\min_{s\\in\\mathcal C}\\langle\\nabla f(x_k),s\\rangle,\\qquad x_{k+1}=(1-\\gamma_k)x_k+\\gamma_ks_k,\\ \\gamma_k=\\frac2{k+2}",
    "plain": "s = argmin ⟨∇f, s⟩;  x ← (1 − γ)x + γs",
    "symbols": "",
    "notes": "Projection-free: only a linear minimisation over the constraint set. On the simplex s is a vertex.",
    "related": [
      "projected_gradient"
    ]
  },
  {
    "id": "gauss_newton",
    "title": "Gauss–Newton and Levenberg–Marquardt",
    "field": "optimization",
    "latex": "\\Delta=-(J^{\\top}J)^{-1}J^{\\top}r,\\qquad \\Delta_{LM}=-(J^{\\top}J+\\lambda I)^{-1}J^{\\top}r",
    "plain": "Δ = −(JᵀJ)⁻¹Jᵀr;  LM adds λI",
    "symbols": "r = residuals, J = their Jacobian",
    "notes": "Exact in one step for linear least squares; LM interpolates toward gradient descent.",
    "related": [
      "ols",
      "newton_method_multi"
    ]
  },
  {
    "id": "gradient_accumulation",
    "title": "gradient accumulation",
    "field": "optimization",
    "latex": "g=\\frac1K\\sum_{k=1}^{K}\\nabla L_{B_k},\\qquad B_{\\text{effective}}=K\\cdot B",
    "plain": "average K micro-batch gradients before stepping",
    "symbols": "",
    "notes": "Gives a large effective batch on small memory; scale each loss by 1/K.",
    "related": [
      "linear_scaling_rule"
    ]
  },
  {
    "id": "gradient_check",
    "title": "gradient check (relative error)",
    "field": "optimization",
    "latex": "\\frac{\\|g_{\\text{analytic}}-g_{\\text{numeric}}\\|}{\\max(\\|g_{\\text{analytic}}\\|,\\|g_{\\text{numeric}}\\|)}\\ \\lesssim 10^{-6}",
    "plain": "relative error ‖g_a − g_n‖/max(‖g_a‖, ‖g_n‖) ≲ 1e-6",
    "symbols": "",
    "notes": "Compare backprop with the central difference.",
    "related": [
      "finite_differences"
    ]
  },
  {
    "id": "gd_rate_strongly_convex",
    "title": "gradient descent rate (strongly convex)",
    "field": "optimization",
    "latex": "\\|x_k-x^*\\|^2\\le\\left(1-\\frac{\\mu}{L}\\right)^{k}\\|x_0-x^*\\|^2",
    "plain": "‖x_k − x*‖² ≤ (1 − μ/L)ᵏ ‖x₀ − x*‖²",
    "symbols": "μ-strongly convex, L-smooth, step η = 1/L; μ/L = 1/κ",
    "notes": "Linear convergence; rate is governed by the condition number.",
    "related": [
      "condition_number",
      "descent_lemma"
    ]
  },
  {
    "id": "gradient_descent",
    "title": "gradient descent step",
    "field": "optimization",
    "latex": "\\theta_{t+1}=\\theta_t-\\eta\\,\\nabla L(\\theta_t)",
    "plain": "θ ← θ − η ∇L(θ)",
    "symbols": "η = learning rate",
    "notes": "Converges for convex L-smooth objectives when η ≤ 1/L.",
    "related": [
      "momentum",
      "adam",
      "gd_rate_strongly_convex"
    ]
  },
  {
    "id": "gradient_noise_scale",
    "title": "gradient noise scale",
    "field": "optimization",
    "latex": "\\mathcal B_{\\text{noise}}=\\frac{\\operatorname{tr}(\\Sigma)}{\\|G\\|^2}",
    "plain": "B_noise = tr(Σ)/‖G‖²",
    "symbols": "Σ = per-example gradient covariance, G = true gradient",
    "notes": "The batch size beyond which larger batches stop helping (critical batch size).",
    "related": [
      "linear_scaling_rule"
    ]
  },
  {
    "id": "gradient_clipping",
    "title": "gradient norm clipping",
    "field": "optimization",
    "latex": "g\\leftarrow g\\cdot\\min\\!\\left(1,\\frac{c}{\\|g\\|_2}\\right)",
    "plain": "g ← g · min(1, c / ‖g‖₂)",
    "symbols": "c = clip threshold",
    "notes": "Rescales the whole gradient, keeping its direction.",
    "related": [
      "gradient_descent"
    ]
  },
  {
    "id": "hessian_vector_product",
    "title": "Hessian–vector product",
    "field": "optimization",
    "latex": "H\\mathbf v\\approx\\frac{\\nabla f(x+\\varepsilon\\mathbf v)-\\nabla f(x)}{\\varepsilon}=\\nabla_x\\big(\\nabla f(x)^{\\top}\\mathbf v\\big)",
    "plain": "Hv ≈ (∇f(x + εv) − ∇f(x))/ε",
    "symbols": "",
    "notes": "Needs only gradients; reverse-mode autodiff computes it exactly in about twice the cost of a gradient.",
    "related": [
      "hessian_matrix",
      "conjugate_gradient"
    ]
  },
  {
    "id": "ista",
    "title": "ISTA (proximal gradient for the lasso)",
    "field": "optimization",
    "latex": "x\\leftarrow\\operatorname{prox}_{\\eta\\lambda\\|\\cdot\\|_1}\\big(x-\\eta A^{\\top}(Ax-b)\\big)",
    "plain": "x ← S_{ηλ}(x − ηAᵀ(Ax − b))",
    "symbols": "",
    "notes": "FISTA adds Nesterov momentum for an O(1/k²) rate.",
    "related": [
      "fista",
      "proximal_l1"
    ]
  },
  {
    "id": "kkt",
    "title": "KKT stationarity (inequality constraints)",
    "field": "optimization",
    "latex": "\\nabla f(x)+\\sum_i\\mu_i\\nabla g_i(x)=0,\\quad \\mu_i\\ge0,\\quad g_i(x)\\le0,\\quad \\mu_i g_i(x)=0",
    "plain": "∇f + Σ μᵢ∇gᵢ = 0;  μᵢ ≥ 0;  gᵢ ≤ 0;  μᵢgᵢ = 0",
    "symbols": "gᵢ(x) ≤ 0 constraints, μᵢ multipliers",
    "notes": "Complementary slackness: a constraint is active or its multiplier is zero.",
    "related": [
      "lagrangian",
      "svm_primal"
    ]
  },
  {
    "id": "weight_decay_equivalence",
    "title": "L2 regularisation as weight decay",
    "field": "optimization",
    "latex": "\\theta\\leftarrow\\theta-\\eta\\big(\\nabla L+\\lambda\\theta\\big)=(1-\\eta\\lambda)\\theta-\\eta\\nabla L",
    "plain": "θ ← (1 − ηλ)θ − η∇L",
    "symbols": "",
    "notes": "Identical for plain SGD; not for Adam, which is why AdamW decouples it.",
    "related": [
      "adamw",
      "l2_penalty"
    ]
  },
  {
    "id": "lagrangian",
    "title": "Lagrange multipliers",
    "field": "optimization",
    "latex": "\\mathcal L(x,\\lambda)=f(x)+\\lambda\\,g(x),\\quad \\nabla_x\\mathcal L=0,\\ g(x)=0",
    "plain": "L(x,λ) = f(x) + λ g(x);  ∇ₓL = 0,  g(x) = 0",
    "symbols": "equality constraint g(x) = 0",
    "notes": "Example: min x²+y² subject to x+y=1 gives x=y=½, λ=−1.",
    "related": [
      "kkt"
    ]
  },
  {
    "id": "lagrange_dual",
    "title": "Lagrangian dual",
    "field": "optimization",
    "latex": "g(\\lambda)=\\inf_x\\ \\mathcal L(x,\\lambda),\\quad d^*=\\max_{\\lambda\\ge0}g(\\lambda)\\le p^*",
    "plain": "g(λ) = inf_x L(x, λ);  d* ≤ p*  (weak duality)",
    "symbols": "",
    "notes": "Strong duality (d* = p*) holds for convex problems under Slater's condition. Example: min x² s.t. x ≥ 1 has g(λ) = λ − λ²/4, maximised at λ = 2.",
    "related": [
      "kkt",
      "svm_dual"
    ]
  },
  {
    "id": "lars_lamb",
    "title": "layer-wise trust ratio (LARS / LAMB)",
    "field": "optimization",
    "latex": "\\lambda_\\ell=\\eta\\,\\frac{\\|\\theta_\\ell\\|}{\\|g_\\ell\\|+\\beta\\|\\theta_\\ell\\|},\\qquad \\theta_\\ell\\leftarrow\\theta_\\ell-\\lambda_\\ell\\big(g_\\ell+\\beta\\theta_\\ell\\big)",
    "plain": "λ_ℓ = η‖θ_ℓ‖/(‖g_ℓ‖ + β‖θ_ℓ‖)",
    "symbols": "",
    "notes": "Scales each layer's step to its weight norm; enables very large batches.",
    "related": [
      "adamw",
      "linear_scaling_rule"
    ]
  },
  {
    "id": "linear_scaling_rule",
    "title": "learning-rate scaling with batch size",
    "field": "optimization",
    "latex": "\\eta'=\\eta\\,\\frac{B'}{B}\\ \\ (\\text{SGD}),\\qquad \\eta'=\\eta\\sqrt{\\frac{B'}{B}}\\ \\ (\\text{Adam, common heuristic})",
    "plain": "η′ = η·B′/B",
    "symbols": "",
    "notes": "Valid up to a critical batch size; combine with warm-up.",
    "related": [
      "gradient_noise_scale"
    ]
  },
  {
    "id": "lr_warmup",
    "title": "linear learning-rate warm-up",
    "field": "optimization",
    "latex": "\\eta_t=\\eta_{\\max}\\,\\frac{t}{T_w}\\quad(t\\le T_w)",
    "plain": "η_t = η_max · t / T_w",
    "symbols": "T_w = warm-up steps",
    "notes": "Stabilises early training of large models.",
    "related": [
      "lr_cosine"
    ]
  },
  {
    "id": "lion",
    "title": "Lion optimizer",
    "field": "optimization",
    "latex": "\\mathbf u=\\operatorname{sign}\\big(\\beta_1m+(1-\\beta_1)g\\big),\\quad \\theta\\leftarrow\\theta-\\eta(\\mathbf u+\\lambda\\theta),\\quad m\\leftarrow\\beta_2m+(1-\\beta_2)g",
    "plain": "u = sign(β₁m + (1−β₁)g);  θ ← θ − η(u + λθ)",
    "symbols": "",
    "notes": "Sign updates make every coordinate move by the same magnitude; found by program search.",
    "related": [
      "adamw"
    ]
  },
  {
    "id": "lookahead",
    "title": "Lookahead optimizer",
    "field": "optimization",
    "latex": "\\phi\\leftarrow\\phi+\\alpha(\\theta_k-\\phi)",
    "plain": "slow ← slow + α(fast − slow) every k steps",
    "symbols": "",
    "notes": "",
    "related": [
      "ema"
    ]
  },
  {
    "id": "momentum",
    "title": "momentum (heavy ball)",
    "field": "optimization",
    "latex": "v\\leftarrow\\mu v+g,\\quad \\theta\\leftarrow\\theta-\\eta v",
    "plain": "v ← μv + g;  θ ← θ − ηv",
    "symbols": "μ ≈ 0.9 = momentum coefficient",
    "notes": "Accumulates a velocity that smooths noisy gradients.",
    "related": [
      "gradient_descent",
      "adam"
    ]
  },
  {
    "id": "nesterov",
    "title": "Nesterov accelerated gradient",
    "field": "optimization",
    "latex": "\\mathbf v\\leftarrow\\mu\\mathbf v-\\eta\\nabla f(\\theta+\\mu\\mathbf v),\\quad \\theta\\leftarrow\\theta+\\mathbf v",
    "plain": "v ← μv − η∇f(θ + μv);  θ ← θ + v",
    "symbols": "",
    "notes": "Evaluates the gradient at the look-ahead point; O(1/k²) for smooth convex f.",
    "related": [
      "momentum",
      "nesterov_rate"
    ]
  },
  {
    "id": "pl_condition",
    "title": "Polyak–Łojasiewicz condition",
    "field": "optimization",
    "latex": "\\tfrac12\\|\\nabla f(x)\\|^2\\ge\\mu\\big(f(x)-f^*\\big)\\ \\Rightarrow\\ f(x_k)-f^*\\le\\Big(1-\\frac\\mu L\\Big)^k\\big(f(x_0)-f^*\\big)",
    "plain": "½‖∇f‖² ≥ μ(f − f*)  ⇒  linear rate (1 − μ/L)ᵏ",
    "symbols": "",
    "notes": "Linear convergence without convexity; holds for many over-parameterised networks.",
    "related": [
      "gd_rate_strongly_convex"
    ]
  },
  {
    "id": "lr_polynomial",
    "title": "polynomial learning-rate decay",
    "field": "optimization",
    "latex": "\\eta_t=(\\eta_0-\\eta_{\\text{end}})\\Big(1-\\frac tT\\Big)^p+\\eta_{\\text{end}}",
    "plain": "η_t = (η₀ − η_end)(1 − t/T)ᵖ + η_end",
    "symbols": "",
    "notes": "p = 1 is linear decay.",
    "related": [
      "lr_cosine"
    ]
  },
  {
    "id": "projected_gradient",
    "title": "projected gradient descent",
    "field": "optimization",
    "latex": "x\\leftarrow\\Pi_{\\mathcal C}\\big(x-\\eta\\nabla f(x)\\big)",
    "plain": "x ← Π_C(x − η∇f(x))",
    "symbols": "Π_C = Euclidean projection onto C",
    "notes": "For a box [l, u] the projection is a clip.",
    "related": [
      "frank_wolfe",
      "projection_simplex"
    ]
  },
  {
    "id": "proximal_l1",
    "title": "proximal operator of the L1 norm",
    "field": "optimization",
    "latex": "\\operatorname{prox}_{\\lambda\\|\\cdot\\|_1}(v)=\\operatorname{sign}(v)\\,(|v|-\\lambda)_+",
    "plain": "prox(v) = sign(v)(|v| − λ)₊  (soft-thresholding)",
    "symbols": "",
    "notes": "Defined in general as argmin f(x) + (1/2λ)‖x − v‖².",
    "related": [
      "lasso_soft_threshold",
      "ista"
    ]
  },
  {
    "id": "regret_bound",
    "title": "regret of online gradient descent",
    "field": "optimization",
    "latex": "\\operatorname{Regret}_T=\\sum_{t=1}^{T}f_t(x_t)-\\min_x\\sum_tf_t(x)\\le\\frac{3RG}2\\sqrt T",
    "plain": "Regret_T ≤ (3/2) R G √T",
    "symbols": "",
    "notes": "Hedge / exponentiated gradient: regret ≤ √(T ln N / 2) for N experts.",
    "related": [
      "mirror_descent_simplex",
      "ucb1"
    ]
  },
  {
    "id": "rmsprop",
    "title": "RMSProp",
    "field": "optimization",
    "latex": "s\\leftarrow\\beta s+(1-\\beta)g^2,\\quad\\theta\\leftarrow\\theta-\\frac{\\eta\\,g}{\\sqrt s+\\epsilon}",
    "plain": "s ← βs + (1−β)g²;  θ ← θ − η g / (√s + ε)",
    "symbols": "β ≈ 0.9",
    "notes": "",
    "related": [
      "adagrad",
      "adam"
    ]
  },
  {
    "id": "sgd_rate_convex",
    "title": "SGD rate (convex, bounded gradients)",
    "field": "optimization",
    "latex": "\\mathbb E\\big[f(\\bar x_T)\\big]-f^*\\le\\frac{R\\,G}{\\sqrt T}\\quad\\big(\\eta=\\tfrac{R}{G\\sqrt T}\\big)",
    "plain": "E f(x̄_T) − f* ≤ R G/√T",
    "symbols": "R = ‖x₀ − x*‖, G = bound on gradient norm",
    "notes": "",
    "related": [
      "subgradient_rate"
    ]
  },
  {
    "id": "sam",
    "title": "sharpness-aware minimisation",
    "field": "optimization",
    "latex": "\\varepsilon=\\rho\\frac{\\nabla L(w)}{\\|\\nabla L(w)\\|},\\qquad w\\leftarrow w-\\eta\\,\\nabla L(w+\\varepsilon)",
    "plain": "ε = ρ∇L/‖∇L‖;  w ← w − η∇L(w + ε)",
    "symbols": "ρ = neighbourhood radius",
    "notes": "Seeks flat minima by taking the gradient at the worst nearby point.",
    "related": [
      "gradient_descent"
    ]
  },
  {
    "id": "lr_step_decay",
    "title": "step learning-rate decay",
    "field": "optimization",
    "latex": "\\eta_t=\\eta_0\\,\\gamma^{\\lfloor t/s\\rfloor}",
    "plain": "η_t = η₀ γ^⌊t/s⌋",
    "symbols": "",
    "notes": "",
    "related": [
      "lr_exponential_decay"
    ]
  },
  {
    "id": "subgradient_rate",
    "title": "subgradient method bound",
    "field": "optimization",
    "latex": "\\min_{i\\le k}f(x_i)-f^*\\le\\frac{R^2}{2\\alpha k}+\\frac{\\alpha G^2}{2}",
    "plain": "min f(xᵢ) − f* ≤ R²/(2αk) + αG²/2",
    "symbols": "constant step size α",
    "notes": "",
    "related": [
      "sgd_rate_convex"
    ]
  },
  {
    "id": "svm_dual",
    "title": "SVM dual problem",
    "field": "optimization",
    "latex": "\\max_\\alpha\\ \\sum_i\\alpha_i-\\tfrac12\\sum_{i,j}\\alpha_i\\alpha_jy_iy_j\\,k(\\mathbf x_i,\\mathbf x_j)\\quad\\text{s.t. }0\\le\\alpha_i\\le C,\\ \\sum_i\\alpha_iy_i=0",
    "plain": "max Σαᵢ − ½ ΣΣ αᵢαⱼyᵢyⱼ k(xᵢ, xⱼ)",
    "symbols": "",
    "notes": "Only support vectors have αᵢ > 0. Replace the dot product by a kernel.",
    "related": [
      "svm_primal",
      "rbf_kernel"
    ]
  },
  {
    "id": "lr_inverse_sqrt",
    "title": "Transformer learning-rate schedule",
    "field": "optimization",
    "latex": "\\eta_t=d_{\\text{model}}^{-1/2}\\min\\big(t^{-1/2},\\ t\\,t_w^{-3/2}\\big)",
    "plain": "η_t = d^(−½) min(t^(−½), t·t_w^(−3/2))",
    "symbols": "",
    "notes": "Linear warm-up for t_w steps, then decay as 1/√t (\"Attention Is All You Need\").",
    "related": [
      "lr_warmup"
    ]
  },
  {
    "id": "trust_region_ratio",
    "title": "trust-region ratio",
    "field": "optimization",
    "latex": "\\rho=\\frac{f(x)-f(x+p)}{m(0)-m(p)}",
    "plain": "ρ = actual reduction / predicted reduction",
    "symbols": "m = local quadratic model",
    "notes": "ρ near 1: model is good, enlarge the region; ρ small: shrink it.",
    "related": [
      "newton_method_multi"
    ]
  },
  {
    "id": "minibatch_gradient_variance",
    "title": "variance of a minibatch gradient",
    "field": "optimization",
    "latex": "\\operatorname{Var}\\big(\\hat g_B\\big)=\\frac{\\Sigma}{B}\\quad\\text{(sampling with replacement)}",
    "plain": "Var(ĝ_B) = Σ/B",
    "symbols": "",
    "notes": "Halving the noise needs four times the batch.",
    "related": [
      "gradient_noise_scale"
    ]
  },
  {
    "id": "wolfe_conditions",
    "title": "Wolfe curvature condition",
    "field": "optimization",
    "latex": "\\nabla f(x+tp)^{\\top}p\\ge c_2\\,\\nabla f(x)^{\\top}p,\\quad 0<c_1<c_2<1",
    "plain": "∇f(x + tp)ᵀp ≥ c₂ ∇f(x)ᵀp",
    "symbols": "",
    "notes": "Together with Armijo it rules out too-short steps; required for BFGS.",
    "related": [
      "armijo"
    ]
  },
  {
    "id": "zero_one_loss",
    "title": "0–1 loss and risk",
    "field": "ml-metrics",
    "latex": "\\ell(y,\\hat y)=\\mathbf 1[y\\ne\\hat y],\\qquad R(h)=\\mathbb E\\,\\ell(y,h(x))",
    "plain": "ℓ = 1[y ≠ ŷ];  risk = error rate",
    "symbols": "",
    "notes": "Non-differentiable, so surrogates (log, hinge, exponential) replace it in training.",
    "related": [
      "bayes_error"
    ]
  },
  {
    "id": "adjusted_r_squared",
    "title": "adjusted R²",
    "field": "ml-metrics",
    "latex": "R^2_{\\mathrm{adj}}=1-(1-R^2)\\frac{n-1}{n-p-1}",
    "plain": "R²_adj = 1 − (1−R²)(n−1)/(n−p−1)",
    "symbols": "n samples, p predictors",
    "notes": "Penalises adding useless predictors.",
    "related": [
      "r_squared"
    ]
  },
  {
    "id": "auc_roc",
    "title": "area under the ROC curve (AUC)",
    "field": "ml-metrics",
    "latex": "\\mathrm{AUC}=P\\big(s^{+}>s^{-}\\big)+\\tfrac12P\\big(s^{+}=s^{-}\\big)",
    "plain": "AUC = P(score⁺ > score⁻) + ½ P(tie)",
    "symbols": "s⁺, s⁻ = scores of a random positive and negative",
    "notes": "Threshold-free ranking quality; 0.5 is chance.",
    "related": [
      "recall"
    ]
  },
  {
    "id": "average_precision",
    "title": "average precision (PR-AUC)",
    "field": "ml-metrics",
    "latex": "\\mathrm{AP}=\\sum_n(R_n-R_{n-1})\\,P_n",
    "plain": "AP = Σ (Rₙ − Rₙ₋₁) Pₙ",
    "symbols": "precision and recall at each threshold",
    "notes": "Preferred to ROC-AUC for heavy class imbalance.",
    "related": [
      "auc_roc"
    ]
  },
  {
    "id": "balanced_accuracy",
    "title": "balanced accuracy",
    "field": "ml-metrics",
    "latex": "\\mathrm{BA}=\\tfrac12\\Big(\\frac{TP}{TP+FN}+\\frac{TN}{TN+FP}\\Big)",
    "plain": "BA = (TPR + TNR)/2",
    "symbols": "",
    "notes": "Accuracy that does not reward predicting the majority class.",
    "related": [
      "recall",
      "specificity_npv"
    ]
  },
  {
    "id": "binary_cross_entropy",
    "title": "binary cross-entropy (log loss)",
    "field": "ml-metrics",
    "latex": "L=-\\big[y\\log p+(1-y)\\log(1-p)\\big]",
    "plain": "L = −[ y log p + (1−y) log(1−p) ]",
    "symbols": "y ∈ {0,1}, p = predicted probability of class 1",
    "notes": "",
    "related": [
      "cross_entropy",
      "logistic_gradient"
    ]
  },
  {
    "id": "bce_with_logits",
    "title": "binary cross-entropy from logits (stable)",
    "field": "ml-metrics",
    "latex": "L=\\max(z,0)-zy+\\ln\\big(1+e^{-|z|}\\big)",
    "plain": "L = max(z, 0) − zy + ln(1 + e^(−|z|))",
    "symbols": "z = logit",
    "notes": "Algebraically equal to −y ln σ(z) − (1 − y) ln(1 − σ(z)) without overflow.",
    "related": [
      "binary_cross_entropy",
      "logsumexp_stable"
    ]
  },
  {
    "id": "bleu_brevity",
    "title": "BLEU brevity penalty",
    "field": "ml-metrics",
    "latex": "\\mathrm{BP}=\\begin{cases}1&c>r\\\\ e^{1-r/c}&c\\le r\\end{cases}",
    "plain": "BP = 1 if c > r, else e^(1 − r/c)",
    "symbols": "c = candidate length, r = reference length",
    "notes": "",
    "related": [
      "bleu"
    ]
  },
  {
    "id": "bleu",
    "title": "BLEU score",
    "field": "ml-metrics",
    "latex": "\\mathrm{BLEU}=\\mathrm{BP}\\cdot\\exp\\!\\Big(\\sum_{n=1}^{N}w_n\\log p_n\\Big),\\quad \\mathrm{BP}=\\min\\big(1,e^{1-r/c}\\big)",
    "plain": "BLEU = BP · exp( Σ wₙ log pₙ )",
    "symbols": "pₙ = n-gram precision, r/c = reference/candidate length",
    "notes": "",
    "related": [
      "perplexity"
    ]
  },
  {
    "id": "brier_score",
    "title": "Brier score",
    "field": "ml-metrics",
    "latex": "\\mathrm{BS}=\\frac1n\\sum_i\\sum_k\\big(p_{ik}-\\mathbf{1}[k=y_i]\\big)^2",
    "plain": "BS = (1/n) Σᵢ Σₖ (pᵢₖ − 1[k = yᵢ])²",
    "symbols": "",
    "notes": "A proper scoring rule: lowest in expectation only when the probabilities are honest.",
    "related": [
      "ece",
      "binary_cross_entropy"
    ]
  },
  {
    "id": "brier_decomposition",
    "title": "Brier score decomposition",
    "field": "ml-metrics",
    "latex": "\\mathrm{BS}=\\underbrace{\\mathrm{REL}}_{\\text{reliability}}-\\underbrace{\\mathrm{RES}}_{\\text{resolution}}+\\underbrace{\\mathrm{UNC}}_{\\text{uncertainty}},\\quad \\mathrm{UNC}=\\bar o(1-\\bar o)",
    "plain": "BS = REL − RES + UNC;  UNC = ō(1 − ō)",
    "symbols": "ō = base rate",
    "notes": "REL is the calibration error part: lower is better.",
    "related": [
      "brier_score",
      "ece"
    ]
  },
  {
    "id": "calinski_harabasz",
    "title": "Calinski–Harabasz index",
    "field": "ml-metrics",
    "latex": "\\mathrm{CH}=\\frac{\\mathrm{SS}_B/(k-1)}{\\mathrm{SS}_W/(n-k)}",
    "plain": "CH = (SS_B/(k − 1)) / (SS_W/(n − k))",
    "symbols": "",
    "notes": "The ANOVA F ratio applied to clusters; higher is better.",
    "related": [
      "anova_f"
    ]
  },
  {
    "id": "classification_accuracy",
    "title": "classification accuracy and confusion-matrix rates",
    "field": "ml-metrics",
    "latex": "\\mathrm{Acc}=\\frac{TP+TN}{TP+TN+FP+FN},\\qquad \\text{prevalence}=\\frac{TP+FN}N",
    "plain": "accuracy = (TP + TN)/N;  prevalence = (TP + FN)/N",
    "symbols": "",
    "notes": "Misleading when classes are imbalanced: always predicting the majority class can score highly.",
    "related": [
      "balanced_accuracy",
      "specificity_npv",
      "precision",
      "recall"
    ]
  },
  {
    "id": "purity",
    "title": "cluster purity",
    "field": "ml-metrics",
    "latex": "\\mathrm{purity}=\\frac1n\\sum_k\\max_j|c_k\\cap t_j|",
    "plain": "purity = (1/n) Σ_k max_j |c_k ∩ t_j|",
    "symbols": "",
    "notes": "Biased toward many small clusters.",
    "related": [
      "nmi"
    ]
  },
  {
    "id": "r_squared",
    "title": "coefficient of determination R²",
    "field": "ml-metrics",
    "latex": "R^2=1-\\frac{\\sum(y_i-\\hat y_i)^2}{\\sum(y_i-\\bar y)^2}",
    "plain": "R² = 1 − SS_res / SS_tot",
    "symbols": "",
    "notes": "1 is perfect; can be negative for a bad model.",
    "related": [
      "adjusted_r_squared",
      "mse"
    ]
  },
  {
    "id": "contrastive_loss",
    "title": "contrastive loss (Hadsell)",
    "field": "ml-metrics",
    "latex": "L=y\\,d^2+(1-y)\\max(0,\\,m-d)^2",
    "plain": "L = y d² + (1 − y) max(0, m − d)²",
    "symbols": "y = 1 for similar pairs",
    "notes": "",
    "related": [
      "triplet_loss"
    ]
  },
  {
    "id": "davies_bouldin",
    "title": "Davies–Bouldin index",
    "field": "ml-metrics",
    "latex": "\\mathrm{DB}=\\frac1k\\sum_i\\max_{j\\ne i}\\frac{s_i+s_j}{d_{ij}}",
    "plain": "DB = (1/k) Σᵢ maxⱼ≠ᵢ (sᵢ + sⱼ)/dᵢⱼ",
    "symbols": "s = within-cluster scatter, d = centroid distance",
    "notes": "Lower is better.",
    "related": [
      "silhouette"
    ]
  },
  {
    "id": "ndcg",
    "title": "DCG and NDCG",
    "field": "ml-metrics",
    "latex": "\\mathrm{DCG}@k=\\sum_{i=1}^{k}\\frac{2^{rel_i}-1}{\\log_2(i+1)},\\qquad \\mathrm{NDCG}@k=\\frac{\\mathrm{DCG}@k}{\\mathrm{IDCG}@k}",
    "plain": "DCG = Σ (2^relᵢ − 1)/log₂(i + 1);  NDCG = DCG/IDCG",
    "symbols": "",
    "notes": "Rewards relevant items near the top.",
    "related": [
      "mrr"
    ]
  },
  {
    "id": "dice",
    "title": "Dice coefficient",
    "field": "ml-metrics",
    "latex": "\\mathrm{Dice}=\\frac{2|A\\cap B|}{|A|+|B|}",
    "plain": "Dice = 2|A ∩ B| / (|A| + |B|)",
    "symbols": "",
    "notes": "",
    "related": [
      "iou"
    ]
  },
  {
    "id": "dice_loss",
    "title": "Dice loss",
    "field": "ml-metrics",
    "latex": "L=1-\\frac{2\\sum p_ig_i+\\epsilon}{\\sum p_i+\\sum g_i+\\epsilon}",
    "plain": "L = 1 − (2Σpᵢgᵢ + ε)/(Σpᵢ + Σgᵢ + ε)",
    "symbols": "",
    "notes": "Directly optimises overlap; standard for segmentation with small foregrounds.",
    "related": [
      "dice",
      "tversky_loss"
    ]
  },
  {
    "id": "epistemic_aleatoric",
    "title": "epistemic and aleatoric uncertainty (ensembles)",
    "field": "ml-metrics",
    "latex": "\\underbrace{H\\big(\\bar p\\big)}_{\\text{total}}=\\underbrace{\\mathbb E_m H(p_m)}_{\\text{aleatoric}}+\\underbrace{I(y;m)}_{\\text{epistemic}},\\quad \\bar p=\\frac1M\\sum_mp_m",
    "plain": "H(mean p) = mean H(pₘ) + mutual information",
    "symbols": "",
    "notes": "Epistemic uncertainty is the disagreement between ensemble members.",
    "related": [
      "entropy",
      "mutual_information"
    ]
  },
  {
    "id": "ece",
    "title": "expected calibration error (ECE)",
    "field": "ml-metrics",
    "latex": "\\mathrm{ECE}=\\sum_{b=1}^{B}\\frac{n_b}{n}\\,\\big|\\operatorname{acc}(b)-\\operatorname{conf}(b)\\big|",
    "plain": "ECE = Σ_b (n_b/n) · |acc(b) − conf(b)|",
    "symbols": "B confidence bins, n_b examples in bin b, acc(b) = fraction correct, conf(b) = mean confidence",
    "notes": "Measures whether stated confidence matches how often the model is right. Depends on the binning; 15 bins is common.",
    "related": [
      "excyst-ece",
      "brier_score",
      "temperature_softmax",
      "mce"
    ]
  },
  {
    "id": "explained_variance_score",
    "title": "explained variance score",
    "field": "ml-metrics",
    "latex": "\\mathrm{EV}=1-\\frac{\\operatorname{Var}(y-\\hat y)}{\\operatorname{Var}(y)}",
    "plain": "EV = 1 − Var(y − ŷ)/Var(y)",
    "symbols": "",
    "notes": "Like R² but ignores a constant bias in the residuals.",
    "related": [
      "r_squared"
    ]
  },
  {
    "id": "exponential_loss",
    "title": "exponential loss",
    "field": "ml-metrics",
    "latex": "L=e^{-yf(x)}",
    "plain": "L = exp(−y f(x))",
    "symbols": "y ∈ {−1, +1}",
    "notes": "The loss AdaBoost minimises.",
    "related": [
      "adaboost_weights"
    ]
  },
  {
    "id": "f1_score",
    "title": "F1 score",
    "field": "ml-metrics",
    "latex": "F_1=\\frac{2PR}{P+R}=\\frac{2TP}{2TP+FP+FN}",
    "plain": "F₁ = 2PR / (P + R)",
    "symbols": "P = precision, R = recall",
    "notes": "Harmonic mean of precision and recall.",
    "related": [
      "precision",
      "recall",
      "f_beta"
    ]
  },
  {
    "id": "focal_loss",
    "title": "focal loss",
    "field": "ml-metrics",
    "latex": "\\mathrm{FL}(p_t)=-\\alpha_t(1-p_t)^{\\gamma}\\ln p_t",
    "plain": "FL = −α (1 − pₜ)^γ ln pₜ",
    "symbols": "pₜ = probability of the true class, γ ≈ 2",
    "notes": "Down-weights easy examples so rare hard ones dominate; used for dense detection.",
    "related": [
      "binary_cross_entropy"
    ]
  },
  {
    "id": "fid",
    "title": "Fréchet inception distance",
    "field": "ml-metrics",
    "latex": "\\mathrm{FID}=\\|\\mu_1-\\mu_2\\|^2+\\operatorname{tr}\\big(\\Sigma_1+\\Sigma_2-2(\\Sigma_1\\Sigma_2)^{1/2}\\big)",
    "plain": "FID = ‖μ₁ − μ₂‖² + tr(Σ₁ + Σ₂ − 2(Σ₁Σ₂)^½)",
    "symbols": "Gaussian fits to Inception features of real and generated images",
    "notes": "Lower is better. It is the squared Wasserstein-2 distance between the two Gaussians.",
    "related": [
      "wasserstein_gaussian"
    ]
  },
  {
    "id": "f_beta",
    "title": "Fβ score",
    "field": "ml-metrics",
    "latex": "F_\\beta=\\frac{(1+\\beta^2)\\,PR}{\\beta^2P+R}",
    "plain": "F_β = (1+β²) P R / (β² P + R)",
    "symbols": "β > 1 favours recall, β < 1 favours precision",
    "notes": "",
    "related": [
      "f1_score"
    ]
  },
  {
    "id": "gaussian_nll",
    "title": "Gaussian negative log-likelihood (heteroscedastic)",
    "field": "ml-metrics",
    "latex": "L=\\tfrac12\\ln(2\\pi\\sigma^2)+\\frac{(y-\\mu)^2}{2\\sigma^2}",
    "plain": "L = ½ ln(2πσ²) + (y − μ)²/(2σ²)",
    "symbols": "the network predicts both μ and σ",
    "notes": "Learns its own uncertainty; MSE is the case of fixed σ.",
    "related": [
      "mse",
      "gaussian_pdf"
    ]
  },
  {
    "id": "gelu",
    "title": "GELU",
    "field": "ml-metrics",
    "latex": "\\operatorname{GELU}(x)=x\\,\\Phi(x)=\\tfrac{x}{2}\\left[1+\\operatorname{erf}\\!\\left(\\tfrac{x}{\\sqrt2}\\right)\\right]",
    "plain": "GELU(x) = x Φ(x)",
    "symbols": "Φ = standard normal cdf",
    "notes": "The activation in BERT and GPT-style transformers.",
    "related": [
      "relu",
      "normal_cdf",
      "swish"
    ]
  },
  {
    "id": "hinge_loss",
    "title": "hinge loss",
    "field": "ml-metrics",
    "latex": "L=\\max\\big(0,\\,1-y\\,f(x)\\big)",
    "plain": "L = max(0, 1 − y f(x))",
    "symbols": "y ∈ {−1,+1}",
    "notes": "The SVM loss.",
    "related": [
      "svm_primal"
    ]
  },
  {
    "id": "huber_loss",
    "title": "Huber loss",
    "field": "ml-metrics",
    "latex": "L_\\delta(a)=\\begin{cases}\\tfrac12a^2&|a|\\le\\delta\\\\ \\delta\\big(|a|-\\tfrac12\\delta\\big)&|a|>\\delta\\end{cases}",
    "plain": "L(a) = ½a² if |a| ≤ δ, else δ(|a| − ½δ)",
    "symbols": "a = residual y − ŷ",
    "notes": "Quadratic near zero, linear in the tails.",
    "related": [
      "mse",
      "mae"
    ]
  },
  {
    "id": "tanh",
    "title": "hyperbolic tangent",
    "field": "ml-metrics",
    "latex": "\\tanh x=\\frac{e^{x}-e^{-x}}{e^{x}+e^{-x}}=2\\sigma(2x)-1",
    "plain": "tanh x = (eˣ − e⁻ˣ)/(eˣ + e⁻ˣ)",
    "symbols": "",
    "notes": "Zero-centred, range (−1, 1).",
    "related": [
      "sigmoid"
    ]
  },
  {
    "id": "inception_score",
    "title": "inception score",
    "field": "ml-metrics",
    "latex": "\\mathrm{IS}=\\exp\\Big(\\mathbb E_x\\,D_{\\mathrm{KL}}\\big(p(y\\mid x)\\,\\|\\,p(y)\\big)\\Big)",
    "plain": "IS = exp(E KL(p(y|x) ‖ p(y)))",
    "symbols": "",
    "notes": "High when each image is classified confidently and the classes are diverse.",
    "related": [
      "fid"
    ]
  },
  {
    "id": "iou",
    "title": "intersection over union (Jaccard)",
    "field": "ml-metrics",
    "latex": "\\mathrm{IoU}=\\frac{|A\\cap B|}{|A\\cup B|}",
    "plain": "IoU = |A ∩ B| / |A ∪ B|",
    "symbols": "",
    "notes": "Standard for detection and segmentation.",
    "related": [
      "dice"
    ]
  },
  {
    "id": "k_fold_cv",
    "title": "k-fold cross-validation estimate",
    "field": "ml-metrics",
    "latex": "\\widehat{\\mathrm{Err}}=\\frac1k\\sum_{i=1}^{k}\\mathrm{Err}_i,\\qquad \\mathrm{SE}\\approx\\frac{s}{\\sqrt k}",
    "plain": "average the error over k held-out folds",
    "symbols": "",
    "notes": "k = 5 or 10 is typical; leave-one-out is k = n.",
    "related": [
      "loocv_shortcut",
      "bootstrap_se"
    ]
  },
  {
    "id": "kl_div_loss",
    "title": "KL-divergence loss (distillation)",
    "field": "ml-metrics",
    "latex": "L=\\tau^2\\,D_{\\mathrm{KL}}\\big(\\operatorname{softmax}(z_t/\\tau)\\,\\|\\,\\operatorname{softmax}(z_s/\\tau)\\big)",
    "plain": "L = τ² KL(softmax(z_t/τ) ‖ softmax(z_s/τ))",
    "symbols": "t = teacher, s = student, τ = temperature",
    "notes": "The τ² factor keeps gradient magnitudes comparable as τ changes.",
    "related": [
      "kl_divergence",
      "temperature_softmax"
    ]
  },
  {
    "id": "label_smoothing",
    "title": "label smoothing",
    "field": "ml-metrics",
    "latex": "y'_k=(1-\\varepsilon)\\,\\mathbf{1}[k=y]+\\frac{\\varepsilon}{K}",
    "plain": "y′ₖ = (1−ε)·1[k=y] + ε/K",
    "symbols": "K classes, ε ≈ 0.1",
    "notes": "Softens one-hot targets to discourage overconfidence.",
    "related": [
      "softmax_cross_entropy"
    ]
  },
  {
    "id": "edit_distance",
    "title": "Levenshtein distance recurrence",
    "field": "ml-metrics",
    "latex": "d_{i,j}=\\min\\big(d_{i-1,j}+1,\\ d_{i,j-1}+1,\\ d_{i-1,j-1}+\\mathbf 1[a_i\\ne b_j]\\big)",
    "plain": "dᵢⱼ = min(dᵢ₋₁,ⱼ + 1, dᵢ,ⱼ₋₁ + 1, dᵢ₋₁,ⱼ₋₁ + 1[aᵢ ≠ bⱼ])",
    "symbols": "",
    "notes": "Dynamic programming, O(mn).",
    "related": [
      "wer"
    ]
  },
  {
    "id": "likelihood_ratios",
    "title": "likelihood ratios and diagnostic odds",
    "field": "ml-metrics",
    "latex": "\\mathrm{LR}^+=\\frac{\\mathrm{TPR}}{\\mathrm{FPR}},\\quad \\mathrm{LR}^-=\\frac{\\mathrm{FNR}}{\\mathrm{TNR}},\\quad \\mathrm{DOR}=\\frac{\\mathrm{LR}^+}{\\mathrm{LR}^-}",
    "plain": "LR⁺ = TPR/FPR;  LR⁻ = FNR/TNR",
    "symbols": "",
    "notes": "Multiply the prior odds by LR to get the posterior odds.",
    "related": [
      "bayes_factor",
      "specificity_npv"
    ]
  },
  {
    "id": "log_cosh",
    "title": "log-cosh loss",
    "field": "ml-metrics",
    "latex": "L=\\ln\\cosh(\\hat y-y)",
    "plain": "L = ln cosh(ŷ − y)",
    "symbols": "",
    "notes": "Behaves like ½a² near 0 and |a| − ln 2 in the tails; smooth everywhere.",
    "related": [
      "huber_loss"
    ]
  },
  {
    "id": "logsumexp",
    "title": "log-sum-exp",
    "field": "ml-metrics",
    "latex": "\\operatorname{LSE}(z)=\\log\\sum_j e^{z_j}=m+\\log\\sum_j e^{z_j-m},\\ m=\\max_j z_j",
    "plain": "LSE(z) = m + log Σ exp(zⱼ − m)",
    "symbols": "",
    "notes": "A smooth maximum: max(z) ≤ LSE(z) ≤ max(z) + log n.",
    "related": [
      "softmax"
    ]
  },
  {
    "id": "mape_smape",
    "title": "MAPE and sMAPE",
    "field": "ml-metrics",
    "latex": "\\mathrm{MAPE}=\\frac{100}n\\sum\\Big|\\frac{y-\\hat y}y\\Big|,\\qquad \\mathrm{sMAPE}=\\frac{100}n\\sum\\frac{2|y-\\hat y|}{|y|+|\\hat y|}",
    "plain": "MAPE = (100/n) Σ |(y − ŷ)/y|",
    "symbols": "",
    "notes": "MAPE explodes when y ≈ 0 and penalises over-forecasts less than under-forecasts.",
    "related": [
      "mae"
    ]
  },
  {
    "id": "margin_ranking_loss",
    "title": "margin ranking loss",
    "field": "ml-metrics",
    "latex": "L=\\max\\big(0,\\,-y(x_1-x_2)+m\\big)",
    "plain": "L = max(0, −y(x₁ − x₂) + m)",
    "symbols": "y = +1 if x₁ should rank higher",
    "notes": "",
    "related": [
      "hinge_loss"
    ]
  },
  {
    "id": "mcc",
    "title": "Matthews correlation coefficient",
    "field": "ml-metrics",
    "latex": "\\mathrm{MCC}=\\frac{TP\\cdot TN-FP\\cdot FN}{\\sqrt{(TP+FP)(TP+FN)(TN+FP)(TN+FN)}}",
    "plain": "MCC = (TP·TN − FP·FN) / √((TP+FP)(TP+FN)(TN+FP)(TN+FN))",
    "symbols": "",
    "notes": "Balanced even for imbalanced classes; ranges −1 to 1.",
    "related": [
      "f1_score"
    ]
  },
  {
    "id": "mce",
    "title": "maximum calibration error (MCE)",
    "field": "ml-metrics",
    "latex": "\\mathrm{MCE}=\\max_{b}\\big|\\operatorname{acc}(b)-\\operatorname{conf}(b)\\big|",
    "plain": "MCE = max_b |acc(b) − conf(b)|",
    "symbols": "same bins as ECE",
    "notes": "The worst bin, however few examples it holds.",
    "related": [
      "ece"
    ]
  },
  {
    "id": "mae",
    "title": "mean absolute error",
    "field": "ml-metrics",
    "latex": "\\mathrm{MAE}=\\frac1n\\sum_i|y_i-\\hat y_i|",
    "plain": "MAE = (1/n) Σ |yᵢ − ŷᵢ|",
    "symbols": "",
    "notes": "More robust to outliers than MSE.",
    "related": [
      "mse",
      "huber_loss"
    ]
  },
  {
    "id": "mase",
    "title": "mean absolute scaled error",
    "field": "ml-metrics",
    "latex": "\\mathrm{MASE}=\\frac{\\frac1n\\sum|y_t-\\hat y_t|}{\\frac1{n-1}\\sum|y_t-y_{t-1}|}",
    "plain": "MASE = MAE / (MAE of the naive one-step forecast)",
    "symbols": "",
    "notes": "Below 1 beats the naive forecast; scale-free.",
    "related": [
      "mape_smape"
    ]
  },
  {
    "id": "mrr",
    "title": "mean reciprocal rank",
    "field": "ml-metrics",
    "latex": "\\mathrm{MRR}=\\frac1{|Q|}\\sum_{q}\\frac1{\\mathrm{rank}_q}",
    "plain": "MRR = mean(1/rank of the first relevant result)",
    "symbols": "",
    "notes": "",
    "related": [
      "ndcg"
    ]
  },
  {
    "id": "mse",
    "title": "mean squared error",
    "field": "ml-metrics",
    "latex": "\\mathrm{MSE}=\\frac1n\\sum_i(y_i-\\hat y_i)^2",
    "plain": "MSE = (1/n) Σ (yᵢ − ŷᵢ)²",
    "symbols": "",
    "notes": "Sensitive to outliers; RMSE = √MSE is in the units of y.",
    "related": [
      "mae",
      "rmse",
      "bias_variance"
    ]
  },
  {
    "id": "multiclass_hinge",
    "title": "multi-class hinge loss (Weston–Watkins)",
    "field": "ml-metrics",
    "latex": "L=\\sum_{j\\ne y}\\max\\big(0,\\ s_j-s_y+\\Delta\\big)",
    "plain": "L = Σ_{j≠y} max(0, sⱼ − s_y + Δ)",
    "symbols": "s = class scores",
    "notes": "",
    "related": [
      "hinge_loss"
    ]
  },
  {
    "id": "nmi",
    "title": "normalised mutual information",
    "field": "ml-metrics",
    "latex": "\\mathrm{NMI}=\\frac{2\\,I(U;V)}{H(U)+H(V)}",
    "plain": "NMI = 2I(U;V)/(H(U) + H(V))",
    "symbols": "",
    "notes": "Agreement between two clusterings or a clustering and labels, in [0, 1].",
    "related": [
      "mutual_information",
      "rand_index"
    ]
  },
  {
    "id": "poisson_nll",
    "title": "Poisson negative log-likelihood loss",
    "field": "ml-metrics",
    "latex": "L=\\mu-y\\ln\\mu+\\ln y!",
    "plain": "L = μ − y ln μ + ln y!",
    "symbols": "μ = predicted rate, y = observed count",
    "notes": "The loss for count data; μ = exp(model output).",
    "related": [
      "poisson_loglik"
    ]
  },
  {
    "id": "precision",
    "title": "precision",
    "field": "ml-metrics",
    "latex": "\\mathrm{Precision}=\\frac{TP}{TP+FP}",
    "plain": "Precision = TP / (TP + FP)",
    "symbols": "TP/FP = true/false positives",
    "notes": "Of the items flagged, how many were right.",
    "related": [
      "recall",
      "f1_score"
    ]
  },
  {
    "id": "precision_at_k",
    "title": "precision@k and recall@k",
    "field": "ml-metrics",
    "latex": "P@k=\\frac{|\\text{relevant in top }k|}k,\\qquad R@k=\\frac{|\\text{relevant in top }k|}{|\\text{relevant}|}",
    "plain": "P@k, R@k",
    "symbols": "",
    "notes": "",
    "related": [
      "average_precision"
    ]
  },
  {
    "id": "rand_index",
    "title": "Rand index and adjusted Rand index",
    "field": "ml-metrics",
    "latex": "\\mathrm{RI}=\\frac{a+b}{\\binom n2},\\qquad \\mathrm{ARI}=\\frac{\\mathrm{RI}-\\mathbb E[\\mathrm{RI}]}{\\max\\mathrm{RI}-\\mathbb E[\\mathrm{RI}]}",
    "plain": "RI = (agreeing pairs)/C(n, 2)",
    "symbols": "a = pairs together in both, b = apart in both",
    "notes": "ARI is 0 for random labelings and 1 for identical ones.",
    "related": [
      "nmi"
    ]
  },
  {
    "id": "recall",
    "title": "recall",
    "field": "ml-metrics",
    "latex": "\\mathrm{Recall}=\\frac{TP}{TP+FN}",
    "plain": "Recall = TP / (TP + FN)",
    "symbols": "FN = false negatives",
    "notes": "Of the real positives, how many were found. Also called sensitivity or TPR.",
    "related": [
      "precision",
      "f1_score"
    ]
  },
  {
    "id": "relu",
    "title": "ReLU and leaky ReLU",
    "field": "ml-metrics",
    "latex": "\\operatorname{ReLU}(x)=\\max(0,x),\\qquad \\operatorname{LeakyReLU}(x)=\\max(\\alpha x,x)",
    "plain": "ReLU(x) = max(0, x)",
    "symbols": "α ≈ 0.01",
    "notes": "Gradient is 1 for x > 0, 0 for x < 0.",
    "related": [
      "gelu",
      "softplus"
    ]
  },
  {
    "id": "rmse",
    "title": "root mean squared error",
    "field": "ml-metrics",
    "latex": "\\mathrm{RMSE}=\\sqrt{\\frac1n\\sum_i(y_i-\\hat y_i)^2}",
    "plain": "RMSE = √( (1/n) Σ (yᵢ − ŷᵢ)² )",
    "symbols": "",
    "notes": "",
    "related": [
      "mse"
    ]
  },
  {
    "id": "rmsle",
    "title": "root mean squared log error",
    "field": "ml-metrics",
    "latex": "\\mathrm{RMSLE}=\\sqrt{\\frac1n\\sum\\big(\\ln(1+\\hat y)-\\ln(1+y)\\big)^2}",
    "plain": "RMSLE = √(mean((ln(1 + ŷ) − ln(1 + y))²))",
    "symbols": "",
    "notes": "Cares about relative, not absolute, error.",
    "related": [
      "rmse"
    ]
  },
  {
    "id": "rouge_n",
    "title": "ROUGE-N",
    "field": "ml-metrics",
    "latex": "\\mathrm{ROUGE\\text{-}N}=\\frac{\\sum_{g\\in\\text{ref}}\\min\\big(\\mathrm{count}_{\\text{cand}}(g),\\mathrm{count}_{\\text{ref}}(g)\\big)}{\\sum_{g\\in\\text{ref}}\\mathrm{count}_{\\text{ref}}(g)}",
    "plain": "ROUGE-N = overlapping n-grams / n-grams in the reference (recall)",
    "symbols": "",
    "notes": "ROUGE-L uses the longest common subsequence.",
    "related": [
      "bleu",
      "f1_score"
    ]
  },
  {
    "id": "sigmoid",
    "title": "sigmoid (logistic function)",
    "field": "ml-metrics",
    "latex": "\\sigma(x)=\\frac{1}{1+e^{-x}},\\qquad \\sigma'(x)=\\sigma(x)\\big(1-\\sigma(x)\\big)",
    "plain": "σ(x) = 1 / (1 + e⁻ˣ);  σ′ = σ(1 − σ)",
    "symbols": "",
    "notes": "Saturates for large |x|, so gradients vanish.",
    "related": [
      "tanh",
      "softplus",
      "logistic_regression"
    ]
  },
  {
    "id": "silhouette",
    "title": "silhouette coefficient",
    "field": "ml-metrics",
    "latex": "s=\\frac{b-a}{\\max(a,b)}",
    "plain": "s = (b − a)/max(a, b)",
    "symbols": "a = mean distance to own cluster, b = mean distance to the nearest other cluster",
    "notes": "Between −1 and 1; higher is better.",
    "related": [
      "kmeans_objective"
    ]
  },
  {
    "id": "smooth_l1",
    "title": "smooth L1 loss",
    "field": "ml-metrics",
    "latex": "L=\\begin{cases}\\tfrac12a^2/\\beta&|a|<\\beta\\\\ |a|-\\tfrac12\\beta&\\text{otherwise}\\end{cases}",
    "plain": "L = ½a²/β if |a| < β, else |a| − ½β",
    "symbols": "",
    "notes": "Detection models (Faster R-CNN) use it for box regression.",
    "related": [
      "huber_loss"
    ]
  },
  {
    "id": "softmax",
    "title": "softmax",
    "field": "ml-metrics",
    "latex": "\\operatorname{softmax}(z)_k=\\frac{e^{z_k}}{\\sum_j e^{z_j}}",
    "plain": "softmax(z)ₖ = exp(zₖ) / Σⱼ exp(zⱼ)",
    "symbols": "",
    "notes": "Subtract max(z) before exponentiating for stability.",
    "related": [
      "softmax_cross_entropy",
      "temperature_softmax",
      "logsumexp"
    ]
  },
  {
    "id": "softmax_cross_entropy",
    "title": "softmax cross-entropy (from logits)",
    "field": "ml-metrics",
    "latex": "L=-z_y+\\log\\sum_j e^{z_j}",
    "plain": "L = −z_y + log Σⱼ exp(zⱼ)",
    "symbols": "z = logits, y = true class",
    "notes": "The numerically stable form of −log softmax(z)_y.",
    "related": [
      "softmax",
      "logsumexp",
      "softmax_ce_gradient"
    ]
  },
  {
    "id": "temperature_softmax",
    "title": "softmax with temperature",
    "field": "ml-metrics",
    "latex": "\\operatorname{softmax}(z/T)_k=\\frac{e^{z_k/T}}{\\sum_j e^{z_j/T}}",
    "plain": "softmax(z/T)ₖ",
    "symbols": "T > 1 flattens, T < 1 sharpens",
    "notes": "Used for calibration and sampling.",
    "related": [
      "softmax",
      "excyst-temperature"
    ]
  },
  {
    "id": "softplus",
    "title": "softplus",
    "field": "ml-metrics",
    "latex": "\\operatorname{softplus}(x)=\\ln(1+e^{x})",
    "plain": "softplus(x) = ln(1 + eˣ)",
    "symbols": "",
    "notes": "A smooth approximation of ReLU; its derivative is the sigmoid.",
    "related": [
      "relu",
      "sigmoid"
    ]
  },
  {
    "id": "specificity_npv",
    "title": "specificity, NPV, FPR and FNR",
    "field": "ml-metrics",
    "latex": "\\mathrm{TNR}=\\frac{TN}{TN+FP},\\ \\ \\mathrm{NPV}=\\frac{TN}{TN+FN},\\ \\ \\mathrm{FPR}=\\frac{FP}{FP+TN},\\ \\ \\mathrm{FNR}=\\frac{FN}{FN+TP}",
    "plain": "TNR = TN/(TN + FP);  NPV = TN/(TN + FN);  FPR = 1 − TNR;  FNR = 1 − TPR",
    "symbols": "",
    "notes": "",
    "related": [
      "recall",
      "precision"
    ]
  },
  {
    "id": "ssim",
    "title": "structural similarity index (SSIM)",
    "field": "ml-metrics",
    "latex": "\\mathrm{SSIM}=\\frac{(2\\mu_x\\mu_y+c_1)(2\\sigma_{xy}+c_2)}{(\\mu_x^2+\\mu_y^2+c_1)(\\sigma_x^2+\\sigma_y^2+c_2)}",
    "plain": "SSIM = (2μxμy + c₁)(2σxy + c₂)/((μx² + μy² + c₁)(σx² + σy² + c₂))",
    "symbols": "",
    "notes": "1 for identical images.",
    "related": [
      "psnr"
    ]
  },
  {
    "id": "swish",
    "title": "Swish / SiLU",
    "field": "ml-metrics",
    "latex": "\\operatorname{SiLU}(x)=x\\,\\sigma(x)",
    "plain": "SiLU(x) = x σ(x)",
    "symbols": "",
    "notes": "",
    "related": [
      "gelu",
      "sigmoid"
    ]
  },
  {
    "id": "triplet_loss",
    "title": "triplet loss",
    "field": "ml-metrics",
    "latex": "L=\\max\\big(0,\\ d(a,p)-d(a,n)+m\\big)",
    "plain": "L = max(0, d(a, p) − d(a, n) + m)",
    "symbols": "a = anchor, p = positive, n = negative, m = margin",
    "notes": "Pulls matching pairs together and pushes others at least m apart.",
    "related": [
      "contrastive_loss",
      "infonce"
    ]
  },
  {
    "id": "tversky_loss",
    "title": "Tversky index",
    "field": "ml-metrics",
    "latex": "T=\\frac{TP}{TP+\\alpha FP+\\beta FN}",
    "plain": "T = TP/(TP + αFP + βFN)",
    "symbols": "",
    "notes": "α = β = ½ is Dice; β > α favours recall.",
    "related": [
      "dice_loss"
    ]
  },
  {
    "id": "wer",
    "title": "word error rate",
    "field": "ml-metrics",
    "latex": "\\mathrm{WER}=\\frac{S+D+I}{N}",
    "plain": "WER = (S + D + I)/N",
    "symbols": "S substitutions, D deletions, I insertions, N reference words",
    "notes": "Can exceed 1. CER is the same at character level.",
    "related": [
      "edit_distance"
    ]
  },
  {
    "id": "youden_j",
    "title": "Youden's J and G-mean",
    "field": "ml-metrics",
    "latex": "J=\\mathrm{TPR}+\\mathrm{TNR}-1,\\qquad G=\\sqrt{\\mathrm{TPR}\\cdot\\mathrm{TNR}}",
    "plain": "J = TPR + TNR − 1;  G = √(TPR·TNR)",
    "symbols": "",
    "notes": "J picks the best ROC threshold.",
    "related": [
      "auc_roc"
    ]
  },
  {
    "id": "uncertainty_sampling",
    "title": "active-learning acquisition scores",
    "field": "ml-models",
    "latex": "\\text{least confidence: }1-\\max_kp_k;\\quad \\text{margin: }p_{(1)}-p_{(2)};\\quad \\text{entropy: }-\\sum_kp_k\\ln p_k",
    "plain": "query the examples the model is least sure about",
    "symbols": "",
    "notes": "",
    "related": [
      "epistemic_aleatoric",
      "entropy"
    ]
  },
  {
    "id": "adaboost_weights",
    "title": "AdaBoost",
    "field": "ml-models",
    "latex": "\\alpha_t=\\tfrac12\\ln\\frac{1-\\varepsilon_t}{\\varepsilon_t},\\qquad w_i\\leftarrow w_i\\,e^{-\\alpha_ty_ih_t(x_i)}/Z_t",
    "plain": "αₜ = ½ ln((1 − εₜ)/εₜ);  wᵢ ← wᵢ e^(−αₜ yᵢ hₜ(xᵢ))/Z",
    "symbols": "",
    "notes": "Misclassified points are up-weighted.",
    "related": [
      "exponential_loss",
      "gradient_boosting"
    ]
  },
  {
    "id": "conformal_aps",
    "title": "adaptive prediction sets (APS)",
    "field": "ml-models",
    "latex": "s(x,y)=\\sum_{j:\\hat p_j(x)\\ge\\hat p_y(x)}\\hat p_j(x),\\qquad \\mathcal C(x)=\\{y:\\ s(x,y)\\le\\hat q\\}",
    "plain": "score = total probability of all classes at least as likely as y",
    "symbols": "",
    "notes": "Sets whose size adapts to difficulty; coverage still ≥ 1 − α.",
    "related": [
      "excyst-conformal"
    ]
  },
  {
    "id": "als_update",
    "title": "alternating least squares (matrix factorisation)",
    "field": "ml-models",
    "latex": "\\mathbf u_i=\\Big(V_{\\Omega_i}^{\\top}V_{\\Omega_i}+\\lambda I\\Big)^{-1}V_{\\Omega_i}^{\\top}\\mathbf r_i",
    "plain": "uᵢ = (VᵀV + λI)⁻¹Vᵀrᵢ over the items user i rated",
    "symbols": "",
    "notes": "Each step is a ridge regression; the basis of many recommender systems.",
    "related": [
      "ridge_regression"
    ]
  },
  {
    "id": "angle_between_vectors",
    "title": "angle between vectors",
    "field": "ml-models",
    "latex": "\\theta=\\arccos\\frac{\\mathbf x\\cdot\\mathbf y}{\\|\\mathbf x\\|\\|\\mathbf y\\|}",
    "plain": "θ = arccos(x·y/(‖x‖‖y‖))",
    "symbols": "",
    "notes": "",
    "related": [
      "cosine_similarity",
      "dot_product"
    ]
  },
  {
    "id": "bagging",
    "title": "bagging and out-of-bag fraction",
    "field": "ml-models",
    "latex": "P(\\text{example not in a bootstrap sample})=\\Big(1-\\frac1n\\Big)^n\\xrightarrow{n\\to\\infty}e^{-1}\\approx0.368",
    "plain": "(1 − 1/n)ⁿ → e⁻¹ ≈ 0.368",
    "symbols": "",
    "notes": "About 63.2% of the data appears in each bootstrap; the rest is a free validation set (out-of-bag error).",
    "related": [
      "ensemble_variance",
      "bootstrap_se"
    ]
  },
  {
    "id": "bayesian_linear_regression",
    "title": "Bayesian linear regression",
    "field": "ml-models",
    "latex": "S_N=\\big(\\alpha I+\\beta\\Phi^{\\top}\\Phi\\big)^{-1},\\ \\ \\mathbf m_N=\\beta S_N\\Phi^{\\top}\\mathbf t,\\ \\ p(t_*)=\\mathcal N\\big(\\mathbf m_N^{\\top}\\boldsymbol\\phi_*,\\ \\beta^{-1}+\\boldsymbol\\phi_*^{\\top}S_N\\boldsymbol\\phi_*\\big)",
    "plain": "posterior N(m_N, S_N); predictive variance = noise + parameter uncertainty",
    "symbols": "α = prior precision, β = noise precision",
    "notes": "m_N is the ridge solution with λ = α/β.",
    "related": [
      "ridge_regression",
      "gp_posterior"
    ]
  },
  {
    "id": "bm25",
    "title": "BM25",
    "field": "ml-models",
    "latex": "\\mathrm{score}(q,d)=\\sum_{t\\in q}\\ln\\frac{N-\\mathrm{df}+0.5}{\\mathrm{df}+0.5}\\cdot\\frac{f(k_1+1)}{f+k_1\\big(1-b+b\\frac{|d|}{\\mathrm{avgdl}}\\big)}",
    "plain": "idf × f(k₁ + 1)/(f + k₁(1 − b + b|d|/avgdl))",
    "symbols": "k₁ ≈ 1.2, b ≈ 0.75",
    "notes": "The standard lexical ranking function.",
    "related": [
      "tf_idf"
    ]
  },
  {
    "id": "kernels_common",
    "title": "common kernels",
    "field": "ml-models",
    "latex": "k_{\\text{lin}}=\\mathbf x^{\\top}\\mathbf x',\\quad k_{\\text{poly}}=(\\mathbf x^{\\top}\\mathbf x'+c)^d,\\quad k_{\\text{Laplace}}=e^{-\\|\\mathbf x-\\mathbf x'\\|/\\ell},\\quad k_{\\text{Mat\\'ern}}^{3/2}=\\Big(1+\\tfrac{\\sqrt3r}{\\ell}\\Big)e^{-\\sqrt3r/\\ell}",
    "plain": "linear, polynomial, Laplace, Matérn 3/2",
    "symbols": "",
    "notes": "",
    "related": [
      "rbf_kernel"
    ]
  },
  {
    "id": "dp_composition",
    "title": "composition and subsampling",
    "field": "ml-models",
    "latex": "\\text{basic: }\\varepsilon_{tot}=\\sum_i\\varepsilon_i;\\qquad \\text{advanced: }\\varepsilon'=\\varepsilon\\sqrt{2k\\ln(1/\\delta')}+k\\varepsilon(e^\\varepsilon-1);\\qquad \\text{subsampling: }\\ln\\big(1+q(e^\\varepsilon-1)\\big)",
    "plain": "privacy budgets add up; subsampling amplifies privacy",
    "symbols": "q = sampling rate",
    "notes": "DP-SGD tracks this with the moments (RDP) accountant.",
    "related": [
      "differential_privacy"
    ]
  },
  {
    "id": "dbscan",
    "title": "DBSCAN neighbourhood",
    "field": "ml-models",
    "latex": "N_\\varepsilon(p)=\\{q:\\ d(p,q)\\le\\varepsilon\\};\\ \\ p\\text{ is a core point if }|N_\\varepsilon(p)|\\ge\\text{minPts}",
    "plain": "core point: at least minPts points within ε",
    "symbols": "",
    "notes": "No k needed; finds arbitrary shapes and flags noise.",
    "related": [
      "kmeans_objective"
    ]
  },
  {
    "id": "demographic_parity",
    "title": "demographic parity and disparate impact",
    "field": "ml-models",
    "latex": "\\Delta_{DP}=\\big|P(\\hat y=1\\mid A=0)-P(\\hat y=1\\mid A=1)\\big|,\\qquad \\mathrm{DI}=\\frac{P(\\hat y=1\\mid A=1)}{P(\\hat y=1\\mid A=0)}\\ \\ (\\ge0.8)",
    "plain": "ΔDP = |P(ŷ = 1 | A = 0) − P(ŷ = 1 | A = 1)|;  disparate impact ≥ 0.8",
    "symbols": "A = protected attribute",
    "notes": "The four-fifths rule of US employment law.",
    "related": [
      "equalized_odds"
    ]
  },
  {
    "id": "differential_privacy",
    "title": "differential privacy",
    "field": "ml-models",
    "latex": "P\\big(\\mathcal M(D)\\in S\\big)\\le e^{\\varepsilon}P\\big(\\mathcal M(D')\\in S\\big)+\\delta\\quad\\text{for neighbouring }D,D'",
    "plain": "P(M(D) ∈ S) ≤ e^ε P(M(D′) ∈ S) + δ",
    "symbols": "",
    "notes": "Smaller ε means stronger privacy.",
    "related": [
      "laplace_mechanism"
    ]
  },
  {
    "id": "elastic_net",
    "title": "elastic net",
    "field": "ml-models",
    "latex": "R(\\mathbf w)=\\lambda\\Big(\\alpha\\|\\mathbf w\\|_1+\\tfrac{1-\\alpha}{2}\\|\\mathbf w\\|_2^2\\Big)",
    "plain": "R(w) = λ( α‖w‖₁ + (1−α)/2 ‖w‖₂² )",
    "symbols": "α mixes L1 and L2",
    "notes": "",
    "related": [
      "l1_penalty",
      "l2_penalty"
    ]
  },
  {
    "id": "em_gmm",
    "title": "EM for Gaussian mixtures",
    "field": "ml-models",
    "latex": "\\gamma_{ik}=\\frac{\\pi_k\\mathcal N(x_i\\mid\\mu_k,\\Sigma_k)}{\\sum_j\\pi_j\\mathcal N(x_i\\mid\\mu_j,\\Sigma_j)};\\ \\ N_k=\\sum_i\\gamma_{ik},\\ \\mu_k=\\frac1{N_k}\\sum_i\\gamma_{ik}x_i,\\ \\pi_k=\\frac{N_k}N",
    "plain": "E-step: responsibilities γ;  M-step: re-estimate πₖ, μₖ, Σₖ",
    "symbols": "",
    "notes": "Each iteration never decreases the likelihood.",
    "related": [
      "gaussian_mixture",
      "kmeans_objective"
    ]
  },
  {
    "id": "equalized_odds",
    "title": "equalised odds and equal opportunity",
    "field": "ml-models",
    "latex": "P(\\hat y=1\\mid y=y_0,A=a)\\ \\text{equal across }a,\\ y_0\\in\\{0,1\\};\\qquad \\text{equal opportunity: only }y=1",
    "plain": "equal TPR and FPR across groups",
    "symbols": "",
    "notes": "Several fairness criteria cannot hold simultaneously unless base rates are equal (impossibility theorem).",
    "related": [
      "demographic_parity"
    ]
  },
  {
    "id": "factorization_machine",
    "title": "factorisation machine",
    "field": "ml-models",
    "latex": "\\hat y=w_0+\\sum_iw_ix_i+\\sum_{i<j}\\langle\\mathbf v_i,\\mathbf v_j\\rangle x_ix_j=w_0+\\mathbf w^{\\top}\\mathbf x+\\tfrac12\\sum_f\\Big[\\big(\\sum_iv_{if}x_i\\big)^2-\\sum_iv_{if}^2x_i^2\\Big]",
    "plain": "pairwise interactions through low-rank factors, computed in O(kn)",
    "symbols": "",
    "notes": "",
    "related": [
      "als_update"
    ]
  },
  {
    "id": "fedavg",
    "title": "federated averaging",
    "field": "ml-models",
    "latex": "w_{t+1}=\\sum_{k=1}^{K}\\frac{n_k}{n}\\,w_{t+1}^{(k)}",
    "plain": "w ← Σ (n_k/n) w^(k)",
    "symbols": "",
    "notes": "Clients train locally; the server averages their weights by data size.",
    "related": [
      "ema"
    ]
  },
  {
    "id": "lda_fisher",
    "title": "Fisher's linear discriminant",
    "field": "ml-models",
    "latex": "\\mathbf w\\propto S_W^{-1}(\\boldsymbol\\mu_1-\\boldsymbol\\mu_0),\\qquad J(\\mathbf w)=\\frac{\\big(\\mathbf w^{\\top}(\\boldsymbol\\mu_1-\\boldsymbol\\mu_0)\\big)^2}{\\mathbf w^{\\top}S_W\\mathbf w}",
    "plain": "w ∝ S_W⁻¹(μ₁ − μ₀)",
    "symbols": "S_W = within-class scatter",
    "notes": "",
    "related": [
      "mahalanobis"
    ]
  },
  {
    "id": "gaussian_discriminant",
    "title": "Gaussian discriminant (LDA / QDA)",
    "field": "ml-models",
    "latex": "\\delta_k(x)=-\\tfrac12(x-\\mu_k)^{\\top}\\Sigma_k^{-1}(x-\\mu_k)-\\tfrac12\\ln|\\Sigma_k|+\\ln\\pi_k",
    "plain": "δₖ(x) = −½(x − μₖ)ᵀΣₖ⁻¹(x − μₖ) − ½ ln|Σₖ| + ln πₖ",
    "symbols": "shared Σ gives LDA (linear boundary), per-class Σₖ gives QDA",
    "notes": "",
    "related": [
      "lda_fisher"
    ]
  },
  {
    "id": "gaussian_mixture",
    "title": "Gaussian mixture density",
    "field": "ml-models",
    "latex": "p(x)=\\sum_{k}\\pi_k\\,\\mathcal N(x\\mid\\mu_k,\\sigma_k^2),\\quad \\sum_k\\pi_k=1",
    "plain": "p(x) = Σₖ πₖ N(x | μₖ, σₖ²)",
    "symbols": "πₖ = mixing weights",
    "notes": "Fit by expectation–maximisation.",
    "related": [
      "gaussian_pdf"
    ]
  },
  {
    "id": "naive_bayes_gaussian",
    "title": "Gaussian naive Bayes",
    "field": "ml-models",
    "latex": "\\ln P(y\\mid\\mathbf x)=\\ln P(y)-\\sum_i\\Big[\\tfrac12\\ln(2\\pi\\sigma_{iy}^2)+\\frac{(x_i-\\mu_{iy})^2}{2\\sigma_{iy}^2}\\Big]+\\text{const}",
    "plain": "log prior + Σ per-feature Gaussian log-likelihoods",
    "symbols": "",
    "notes": "",
    "related": [
      "naive_bayes"
    ]
  },
  {
    "id": "gp_marginal_likelihood",
    "title": "Gaussian process log marginal likelihood",
    "field": "ml-models",
    "latex": "\\ln p(\\mathbf y)=-\\tfrac12\\mathbf y^{\\top}(K+\\sigma^2I)^{-1}\\mathbf y-\\tfrac12\\ln|K+\\sigma^2I|-\\tfrac n2\\ln2\\pi",
    "plain": "ln p(y) = −½yᵀA⁻¹y − ½ ln|A| − (n/2) ln 2π,  A = K + σ²I",
    "symbols": "",
    "notes": "Maximise over kernel hyperparameters: a built-in Occam's razor.",
    "related": [
      "gp_posterior"
    ]
  },
  {
    "id": "gp_posterior",
    "title": "Gaussian process posterior",
    "field": "ml-models",
    "latex": "\\mu_*=K_*^{\\top}(K+\\sigma^2I)^{-1}\\mathbf y,\\qquad \\sigma_*^2=k_{**}-K_*^{\\top}(K+\\sigma^2I)^{-1}K_*",
    "plain": "μ* = K*ᵀ(K + σ²I)⁻¹y;  σ*² = k** − K*ᵀ(K + σ²I)⁻¹K*",
    "symbols": "",
    "notes": "Exact Bayesian regression with a kernel prior; O(n³).",
    "related": [
      "mvn_conditional",
      "kernel_ridge"
    ]
  },
  {
    "id": "gini_impurity",
    "title": "Gini impurity",
    "field": "ml-models",
    "latex": "G=1-\\sum_k p_k^2",
    "plain": "G = 1 − Σ pₖ²",
    "symbols": "pₖ = class proportions in a node",
    "notes": "0 for a pure node.",
    "related": [
      "information_gain"
    ]
  },
  {
    "id": "glove_loss",
    "title": "GloVe loss",
    "field": "ml-models",
    "latex": "J=\\sum_{i,j}f(X_{ij})\\big(\\mathbf w_i^{\\top}\\tilde{\\mathbf w}_j+b_i+\\tilde b_j-\\ln X_{ij}\\big)^2,\\quad f(x)=\\min\\big((x/x_{\\max})^{3/4},1\\big)",
    "plain": "J = Σ f(Xᵢⱼ)(wᵢᵀw̃ⱼ + bᵢ + b̃ⱼ − ln Xᵢⱼ)²",
    "symbols": "",
    "notes": "",
    "related": [
      "word2vec_sgns"
    ]
  },
  {
    "id": "gradient_boosting",
    "title": "gradient boosting",
    "field": "ml-models",
    "latex": "F_m(x)=F_{m-1}(x)+\\nu\\,h_m(x),\\quad h_m\\ \\text{fits}\\ r_{im}=-\\Big[\\frac{\\partial L(y_i,F(x_i))}{\\partial F(x_i)}\\Big]_{F=F_{m-1}}",
    "plain": "fit each tree to the negative gradient of the loss",
    "symbols": "ν = shrinkage",
    "notes": "For squared error the pseudo-residual is y − F; for log loss it is y − p.",
    "related": [
      "xgboost_leaf",
      "adaboost_weights"
    ]
  },
  {
    "id": "logistic_gradient",
    "title": "gradient of logistic loss",
    "field": "ml-models",
    "latex": "\\nabla_{\\mathbf w}L=(p-y)\\,\\mathbf x,\\qquad \\frac{\\partial L}{\\partial b}=p-y",
    "plain": "∇_w L = (p − y)·x;  ∂L/∂b = p − y",
    "symbols": "p = σ(wᵀx + b)",
    "notes": "Residual times input.",
    "related": [
      "binary_cross_entropy",
      "softmax_ce_gradient"
    ]
  },
  {
    "id": "softmax_ce_gradient",
    "title": "gradient of softmax cross-entropy",
    "field": "ml-models",
    "latex": "\\frac{\\partial L}{\\partial z_k}=p_k-y_k",
    "plain": "∂L/∂zₖ = pₖ − yₖ",
    "symbols": "p = softmax(z), y = one-hot target",
    "notes": "The simplest gradient in deep learning.",
    "related": [
      "softmax_cross_entropy",
      "logistic_gradient"
    ]
  },
  {
    "id": "histogram_binning",
    "title": "histogram binning calibration",
    "field": "ml-models",
    "latex": "\\hat p(s)=\\frac{\\#\\{i\\in\\text{bin}(s):y_i=1\\}}{\\#\\{i\\in\\text{bin}(s)\\}}",
    "plain": "replace the score by the empirical positive rate of its bin",
    "symbols": "",
    "notes": "",
    "related": [
      "ece",
      "platt_scaling"
    ]
  },
  {
    "id": "hmm_forward",
    "title": "HMM forward algorithm",
    "field": "ml-models",
    "latex": "\\alpha_t(j)=\\Big[\\sum_i\\alpha_{t-1}(i)A_{ij}\\Big]B_j(o_t),\\quad P(O)=\\sum_j\\alpha_T(j)",
    "plain": "αₜ(j) = [Σᵢ αₜ₋₁(i)Aᵢⱼ] Bⱼ(oₜ)",
    "symbols": "A = transitions, B = emissions",
    "notes": "Dynamic programming in O(TN²). Replace the sum by a max for Viterbi.",
    "related": [
      "viterbi"
    ]
  },
  {
    "id": "information_gain",
    "title": "information gain",
    "field": "ml-models",
    "latex": "\\mathrm{IG}=H(\\text{parent})-\\sum_j\\frac{n_j}{n}H(\\text{child}_j)",
    "plain": "IG = H(parent) − Σⱼ (nⱼ/n) H(childⱼ)",
    "symbols": "",
    "notes": "The split criterion of ID3/C4.5 trees.",
    "related": [
      "entropy",
      "gini_impurity"
    ]
  },
  {
    "id": "isotonic_pav",
    "title": "isotonic regression (pool adjacent violators)",
    "field": "ml-models",
    "latex": "\\min\\sum(y_i-f_i)^2\\ \\text{s.t. }f_1\\le f_2\\le\\cdots\\le f_n",
    "plain": "pool adjacent violators: replace out-of-order neighbours by their mean",
    "symbols": "",
    "notes": "A monotone, non-parametric fit; used to calibrate scores.",
    "related": [
      "platt_scaling"
    ]
  },
  {
    "id": "kmeans_objective",
    "title": "k-means objective",
    "field": "ml-models",
    "latex": "J=\\sum_{n}\\sum_{k}r_{nk}\\,\\|\\mathbf x_n-\\boldsymbol\\mu_k\\|^2",
    "plain": "J = Σₙ Σₖ rₙₖ ‖xₙ − μₖ‖²",
    "symbols": "rₙₖ = 1 if point n is assigned to cluster k",
    "notes": "Lloyd's algorithm alternates assignment and mean updates; J never increases.",
    "related": [
      "pca_objective"
    ]
  },
  {
    "id": "kmeans_update",
    "title": "k-means update steps",
    "field": "ml-models",
    "latex": "c_i=\\arg\\min_k\\|x_i-\\mu_k\\|^2,\\qquad \\mu_k=\\frac1{|C_k|}\\sum_{i\\in C_k}x_i",
    "plain": "assign to the nearest centroid, then move each centroid to its cluster mean",
    "symbols": "",
    "notes": "",
    "related": [
      "kmeans_objective",
      "kmeans_plusplus"
    ]
  },
  {
    "id": "kmeans_plusplus",
    "title": "k-means++ seeding",
    "field": "ml-models",
    "latex": "P(x)=\\frac{D(x)^2}{\\sum_{x'}D(x')^2}",
    "plain": "choose the next centre with probability ∝ D(x)²",
    "symbols": "D(x) = distance to the nearest chosen centre",
    "notes": "O(log k)-competitive with the optimum in expectation.",
    "related": [
      "kmeans_update"
    ]
  },
  {
    "id": "knn_vote",
    "title": "k-nearest-neighbour prediction",
    "field": "ml-models",
    "latex": "\\hat y(x)=\\arg\\max_c\\sum_{i\\in N_k(x)}w_i\\mathbf 1[y_i=c],\\quad w_i=\\frac1{d(x,x_i)}\\ \\text{(optional)}",
    "plain": "majority (or distance-weighted) vote of the k nearest points",
    "symbols": "",
    "notes": "",
    "related": [
      "knn_error_bound"
    ]
  },
  {
    "id": "kalman_filter",
    "title": "Kalman filter",
    "field": "ml-models",
    "latex": "\\text{predict: }\\hat x^-=F\\hat x,\\ P^-=FPF^{\\top}+Q;\\quad \\text{update: }K=P^-H^{\\top}(HP^-H^{\\top}+R)^{-1},\\ \\hat x=\\hat x^-+K(z-H\\hat x^-),\\ P=(I-KH)P^-",
    "plain": "predict with F, Q;  update with gain K = P⁻Hᵀ(HP⁻Hᵀ + R)⁻¹",
    "symbols": "",
    "notes": "The exact Bayesian filter for linear-Gaussian state-space models.",
    "related": [
      "mvn_conditional",
      "hmm_forward"
    ]
  },
  {
    "id": "kernel_pca_centering",
    "title": "kernel PCA centering",
    "field": "ml-models",
    "latex": "\\tilde K=K-\\mathbf 1_nK-K\\mathbf 1_n+\\mathbf 1_nK\\mathbf 1_n,\\quad \\mathbf 1_n=\\tfrac1n\\mathbf 1\\mathbf 1^{\\top}",
    "plain": "K̃ = K − 1ₙK − K1ₙ + 1ₙK1ₙ",
    "symbols": "",
    "notes": "Centres the data in feature space; then eigendecompose K̃.",
    "related": [
      "pca_svd"
    ]
  },
  {
    "id": "kernel_ridge",
    "title": "kernel ridge regression",
    "field": "ml-models",
    "latex": "\\boldsymbol\\alpha=(K+\\lambda I)^{-1}\\mathbf y,\\qquad \\hat f(x)=\\sum_i\\alpha_i\\,k(x_i,x)",
    "plain": "α = (K + λI)⁻¹y;  f(x) = Σ αᵢ k(xᵢ, x)",
    "symbols": "",
    "notes": "Equals the GP posterior mean with noise variance λ.",
    "related": [
      "gp_posterior",
      "rbf_kernel"
    ]
  },
  {
    "id": "l1_penalty",
    "title": "L1 penalty (lasso)",
    "field": "ml-models",
    "latex": "R(\\mathbf w)=\\lambda\\|\\mathbf w\\|_1",
    "plain": "R(w) = λ Σ |wᵢ|",
    "symbols": "λ = strength",
    "notes": "Drives weights exactly to zero (sparse solutions).",
    "related": [
      "l1_norm",
      "l2_penalty",
      "elastic_net"
    ]
  },
  {
    "id": "l2_penalty",
    "title": "L2 penalty (weight decay)",
    "field": "ml-models",
    "latex": "R(\\mathbf w)=\\lambda\\|\\mathbf w\\|_2^2",
    "plain": "R(w) = λ Σ wᵢ²",
    "symbols": "",
    "notes": "Shrinks weights smoothly. Equivalent to a Gaussian prior on w.",
    "related": [
      "l1_penalty",
      "ridge_regression"
    ]
  },
  {
    "id": "laplace_mechanism",
    "title": "Laplace and Gaussian mechanisms",
    "field": "ml-models",
    "latex": "\\mathcal M(D)=f(D)+\\operatorname{Lap}\\big(\\Delta f/\\varepsilon\\big),\\qquad \\sigma=\\frac{\\Delta f\\sqrt{2\\ln(1.25/\\delta)}}\\varepsilon\\ \\ (\\text{Gaussian})",
    "plain": "add Laplace noise of scale Δf/ε",
    "symbols": "Δf = sensitivity",
    "notes": "",
    "related": [
      "differential_privacy"
    ]
  },
  {
    "id": "linear_regression",
    "title": "linear regression model",
    "field": "ml-models",
    "latex": "\\hat y=\\mathbf w^{\\top}\\mathbf x+b",
    "plain": "ŷ = wᵀx + b",
    "symbols": "w = weights, b = bias",
    "notes": "",
    "related": [
      "ols",
      "logistic_regression"
    ]
  },
  {
    "id": "logistic_regression",
    "title": "logistic regression model",
    "field": "ml-models",
    "latex": "p(y=1\\mid\\mathbf x)=\\sigma(\\mathbf w^{\\top}\\mathbf x+b)",
    "plain": "p(y=1|x) = σ(wᵀx + b)",
    "symbols": "",
    "notes": "The log-odds are linear in x.",
    "related": [
      "sigmoid",
      "binary_cross_entropy",
      "logistic_gradient"
    ]
  },
  {
    "id": "naive_bayes",
    "title": "naive Bayes",
    "field": "ml-models",
    "latex": "P(y\\mid\\mathbf x)\\propto P(y)\\prod_i P(x_i\\mid y)",
    "plain": "P(y|x) ∝ P(y) Πᵢ P(xᵢ|y)",
    "symbols": "Features assumed independent given the class",
    "notes": "In practice add log-probabilities.",
    "related": [
      "bayes"
    ]
  },
  {
    "id": "nmf_updates",
    "title": "non-negative matrix factorisation (multiplicative updates)",
    "field": "ml-models",
    "latex": "H\\leftarrow H\\circ\\frac{W^{\\top}V}{W^{\\top}WH},\\qquad W\\leftarrow W\\circ\\frac{VH^{\\top}}{WHH^{\\top}}",
    "plain": "H ← H ∘ (WᵀV)/(WᵀWH);  W ← W ∘ (VHᵀ)/(WHHᵀ)",
    "symbols": "",
    "notes": "Lee–Seung updates; keep everything non-negative and never increase ‖V − WH‖.",
    "related": [
      "pca_svd"
    ]
  },
  {
    "id": "particle_filter",
    "title": "particle filter (bootstrap) weights",
    "field": "ml-models",
    "latex": "w_i\\propto w_i\\,p(z\\mid x_i),\\quad N_{\\text{eff}}=\\frac1{\\sum_iw_i^2}\\ \\text{(resample if small)}",
    "plain": "wᵢ ∝ wᵢ p(z | xᵢ);  N_eff = 1/Σwᵢ²",
    "symbols": "",
    "notes": "Sequential Monte Carlo for non-linear, non-Gaussian filtering.",
    "related": [
      "effective_sample_size",
      "kalman_filter"
    ]
  },
  {
    "id": "pca_svd",
    "title": "PCA via SVD",
    "field": "ml-models",
    "latex": "X_c=U\\Sigma V^{\\top},\\quad \\text{components }=V,\\quad \\text{scores }=U\\Sigma,\\quad \\text{variance}_k=\\frac{\\sigma_k^2}{n-1}",
    "plain": "components = V, variances = σₖ²/(n − 1)",
    "symbols": "X_c = centred data",
    "notes": "",
    "related": [
      "pca_objective",
      "svd"
    ]
  },
  {
    "id": "perceptron_bound",
    "title": "perceptron mistake bound (Novikoff)",
    "field": "ml-models",
    "latex": "\\#\\text{mistakes}\\le\\Big(\\frac R\\gamma\\Big)^2",
    "plain": "mistakes ≤ (R/γ)²",
    "symbols": "R = max ‖x‖, γ = margin",
    "notes": "",
    "related": [
      "perceptron"
    ]
  },
  {
    "id": "perceptron",
    "title": "perceptron update",
    "field": "ml-models",
    "latex": "\\text{if }y\\,\\mathbf w^{\\top}\\mathbf x\\le0:\\quad \\mathbf w\\leftarrow\\mathbf w+y\\,\\mathbf x",
    "plain": "if a mistake: w ← w + y x",
    "symbols": "",
    "notes": "Converges in at most (R/γ)² mistakes when the data are separable with margin γ.",
    "related": [
      "svm_primal"
    ]
  },
  {
    "id": "platt_scaling",
    "title": "Platt scaling",
    "field": "ml-models",
    "latex": "P(y=1\\mid s)=\\sigma(As+B)",
    "plain": "P(y = 1 | s) = σ(As + B)",
    "symbols": "s = classifier score; A, B fitted on validation data by maximum likelihood",
    "notes": "Calibrates SVM and boosting scores; temperature scaling is the one-parameter version.",
    "related": [
      "excyst-temperature",
      "isotonic_pav"
    ]
  },
  {
    "id": "probabilistic_pca",
    "title": "probabilistic PCA",
    "field": "ml-models",
    "latex": "\\hat\\sigma^2=\\frac1{d-q}\\sum_{j=q+1}^{d}\\lambda_j,\\qquad W=U_q(\\Lambda_q-\\hat\\sigma^2I)^{1/2}",
    "plain": "σ̂² = mean of the discarded eigenvalues",
    "symbols": "",
    "notes": "PCA as a latent-variable model; gives a likelihood.",
    "related": [
      "pca_objective"
    ]
  },
  {
    "id": "randomized_response",
    "title": "randomised response",
    "field": "ml-models",
    "latex": "P(\\text{truth})=\\frac{e^\\varepsilon}{1+e^\\varepsilon},\\qquad \\hat p=\\frac{\\tilde p-(1-q)}{2q-1}",
    "plain": "answer truthfully with probability e^ε/(1 + e^ε), and debias the aggregate",
    "symbols": "",
    "notes": "The simplest local-DP mechanism.",
    "related": [
      "differential_privacy"
    ]
  },
  {
    "id": "rbf_kernel",
    "title": "RBF (Gaussian) kernel",
    "field": "ml-models",
    "latex": "k(\\mathbf x,\\mathbf x')=\\exp\\!\\Big(-\\frac{\\|\\mathbf x-\\mathbf x'\\|^2}{2\\ell^2}\\Big)=\\exp\\!\\big(-\\gamma\\|\\mathbf x-\\mathbf x'\\|^2\\big)",
    "plain": "k(x, x′) = exp(−‖x − x′‖²/2ℓ²)",
    "symbols": "ℓ = length scale, γ = 1/(2ℓ²)",
    "notes": "Positive definite; corresponds to an infinite-dimensional feature space.",
    "related": [
      "gram_matrix",
      "gp_posterior"
    ]
  },
  {
    "id": "word2vec_sgns",
    "title": "skip-gram with negative sampling",
    "field": "ml-models",
    "latex": "L=-\\ln\\sigma(\\mathbf u_o^{\\top}\\mathbf v_c)-\\sum_{k=1}^{K}\\ln\\sigma\\big(-\\mathbf u_k^{\\top}\\mathbf v_c\\big)",
    "plain": "L = −ln σ(u_oᵀv_c) − Σ ln σ(−u_kᵀv_c)",
    "symbols": "o = observed context word, k = sampled negatives",
    "notes": "Implicitly factorises the shifted PMI matrix.",
    "related": [
      "sigmoid",
      "glove_loss"
    ]
  },
  {
    "id": "svm_primal",
    "title": "support vector machine (soft margin)",
    "field": "ml-models",
    "latex": "\\min_{\\mathbf w,b,\\xi}\\ \\tfrac12\\|\\mathbf w\\|^2+C\\sum_i\\xi_i\\quad\\text{s.t. }y_i(\\mathbf w^{\\top}\\mathbf x_i+b)\\ge1-\\xi_i,\\ \\xi_i\\ge0",
    "plain": "min ½‖w‖² + C Σ ξᵢ   s.t. yᵢ(wᵀxᵢ + b) ≥ 1 − ξᵢ, ξᵢ ≥ 0",
    "symbols": "C trades margin width against violations ξ",
    "notes": "",
    "related": [
      "svm_margin",
      "hinge_loss",
      "kkt"
    ]
  },
  {
    "id": "svm_margin",
    "title": "SVM margin width",
    "field": "ml-models",
    "latex": "\\text{margin}=\\frac{2}{\\|\\mathbf w\\|}",
    "plain": "margin = 2 / ‖w‖",
    "symbols": "",
    "notes": "Maximising the margin means minimising ‖w‖.",
    "related": [
      "svm_primal"
    ]
  },
  {
    "id": "tsne",
    "title": "t-SNE",
    "field": "ml-models",
    "latex": "p_{j|i}=\\frac{e^{-\\|x_i-x_j\\|^2/2\\sigma_i^2}}{\\sum_{k\\ne i}e^{-\\|x_i-x_k\\|^2/2\\sigma_i^2}},\\quad q_{ij}=\\frac{(1+\\|y_i-y_j\\|^2)^{-1}}{\\sum_{k\\ne l}(1+\\|y_k-y_l\\|^2)^{-1}},\\quad C=\\mathrm{KL}(P\\|Q)",
    "plain": "Gaussian affinities in the data space, Student-t (1 dof) affinities in the map, minimise KL",
    "symbols": "",
    "notes": "The heavy-tailed t kernel avoids crowding. Perplexity = 2^H(Pᵢ) sets σᵢ.",
    "related": [
      "kl_divergence"
    ]
  },
  {
    "id": "tf_idf",
    "title": "TF-IDF",
    "field": "ml-models",
    "latex": "\\mathrm{tfidf}(t,d)=\\mathrm{tf}(t,d)\\cdot\\ln\\frac{N}{\\mathrm{df}(t)}",
    "plain": "tf-idf = tf × ln(N/df)",
    "symbols": "N = documents, df = documents containing t",
    "notes": "Common-word terms get weights near 0.",
    "related": [
      "bm25"
    ]
  },
  {
    "id": "ensemble_variance",
    "title": "variance of an averaged ensemble",
    "field": "ml-models",
    "latex": "\\operatorname{Var}\\!\\Big(\\frac1B\\sum_b f_b\\Big)=\\rho\\sigma^2+\\frac{1-\\rho}{B}\\sigma^2",
    "plain": "Var = ρσ² + (1−ρ)σ²/B",
    "symbols": "B models, pairwise correlation ρ, variance σ²",
    "notes": "Averaging only removes the uncorrelated part: decorrelate the models (random forests).",
    "related": [
      "bias_variance"
    ]
  },
  {
    "id": "viterbi",
    "title": "Viterbi algorithm",
    "field": "ml-models",
    "latex": "\\delta_t(j)=\\max_i\\big[\\delta_{t-1}(i)A_{ij}\\big]B_j(o_t),\\quad \\text{backtrack the argmax}",
    "plain": "δₜ(j) = maxᵢ[δₜ₋₁(i)Aᵢⱼ] Bⱼ(oₜ)",
    "symbols": "",
    "notes": "The most likely hidden-state sequence.",
    "related": [
      "hmm_forward"
    ]
  },
  {
    "id": "ward_linkage",
    "title": "Ward's linkage",
    "field": "ml-models",
    "latex": "\\Delta(A,B)=\\frac{|A||B|}{|A|+|B|}\\,\\|\\mu_A-\\mu_B\\|^2",
    "plain": "Δ = |A||B|/(|A| + |B|) · ‖μ_A − μ_B‖²",
    "symbols": "",
    "notes": "Merges the pair that least increases the within-cluster variance.",
    "related": [
      "kmeans_objective"
    ]
  },
  {
    "id": "xgboost_leaf",
    "title": "XGBoost leaf weight and split gain",
    "field": "ml-models",
    "latex": "w^*=-\\frac{G}{H+\\lambda},\\qquad \\text{Gain}=\\tfrac12\\Big[\\frac{G_L^2}{H_L+\\lambda}+\\frac{G_R^2}{H_R+\\lambda}-\\frac{(G_L+G_R)^2}{H_L+H_R+\\lambda}\\Big]-\\gamma",
    "plain": "w* = −G/(H + λ);  gain = ½[G_L²/(H_L + λ) + G_R²/(H_R + λ) − (G_L + G_R)²/(H + λ)] − γ",
    "symbols": "G, H = sums of first and second derivatives of the loss in the leaf",
    "notes": "",
    "related": [
      "gradient_boosting"
    ]
  },
  {
    "id": "additive_attention",
    "title": "additive (Bahdanau) attention score",
    "field": "deep-learning",
    "latex": "e_{ij}=\\mathbf v^{\\top}\\tanh(W_1\\mathbf s_i+W_2\\mathbf h_j),\\quad \\alpha_{ij}=\\operatorname{softmax}_j(e_{ij}),\\quad \\mathbf c_i=\\sum_j\\alpha_{ij}\\mathbf h_j",
    "plain": "eᵢⱼ = vᵀ tanh(W₁sᵢ + W₂hⱼ);  α = softmax(e)",
    "symbols": "",
    "notes": "The original neural-translation attention.",
    "related": [
      "attention"
    ]
  },
  {
    "id": "quantization",
    "title": "affine quantisation",
    "field": "deep-learning",
    "latex": "q=\\operatorname{clip}\\big(\\operatorname{round}(x/s)+z,\\ 0,\\ 2^b-1\\big),\\quad s=\\frac{x_{\\max}-x_{\\min}}{2^b-1},\\quad \\hat x=s\\,(q-z)",
    "plain": "q = round(x/s) + z;  x̂ = s(q − z)",
    "symbols": "b bits, scale s, zero-point z",
    "notes": "Worst-case rounding error is s/2.",
    "related": [
      "machine_epsilon"
    ]
  },
  {
    "id": "alibi",
    "title": "ALiBi attention bias",
    "field": "deep-learning",
    "latex": "\\operatorname{softmax}\\big(q_i k_j^{\\top}-m\\,(i-j)\\big),\\quad m_h=2^{-8h/H}",
    "plain": "score − m·(i − j)",
    "symbols": "m = head-specific slope",
    "notes": "A linear distance penalty instead of position embeddings; extrapolates to longer contexts.",
    "related": [
      "rope"
    ]
  },
  {
    "id": "backprop_delta",
    "title": "backpropagation (layer error)",
    "field": "deep-learning",
    "latex": "\\boldsymbol\\delta^{(l)}=\\big(W^{(l+1)}\\big)^{\\top}\\boldsymbol\\delta^{(l+1)}\\odot\\sigma'\\!\\big(\\mathbf z^{(l)}\\big)",
    "plain": "δ⁽ˡ⁾ = (W⁽ˡ⁺¹⁾)ᵀ δ⁽ˡ⁺¹⁾ ⊙ σ′(z⁽ˡ⁾)",
    "symbols": "",
    "notes": "∂L/∂W⁽ˡ⁾ = δ⁽ˡ⁾ (a⁽ˡ⁻¹⁾)ᵀ",
    "related": [
      "chain_rule"
    ]
  },
  {
    "id": "batchnorm",
    "title": "batch normalisation",
    "field": "deep-learning",
    "latex": "\\hat x=\\frac{x-\\mu_B}{\\sqrt{\\sigma_B^2+\\epsilon}},\\quad y=\\gamma\\hat x+\\beta",
    "plain": "x̂ = (x − μ_B)/√(σ²_B + ε);  y = γx̂ + β",
    "symbols": "μ_B, σ²_B = batch statistics; γ, β learned",
    "notes": "Uses running averages at inference time.",
    "related": [
      "layernorm",
      "rmsnorm"
    ]
  },
  {
    "id": "bn_momentum",
    "title": "batch-norm running statistics",
    "field": "deep-learning",
    "latex": "\\mu_{\\text{run}}\\leftarrow(1-m)\\mu_{\\text{run}}+m\\,\\mu_B,\\qquad \\sigma^2_{\\text{run}}\\leftarrow(1-m)\\sigma^2_{\\text{run}}+m\\,\\sigma^2_B",
    "plain": "running = (1 − m)·running + m·batch  (m ≈ 0.1)",
    "symbols": "",
    "notes": "Used at inference time in place of batch statistics.",
    "related": [
      "batchnorm",
      "ema"
    ]
  },
  {
    "id": "beam_search_score",
    "title": "beam search with length normalisation",
    "field": "deep-learning",
    "latex": "\\operatorname{score}(Y)=\\frac{\\ln P(Y\\mid X)}{\\big((5+|Y|)/6\\big)^{\\alpha}}",
    "plain": "score = ln P(Y|X) / ((5 + |Y|)/6)^α",
    "symbols": "α ≈ 0.6",
    "notes": "Without it beam search prefers short outputs.",
    "related": [
      "sampling_top_p"
    ]
  },
  {
    "id": "bradley_terry_reward",
    "title": "Bradley–Terry reward-model loss",
    "field": "deep-learning",
    "latex": "L=-\\ln\\sigma\\big(r(x,y_w)-r(x,y_l)\\big)",
    "plain": "L = −ln σ(r(x, y_w) − r(x, y_l))",
    "symbols": "y_w preferred over y_l",
    "notes": "Trains a reward model from human preference pairs.",
    "related": [
      "sigmoid",
      "binary_cross_entropy"
    ]
  },
  {
    "id": "cfg",
    "title": "classifier-free guidance",
    "field": "deep-learning",
    "latex": "\\tilde\\varepsilon=(1+w)\\,\\varepsilon_\\theta(x_t,c)-w\\,\\varepsilon_\\theta(x_t,\\varnothing)",
    "plain": "ε̃ = (1 + w)ε(x, c) − wε(x, ∅)",
    "symbols": "w = guidance strength",
    "notes": "Extrapolates away from the unconditional prediction toward the conditioned one.",
    "related": [
      "ddpm_reverse"
    ]
  },
  {
    "id": "chinchilla_optimal",
    "title": "compute-optimal training (Chinchilla)",
    "field": "deep-learning",
    "latex": "D^*\\approx20\\,N,\\qquad N^*\\propto C^{0.5},\\ D^*\\propto C^{0.5},\\qquad C\\approx6ND",
    "plain": "D ≈ 20N tokens;  N and D both grow as √C",
    "symbols": "",
    "notes": "Scale parameters and data together. Many deployed models are deliberately over-trained for cheaper inference.",
    "related": [
      "scaling_law",
      "transformer_flops"
    ]
  },
  {
    "id": "conv_flops",
    "title": "convolution cost",
    "field": "deep-learning",
    "latex": "\\text{FLOPs}\\approx2\\,H_{out}W_{out}\\,k^2\\,C_{in}C_{out},\\qquad \\text{params}=k^2C_{in}C_{out}+C_{out}",
    "plain": "FLOPs ≈ 2·H_out·W_out·k²·C_in·C_out",
    "symbols": "",
    "notes": "",
    "related": [
      "depthwise_separable",
      "matmul_flops"
    ]
  },
  {
    "id": "conv_output_size",
    "title": "convolution output size",
    "field": "deep-learning",
    "latex": "n_{out}=\\left\\lfloor\\frac{n+2p-k}{s}\\right\\rfloor+1",
    "plain": "n_out = ⌊(n + 2p − k)/s⌋ + 1",
    "symbols": "n input size, k kernel, p padding, s stride",
    "notes": "",
    "related": [
      "param_count"
    ]
  },
  {
    "id": "ddim_step",
    "title": "DDIM deterministic step",
    "field": "deep-learning",
    "latex": "\\hat x_0=\\frac{x_t-\\sqrt{1-\\bar\\alpha_t}\\,\\varepsilon_\\theta}{\\sqrt{\\bar\\alpha_t}},\\qquad x_{t-1}=\\sqrt{\\bar\\alpha_{t-1}}\\,\\hat x_0+\\sqrt{1-\\bar\\alpha_{t-1}}\\,\\varepsilon_\\theta",
    "plain": "predict x̂₀, then jump to the earlier noise level",
    "symbols": "",
    "notes": "Allows far fewer sampling steps than DDPM.",
    "related": [
      "ddpm_reverse"
    ]
  },
  {
    "id": "ddpm_reverse",
    "title": "DDPM reverse step",
    "field": "deep-learning",
    "latex": "\\mu_\\theta(x_t,t)=\\frac1{\\sqrt{\\alpha_t}}\\Big(x_t-\\frac{\\beta_t}{\\sqrt{1-\\bar\\alpha_t}}\\,\\varepsilon_\\theta(x_t,t)\\Big),\\qquad \\tilde\\beta_t=\\frac{1-\\bar\\alpha_{t-1}}{1-\\bar\\alpha_t}\\beta_t",
    "plain": "μ = (xₜ − βₜ/√(1 − ᾱₜ) ε_θ)/√αₜ;  β̃ₜ = (1 − ᾱₜ₋₁)/(1 − ᾱₜ) βₜ",
    "symbols": "",
    "notes": "",
    "related": [
      "ddpm_forward",
      "ddpm_loss"
    ]
  },
  {
    "id": "score_matching",
    "title": "denoising score matching",
    "field": "deep-learning",
    "latex": "\\mathcal L=\\mathbb E\\Big\\|s_\\theta(\\tilde x,\\sigma)+\\frac{\\tilde x-x}{\\sigma^2}\\Big\\|^2,\\qquad \\tilde x=x+\\sigma\\varepsilon",
    "plain": "train s_θ(x̃) to equal −(x̃ − x)/σ² = ∇log q(x̃|x)",
    "symbols": "",
    "notes": "The score is ∇ₓ log p(x); ε-prediction in DDPM is the same thing up to scale: s = −ε/σ.",
    "related": [
      "ddpm_loss",
      "langevin_dynamics"
    ]
  },
  {
    "id": "depthwise_separable",
    "title": "depthwise-separable convolution parameters",
    "field": "deep-learning",
    "latex": "\\underbrace{k^2C_{in}+C_{in}C_{out}}_{\\text{separable}}\\ \\text{vs}\\ \\underbrace{k^2C_{in}C_{out}}_{\\text{standard}}",
    "plain": "k²Cᵢₙ + CᵢₙC_out  vs  k²CᵢₙC_out",
    "symbols": "",
    "notes": "About an 8–9× reduction for 3×3 kernels (MobileNet).",
    "related": [
      "param_count",
      "conv_flops"
    ]
  },
  {
    "id": "ddpm_forward",
    "title": "diffusion forward process",
    "field": "deep-learning",
    "latex": "x_t=\\sqrt{\\bar\\alpha_t}\\,x_0+\\sqrt{1-\\bar\\alpha_t}\\,\\varepsilon,\\quad \\bar\\alpha_t=\\prod_{s\\le t}\\alpha_s",
    "plain": "xₜ = √ᾱₜ x₀ + √(1−ᾱₜ) ε;  ᾱₜ = Πₛ αₛ",
    "symbols": "ε ~ N(0, I)",
    "notes": "Sample any noise level directly from x₀.",
    "related": [
      "ddpm_loss"
    ]
  },
  {
    "id": "ddpm_loss",
    "title": "diffusion training loss",
    "field": "deep-learning",
    "latex": "L=\\mathbb{E}_{t,x_0,\\varepsilon}\\big[\\|\\varepsilon-\\varepsilon_\\theta(x_t,t)\\|^2\\big]",
    "plain": "L = E‖ε − ε_θ(xₜ, t)‖²",
    "symbols": "",
    "notes": "The network predicts the noise that was added.",
    "related": [
      "ddpm_forward"
    ]
  },
  {
    "id": "dilated_conv",
    "title": "dilated convolution",
    "field": "deep-learning",
    "latex": "k_{\\text{eff}}=k+(k-1)(d-1)",
    "plain": "k_eff = k + (k − 1)(d − 1)",
    "symbols": "d = dilation",
    "notes": "Grows the receptive field without adding parameters.",
    "related": [
      "receptive_field"
    ]
  },
  {
    "id": "dpo",
    "title": "direct preference optimisation (DPO)",
    "field": "deep-learning",
    "latex": "L=-\\ln\\sigma\\Big(\\beta\\ln\\frac{\\pi_\\theta(y_w\\mid x)}{\\pi_{\\text{ref}}(y_w\\mid x)}-\\beta\\ln\\frac{\\pi_\\theta(y_l\\mid x)}{\\pi_{\\text{ref}}(y_l\\mid x)}\\Big)",
    "plain": "L = −ln σ(β[log(π/π_ref)(y_w) − log(π/π_ref)(y_l)])",
    "symbols": "",
    "notes": "Optimises the RLHF objective in closed form, with no separate reward model or RL loop.",
    "related": [
      "bradley_terry_reward",
      "rlhf_kl"
    ]
  },
  {
    "id": "early_stopping",
    "title": "early-stopping rule",
    "field": "deep-learning",
    "latex": "\\text{stop when }L_{\\text{val}}\\text{ has not improved for }p\\text{ epochs (patience)}",
    "plain": "stop after `patience` epochs without a new best validation loss",
    "symbols": "",
    "notes": "Acts like an L2 penalty whose strength shrinks with training time.",
    "related": [
      "l2_penalty"
    ]
  },
  {
    "id": "elu_selu",
    "title": "ELU and SELU",
    "field": "deep-learning",
    "latex": "\\operatorname{ELU}(x)=\\begin{cases}x&x>0\\\\ \\alpha(e^x-1)&x\\le0\\end{cases},\\qquad \\operatorname{SELU}=\\lambda\\operatorname{ELU}\\ (\\lambda\\approx1.0507,\\ \\alpha\\approx1.6733)",
    "plain": "ELU: x for x > 0, α(eˣ − 1) otherwise;  SELU scales it by λ",
    "symbols": "",
    "notes": "SELU self-normalises activations in fully connected networks.",
    "related": [
      "relu",
      "gelu"
    ]
  },
  {
    "id": "ema_decay_halflife",
    "title": "EMA decay and half-life",
    "field": "deep-learning",
    "latex": "\\beta=0.5^{1/\\text{half-life}},\\qquad \\text{effective window}\\approx\\frac1{1-\\beta}",
    "plain": "β = 0.5^(1/half-life);  window ≈ 1/(1 − β)",
    "symbols": "",
    "notes": "",
    "related": [
      "ema"
    ]
  },
  {
    "id": "vae_elbo",
    "title": "evidence lower bound (VAE)",
    "field": "deep-learning",
    "latex": "\\log p(x)\\ \\ge\\ \\mathbb{E}_{q(z|x)}[\\log p(x\\mid z)]-D_{\\mathrm{KL}}\\big(q(z\\mid x)\\,\\|\\,p(z)\\big)",
    "plain": "log p(x) ≥ E_q[log p(x|z)] − KL(q(z|x) ‖ p(z))",
    "symbols": "",
    "notes": "Reconstruction term minus a regulariser.",
    "related": [
      "vae_kl",
      "reparameterization"
    ]
  },
  {
    "id": "flow_matching",
    "title": "flow matching and rectified flow",
    "field": "deep-learning",
    "latex": "x_t=(1-t)\\,x_0+t\\,x_1,\\qquad \\mathcal L=\\mathbb E\\big\\|v_\\theta(x_t,t)-(x_1-x_0)\\big\\|^2",
    "plain": "x_t = (1 − t)x₀ + t x₁;  regress v_θ onto x₁ − x₀",
    "symbols": "x₀ ~ noise, x₁ ~ data",
    "notes": "Straight-line paths give simple training and few-step sampling.",
    "related": [
      "ddpm_forward"
    ]
  },
  {
    "id": "gan_minimax",
    "title": "GAN objective",
    "field": "deep-learning",
    "latex": "\\min_G\\max_D\\ \\mathbb{E}_{x\\sim p_{\\text{data}}}[\\log D(x)]+\\mathbb{E}_{z\\sim p_z}[\\log(1-D(G(z)))]",
    "plain": "min_G max_D E[log D(x)] + E[log(1 − D(G(z)))]",
    "symbols": "",
    "notes": "",
    "related": [
      "gan_optimal_discriminator"
    ]
  },
  {
    "id": "glu",
    "title": "gated linear unit",
    "field": "deep-learning",
    "latex": "\\operatorname{GLU}(a,b)=a\\odot\\sigma(b)",
    "plain": "GLU(a, b) = a ⊙ σ(b)",
    "symbols": "",
    "notes": "",
    "related": [
      "swiglu",
      "sigmoid"
    ]
  },
  {
    "id": "gelu_tanh",
    "title": "GELU tanh approximation",
    "field": "deep-learning",
    "latex": "\\operatorname{GELU}(x)\\approx\\tfrac12x\\Big(1+\\tanh\\!\\Big[\\sqrt{\\tfrac2\\pi}\\big(x+0.044715x^3\\big)\\Big]\\Big)",
    "plain": "GELU ≈ ½x(1 + tanh(√(2/π)(x + 0.044715x³)))",
    "symbols": "",
    "notes": "The form used in the original BERT and GPT-2 code.",
    "related": [
      "gelu"
    ]
  },
  {
    "id": "generalization_finite",
    "title": "generalisation bound for a finite class",
    "field": "deep-learning",
    "latex": "R(h)\\le\\hat R(h)+\\sqrt{\\frac{\\ln|\\mathcal H|+\\ln(2/\\delta)}{2n}}\\quad\\text{with probability }1-\\delta",
    "plain": "R ≤ R̂ + √((ln|H| + ln(2/δ))/(2n))",
    "symbols": "",
    "notes": "From Hoeffding and a union bound.",
    "related": [
      "hoeffding",
      "vc_bound"
    ]
  },
  {
    "id": "gat_attention",
    "title": "graph attention (GAT)",
    "field": "deep-learning",
    "latex": "e_{ij}=\\operatorname{LeakyReLU}\\big(\\mathbf a^{\\top}[W\\mathbf h_i\\,\\|\\,W\\mathbf h_j]\\big),\\quad \\alpha_{ij}=\\operatorname{softmax}_j(e_{ij}),\\quad \\mathbf h_i'=\\sigma\\Big(\\sum_j\\alpha_{ij}W\\mathbf h_j\\Big)",
    "plain": "learned attention weights over neighbours",
    "symbols": "",
    "notes": "",
    "related": [
      "attention",
      "gcn_propagation"
    ]
  },
  {
    "id": "gcn_propagation",
    "title": "graph convolution (GCN)",
    "field": "deep-learning",
    "latex": "H^{(l+1)}=\\sigma\\big(\\tilde D^{-1/2}\\tilde A\\tilde D^{-1/2}H^{(l)}W^{(l)}\\big),\\quad \\tilde A=A+I",
    "plain": "H′ = σ(D̃^(−½) Ã D̃^(−½) H W)",
    "symbols": "",
    "notes": "Each node averages its neighbours (and itself).",
    "related": [
      "normalized_laplacian"
    ]
  },
  {
    "id": "gin_update",
    "title": "graph isomorphism network (GIN)",
    "field": "deep-learning",
    "latex": "\\mathbf h_v'=\\operatorname{MLP}\\Big((1+\\varepsilon)\\mathbf h_v+\\sum_{u\\in N(v)}\\mathbf h_u\\Big)",
    "plain": "h′ = MLP((1 + ε)hᵥ + Σ hᵤ)",
    "symbols": "",
    "notes": "As expressive as the Weisfeiler–Lehman test.",
    "related": [
      "gcn_propagation"
    ]
  },
  {
    "id": "groupnorm",
    "title": "group normalisation",
    "field": "deep-learning",
    "latex": "\\hat x=\\frac{x-\\mu_g}{\\sqrt{\\sigma_g^2+\\epsilon}},\\quad \\mu_g,\\sigma_g\\ \\text{over the channels in a group and }H,W",
    "plain": "normalise over each group of channels",
    "symbols": "",
    "notes": "Independent of batch size; instance norm is G = C, layer norm is G = 1.",
    "related": [
      "layernorm",
      "batchnorm"
    ]
  },
  {
    "id": "grpo_advantage",
    "title": "group-relative advantage (GRPO)",
    "field": "deep-learning",
    "latex": "\\hat A_i=\\frac{r_i-\\operatorname{mean}(r_{1:G})}{\\operatorname{std}(r_{1:G})}",
    "plain": "Âᵢ = (rᵢ − mean(r))/std(r) over a group of G samples",
    "symbols": "",
    "notes": "Replaces a learned value function by the group baseline.",
    "related": [
      "gae",
      "ppo_clip"
    ]
  },
  {
    "id": "group_conv_params",
    "title": "grouped convolution parameters",
    "field": "deep-learning",
    "latex": "\\frac{k^2C_{in}C_{out}}{g}",
    "plain": "k² C_in C_out / g",
    "symbols": "g = number of groups",
    "notes": "g = C_in gives a depthwise convolution.",
    "related": [
      "depthwise_separable"
    ]
  },
  {
    "id": "gru_cell",
    "title": "GRU hidden update",
    "field": "deep-learning",
    "latex": "h_t=(1-z_t)\\odot h_{t-1}+z_t\\odot\\tilde h_t",
    "plain": "hₜ = (1 − zₜ) ⊙ hₜ₋₁ + zₜ ⊙ h̃ₜ",
    "symbols": "z = update gate",
    "notes": "",
    "related": [
      "lstm_cell"
    ]
  },
  {
    "id": "he_init",
    "title": "He (Kaiming) initialisation",
    "field": "deep-learning",
    "latex": "w\\sim\\mathcal N\\!\\left(0,\\tfrac{2}{n_{in}}\\right)",
    "plain": "std = √(2 / fan_in)",
    "symbols": "",
    "notes": "For ReLU networks.",
    "related": [
      "xavier_init"
    ]
  },
  {
    "id": "iwae",
    "title": "importance-weighted autoencoder bound",
    "field": "deep-learning",
    "latex": "\\mathcal L_K=\\mathbb E\\Big[\\log\\frac1K\\sum_{k=1}^{K}\\frac{p(x,z_k)}{q(z_k\\mid x)}\\Big]\\ \\ge\\ \\mathcal L_1=\\text{ELBO}",
    "plain": "L_K = E log (1/K) Σ p(x, zₖ)/q(zₖ|x)",
    "symbols": "",
    "notes": "A tighter bound as K grows.",
    "related": [
      "vae_elbo",
      "importance_sampling"
    ]
  },
  {
    "id": "infonce",
    "title": "InfoNCE (contrastive) loss",
    "field": "deep-learning",
    "latex": "L=-\\log\\frac{\\exp(s^{+}/\\tau)}{\\sum_{j}\\exp(s_j/\\tau)}",
    "plain": "L = −log( exp(s⁺/τ) / Σⱼ exp(sⱼ/τ) )",
    "symbols": "s = similarity scores (positive first), τ = temperature",
    "notes": "Lower bounds mutual information.",
    "related": [
      "cosine_similarity",
      "mutual_information"
    ]
  },
  {
    "id": "dropout",
    "title": "inverted dropout",
    "field": "deep-learning",
    "latex": "\\mathbf y=\\frac{\\mathbf m\\odot\\mathbf x}{1-p},\\quad m_i\\sim\\mathrm{Bernoulli}(1-p)",
    "plain": "y = (m ⊙ x) / (1 − p)",
    "symbols": "p = drop probability",
    "notes": "Scaling by 1/(1−p) keeps the expected activation unchanged.",
    "related": [
      "l2_penalty"
    ]
  },
  {
    "id": "kv_cache_size",
    "title": "KV-cache size",
    "field": "deep-learning",
    "latex": "\\text{bytes}=2\\cdot n_{\\text{layers}}\\cdot n_{kv}\\cdot d_{\\text{head}}\\cdot T\\cdot b",
    "plain": "bytes = 2 · layers · kv_heads · d_head · T · bytes_per_value",
    "symbols": "",
    "notes": "Grouped-query attention shrinks it by n_heads/n_kv. It, not weights, often limits long-context serving.",
    "related": [
      "attention_flops"
    ]
  },
  {
    "id": "layernorm",
    "title": "layer normalisation",
    "field": "deep-learning",
    "latex": "\\hat x_i=\\frac{x_i-\\mu}{\\sqrt{\\sigma^2+\\epsilon}},\\quad y_i=\\gamma_i\\hat x_i+\\beta_i",
    "plain": "x̂ᵢ = (xᵢ − μ)/√(σ² + ε);  yᵢ = γᵢx̂ᵢ + βᵢ",
    "symbols": "μ, σ² over the features of one example",
    "notes": "Independent of batch size; standard in transformers.",
    "related": [
      "batchnorm",
      "rmsnorm"
    ]
  },
  {
    "id": "fine_tune_lr_decay",
    "title": "layer-wise learning-rate decay",
    "field": "deep-learning",
    "latex": "\\eta_\\ell=\\eta_{\\text{top}}\\,\\gamma^{L-\\ell}",
    "plain": "η_ℓ = η_top γ^(L − ℓ)",
    "symbols": "",
    "notes": "Lower layers (general features) change more slowly when fine-tuning.",
    "related": [
      "lr_exponential_decay"
    ]
  },
  {
    "id": "lsgan_hinge_gan",
    "title": "least-squares and hinge GAN losses",
    "field": "deep-learning",
    "latex": "\\text{LSGAN: }\\tfrac12\\mathbb E(D(x)-1)^2+\\tfrac12\\mathbb E\\,D(G(z))^2;\\qquad \\text{hinge: }\\mathbb E\\max(0,1-D(x))+\\mathbb E\\max(0,1+D(G(z)))",
    "plain": "squared and hinge variants of the discriminator loss",
    "symbols": "",
    "notes": "",
    "related": [
      "gan_minimax"
    ]
  },
  {
    "id": "lecun_init",
    "title": "LeCun and orthogonal initialisation",
    "field": "deep-learning",
    "latex": "\\operatorname{Var}(w)=\\frac1{n_{in}},\\qquad \\text{orthogonal: }W^{\\top}W=I",
    "plain": "std = √(1/fan_in)",
    "symbols": "",
    "notes": "Keeps activations at unit variance for SELU / tanh networks.",
    "related": [
      "he_init",
      "xavier_init"
    ]
  },
  {
    "id": "linear_layer",
    "title": "linear (fully connected) layer",
    "field": "deep-learning",
    "latex": "\\mathbf y=W\\mathbf x+\\mathbf b",
    "plain": "y = W x + b",
    "symbols": "W ∈ ℝ^(out×in)",
    "notes": "",
    "related": [
      "param_count"
    ]
  },
  {
    "id": "linear_attention",
    "title": "linear attention",
    "field": "deep-learning",
    "latex": "\\operatorname{Attn}(Q,K,V)_i=\\frac{\\phi(q_i)^{\\top}\\sum_j\\phi(k_j)v_j^{\\top}}{\\phi(q_i)^{\\top}\\sum_j\\phi(k_j)}",
    "plain": "φ(q)ᵀ(Σ φ(k)vᵀ) / φ(q)ᵀ(Σ φ(k))",
    "symbols": "φ = positive feature map, e.g. elu + 1",
    "notes": "Associativity gives O(T) time and a recurrent form.",
    "related": [
      "attention"
    ]
  },
  {
    "id": "lipschitz_network",
    "title": "Lipschitz bound of a network",
    "field": "deep-learning",
    "latex": "\\operatorname{Lip}(f)\\le\\prod_{\\ell}\\|W_\\ell\\|_2\\cdot\\prod_\\ell\\operatorname{Lip}(\\sigma_\\ell)",
    "plain": "Lip(f) ≤ Π ‖W_ℓ‖₂ · Π Lip(σ_ℓ)",
    "symbols": "",
    "notes": "ReLU has Lip 1. Loose, but it is the basis of spectral-norm and Lipschitz-constrained training.",
    "related": [
      "spectral_norm",
      "lipschitz"
    ]
  },
  {
    "id": "lora",
    "title": "low-rank adaptation (LoRA)",
    "field": "deep-learning",
    "latex": "W'=W+\\frac\\alpha r\\,BA,\\quad B\\in\\mathbb R^{d\\times r},\\ A\\in\\mathbb R^{r\\times k},\\quad \\text{trainable params}=r(d+k)",
    "plain": "W′ = W + (α/r)·BA;  params = r(d + k)",
    "symbols": "",
    "notes": "A 4096×4096 layer at r = 8 trains 65 536 parameters instead of 16.8 million.",
    "related": [
      "eckart_young"
    ]
  },
  {
    "id": "lstm_cell",
    "title": "LSTM cell state update",
    "field": "deep-learning",
    "latex": "c_t=f_t\\odot c_{t-1}+i_t\\odot\\tilde c_t,\\qquad h_t=o_t\\odot\\tanh(c_t)",
    "plain": "cₜ = fₜ ⊙ cₜ₋₁ + iₜ ⊙ c̃ₜ;  hₜ = oₜ ⊙ tanh(cₜ)",
    "symbols": "f, i, o = forget, input, output gates",
    "notes": "The additive update lets gradients flow over long spans.",
    "related": [
      "gru_cell",
      "sigmoid"
    ]
  },
  {
    "id": "lstm_full",
    "title": "LSTM gates",
    "field": "deep-learning",
    "latex": "f=\\sigma(W_f[h,x]+b_f),\\ i=\\sigma(W_i[h,x]+b_i),\\ o=\\sigma(W_o[h,x]+b_o),\\ \\tilde c=\\tanh(W_c[h,x]+b_c)",
    "plain": "forget, input and output gates plus a candidate cell",
    "symbols": "",
    "notes": "Then cₜ = f ⊙ cₜ₋₁ + i ⊙ c̃ and hₜ = o ⊙ tanh(cₜ).",
    "related": [
      "lstm_cell"
    ]
  },
  {
    "id": "mup_scaling",
    "title": "maximal-update parametrisation (μP)",
    "field": "deep-learning",
    "latex": "\\eta_{\\text{hidden}}\\propto\\frac1{\\text{width}},\\qquad \\text{output multiplier}\\propto\\frac1{\\text{width}}",
    "plain": "hidden-layer learning rate ∝ 1/width",
    "symbols": "",
    "notes": "Hyper-parameters tuned on a small model transfer to a large one.",
    "related": [
      "he_init"
    ]
  },
  {
    "id": "message_passing",
    "title": "message passing framework",
    "field": "deep-learning",
    "latex": "m_v=\\bigoplus_{u\\in N(v)}\\psi(h_u,h_v,e_{uv}),\\qquad h_v'=\\phi(h_v,m_v)",
    "plain": "aggregate messages from neighbours, then update",
    "symbols": "",
    "notes": "Sum, mean and max are the usual permutation-invariant aggregators.",
    "related": [
      "gcn_propagation"
    ]
  },
  {
    "id": "mish_hardswish",
    "title": "Mish and hard-swish",
    "field": "deep-learning",
    "latex": "\\operatorname{Mish}(x)=x\\tanh\\big(\\ln(1+e^x)\\big),\\qquad \\text{hard-swish}(x)=x\\frac{\\operatorname{ReLU6}(x+3)}6",
    "plain": "Mish = x tanh(softplus x);  h-swish = x·ReLU6(x + 3)/6",
    "symbols": "",
    "notes": "",
    "related": [
      "swish",
      "gelu"
    ]
  },
  {
    "id": "moe_router",
    "title": "mixture-of-experts routing and load balance",
    "field": "deep-learning",
    "latex": "g=\\operatorname{softmax}(W_rx),\\quad y=\\sum_{i\\in\\text{top-}k}g_i\\,E_i(x),\\qquad L_{\\text{bal}}=\\alpha N\\sum_{i=1}^{N}f_iP_i",
    "plain": "top-k gate over experts;  balance loss α N Σ fᵢ Pᵢ",
    "symbols": "f = fraction of tokens routed to expert i, P = mean router probability",
    "notes": "Minimised when routing is uniform.",
    "related": [
      "softmax"
    ]
  },
  {
    "id": "mixup",
    "title": "mixup",
    "field": "deep-learning",
    "latex": "\\tilde x=\\lambda x_i+(1-\\lambda)x_j,\\quad \\tilde y=\\lambda y_i+(1-\\lambda)y_j,\\quad \\lambda\\sim\\mathrm{Beta}(\\alpha,\\alpha)",
    "plain": "x̃ = λxᵢ + (1 − λ)xⱼ;  ỹ likewise",
    "symbols": "",
    "notes": "",
    "related": [
      "label_smoothing"
    ]
  },
  {
    "id": "mfu",
    "title": "model FLOPs utilisation",
    "field": "deep-learning",
    "latex": "\\mathrm{MFU}=\\frac{6ND/\\Delta t}{P_{\\text{peak}}\\cdot n_{\\text{GPU}}}",
    "plain": "MFU = (6·N·tokens/sec) / peak FLOPs",
    "symbols": "",
    "notes": "40–60% is excellent for large-scale training.",
    "related": [
      "transformer_flops"
    ]
  },
  {
    "id": "model_size",
    "title": "model size in memory",
    "field": "deep-learning",
    "latex": "\\text{bytes}=N\\cdot\\frac{\\text{bits}}8,\\qquad \\text{e.g. }7\\text{B parameters at 16 bits}=14\\ \\text{GB}",
    "plain": "bytes = N × bits/8",
    "symbols": "",
    "notes": "Add the KV cache and activations for inference memory.",
    "related": [
      "transformer_memory",
      "quantization"
    ]
  },
  {
    "id": "multi_head",
    "title": "multi-head attention dimensions",
    "field": "deep-learning",
    "latex": "d_k=d_v=\\frac{d_{\\text{model}}}{h},\\quad \\operatorname{MHA}=\\operatorname{Concat}(\\text{head}_1,\\dots,\\text{head}_h)W^{O}",
    "plain": "d_k = d_model / h;  MHA = Concat(head₁…head_h) W^O",
    "symbols": "h = number of heads",
    "notes": "",
    "related": [
      "attention"
    ]
  },
  {
    "id": "ntk",
    "title": "neural tangent kernel",
    "field": "deep-learning",
    "latex": "\\Theta(x,x')=\\nabla_\\theta f(x;\\theta)^{\\top}\\nabla_\\theta f(x';\\theta)",
    "plain": "Θ(x, x′) = ∇_θ f(x)·∇_θ f(x′)",
    "symbols": "",
    "notes": "In the infinite-width limit it stays constant, and training is kernel regression with Θ.",
    "related": [
      "gram_matrix",
      "kernel_ridge"
    ]
  },
  {
    "id": "noise_regularization",
    "title": "noise injection as regularisation",
    "field": "deep-learning",
    "latex": "\\mathbb E\\big[(\\mathbf w^{\\top}(\\mathbf x+\\boldsymbol\\varepsilon)-y)^2\\big]=(\\mathbf w^{\\top}\\mathbf x-y)^2+\\sigma^2\\|\\mathbf w\\|^2",
    "plain": "adding N(0, σ²) input noise ≡ an L2 penalty σ²‖w‖²",
    "symbols": "",
    "notes": "Bishop (1995): Tikhonov regularisation is equivalent to training with noise.",
    "related": [
      "l2_penalty",
      "ridge_regression"
    ]
  },
  {
    "id": "flow_change_of_variables",
    "title": "normalising flow change of variables",
    "field": "deep-learning",
    "latex": "\\log p_X(x)=\\log p_Z\\big(f(x)\\big)+\\log\\Big|\\det\\frac{\\partial f}{\\partial x}\\Big|",
    "plain": "log p(x) = log p(z) + log|det ∂z/∂x|",
    "symbols": "z = f(x)",
    "notes": "Layers are chosen so the Jacobian determinant is cheap (triangular, coupling).",
    "related": [
      "jacobian_change"
    ]
  },
  {
    "id": "flash_attention_rescale",
    "title": "online softmax (FlashAttention rescaling)",
    "field": "deep-learning",
    "latex": "m'=\\max(m,\\tilde m),\\quad \\ell'=e^{m-m'}\\ell+e^{\\tilde m-m'}\\tilde\\ell,\\quad O'=\\frac{e^{m-m'}\\ell\\,O+e^{\\tilde m-m'}\\tilde\\ell\\,\\tilde O}{\\ell'}",
    "plain": "merge two blocks' running max, normaliser and output",
    "symbols": "",
    "notes": "Lets attention be computed block by block without materialising the T×T matrix.",
    "related": [
      "attention",
      "logsumexp_stable"
    ]
  },
  {
    "id": "gan_optimal_discriminator",
    "title": "optimal GAN discriminator",
    "field": "deep-learning",
    "latex": "D^{*}(x)=\\frac{p_{\\text{data}}(x)}{p_{\\text{data}}(x)+p_g(x)}",
    "plain": "D*(x) = p_data(x) / (p_data(x) + p_g(x))",
    "symbols": "",
    "notes": "At the optimum p_g = p_data, D* = ½.",
    "related": [
      "gan_minimax"
    ]
  },
  {
    "id": "pac_bayes",
    "title": "PAC-Bayes bound",
    "field": "deep-learning",
    "latex": "\\mathbb E_{h\\sim Q}R(h)\\le\\mathbb E_{h\\sim Q}\\hat R(h)+\\sqrt{\\frac{D_{\\mathrm{KL}}(Q\\|P)+\\ln\\frac{2\\sqrt n}\\delta}{2n}}",
    "plain": "E_Q R ≤ E_Q R̂ + √((KL(Q‖P) + ln(2√n/δ))/(2n))",
    "symbols": "",
    "notes": "Non-vacuous bounds for neural networks have been obtained this way.",
    "related": [
      "kl_divergence",
      "generalization_finite"
    ]
  },
  {
    "id": "param_count",
    "title": "parameter counts",
    "field": "deep-learning",
    "latex": "\\text{dense: }(n_{in}+1)\\,n_{out}\\qquad \\text{conv: }(k_hk_wc_{in}+1)\\,c_{out}",
    "plain": "dense: (in+1)·out     conv: (kₕk_w·c_in + 1)·c_out",
    "symbols": "",
    "notes": "Bias counted once per output.",
    "related": [
      "linear_layer",
      "conv_output_size"
    ]
  },
  {
    "id": "mlp_params",
    "title": "parameters of a multilayer perceptron",
    "field": "deep-learning",
    "latex": "\\sum_{\\ell}(n_{\\ell-1}+1)\\,n_\\ell,\\qquad \\text{forward FLOPs}\\approx2\\times\\text{parameters}",
    "plain": "Σ (n_{ℓ−1} + 1) n_ℓ",
    "symbols": "",
    "notes": "A 784-128-10 network has 101 770 parameters.",
    "related": [
      "param_count"
    ]
  },
  {
    "id": "scaling_law",
    "title": "parametric scaling law",
    "field": "deep-learning",
    "latex": "L(N,D)=E+\\frac{A}{N^{\\alpha}}+\\frac{B}{D^{\\beta}}",
    "plain": "L(N,D) = E + A/N^α + B/D^β",
    "symbols": "N parameters, D training tokens; E, A, B, α, β fitted constants",
    "notes": "The Chinchilla form; constants depend on the data and architecture.",
    "related": [
      "transformer_flops"
    ]
  },
  {
    "id": "pooling_output",
    "title": "pooling output size",
    "field": "deep-learning",
    "latex": "n_{out}=\\Big\\lfloor\\frac{n-k}{s}\\Big\\rfloor+1,\\qquad \\text{global average pool: }\\frac1{HW}\\sum_{h,w}x_{hw}",
    "plain": "n_out = ⌊(n − k)/s⌋ + 1",
    "symbols": "",
    "notes": "",
    "related": [
      "conv_output_size"
    ]
  },
  {
    "id": "kaplan_scaling",
    "title": "power-law loss scaling",
    "field": "deep-learning",
    "latex": "L(N)=\\Big(\\frac{N_c}{N}\\Big)^{\\alpha_N},\\quad L(D)=\\Big(\\frac{D_c}{D}\\Big)^{\\alpha_D},\\quad L(C)=\\Big(\\frac{C_c}{C}\\Big)^{\\alpha_C}",
    "plain": "loss falls as a power law in parameters, data and compute",
    "symbols": "",
    "notes": "Doubling N multiplies the reducible loss by 2^(−α).",
    "related": [
      "scaling_law"
    ]
  },
  {
    "id": "prelu",
    "title": "PReLU and leaky ReLU gradient",
    "field": "deep-learning",
    "latex": "f(x)=\\max(0,x)+a\\min(0,x),\\qquad \\frac{\\partial f}{\\partial a}=\\min(0,x)",
    "plain": "f = max(0, x) + a·min(0, x);  ∂f/∂a = min(0, x)",
    "symbols": "a learned",
    "notes": "",
    "related": [
      "relu"
    ]
  },
  {
    "id": "rademacher",
    "title": "Rademacher generalisation bound",
    "field": "deep-learning",
    "latex": "R(h)\\le\\hat R(h)+2\\mathfrak R_n(\\mathcal H)+\\sqrt{\\frac{\\ln(1/\\delta)}{2n}}",
    "plain": "R ≤ R̂ + 2ℜₙ(H) + √(ln(1/δ)/(2n))",
    "symbols": "ℜₙ = Rademacher complexity",
    "notes": "Data-dependent; for linear classes ℜ ≤ BR/√n.",
    "related": [
      "vc_bound"
    ]
  },
  {
    "id": "receptive_field",
    "title": "receptive field recurrence",
    "field": "deep-learning",
    "latex": "r_l=r_{l-1}+(k_l-1)\\prod_{i<l}s_i",
    "plain": "r_l = r_{l−1} + (k_l − 1)·Π_{i<l} sᵢ",
    "symbols": "",
    "notes": "",
    "related": [
      "dilated_conv",
      "conv_output_size"
    ]
  },
  {
    "id": "reparameterization",
    "title": "reparameterisation trick",
    "field": "deep-learning",
    "latex": "z=\\mu+\\sigma\\odot\\varepsilon,\\quad \\varepsilon\\sim\\mathcal N(0,I)",
    "plain": "z = μ + σ ⊙ ε,  ε ~ N(0, I)",
    "symbols": "",
    "notes": "Moves the randomness out of the graph so gradients flow through μ and σ.",
    "related": [
      "vae_elbo"
    ]
  },
  {
    "id": "repetition_penalty",
    "title": "repetition penalty",
    "field": "deep-learning",
    "latex": "z_i\\leftarrow\\begin{cases}z_i/\\theta&z_i>0\\\\ z_i\\theta&z_i<0\\end{cases}\\quad(\\text{for tokens already generated})",
    "plain": "divide positive logits (multiply negative ones) by θ > 1",
    "symbols": "",
    "notes": "",
    "related": [
      "sampling_top_p"
    ]
  },
  {
    "id": "residual_init_scale",
    "title": "residual-branch scaling",
    "field": "deep-learning",
    "latex": "\\text{scale the last layer of each residual branch by }\\frac1{\\sqrt{2L}}",
    "plain": "scale residual outputs by 1/√(2L)",
    "symbols": "L = number of residual blocks",
    "notes": "Keeps the variance of the residual stream from growing with depth (GPT-2).",
    "related": [
      "he_init"
    ]
  },
  {
    "id": "rlhf_kl",
    "title": "RLHF reward with KL penalty",
    "field": "deep-learning",
    "latex": "R(x,y)=r_\\phi(x,y)-\\beta\\,\\ln\\frac{\\pi_\\theta(y\\mid x)}{\\pi_{\\text{ref}}(y\\mid x)}",
    "plain": "R = r(x, y) − β log(π/π_ref)",
    "symbols": "",
    "notes": "Keeps the policy close to the reference model.",
    "related": [
      "dpo",
      "ppo_clip"
    ]
  },
  {
    "id": "rmsnorm",
    "title": "RMSNorm",
    "field": "deep-learning",
    "latex": "y_i=\\frac{x_i}{\\sqrt{\\tfrac1d\\sum_j x_j^2+\\epsilon}}\\,g_i",
    "plain": "yᵢ = xᵢ / √(mean(x²) + ε) · gᵢ",
    "symbols": "g = learned gain",
    "notes": "LayerNorm without the mean subtraction; used in modern LLMs.",
    "related": [
      "layernorm"
    ]
  },
  {
    "id": "rope",
    "title": "rotary position embedding (RoPE)",
    "field": "deep-learning",
    "latex": "\\begin{pmatrix}x_{2i}'\\\\ x_{2i+1}'\\end{pmatrix}=\\begin{pmatrix}\\cos m\\theta_i&-\\sin m\\theta_i\\\\ \\sin m\\theta_i&\\cos m\\theta_i\\end{pmatrix}\\begin{pmatrix}x_{2i}\\\\ x_{2i+1}\\end{pmatrix},\\quad \\theta_i=10000^{-2i/d}",
    "plain": "rotate each coordinate pair by m·θᵢ",
    "symbols": "m = position",
    "notes": "Relative position enters the attention score through the rotation difference.",
    "related": [
      "positional_encoding",
      "rotation_2d"
    ]
  },
  {
    "id": "attention",
    "title": "scaled dot-product attention",
    "field": "deep-learning",
    "latex": "\\operatorname{Attn}(Q,K,V)=\\operatorname{softmax}\\!\\left(\\frac{QK^{\\top}}{\\sqrt{d_k}}\\right)V",
    "plain": "Attn(Q,K,V) = softmax( QKᵀ/√d_k ) V",
    "symbols": "d_k = key dimension",
    "notes": "The 1/√d_k keeps dot products from saturating the softmax.",
    "related": [
      "multi_head",
      "positional_encoding",
      "softmax"
    ]
  },
  {
    "id": "attention_flops",
    "title": "self-attention cost",
    "field": "deep-learning",
    "latex": "\\text{FLOPs}\\approx4T^2d\\ \\ (QK^{\\top}\\text{ and }AV),\\qquad \\text{memory}=O(T^2)",
    "plain": "FLOPs ≈ 4T²d per layer;  attention matrix memory O(T²)",
    "symbols": "T = sequence length, d = model width",
    "notes": "FlashAttention keeps the maths but tiles it so memory is O(T).",
    "related": [
      "flash_attention_rescale"
    ]
  },
  {
    "id": "positional_encoding",
    "title": "sinusoidal positional encoding",
    "field": "deep-learning",
    "latex": "PE_{(pos,2i)}=\\sin\\!\\frac{pos}{10000^{2i/d}},\\quad PE_{(pos,2i+1)}=\\cos\\!\\frac{pos}{10000^{2i/d}}",
    "plain": "PE(pos,2i) = sin(pos/10000^(2i/d));  PE(pos,2i+1) = cos(…)",
    "symbols": "",
    "notes": "",
    "related": [
      "attention"
    ]
  },
  {
    "id": "softmax_jacobian",
    "title": "softmax Jacobian",
    "field": "deep-learning",
    "latex": "\\frac{\\partial p_i}{\\partial z_j}=p_i(\\delta_{ij}-p_j),\\qquad J=\\operatorname{diag}(p)-pp^{\\top}",
    "plain": "J = diag(p) − ppᵀ",
    "symbols": "",
    "notes": "Symmetric, rank n − 1, rows sum to zero.",
    "related": [
      "softmax_ce_gradient"
    ]
  },
  {
    "id": "speculative_decoding",
    "title": "speculative decoding acceptance",
    "field": "deep-learning",
    "latex": "P(\\text{accept token }x)=\\min\\Big(1,\\frac{p(x)}{q(x)}\\Big),\\qquad \\text{on rejection resample from }\\operatorname{norm}\\big((p-q)_+\\big)",
    "plain": "accept with probability min(1, p/q)",
    "symbols": "q = draft model, p = target model",
    "notes": "Output distribution is exactly the target's; speed-up comes from verifying several drafted tokens in one pass.",
    "related": [
      "importance_sampling"
    ]
  },
  {
    "id": "stochastic_depth",
    "title": "stochastic depth survival probabilities",
    "field": "deep-learning",
    "latex": "p_\\ell=1-\\frac\\ell L(1-p_L)",
    "plain": "p_ℓ = 1 − (ℓ/L)(1 − p_L)",
    "symbols": "layer ℓ survives with probability p_ℓ",
    "notes": "",
    "related": [
      "dropout"
    ]
  },
  {
    "id": "swiglu",
    "title": "SwiGLU feed-forward block",
    "field": "deep-learning",
    "latex": "\\operatorname{FFN}(x)=\\big(\\operatorname{SiLU}(xW_1)\\odot xW_3\\big)W_2,\\qquad \\text{params}=3\\,d\\,d_{ff}",
    "plain": "FFN(x) = (SiLU(xW₁) ⊙ xW₃)W₂",
    "symbols": "",
    "notes": "Gated FFN used in LLaMA-style models; d_ff ≈ (8/3)d keeps parameters equal to a 4d ReLU FFN.",
    "related": [
      "glu",
      "swish"
    ]
  },
  {
    "id": "softmax_temperature_entropy",
    "title": "temperature and entropy of softmax",
    "field": "deep-learning",
    "latex": "T\\to0:\\ \\text{one-hot};\\qquad T\\to\\infty:\\ \\text{uniform};\\qquad H(T)\\ \\text{increasing in }T",
    "plain": "entropy of softmax(z/T) grows with T",
    "symbols": "",
    "notes": "",
    "related": [
      "temperature_softmax",
      "entropy"
    ]
  },
  {
    "id": "sampling_top_p",
    "title": "top-k, top-p and temperature sampling",
    "field": "deep-learning",
    "latex": "p_i\\propto e^{z_i/T};\\quad \\text{top-}k\\text{: keep the }k\\text{ largest};\\quad \\text{top-}p\\text{: smallest set with }\\sum p\\ge p_0",
    "plain": "temperature, top-k and nucleus (top-p) truncation before renormalising",
    "symbols": "",
    "notes": "T → 0 is greedy decoding.",
    "related": [
      "temperature_softmax",
      "beam_search_score"
    ]
  },
  {
    "id": "transformer_flops",
    "title": "training compute estimate",
    "field": "deep-learning",
    "latex": "C\\approx 6\\,N\\,D",
    "plain": "C ≈ 6 N D",
    "symbols": "N = parameters, D = training tokens; FLOPs",
    "notes": "About 2ND forward + 4ND backward.",
    "related": [
      "scaling_law"
    ]
  },
  {
    "id": "transformer_memory",
    "title": "training memory per parameter (mixed-precision Adam)",
    "field": "deep-learning",
    "latex": "\\underbrace{2}_{\\text{bf16 weights}}+\\underbrace{2}_{\\text{grads}}+\\underbrace{4}_{\\text{fp32 master}}+\\underbrace{4+4}_{\\text{Adam }m,v}=16\\ \\text{bytes/parameter}",
    "plain": "≈ 16 bytes per parameter, before activations",
    "symbols": "",
    "notes": "ZeRO shards these across devices.",
    "related": [
      "transformer_params"
    ]
  },
  {
    "id": "transformer_params",
    "title": "transformer parameter count",
    "field": "deep-learning",
    "latex": "N\\approx12\\,L\\,d^2+V\\,d,\\qquad \\text{(attention }4d^2+\\text{FFN }8d^2\\text{ per layer)}",
    "plain": "N ≈ 12·L·d² + V·d",
    "symbols": "L layers, width d, vocabulary V",
    "notes": "A quick estimate; GPT-3 (L = 96, d = 12288) gives about 175B.",
    "related": [
      "scaling_law",
      "transformer_flops"
    ]
  },
  {
    "id": "transposed_conv_size",
    "title": "transposed convolution output size",
    "field": "deep-learning",
    "latex": "n_{out}=(n-1)s-2p+k+p_{out}",
    "plain": "n_out = (n − 1)s − 2p + k + output_padding",
    "symbols": "",
    "notes": "The inverse of the convolution size formula; used in decoders and GANs.",
    "related": [
      "conv_output_size"
    ]
  },
  {
    "id": "vae_kl",
    "title": "VAE KL term (diagonal Gaussian)",
    "field": "deep-learning",
    "latex": "D_{\\mathrm{KL}}=-\\tfrac12\\sum_j\\big(1+\\log\\sigma_j^2-\\mu_j^2-\\sigma_j^2\\big)",
    "plain": "KL = −½ Σⱼ (1 + log σⱼ² − μⱼ² − σⱼ²)",
    "symbols": "q = N(μ, σ²), prior N(0, 1)",
    "notes": "",
    "related": [
      "kl_gaussians",
      "vae_elbo"
    ]
  },
  {
    "id": "rnn_cell",
    "title": "vanilla RNN cell",
    "field": "deep-learning",
    "latex": "h_t=\\tanh(W_hh_{t-1}+W_xx_t+b)",
    "plain": "hₜ = tanh(W_h hₜ₋₁ + W_x xₜ + b)",
    "symbols": "",
    "notes": "",
    "related": [
      "lstm_cell",
      "gru_cell"
    ]
  },
  {
    "id": "bptt_vanishing",
    "title": "vanishing and exploding gradients (BPTT)",
    "field": "deep-learning",
    "latex": "\\Big\\|\\frac{\\partial h_T}{\\partial h_t}\\Big\\|\\le\\big(\\|W\\|\\,\\gamma\\big)^{T-t}",
    "plain": "‖∂h_T/∂h_t‖ ≤ (‖W‖γ)^(T − t)",
    "symbols": "γ = bound on the activation derivative",
    "notes": "Below 1 the gradient vanishes, above 1 it explodes: the motivation for LSTMs, gradient clipping and orthogonal initialisation.",
    "related": [
      "lstm_cell",
      "gradient_clipping"
    ]
  },
  {
    "id": "vc_bound",
    "title": "VC generalisation bound",
    "field": "deep-learning",
    "latex": "R(h)\\le\\hat R(h)+\\sqrt{\\frac{d\\big(\\ln\\frac{2n}d+1\\big)+\\ln\\frac4\\delta}{n}}",
    "plain": "R ≤ R̂ + √((d(ln(2n/d) + 1) + ln(4/δ))/n)",
    "symbols": "d = VC dimension",
    "notes": "",
    "related": [
      "generalization_finite",
      "rademacher"
    ]
  },
  {
    "id": "vq_vae",
    "title": "VQ-VAE loss",
    "field": "deep-learning",
    "latex": "\\mathcal L=\\|x-\\hat x\\|^2+\\|\\operatorname{sg}[z_e]-e\\|^2+\\beta\\|z_e-\\operatorname{sg}[e]\\|^2",
    "plain": "reconstruction + codebook loss + commitment loss",
    "symbols": "sg = stop-gradient",
    "notes": "",
    "related": [
      "vae_elbo"
    ]
  },
  {
    "id": "wgan",
    "title": "Wasserstein GAN loss and gradient penalty",
    "field": "deep-learning",
    "latex": "L_D=\\mathbb E[D(\\tilde x)]-\\mathbb E[D(x)]+\\lambda\\,\\mathbb E\\big[(\\|\\nabla_{\\hat x}D(\\hat x)\\|_2-1)^2\\big]",
    "plain": "critic loss + λ(‖∇D(x̂)‖ − 1)²",
    "symbols": "",
    "notes": "The critic estimates the Wasserstein-1 distance; the penalty enforces 1-Lipschitzness.",
    "related": [
      "wasserstein_1d",
      "gan_minimax"
    ]
  },
  {
    "id": "weight_norm",
    "title": "weight and spectral normalisation",
    "field": "deep-learning",
    "latex": "\\mathbf w=g\\frac{\\mathbf v}{\\|\\mathbf v\\|},\\qquad \\bar W=\\frac{W}{\\sigma(W)}",
    "plain": "w = g v/‖v‖;  W̄ = W/σ_max(W)",
    "symbols": "",
    "notes": "Spectral norm makes a layer 1-Lipschitz, which stabilises GAN discriminators.",
    "related": [
      "spectral_norm",
      "lipschitz"
    ]
  },
  {
    "id": "xavier_init",
    "title": "Xavier (Glorot) initialisation",
    "field": "deep-learning",
    "latex": "w\\sim\\mathcal N\\!\\left(0,\\tfrac{2}{n_{in}+n_{out}}\\right)",
    "plain": "std = √(2 / (fan_in + fan_out))",
    "symbols": "",
    "notes": "For tanh/sigmoid networks.",
    "related": [
      "he_init"
    ]
  },
  {
    "id": "beta_vae",
    "title": "β-VAE objective",
    "field": "deep-learning",
    "latex": "\\mathcal L=\\mathbb E_q[\\log p(x\\mid z)]-\\beta\\,D_{\\mathrm{KL}}\\big(q(z\\mid x)\\,\\|\\,p(z)\\big)",
    "plain": "L = E[log p(x|z)] − β·KL",
    "symbols": "β > 1 encourages disentanglement",
    "notes": "",
    "related": [
      "vae_elbo"
    ]
  },
  {
    "id": "actor_critic",
    "title": "actor–critic",
    "field": "reinforcement",
    "latex": "\\delta=r+\\gamma V(s')-V(s),\\qquad \\theta\\leftarrow\\theta+\\alpha_\\pi\\,\\delta\\,\\nabla\\ln\\pi_\\theta(a\\mid s),\\qquad w\\leftarrow w+\\alpha_V\\,\\delta\\,\\nabla V_w(s)",
    "plain": "the TD error trains the critic and weights the actor's gradient",
    "symbols": "",
    "notes": "",
    "related": [
      "td_error",
      "reinforce_baseline"
    ]
  },
  {
    "id": "advantage_function",
    "title": "advantage function",
    "field": "reinforcement",
    "latex": "A^\\pi(s,a)=Q^\\pi(s,a)-V^\\pi(s),\\qquad \\mathbb E_{a\\sim\\pi}A^\\pi(s,a)=0",
    "plain": "A = Q − V;  E_π[A] = 0",
    "symbols": "",
    "notes": "",
    "related": [
      "gae"
    ]
  },
  {
    "id": "bellman_expectation",
    "title": "Bellman expectation equation",
    "field": "reinforcement",
    "latex": "V^{\\pi}(s)=\\sum_a\\pi(a\\mid s)\\sum_{s'}P(s'\\mid s,a)\\big[r+\\gamma V^{\\pi}(s')\\big]",
    "plain": "V^π(s) = Σₐ π(a|s) Σₛ′ P(s′|s,a) [ r + γV^π(s′) ]",
    "symbols": "",
    "notes": "",
    "related": [
      "bellman_optimality",
      "td_error"
    ]
  },
  {
    "id": "bellman_optimality",
    "title": "Bellman optimality equation",
    "field": "reinforcement",
    "latex": "Q^{*}(s,a)=r+\\gamma\\sum_{s'}P(s'\\mid s,a)\\max_{a'}Q^{*}(s',a')",
    "plain": "Q*(s,a) = r + γ Σ P(s′|s,a) max_a′ Q*(s′,a′)",
    "symbols": "",
    "notes": "",
    "related": [
      "q_learning"
    ]
  },
  {
    "id": "ddpg_target",
    "title": "DDPG target and Polyak averaging",
    "field": "reinforcement",
    "latex": "y=r+\\gamma Q_{\\phi'}\\big(s',\\mu_{\\theta'}(s')\\big),\\qquad \\phi'\\leftarrow\\tau\\phi+(1-\\tau)\\phi'",
    "plain": "y = r + γQ′(s′, μ′(s′));  target ← τ·online + (1 − τ)·target",
    "symbols": "τ ≈ 0.005",
    "notes": "",
    "related": [
      "ema",
      "td3_target"
    ]
  },
  {
    "id": "discounted_return",
    "title": "discounted return",
    "field": "reinforcement",
    "latex": "G_t=\\sum_{k=0}^{\\infty}\\gamma^{k}r_{t+k}",
    "plain": "Gₜ = Σₖ γᵏ rₜ₊ₖ",
    "symbols": "γ ∈ [0,1) = discount factor",
    "notes": "",
    "related": [
      "bellman_expectation"
    ]
  },
  {
    "id": "c51_projection",
    "title": "distributional RL projection (C51)",
    "field": "reinforcement",
    "latex": "b=\\frac{\\mathcal T z_j-V_{\\min}}{\\Delta z},\\quad \\mathcal Tz_j=r+\\gamma z_j\\ (\\text{clipped}),\\quad \\text{split mass between atoms }\\lfloor b\\rfloor,\\lceil b\\rceil",
    "plain": "b = (r + γz − V_min)/Δz;  split mass between the neighbouring atoms",
    "symbols": "",
    "notes": "",
    "related": [
      "dqn_loss"
    ]
  },
  {
    "id": "double_q_learning",
    "title": "double Q-learning",
    "field": "reinforcement",
    "latex": "Q_A(s,a)\\leftarrow Q_A+\\alpha\\big[r+\\gamma Q_B\\big(s',\\arg\\max_{a'}Q_A(s',a')\\big)-Q_A\\big]",
    "plain": "choose the action with one table, evaluate it with the other",
    "symbols": "",
    "notes": "Removes the maximisation bias of Q-learning.",
    "related": [
      "q_learning"
    ]
  },
  {
    "id": "dqn_loss",
    "title": "DQN loss",
    "field": "reinforcement",
    "latex": "L=\\mathbb E\\Big[\\Big(r+\\gamma\\max_{a'}Q_{\\theta^-}(s',a')-Q_\\theta(s,a)\\Big)^2\\Big]",
    "plain": "L = (r + γ max Q_target(s′, a′) − Q(s, a))²",
    "symbols": "θ⁻ = periodically updated target network",
    "notes": "",
    "related": [
      "q_learning",
      "td_error"
    ]
  },
  {
    "id": "effective_horizon",
    "title": "effective horizon",
    "field": "reinforcement",
    "latex": "H_{\\text{eff}}=\\frac1{1-\\gamma}",
    "plain": "H_eff = 1/(1 − γ)",
    "symbols": "",
    "notes": "γ = 0.99 looks about 100 steps ahead.",
    "related": [
      "discounted_return"
    ]
  },
  {
    "id": "gae",
    "title": "generalised advantage estimation",
    "field": "reinforcement",
    "latex": "\\hat A_t=\\sum_{l=0}^{\\infty}(\\gamma\\lambda)^{l}\\,\\delta_{t+l}",
    "plain": "Âₜ = Σₗ (γλ)ˡ δₜ₊ₗ",
    "symbols": "λ trades bias against variance",
    "notes": "",
    "related": [
      "td_error",
      "ppo_clip"
    ]
  },
  {
    "id": "gradient_bandit",
    "title": "gradient bandit update",
    "field": "reinforcement",
    "latex": "H_a\\leftarrow H_a+\\alpha(R-\\bar R)(1-\\pi_a),\\quad H_b\\leftarrow H_b-\\alpha(R-\\bar R)\\pi_b\\ (b\\ne a)",
    "plain": "preferences follow the policy-gradient rule",
    "symbols": "",
    "notes": "",
    "related": [
      "policy_gradient"
    ]
  },
  {
    "id": "lai_robbins",
    "title": "Lai–Robbins lower bound",
    "field": "reinforcement",
    "latex": "\\liminf_{T\\to\\infty}\\frac{\\mathbb E[\\mathrm{Regret}_T]}{\\ln T}\\ge\\sum_{i:\\mu_i<\\mu^*}\\frac{\\mu^*-\\mu_i}{D_{\\mathrm{KL}}(\\mu_i\\|\\mu^*)}",
    "plain": "no consistent algorithm beats this logarithmic regret",
    "symbols": "",
    "notes": "",
    "related": [
      "ucb1"
    ]
  },
  {
    "id": "maxent_irl",
    "title": "maximum-entropy inverse RL",
    "field": "reinforcement",
    "latex": "P(\\tau\\mid\\theta)=\\frac{\\exp\\big(\\boldsymbol\\theta^{\\top}\\mathbf f(\\tau)\\big)}{Z(\\theta)},\\qquad \\nabla_\\theta\\mathcal L=\\tilde{\\mathbf f}-\\mathbb E_\\theta[\\mathbf f]",
    "plain": "trajectory probability ∝ exp(reward); gradient = expert features − expected features",
    "symbols": "",
    "notes": "",
    "related": [
      "entropy_regularized_policy"
    ]
  },
  {
    "id": "nash_mixed_2x2",
    "title": "mixed Nash equilibrium (2×2 zero-sum)",
    "field": "reinforcement",
    "latex": "p^*=\\frac{d-c}{a-b-c+d},\\qquad v=\\frac{ad-bc}{a-b-c+d}\\quad\\text{for payoffs }\\begin{pmatrix}a&b\\\\c&d\\end{pmatrix}",
    "plain": "p* = (d − c)/(a − b − c + d);  value = (ad − bc)/(a − b − c + d)",
    "symbols": "",
    "notes": "Matching pennies: p* = ½, value 0.",
    "related": [
      "shapley_value"
    ]
  },
  {
    "id": "n_step_return",
    "title": "n-step return",
    "field": "reinforcement",
    "latex": "G_t^{(n)}=\\sum_{k=0}^{n-1}\\gamma^kr_{t+k+1}+\\gamma^nV(s_{t+n})",
    "plain": "Gₜ⁽ⁿ⁾ = Σ γᵏ rₜ₊ₖ₊₁ + γⁿ V(sₜ₊ₙ)",
    "symbols": "",
    "notes": "n = 1 is TD(0), n = ∞ is Monte Carlo.",
    "related": [
      "td_lambda",
      "td_error"
    ]
  },
  {
    "id": "importance_ratio_offpolicy",
    "title": "off-policy correction (importance ratios)",
    "field": "reinforcement",
    "latex": "\\rho_t=\\frac{\\pi(a_t|s_t)}{b(a_t|s_t)},\\qquad \\text{Retrace: }c_s=\\lambda\\min\\big(1,\\tfrac{\\pi}{\\mu}\\big)",
    "plain": "ρ = π/b; Retrace truncates the ratio at 1",
    "symbols": "",
    "notes": "",
    "related": [
      "importance_sampling"
    ]
  },
  {
    "id": "entropy_regularized_policy",
    "title": "optimal entropy-regularised policy",
    "field": "reinforcement",
    "latex": "\\pi^*(a\\mid s)\\propto\\pi_{\\text{ref}}(a\\mid s)\\,\\exp\\big(Q^*(s,a)/\\beta\\big)",
    "plain": "π* ∝ π_ref exp(Q*/β)",
    "symbols": "",
    "notes": "The softmax policy; also the closed-form solution of KL-regularised RL (RLHF).",
    "related": [
      "sac_soft_value",
      "rlhf_kl"
    ]
  },
  {
    "id": "bellman_linear",
    "title": "policy evaluation as a linear system",
    "field": "reinforcement",
    "latex": "V^{\\pi}=(I-\\gamma P_\\pi)^{-1}\\mathbf r_\\pi",
    "plain": "V^π = (I − γP_π)⁻¹ r_π",
    "symbols": "",
    "notes": "Exact for small MDPs; iterative methods scale to large ones.",
    "related": [
      "bellman_expectation",
      "value_iteration"
    ]
  },
  {
    "id": "policy_gradient",
    "title": "policy gradient (softmax policy)",
    "field": "reinforcement",
    "latex": "\\nabla_\\theta J=\\mathbb{E}\\big[\\nabla_\\theta\\log\\pi_\\theta(a\\mid s)\\,\\hat A\\big];\\quad \\nabla_z\\log\\pi(a)=\\mathbf e_a-\\pi",
    "plain": "∇J = E[ ∇ log π(a|s) · Â ];  ∇_z log π(a) = eₐ − π",
    "symbols": "",
    "notes": "REINFORCE. For a softmax policy the gradient on the logits is the one-hot action minus the policy.",
    "related": [
      "ppo_clip",
      "gae"
    ]
  },
  {
    "id": "policy_iteration",
    "title": "policy improvement",
    "field": "reinforcement",
    "latex": "\\pi'(s)=\\arg\\max_aQ^{\\pi}(s,a)\\ \\Rightarrow\\ V^{\\pi'}\\ge V^{\\pi}",
    "plain": "act greedily with respect to Q^π",
    "symbols": "",
    "notes": "Alternating evaluation and improvement converges to the optimal policy.",
    "related": [
      "value_iteration"
    ]
  },
  {
    "id": "reward_shaping",
    "title": "potential-based reward shaping",
    "field": "reinforcement",
    "latex": "F(s,s')=\\gamma\\Phi(s')-\\Phi(s)",
    "plain": "F = γΦ(s′) − Φ(s)",
    "symbols": "",
    "notes": "Ng, Harada and Russell (1999): adding F leaves the optimal policy unchanged.",
    "related": [
      "bellman_optimality"
    ]
  },
  {
    "id": "ppo_clip",
    "title": "PPO clipped objective",
    "field": "reinforcement",
    "latex": "L^{\\text{CLIP}}=\\mathbb{E}\\big[\\min\\big(r_t\\hat A_t,\\ \\operatorname{clip}(r_t,1-\\epsilon,1+\\epsilon)\\hat A_t\\big)\\big],\\ r_t=\\frac{\\pi_\\theta(a|s)}{\\pi_{\\text{old}}(a|s)}",
    "plain": "L = E[ min( r·Â, clip(r, 1−ε, 1+ε)·Â ) ]",
    "symbols": "r = probability ratio, ε ≈ 0.2",
    "notes": "Stops the policy moving too far in one update.",
    "related": [
      "policy_gradient",
      "gae"
    ]
  },
  {
    "id": "q_learning",
    "title": "Q-learning update",
    "field": "reinforcement",
    "latex": "Q(s,a)\\leftarrow Q(s,a)+\\alpha\\big[r+\\gamma\\max_{a'}Q(s',a')-Q(s,a)\\big]",
    "plain": "Q(s,a) ← Q + α [ r + γ max Q(s′,·) − Q ]",
    "symbols": "α = learning rate",
    "notes": "Off-policy temporal-difference control.",
    "related": [
      "td_error",
      "bellman_optimality"
    ]
  },
  {
    "id": "reinforce_baseline",
    "title": "REINFORCE with a baseline",
    "field": "reinforcement",
    "latex": "\\nabla_\\theta J=\\mathbb E\\big[\\nabla_\\theta\\ln\\pi_\\theta(a\\mid s)\\,(G-b(s))\\big]",
    "plain": "∇J = E[∇ln π · (G − b)]",
    "symbols": "",
    "notes": "Any baseline that does not depend on the action leaves the gradient unbiased and can cut the variance.",
    "related": [
      "policy_gradient",
      "actor_critic"
    ]
  },
  {
    "id": "sarsa",
    "title": "SARSA update",
    "field": "reinforcement",
    "latex": "Q(s,a)\\leftarrow Q(s,a)+\\alpha\\big[r+\\gamma Q(s',a')-Q(s,a)\\big]",
    "plain": "Q ← Q + α(r + γQ(s′, a′) − Q)",
    "symbols": "a′ = the action actually taken next",
    "notes": "On-policy; Q-learning replaces Q(s′, a′) by max.",
    "related": [
      "q_learning"
    ]
  },
  {
    "id": "sac_soft_value",
    "title": "soft actor–critic",
    "field": "reinforcement",
    "latex": "J=\\mathbb E\\sum_t\\big[r_t+\\alpha\\,\\mathcal H(\\pi(\\cdot|s_t))\\big],\\qquad V(s)=\\alpha\\ln\\sum_a\\exp\\big(Q(s,a)/\\alpha\\big)",
    "plain": "maximum-entropy objective;  soft value = α log Σ exp(Q/α)",
    "symbols": "",
    "notes": "As α → 0 the soft value tends to max Q.",
    "related": [
      "logsumexp",
      "entropy_regularized_policy"
    ]
  },
  {
    "id": "successor_representation",
    "title": "successor representation",
    "field": "reinforcement",
    "latex": "M=(I-\\gamma T)^{-1},\\qquad V=M\\mathbf r",
    "plain": "M = (I − γT)⁻¹;  V = M r",
    "symbols": "T = state-transition matrix under the policy",
    "notes": "Separates the environment's dynamics from the reward.",
    "related": [
      "bellman_linear"
    ]
  },
  {
    "id": "td3_target",
    "title": "TD3 clipped double-Q target",
    "field": "reinforcement",
    "latex": "y=r+\\gamma\\min\\big(Q_1',Q_2'\\big)\\big(s',\\mu'(s')+\\operatorname{clip}(\\varepsilon,-c,c)\\big)",
    "plain": "y = r + γ min(Q₁′, Q₂′)(s′, μ′(s′) + clipped noise)",
    "symbols": "",
    "notes": "The minimum of two critics counters overestimation.",
    "related": [
      "ddpg_target",
      "double_q_learning"
    ]
  },
  {
    "id": "td_error",
    "title": "temporal-difference error",
    "field": "reinforcement",
    "latex": "\\delta_t=r_t+\\gamma V(s_{t+1})-V(s_t)",
    "plain": "δₜ = rₜ + γV(sₜ₊₁) − V(sₜ)",
    "symbols": "",
    "notes": "",
    "related": [
      "q_learning",
      "gae"
    ]
  },
  {
    "id": "thompson_sampling",
    "title": "Thompson sampling (Bernoulli)",
    "field": "reinforcement",
    "latex": "\\theta_i\\sim\\mathrm{Beta}(\\alpha_i+s_i,\\ \\beta_i+f_i),\\quad a_t=\\arg\\max_i\\theta_i",
    "plain": "sample each arm's success rate from its posterior; play the best sample",
    "symbols": "",
    "notes": "Matches the Lai–Robbins lower bound in practice.",
    "related": [
      "ucb1",
      "beta_binomial_update"
    ]
  },
  {
    "id": "trpo_surrogate",
    "title": "TRPO surrogate and trust region",
    "field": "reinforcement",
    "latex": "\\max_\\theta\\ \\mathbb E\\Big[\\frac{\\pi_\\theta(a|s)}{\\pi_{\\text{old}}(a|s)}\\hat A\\Big]\\quad\\text{s.t.}\\quad\\mathbb E\\big[D_{\\mathrm{KL}}(\\pi_{\\text{old}}\\|\\pi_\\theta)\\big]\\le\\delta",
    "plain": "maximise the importance-weighted advantage within a KL ball",
    "symbols": "",
    "notes": "PPO replaces the constraint with clipping.",
    "related": [
      "ppo_clip",
      "kl_divergence"
    ]
  },
  {
    "id": "ucb1",
    "title": "UCB1",
    "field": "reinforcement",
    "latex": "a_t=\\arg\\max_i\\Big(\\bar x_i+c\\sqrt{\\frac{\\ln t}{n_i}}\\Big)",
    "plain": "choose argmax x̄ᵢ + c√(ln t/nᵢ)",
    "symbols": "c = √2 in the classic analysis",
    "notes": "Optimism in the face of uncertainty: regret O(√(KT ln T)).",
    "related": [
      "thompson_sampling",
      "regret_bound"
    ]
  },
  {
    "id": "uct",
    "title": "UCT and PUCT (MCTS)",
    "field": "reinforcement",
    "latex": "\\mathrm{UCT}=\\bar Q+c\\sqrt{\\frac{\\ln N}{n}},\\qquad \\mathrm{PUCT}=\\bar Q+c\\,P(a)\\frac{\\sqrt N}{1+n}",
    "plain": "select argmax Q̄ + exploration bonus",
    "symbols": "N = parent visits, n = child visits, P = prior",
    "notes": "PUCT (AlphaZero) uses a policy-network prior.",
    "related": [
      "ucb1"
    ]
  },
  {
    "id": "value_iteration",
    "title": "value iteration",
    "field": "reinforcement",
    "latex": "V_{k+1}(s)=\\max_a\\sum_{s'}P(s'\\mid s,a)\\big[r(s,a,s')+\\gamma V_k(s')\\big]",
    "plain": "V ← max_a Σ P (r + γV)",
    "symbols": "",
    "notes": "A γ-contraction: error shrinks by γ per sweep.",
    "related": [
      "bellman_optimality",
      "policy_iteration"
    ]
  },
  {
    "id": "td_lambda",
    "title": "λ-return and eligibility traces",
    "field": "reinforcement",
    "latex": "G_t^\\lambda=(1-\\lambda)\\sum_{n=1}^{\\infty}\\lambda^{n-1}G_t^{(n)},\\qquad e\\leftarrow\\gamma\\lambda e+\\nabla V,\\ \\ \\theta\\leftarrow\\theta+\\alpha\\,\\delta\\,e",
    "plain": "G^λ = (1 − λ) Σ λⁿ⁻¹ G⁽ⁿ⁾;  trace e ← γλe + ∇V",
    "symbols": "",
    "notes": "Interpolates between TD(0) (λ = 0) and Monte Carlo (λ = 1).",
    "related": [
      "n_step_return",
      "gae"
    ]
  },
  {
    "id": "am_gm",
    "title": "AM–GM inequality",
    "field": "math",
    "latex": "\\frac{a+b}{2}\\ \\ge\\ \\sqrt{ab}\\quad(a,b\\ge0)",
    "plain": "(a + b)/2 ≥ √(ab)",
    "symbols": "",
    "notes": "Equality iff a = b.",
    "related": [
      "jensen_inequality"
    ]
  },
  {
    "id": "binomial_theorem",
    "title": "binomial theorem",
    "field": "math",
    "latex": "(x+y)^n=\\sum_{k=0}^{n}\\binom nk x^{n-k}y^{k}",
    "plain": "(x + y)ⁿ = Σₖ C(n,k) xⁿ⁻ᵏ yᵏ",
    "symbols": "",
    "notes": "",
    "related": [
      "binomial",
      "combinations"
    ]
  },
  {
    "id": "change_of_base",
    "title": "change of base for logarithms",
    "field": "math",
    "latex": "\\log_b x=\\frac{\\ln x}{\\ln b}",
    "plain": "log_b x = ln x / ln b",
    "symbols": "",
    "notes": "Bits vs nats: log₂ x = ln x / ln 2.",
    "related": [
      "entropy"
    ]
  },
  {
    "id": "combinations",
    "title": "combinations and permutations",
    "field": "math",
    "latex": "\\binom nk=\\frac{n!}{k!\\,(n-k)!},\\qquad P(n,k)=\\frac{n!}{(n-k)!}",
    "plain": "C(n,k) = n! / (k!(n−k)!);  P(n,k) = n! / (n−k)!",
    "symbols": "",
    "notes": "",
    "related": [
      "binomial_theorem",
      "binomial"
    ]
  },
  {
    "id": "convolution",
    "title": "discrete convolution",
    "field": "math",
    "latex": "(f*g)[n]=\\sum_m f[m]\\,g[n-m]",
    "plain": "(f ∗ g)[n] = Σₘ f[m] g[n−m]",
    "symbols": "",
    "notes": "Convolution in time is multiplication in frequency.",
    "related": [
      "dft",
      "conv_output_size"
    ]
  },
  {
    "id": "dft",
    "title": "discrete Fourier transform",
    "field": "math",
    "latex": "X_k=\\sum_{n=0}^{N-1}x_n\\,e^{-2\\pi i kn/N}",
    "plain": "Xₖ = Σₙ xₙ e^(−2πi kn/N)",
    "symbols": "",
    "notes": "The FFT computes it in O(N log N).",
    "related": [
      "euler_identity",
      "convolution"
    ]
  },
  {
    "id": "euler_identity",
    "title": "Euler's formula and identity",
    "field": "math",
    "latex": "e^{i\\theta}=\\cos\\theta+i\\sin\\theta,\\qquad e^{i\\pi}+1=0",
    "plain": "e^(iθ) = cos θ + i sin θ;  e^(iπ) + 1 = 0",
    "symbols": "",
    "notes": "",
    "related": [
      "dft"
    ]
  },
  {
    "id": "gaussian_integral",
    "title": "Gaussian integral",
    "field": "math",
    "latex": "\\int_{-\\infty}^{\\infty}e^{-x^2}\\,dx=\\sqrt\\pi",
    "plain": "∫ e^(−x²) dx = √π",
    "symbols": "",
    "notes": "Gives the normalising constant of the normal density.",
    "related": [
      "gaussian_pdf"
    ]
  },
  {
    "id": "geometric_series",
    "title": "geometric series",
    "field": "math",
    "latex": "\\sum_{k=0}^{n-1}ar^{k}=a\\,\\frac{1-r^{n}}{1-r},\\qquad \\sum_{k=0}^{\\infty}ar^k=\\frac{a}{1-r}\\ (|r|<1)",
    "plain": "Σ a rᵏ = a(1 − rⁿ)/(1 − r);  to ∞: a/(1 − r)",
    "symbols": "",
    "notes": "",
    "related": [
      "discounted_return"
    ]
  },
  {
    "id": "lipschitz",
    "title": "Lipschitz continuity",
    "field": "math",
    "latex": "\\|f(x)-f(y)\\|\\le L\\,\\|x-y\\|",
    "plain": "‖f(x) − f(y)‖ ≤ L ‖x − y‖",
    "symbols": "L = Lipschitz constant",
    "notes": "Bounds how fast the output can change; the basis of stability and robustness analysis.",
    "related": [
      "spectral_norm",
      "excyst-stability"
    ]
  },
  {
    "id": "quadratic_formula",
    "title": "quadratic formula",
    "field": "math",
    "latex": "x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}",
    "plain": "x = (−b ± √(b² − 4ac)) / 2a",
    "symbols": "ax² + bx + c = 0",
    "notes": "Real roots iff b² − 4ac ≥ 0.",
    "related": []
  },
  {
    "id": "stirling",
    "title": "Stirling's approximation",
    "field": "math",
    "latex": "n!\\approx\\sqrt{2\\pi n}\\left(\\frac ne\\right)^{n}",
    "plain": "n! ≈ √(2πn) (n/e)ⁿ",
    "symbols": "",
    "notes": "Relative error about 1/(12n).",
    "related": [
      "combinations"
    ]
  }
]
