Skip to content
AI360XpertBeta

Limits and Continuity

A limit is the value a function homes in on, and continuity means the graph arrives there with no jump, hole, or break.

The curve x squared minus 4 over x minus 2 runs straight except for a hole at x equals 2, where both sides converge on 4 and filling the hole restores continuity.
The curve x squared minus 4 over x minus 2 runs straight except for a hole at x equals 2, where both sides converge on 4 and filling the hole restores continuity.

Why Does This Exist?

Derivatives are limits, integrals are limits, and training stability is continuity. Gradient descent assumes small steps change the loss a small amount, which is exactly continuity of the loss. Step functions and hard thresholds break that promise, which is why they get soft replacements during training. Every zero-over-zero form in ML, from normalisation edge cases to attention weights, resolves through limit thinking.

This page teaches the idea itself: approach from both sides, name the value, and check the graph actually arrives. The derivative machinery built on top lives in derivatives and partial derivatives, and the polynomial approximations built on top of that live in Taylor series and approximation.

The prerequisite is one distinction: plugging x=ax = a into f(x)f(x) evaluates the function at the point, while a limit asks what happens near it. A hole at x=2x = 2 changes nothing about the approach from 1.999 and 2.001. Evaluation and approach agree only for continuous functions.

Think of It Like This

A bridge with one plank missing

Walk toward a footbridge. From the left bank you approach plank 4, and from the right bank you also approach plank 4, but plank 4 itself was never installed: one hole in an otherwise fine bridge. The limit is where both approaches agree, and continuity is whether the plank is actually there to stand on.

Laying the missing plank, defining the value to equal the limit, repairs the bridge. That repair is called a removable discontinuity, and it is the friendliest kind of break because the approaches already agree, so one well-chosen value fixes everything.

Where it stops: a bridge plank is either present or missing, while functions also jump and blow up. Jumps disagree from each side and blowups run to infinity, and neither is fixed by one plank.

How It Actually Works

The limit lim⁡x→af(x)=L\lim_{x \to a} f(x) = L means f(x)f(x) gets arbitrarily close to LL whenever xx is close to but not equal to aa, from both sides. One-sided limits lim⁡x→a−\lim_{x \to a^-} and lim⁡x→a+\lim_{x \to a^+} check each side, and the two-sided limit exists only when both agree.

Continuity at aa needs three things: f(a)f(a) is defined, the limit exists, and they are equal:

lim⁡x→af(x)=f(a)\lim_{x \to a} f(x) = f(a)

In plain words, approach the point and arrive at the value. Breaks come in three flavours: holes that one value fixes, jumps where left and right disagree as in step functions, and blowups where values run to infinity as in 1/x1/x at 0.

Worked example

Consider f(x)=(x2−4)/(x−2)f(x) = (x^2 - 4)/(x - 2) with x≠2x \ne 2. Plugging x=2x = 2 gives 0/00/0: undefined, a hole. Factor and cancel for x≠2x \ne 2:

f(x)=(x−2)(x+2)x−2=x+2f(x) = \frac{(x-2)(x+2)}{x-2} = x + 2

Near 2 the function behaves exactly like the line x+2x + 2. From the left f(1.999)=3.999f(1.999) = 3.999 and from the right f(2.001)=4.001f(2.001) = 4.001, both homing in on 4, hence lim⁡x→2f(x)=4\lim_{x \to 2} f(x) = 4. Defining f(2)=4f(2) = 4 fills the hole and makes the function continuous there: approach meets arrival, exactly as the diagram shows.

Code

The snippet evaluates both sides of the hole with only the standard library.

def f(x: float) -> float:    return (x ** 2 - 4) / (x - 2)

print(round(f(1.999), 3))  # -> 3.999print(round(f(2.001), 3))  # -> 4.001print(round(1.999 + 2, 3))  # -> 3.999print(round(2.001 + 2, 3))  # -> 4.001

Both sides agree with the cancelled line x+2x + 2, confirming the limit 4 from each direction.

Watch Out For

Plugging into a 0 over 0 form and declaring the answer

The symptom is undefined, so no limit for expressions whose limit plainly exists, like the worked example's 4. A zero-over-zero form is not an answer but a signal to do algebra first: factor, cancel, rationalise, or reach for L'Hopital's rule. Only after simplification may you evaluate, and one-sided disagreement still vetoes the two-sided limit.

Assuming your loss is continuous where it is not

Hard thresholds, argmax selections, and quantisation steps all jump, so gradients through them are zero or undefined and descent stalls. The symptom is training that flatlines exactly at a discretisation boundary. The fix is a continuous relaxation during training with softmax instead of argmax or straight-through estimators where needed, keeping jumps for inference only. Continuity is an assumption to verify, not a default.

The Quick Version

  • A limit is the approached value from both sides, while evaluation is the value at the point.
  • Continuity means the two agree: the limit at aa equals f(a)f(a).
  • Breaks are holes that one value fixes, jumps where sides disagree, or blowups to infinity.
  • The ratio (x2−4)/(x−2)(x^2-4)/(x-2) has limit 4 at x=2x = 2 after cancelling, despite the zero-over-zero hole.
  • A zero-over-zero form means simplify first, never undefined with no limit.
  • Gradient methods assume continuous losses, so jumps need soft relaxations during training.