Minkowski Distance Calculator (Generalized L_p)

Minkowski distance d_p generalized calculator: L_p family, unit balls, Holder inequality, and applications in machine learning and functional analysis.

Calculation parameters
Was this calculator useful?

Minkowski distance

Minkowski distance d_p between two points A = (a_1, ..., a_n) and B = (b_1, ..., b_n) for parameter p >= 1:

d_p(A, B) = (sum_{i=1}^{n} |a_i - b_i|^p)^(1/p)

Generalizes three classical distances: p = 1 Manhattan (L1), p = 2 Euclidean (L2), p -> infty Chebyshev (Linf, max coordinate). Introduced by Hermann Minkowski (1864-1909) as part of normed space theory.

L_p norms family

Minkowski distance induces L_p norms family: ||x||_p = (sum |x_i|^p)^(1/p). For every p >= 1, L_p is legitimate NORM (positivity, homogeneity, triangle inequality). For 0 < p < 1, loses triangle (QUASI-norm). For p = infty: ||x||_inf = max |x_i|.

Notable cases

  • p = 1: Manhattan (L1, taxicab). Outlier-robust, induces sparsity.
  • p = 2: Euclidean (L2). Standard in math, physics, ML.
  • p = infty: Chebyshev (Linf). King moves in chess.
  • p = 0.5: NOT metric (no triangle). Level set is concave star.
  • p = 1.5, 3: rarely used but valid.

L_p unit balls

Set S_p = {x : ||x||_p = 1} is "unit ball" in L_p. 2D shape varying p:

  • p = 0.5: 4-point concave star (NOT convex).
  • p = 1: DIAMOND vertices (1,0), (0,1), (-1,0), (0,-1).
  • p = 1.5: smoothed intermediate.
  • p = 2: classic CIRCLE.
  • p = 3: nearly square with rounded corners.
  • p = 5: closer to square.
  • p = infty: exact SQUARE axis-aligned.

2D L_p volume: V = 4 r^2 (Gamma(1+1/p))^2 / Gamma(1+2/p). p=2: pi r^2, p=1: 2 r^2, p=infty: 4 r^2.

Convexity

L_p unit ball S_p is:

  • NOT convex for 0 < p < 1.
  • Convex for p >= 1.
  • Strictly convex for 1 < p < infty.
  • Convex with flat sides for p = 1, infty.

Holder inequality

For real p, q with 1/p + 1/q = 1 (conjugate exponents), and any vectors a, b in R^n:

|sum a_i b_i| <= ||a||_p * ||b||_q

Case p = q = 2 (self-conjugate): Cauchy-Schwarz |<a,b>| <= ||a||_2 ||b||_2. Case p = 1, q = infty: |sum a_i b_i| <= ||a||_1 ||b||_inf. Otto Holder (1889).

Minkowski inequality

For all p >= 1: ||a + b||_p = 1. For p < 1 reversed.

Equivalent norms

In finite dim n, all L_p norms are EQUIVALENT (constants C_1, C_2 with C_1 ||x||_p <= ||x||_q <= C_2 ||x||_p). Specific:

  • ||x||_inf <= ||x||_2 <= sqrt(n) ||x||_inf.
  • ||x||_2 <= ||x||_1 <= sqrt(n) ||x||_2.
  • ||x||_inf <= ||x||_1 <= n ||x||_inf.

In INFINITE dim (function spaces), norms NO LONGER equivalent: fundamental distinction L^1, L^2, L^p, L^infty.

ML and optimization applications

  • L1: Lasso, sparse coding, outlier robustness.
  • L2: Ridge regression, SVM kernel, neural network weight decay.
  • L1.5: sometimes used as compromise (Berhu loss).
  • Linf: minimax loss, extreme robustness.
  • Variable L_p: optimal p search per dataset.
  • Mahalanobis: Euclidean weighted by covariance matrix.

Physics and math applications

  • Banach spaces: complete normed (Lp with p in [1, infty]).
  • Hilbert spaces: inner product (only L2 in Lp family).
  • Lebesgue integration in Lp.
  • PDEs: Lp estimates of solutions.
  • Probability: Lp convergence.
  • Differential geometry: general metric spaces.

History

Hermann Minkowski (1864-1909) studies geometry of numbers and normed spaces. Otto Holder (1889) proves key inequality. Frigyes Riesz (1907) develops L^p space theory. Stefan Banach (1932) "Theorie des operations lineaires" systematizes functional analysis.

Lp function spaces and the Riesz-Fischer theorem

Minkowski distance between vectors extends naturally to function spaces, giving rise to the Lp spaces, among the most important in modern analysis. The Lp space of a measure set gathers the functions whose p-th power of the absolute value is integrable, with norm given by the p-th root of that integral. For p=1 one has the integrable functions, for p=2 the square-integrable ones, fundamental in quantum mechanics and signal theory.

The crucial result is the Riesz-Fischer theorem: for every p between 1 and infinity the Lp space is complete, that is, every Cauchy sequence converges to an element of the space. This completeness makes the Lp Banach spaces, the ideal setting for functional analysis. Of all of them, only L2 possesses an inner product that induces the norm, becoming a Hilbert space: it is this additional geometric structure that makes L2 so special, with notions of orthogonality, projection and orthonormal bases.

Lp-Lq duality and the Riesz representation theorem

The Holder inequality, besides being an estimation tool, reveals a deep duality structure between Lp spaces with conjugate exponents. The Riesz representation theorem states that, for p strictly between 1 and infinity, the dual space of Lp, that is, the set of continuous linear functionals on it, is exactly Lq with 1/p + 1/q = 1. Every continuous functional is written as the integral of the product with a fixed function of Lq.

This duality has deep consequences: for 1 less than p less than infinity the Lp spaces are reflexive, that is, they coincide with their bidual, a property guaranteeing the existence of minima in many optimization problems and the weak compactness of bounded sets. The extreme cases p=1 and p=infinity behave differently and are more delicate. Lp-Lq duality is one of the pillars of functional analysis, with applications from partial differential equations to approximation theory.

Updated July 2026

Frequently Asked Questions

What is the Minkowski distance?

It is the generalized distance d_p(A,B) = (sum of |a_i - b_i|^p)^(1/p), depending on a parameter p. It includes as special cases the Manhattan distance (p=1), Euclidean (p=2) and Chebyshev (p tending to infinity), unifying the main metrics in a single family.

How does the distance vary with p?

For a fixed vector, the distance d_p decreases as p increases: Manhattan (p=1) gives the largest value, Chebyshev (p infinity) the smallest. Increasing p gives more and more weight to the maximum difference component, until only that one is considered in the limit.

Why must p be at least 1?

Because only for p greater than or equal to 1 does the Minkowski inequality guarantee the triangle property, a requirement of every metric. For p less than 1 the function loses this property and is no longer a true distance, though it remains useful in some contexts as a pseudo-metric.

What is the L_p unit ball?

It is the set of points at distance 1 from the origin in the L_p norm, defined by |x|^p + |y|^p = 1. Its shape changes with p: a diamond for p=1, a circle for p=2, a square for p tending to infinity, and intermediate shapes for values between these.

What is the Holder inequality?

It states that the absolute value of the sum of the products a_i b_i is less than or equal to the product of the norms ||a||_p and ||b||_q, where p and q are conjugate exponents (1/p + 1/q = 1). It generalizes the Cauchy-Schwarz inequality, obtained for p=q=2.

What are the Lp spaces?

They are spaces of functions whose p-th power of the absolute value is integrable, with norm given by the p-th root of the integral. By the Riesz-Fischer theorem they are complete, hence Banach spaces, fundamental in functional analysis, probability and mathematical physics.

Why is L2 special?

Because it is the only Lp space endowed with an inner product that induces the norm, making it a Hilbert space. This structure allows one to speak of orthogonality, projections and orthonormal bases, and underlies quantum mechanics, Fourier analysis and least-squares methods.

What is the point of choosing different p?

To adapt the metric to the problem: p=1 for outlier robustness and sparsity, p=2 as a geometric standard, large p to emphasize the maximum difference. In machine learning, signal processing and optimization, the parameter p becomes a flexible modelling choice.

Comments (0)

No comments yet. Be the first!