{
  "id": "minkowski-distance",
  "title": "Minkowski Distance",
  "lang": "en",
  "source_lang": "en",
  "summary": "Minkowski distance is a family of distances between coordinate vectors, parameterized by an exponent, that includes Manhattan, Euclidean, and maximum-coordinate distance.",
  "category": "mathematics",
  "subcategory": "geometry",
  "type": "concept",
  "aliases": [
    "ℓp distance",
    "Lp distance",
    "p-norm distance"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/minkowski-distance/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/minkowski-distance/",
      "json": "https://aiwiki.page/zh/minkowski-distance.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Minkowski distance is a family of distances between points represented by coordinate vectors, obtained by taking the \\(p\\)th root of the sum of the \\(p\\)th powers of their absolute coordinate differences. For \\(p\\geq 1\\), it is the distance induced by the \\(p\\)-norm and defines a metric on finite-dimensional real coordinate space. Named after Hermann Minkowski, the family includes Manhattan distance at \\(p=1\\), Euclidean distance at \\(p=2\\), and, as a limiting case, Chebyshev distance at \\(p=\\infty\\). It is widely used in geometry, numerical computation, and data analysis."
    },
    {
      "heading": "Definition",
      "text": "For two points \\(x=(x_1,\\ldots,x_n)\\) and \\(y=(y_1,\\ldots,y_n)\\) in \\(\\mathbb{R}^n\\), and a real parameter \\(1\\leq p<\\infty\\), the Minkowski distance is\n\n\\[d_p(x,y)=\\left(\\sum_{i=1}^{n}|x_i-y_i|^p\\right)^{1/p}.\\]\n\nHere, \\(|x_i-y_i|\\) is the absolute value of the difference in coordinate \\(i\\). Equivalently,\n\n\\[d_p(x,y)=\\|x-y\\|_p.\\]\n\nThe limiting case is defined by\n\n\\[d_\\infty(x,y)=\\max_{1\\leq i\\leq n}|x_i-y_i|,\\]\n\nand satisfies\n\n\\[\\lim_{p\\to\\infty}d_p(x,y)=d_\\infty(x,y).\\]\n\nThe parameter \\(p\\), sometimes called the order of the distance, controls how coordinate differences are aggregated. Larger values give greater relative emphasis to the largest differences.\n\nThe same formula applies to vectors with complex coordinates when absolute value is replaced by complex modulus."
    },
    {
      "heading": "Important special cases",
      "text": "Manhattan distance\n\nFor \\(p=1\\),\n\n\\[d_1(x,y)=\\sum_{i=1}^{n}|x_i-y_i|.\\]\n\nAlso called city-block distance or taxicab distance, it measures the total coordinatewise displacement. On an unobstructed rectangular street grid, it gives the shortest route length when travel is restricted to coordinate directions.\n\nEuclidean distance\n\nFor \\(p=2\\),\n\n\\[d_2(x,y)=\\sqrt{\\sum_{i=1}^{n}(x_i-y_i)^2}.\\]\n\nThis is the usual straight-line distance in Euclidean space, obtained from the Pythagorean theorem. It is the member of the family induced by the standard inner product.\n\nChebyshev distance\n\nFor \\(p=\\infty\\),\n\n\\[d_\\infty(x,y)=\\max_i|x_i-y_i|.\\]\n\nAlso called maximum distance, it depends only on the largest coordinate difference. In two dimensions, it describes the minimum number of king moves between squares on an unobstructed chessboard when horizontal, vertical, and diagonal moves each have unit cost.\n\nFor example, if \\(x=(1,2)\\) and \\(y=(4,6)\\), their absolute coordinate differences are \\(3\\) and \\(4\\), so\n\n\\[d_1(x,y)=7,\\qquad d_2(x,y)=5,\\qquad d_\\infty(x,y)=4.\\]"
    },
    {
      "heading": "Metric properties",
      "text": "For every \\(p\\in[1,\\infty]\\), Minkowski distance satisfies:\n\n- Nonnegativity: \\(d_p(x,y)\\geq 0\\).\n- Identity of indiscernibles: \\(d_p(x,y)=0\\) if and only if \\(x=y\\).\n- Symmetry: \\(d_p(x,y)=d_p(y,x)\\).\n- The triangle inequality:\n\n\\[d_p(x,z)\\leq d_p(x,y)+d_p(y,z).\\]\n\nFor finite \\(p\\), the triangle inequality follows from Minkowski’s inequality,\n\n\\[\\left(\\sum_i|a_i+b_i|^p\\right)^{1/p} \\leq \\left(\\sum_i|a_i|^p\\right)^{1/p} + \\left(\\sum_i|b_i|^p\\right)^{1/p}.\\]\n\nMinkowski distance is translation invariant and scales uniformly:\n\n\\[d_p(x+a,y+a)=d_p(x,y), \\qquad d_p(cx,cy)=|c|\\,d_p(x,y).\\]\n\nEvery member of the family is unchanged by permutations of coordinates and by sign reversals applied consistently to corresponding coordinates. In dimensions at least two, however, only \\(p=2\\) is invariant under all Euclidean rotations. For other values of \\(p\\), the chosen coordinate axes are part of the geometry."
    },
    {
      "heading": "Geometry and comparison between orders",
      "text": "The closed unit ball is\n\n\\[B_p=\\left\\{x\\in\\mathbb{R}^n:\\sum_i|x_i|^p\\leq 1\\right\\},\\]\n\nwith \\(B_\\infty=\\{x:\\max_i|x_i|\\leq1\\}\\). Each is a convex set.\n\nIn two dimensions, the unit ball is:\n\n- a diamond with vertices on the coordinate axes for \\(p=1\\);\n- a circular disk for \\(p=2\\);\n- a square aligned with the coordinate axes for \\(p=\\infty\\).\n\nFor \\(1<p<\\infty\\), the unit balls are strictly convex: their boundaries contain no nontrivial straight line segments. Consequently, a straight segment is the unique shortest path between two points, up to reparameterization. At \\(p=1\\) and \\(p=\\infty\\), distinct shortest paths can occur.\n\nFor a fixed vector \\(v\\in\\mathbb{R}^n\\) and \\(1\\leq p<q\\leq\\infty\\),\n\n\\[\\|v\\|_q\\leq\\|v\\|_p \\leq n^{\\,1/p-1/q}\\|v\\|_q,\\]\n\nwhere \\(1/\\infty=0\\). Thus the unnormalized distance between a fixed pair of points is nonincreasing as \\(p\\) increases.\n\nThese bounds also show that all Minkowski distances on a fixed finite-dimensional space generate the same topology: they have the same convergent sequences and open sets. They need not, however, produce the same nearest neighbors or the same ordering of pairwise distances."
    },
    {
      "heading": "Weighted and normalized forms",
      "text": "A weighted Minkowski distance is commonly defined as\n\n\\[d_{p,w}(x,y)= \\left(\\sum_{i=1}^{n}w_i|x_i-y_i|^p\\right)^{1/p}, \\qquad w_i>0.\\]\n\nIt is equivalent to ordinary Minkowski distance after rescaling coordinate \\(i\\) by \\(w_i^{1/p}\\). Strictly positive weights preserve the metric properties. If some weights are zero, distinct vectors differing only in those coordinates can have zero distance; the result is then a pseudometric rather than a metric on the full coordinate space.\n\nA normalized version is\n\n\\[\\bar d_p(x,y)= \\left(\\frac{1}{n}\\sum_{i=1}^{n}|x_i-y_i|^p\\right)^{1/p} =n^{-1/p}d_p(x,y).\\]\n\nFor fixed \\(n\\) and \\(p\\), normalization multiplies all distances by the same positive constant and therefore preserves nearest-neighbor rankings. Its dependence on \\(p\\) differs from that of the unnormalized distance: as a power mean of the absolute differences, \\(\\bar d_p\\) is nondecreasing with \\(p\\).\n\nWeighting conventions are not uniform. A formula using \\(|w_i(x_i-y_i)|^p\\) inside the sum assigns an effective coefficient \\(w_i^p\\), rather than \\(w_i\\)."
    },
    {
      "heading": "Exponents below one",
      "text": "The same algebraic expression is sometimes called a Minkowski distance for \\(0<p<1\\), but it is not generally a metric.\n\nFor example, let \\(x=(1,0)\\), \\(y=(0,0)\\), and \\(z=(0,1)\\). Then\n\n\\[d_p(x,z)=2^{1/p}>2=d_p(x,y)+d_p(y,z),\\]\n\nso the triangle inequality fails. The associated expression is a quasi-norm, and its unit ball is not convex in dimensions at least two.\n\nThere is an important distinction between this expression and its \\(p\\)th power. For \\(0<p<1\\),\n\n\\[\\rho_p(x,y)=\\sum_i|x_i-y_i|^p\\]\n\ndoes define a metric, because \\((a+b)^p\\leq a^p+b^p\\) for nonnegative \\(a,b\\). The outer exponent \\(1/p\\) is what prevents the usual formula from satisfying the triangle inequality."
    },
    {
      "heading": "Applications and limitations",
      "text": "Minkowski distances are used in nearest-neighbor search, cluster analysis, pattern recognition, and other areas of machine learning. The parameter \\(p\\) supplies a family of geometries rather than a universally optimal similarity measure.\n\nAt \\(p=1\\), absolute discrepancies are added directly. At \\(p=2\\), larger discrepancies receive greater relative emphasis through squaring. At \\(p=\\infty\\), only the largest discrepancy determines the distance. For a fixed query and finite \\(p\\), minimizing \\(d_p\\) is equivalent to minimizing\n\n\\[d_p(x,y)^p=\\sum_i|x_i-y_i|^p,\\]\n\nbecause taking a positive \\(p\\)th root preserves order. Nevertheless, the powered expression generally is not itself a metric when \\(p>1\\).\n\nSeveral issues affect interpretation:\n\n- Coordinate scale: A variable measured in numerically larger units can dominate the distance. Rescaling coordinates changes their relative influence.\n- Dependence between variables: Ordinary Minkowski distance does not account for covariance. Mahalanobis distance provides a different construction using a covariance matrix.\n- Large discrepancies: Larger \\(p\\) places greater relative emphasis on unusually large coordinate differences. A smaller \\(p\\) does not by itself guarantee a statistically robust procedure.\n- High dimensionality: In some high-dimensional data models, distances concentrate and become less discriminative, an aspect of the curse of dimensionality.\n- Meaning of coordinates: Numerical encodings of categories do not automatically justify treating their differences as meaningful distances.\n\nFor numerical evaluation with large finite \\(p\\), directly computing \\(|x_i-y_i|^p\\) may overflow or underflow. If\n\n\\[m=\\max_i|x_i-y_i|>0,\\]\n\nan equivalent scaled formula is\n\n\\[d_p(x,y)= m\\left(\\sum_i \\left(\\frac{|x_i-y_i|}{m}\\right)^p \\right)^{1/p}.\\]\n\nThe normalized differences lie in \\([0,1]\\), reducing the risk of overflow in the powers. When \\(m=0\\), the distance is zero."
    },
    {
      "heading": "Relation to function spaces and spacetime",
      "text": "Minkowski distance is the finite-dimensional counterpart of the norm-induced distance on L^p spaces, where sums are replaced by integrals:\n\n\\[d_p(f,g)= \\left(\\int |f-g|^p\\,d\\mu\\right)^{1/p}.\\]\n\nIn this setting, functions equal almost everywhere are identified so that zero distance corresponds to the same element of the space. The finite-dimensional equivalence of all \\(p\\)-norms does not extend unchanged to infinite-dimensional spaces: different exponents can impose genuinely different integrability conditions.\n\nDespite the shared name, Minkowski distance is not the spacetime interval of special relativity. The latter uses an indefinite quadratic form that distinguishes timelike, spacelike, and null separations; it is not a nonnegative metric of the kind defined above."
    }
  ],
  "links": [
    "norm-mathematics",
    "metric-space",
    "euclidean-distance",
    "absolute-value",
    "complex-number",
    "euclidean-space",
    "pythagorean-theorem",
    "inner-product",
    "triangle-inequality",
    "minkowski-inequality",
    "convex-set",
    "topology",
    "cluster-analysis",
    "machine-learning",
    "covariance",
    "mahalanobis-distance",
    "curse-of-dimensionality",
    "lp-space"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}