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.
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 into evaluates the function at the point, while a limit asks what happens near it. A hole at 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 means gets arbitrarily close to whenever is close to but not equal to , from both sides. One-sided limits and check each side, and the two-sided limit exists only when both agree.
Continuity at needs three things: is defined, the limit exists, and they are equal:
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 at 0.
Worked example
Consider with . Plugging gives : undefined, a hole. Factor and cancel for :
Near 2 the function behaves exactly like the line . From the left and from the right , both homing in on 4, hence . Defining 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.001Both sides agree with the cancelled line , 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 equals .
- Breaks are holes that one value fixes, jumps where sides disagree, or blowups to infinity.
- The ratio has limit 4 at 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.