Math Applets

Lipschitz Continuity

Accumulation Point:

Let ARA \subseteq \mathbb{R} be a set and aRa \in \mathbb{R}. Then the following statements are equivalent: Let DRD \subset \mathbb{R} and f:DRf : D \to \mathbb{R}. The function ff is called Lipschitz continuous if there exists an L>0L > 0 such that for all x,yDx, y \in D it holds that f(x)f(y)Lxy|f(x) - f(y)| \le L\, |x - y|.


How to use the applet

  • Drag the two orange points on the curve: they represent (x1,f(x1))(x_1,f(x_1)) and (x2,f(x2))(x_2,f(x_2)).
  • Move the slider LL to change the allowed Lipschitz constant.
  • The red dashed line is the secant line through the two chosen points.
  • The right triangle encodes the differences Δx\Delta x (horizontal) and Δy\Delta y (vertical), so the (absolute) secant slope is
ΔyΔx=f(x2)f(x1)x2x1. \frac{|\Delta y|}{|\Delta x|}=\frac{|f(x_2)-f(x_1)|}{|x_2-x_1|}.
  • The arrows labeled +L+L and L-L visualize the slope bounds ±L\pm L.
  • The shaded “cone” with vertex at the left point shows the region between the two lines of slope ±L\pm L.
  • Green: the Lipschitz inequality holds for the currently chosen points (the secant slope is L\le L in absolute value).
  • Red: the inequality fails for the chosen points (you would need a larger LL).
  • For f(x)=sinxf(x)=\sin x, choosing L1L\ge 1 makes the condition succeed for all pairs of points (consistent with the Mean Value Theorem and cosz1|\cos z|\le 1).

Loading graph…
  • Hold Shift + scroll to zoom
  • Hold Shift + drag to move
  • Points shaped like <> act as sliders

Description

Link to code.

Reference: Lecture Notes Calculus 1 ( May22,2022 ) Definition 4.7 page 65

This applet represents the standard geometric interpretation of Lipschitz continuity.

Given the condition that for an L>0L > 0 f(x)f(y)L,xy|f(x) - f(y)| \le L,|x - y|

and that the slope of a linear function is “slope = vertical difference divided by horizontal difference,” the slope of the secant connecting the points f(x)f(x) and f(y)f(y) has slope f(x)f(y)xy\frac{|f(x) - f(y)|}{|x - y|}. From the LL-condition we retrieve f(x)f(y)xyL\frac{|f(x) - f(y)|}{|x - y|} \le L. The applets updates the color accordingly:

const isConditionMet = () =>
    Math.abs(p2.Y() - p1.Y()) <=
    lSlider.Value() * Math.abs(p2.X() - p1.X());

const color = () => (isConditionMet() ? COLORS.lightGreen : COLORS.lightRed);

Thus the absolute slope is constrained between ±L\pm L, as shown.

I am aware that this touches on the concept of slope, not yet covered by the student at this point, and that this connection is even better explained using the MVT.

As a simple example I chose sin\sin, whose derivative is cos\cos. By the MVT we get that f(x)f(y)xy=cos(z)\frac{f(x) - f(y)}{x - y} = \cos(z) for some zz between xx and yy. But cos(z)1=L>0|\cos(z)| \le 1 = L > 0.