Search

Search papers and lessons

Lipschitz Continuity

Level 2 · 9 min read

A function is Lipschitz when its slope is bounded everywhere: two outputs can never differ by more than a fixed multiple of how far apart their inputs are.

On this page

  • Colour = topic mix
  • Discrete math
  • Linear algebra
  • Calculus
  • Sign in to see your progress

TL;DR

A function is Lipschitz when there is one number LL that caps how steep it ever gets. For any two inputs, the change in the output is at most LL times the distance between the inputs. Continuity says small input changes give small output changes; Lipschitz says exactly how small.

This sharper promise is what lets you bound errors, prove that iterative methods converge, and guarantee that an equation has one solution.

Where you'll see it: in the step-size rule of gradient descent, in the proof that an ODE has a unique solution, and in the stability bounds used to check neural networks against small adversarial changes.

Intuition

A hiking trail with a maximum grade

Picture a mountain trail that the trail builders promise never rises more steeply than 10 percent. Walk 100 metres along it and your height changes by at most 10 metres. You do not need to know the shape of the trail; the promise alone bounds your height change. The number 0.10 is the Lipschitz constant of the trail's height as a function of distance walked.

Continuity alone would only say that the trail has no jumps. A continuous trail could be gentle everywhere, or it could contain a cliff that is steep but still unbroken. A Lipschitz trail rules out the cliff, and the rule is quantitative: you can compute the worst case in advance.

That quantitative promise is the reason the idea exists. Many proofs and algorithms need to say "if the input is off by this much, the output is off by at most that much", and continuity cannot supply a usable number.

−2−1012−20246xf(x)
  • f(x) = x²
  • slope +4
  • slope -4
On [-2, 2], f(x) = x² is 4-Lipschitz. Around the origin its graph stays between the dashed lines of slope ±4, so |f(x) − f(0)| ≤ 4|x − 0| there.

The math

Definition: Lipschitz continuity

Let X⊆RnX \subseteq \mathbb{R}^n and let f:X→Rmf : X \to \mathbb{R}^m. The function ff is LL-Lipschitz on XX for a number L≥0L \ge 0, called a Lipschitz constant, if

∥f(x)−f(y)∥≤L ∥x−y∥for all x,y∈X.\|f(x) - f(y)\| \le L\,\|x - y\| \quad \text{for all } x, y \in X.

Here ∥⋅∥\|\cdot\| is the Euclidean norm (see Vector Norm) on both sides.

In words: the output distance never exceeds LL times the input distance. The smallest valid LL is the best Lipschitz constant of ff on XX. A function can be Lipschitz on one set and not on a larger one, so always state the set.

Lipschitz implies continuous

Suppose ff is LL-Lipschitz with L>0L \gt 0. Given any tolerance ε>0\varepsilon \gt 0, pick δ=ε/L\delta = \varepsilon / L.

  1. If ∥x−y∥<δ\|x - y\| \lt \delta, then ∥f(x)−f(y)∥≤L ∥x−y∥\|f(x) - f(y)\| \le L\,\|x - y\|.
  2. Since ∥x−y∥<δ\|x - y\| \lt \delta, we get L ∥x−y∥<Lδ=εL\,\|x - y\| \lt L\delta = \varepsilon.
  3. So ∥f(x)−f(y)∥<ε\|f(x) - f(y)\| \lt \varepsilon.

The δ\delta depends only on ε\varepsilon, not on the point. That is stronger than ordinary Continuity, which lets δ\delta depend on the point too. It is called uniform continuity.

The converse fails. The square root on [0,1][0, 1] is continuous but not Lipschitz, as the worked examples show.

Derivatives bound the constant

Let f:R→Rf : \mathbb{R} \to \mathbb{R} be differentiable on an interval [a,b][a, b] with ∣f′(t)∣≤L|f'(t)| \le L there. Take x,yx, y in [a,b][a, b].

  1. By the mean value theorem, there is a point cc between xx and yy with f(x)−f(y)=f′(c) (x−y)f(x) - f(y) = f'(c)\,(x - y).
  2. Take absolute values: ∣f(x)−f(y)∣=∣f′(c)∣ ∣x−y∣|f(x) - f(y)| = |f'(c)|\,|x - y|.
  3. Since ∣f′(c)∣≤L|f'(c)| \le L, we get ∣f(x)−f(y)∣≤L ∣x−y∣|f(x) - f(y)| \le L\,|x - y|.

So a bounded Derivative gives a Lipschitz function, with L=max⁡∣f′∣L = \max |f'|. The multivariable version replaces the mean value theorem with the fundamental theorem of calculus along the segment from yy to xx. If XX is convex and ∥∇f∥≤L\|\nabla f\| \le L everywhere on XX, then ff is LL-Lipschitz. The same argument with a Cauchy–Schwarz step gives the bound, and it is the form used when a Gradient is bounded.

The reverse is not true. The function ∣x∣|x| is 1-Lipschitz but has no derivative at 00.

Combining Lipschitz functions

Two rules do most of the work in applications.

  • Sums. If ff is L1L_1-Lipschitz and gg is L2L_2-Lipschitz, then f+gf + g is (L1+L2)(L_1 + L_2)-Lipschitz. The triangle inequality gives ∥(f+g)(x)−(f+g)(y)∥≤∥f(x)−f(y)∥+∥g(x)−g(y)∥\|(f+g)(x) - (f+g)(y)\| \le \|f(x) - f(y)\| + \|g(x) - g(y)\|.
  • Composition. f∘gf \circ g is (L1L2)(L_1 L_2)-Lipschitz, because ∥f(g(x))−f(g(y))∥≤L1 ∥g(x)−g(y)∥≤L1L2 ∥x−y∥\|f(g(x)) - f(g(y))\| \le L_1\,\|g(x) - g(y)\| \le L_1 L_2\,\|x - y\|.

Composition is why the constant of a deep network can be estimated layer by layer. The product of the layer constants is an upper bound, often a loose one.

The contraction case

If L<1L \lt 1, the map is a contraction: each application pulls points closer together. The Banach fixed-point theorem says that a contraction on a complete set (one that contains the limits of its convergent sequences, such as a closed subset of Rn\mathbb{R}^n) has exactly one fixed point, and repeated application converges to it from any start. This is the engine behind many iterative solvers.

Worked examples

Example
A straight line

Let f(x)=3x−2f(x) = 3x - 2 on R\mathbb{R}.

  1. For any xx and yy, f(x)−f(y)=3x−3y=3(x−y)f(x) - f(y) = 3x - 3y = 3(x - y).
  2. So ∣f(x)−f(y)∣=3 ∣x−y∣|f(x) - f(y)| = 3\,|x - y|.
  3. The ratio is exactly 33 for every pair, so L=3L = 3, and no smaller value works.

Interpretation: for a line, the slope is the best Lipschitz constant.

Example
A parabola on a bounded interval

Let f(x)=x2f(x) = x^2. Use the identity x2−y2=(x+y)(x−y)x^2 - y^2 = (x + y)(x - y).

  1. On all of R\mathbb{R}, take y=0y = 0 and let xx grow. The ratio ∣f(x)−f(0)∣/∣x−0∣=∣x∣|f(x) - f(0)| / |x - 0| = |x| is unbounded, so ff is not Lipschitz on R\mathbb{R}.
  2. On [−2,2][-2, 2], we have ∣x+y∣≤4|x + y| \le 4, so ∣f(x)−f(y)∣≤4 ∣x−y∣|f(x) - f(y)| \le 4\,|x - y|. Thus ff is 44-Lipschitz there.
  3. The constant 44 is the best one. Take x=2x = 2 and y=2−hy = 2 - h for small h>0h \gt 0: the ratio is ∣x+y∣=4−h|x + y| = 4 - h, which approaches 44 as h→0h \to 0.

Interpretation: a parabola gets steeper as you move out, so its Lipschitz constant depends on the interval you choose.

Example
The length of a vector

Let f(x)=∥x∥f(x) = \|x\| on R2\mathbb{R}^2. The reverse triangle inequality gives ∣ ∥x∥−∥y∥ ∣≤∥x−y∥\big|\,\|x\| - \|y\|\,\big| \le \|x - y\|, so ff is 11-Lipschitz.

Check with numbers. Take x=(3,4)x = (3, 4) and y=(3,0)y = (3, 0).

  1. ∥x∥=5\|x\| = 5 and ∥y∥=3\|y\| = 3, so the output difference is 22.
  2. x−y=(0,4)x - y = (0, 4), so ∥x−y∥=4\|x - y\| = 4.
  3. The ratio is 2/4=0.5≤12 / 4 = 0.5 \le 1, as the rule predicts.

Interpretation: taking a length never stretches distances between vectors.

Example
A continuous function that is not Lipschitz

Let f(x)=xf(x) = \sqrt{x} on [0,1][0, 1]. It is continuous, including at 00.

  1. Take y=0y = 0. The ratio is ∣x−0∣/∣x−0∣=1/x|\sqrt{x} - 0| / |x - 0| = 1 / \sqrt{x}.
  2. At x=0.01x = 0.01 the ratio is 1010. At x=0.0001x = 0.0001 it is 100100.
  3. The ratio is unbounded as xx approaches 00, so no finite LL works.

Interpretation: the square root has a vertical tangent at 00, which is exactly what Lipschitz forbids.

Tradeoffs and failure modes

Lipschitz is a strong, quantitative promise. Its strength is also its cost: the constant must be known or bounded, and a bad bound makes every guarantee weak.

SituationWhat goes wrongBetter choice
You only need "small input gives small output"Lipschitz adds an assumption you may not havePlain continuity is enough
The function has a corner, a cusp or a jumpThe ratio is unbounded, so no LL existsUse a weaker condition such as Hölder continuity, or split the domain
LL is large or unknownStep sizes and error bounds become tiny and slowEstimate LL locally, or use adaptive methods
A deep network's constant is a product of layer constantsThe product is an upper bound and often far too largeNormalise the weight matrices, or report the bound as conservative
Searching for a global minimum in many dimensionsBranch-and-bound cost grows quickly with dimensionCompare with the methods in Global Optimization

A common mistake is to assume a function is Lipschitz because it is smooth on a small region. Smoothness on a region does not bound the slope on a larger one. Always state the set on which the constant holds.

History

Rudolf Lipschitz, a German mathematician, introduced the condition in the 1870s while studying differential equations. The problem he was solving was whether an equation y′=f(x,y)y' = f(x, y) has a solution, and whether that solution is unique. The condition on ff in yy turned out to be exactly what the successive-approximation method needs. Later work by Émile Picard, Ernst Lindelöf and others built the existence and uniqueness theorem on it, and the name "Lipschitz" stuck.

In the early 1920s Stefan Banach proved the fixed-point theorem for contractions, which made the condition L<1L \lt 1 a central tool in analysis and then in numerical methods. The idea has stayed useful because it gives a number, not just a qualitative promise, and a number can be used in proofs and algorithms.

Check yourself

QuestionIn your own words, what does it mean for f to be L-Lipschitz?Show answer

For any two inputs, the distance between the outputs is at most LL times the distance between the inputs. The ratio of output change to input change never exceeds LL. Equivalently, the function never gets steeper than slope LL anywhere in its domain.

QuestionFind the best Lipschitz constant of f(x) = x³ on [−1, 1].Show answer

Use x3−y3=(x−y)(x2+xy+y2)x^3 - y^3 = (x - y)(x^2 + xy + y^2), so the ratio is ∣x2+xy+y2∣|x^2 + xy + y^2|. On [−1,1][-1, 1] this is largest when x=y=±1x = y = \pm 1, where it equals 33. Smaller values of xx and yy give smaller values, so the best constant is L=3L = 3. The derivative check agrees: f′(x)=3x2f'(x) = 3x^2 has maximum absolute value 33 on [−1,1][-1, 1].

QuestionWhy does Lipschitz continuity imply continuity, but not the other way round?Show answer

Lipschitz gives a bound ∥f(x)−f(y)∥≤L ∥x−y∥\|f(x) - f(y)\| \le L\,\|x - y\|. Choosing δ=ε/L\delta = \varepsilon / L makes the output gap smaller than ε\varepsilon whenever the input gap is smaller than δ\delta, which is the definition of continuity. The converse fails because continuity allows the slope to be unbounded near a point, as the square root at 00 shows. Continuity only needs the output gap to shrink eventually, not to shrink at a linear rate.

QuestionA model is 4-Lipschitz in the Euclidean norm. Two inputs differ by 0.01 in norm. What is the largest possible change in output?Show answer

The bound is L⋅∥x−y∥=4×0.01=0.04L \cdot \|x - y\| = 4 \times 0.01 = 0.04. No pair of inputs at that distance can produce a larger output difference. The bound is worst case, so the actual change is often smaller.

Sources