Why This Matters
Continuity is the bridge between limits and the rest of calculus. A continuous function is one you can draw without lifting your pen -- but the formal definition is far more precise. A function is continuous at a point when three things are true: the function is defined there, the limit exists there, and the limit equals the function value.
Most of the functions you encounter in practice are continuous on their domain: polynomials, exponentials, trigonometric functions, and their compositions. But understanding where continuity breaks down is just as important. A removable discontinuity is a hole in the graph that could be "filled in" by redefining the function at a single point. Jump discontinuities and infinite discontinuities require more careful handling.
The Intermediate Value Theorem (IVT) is a powerful consequence of continuity. It says that if a continuous function takes value A at one point and value B at another, it must take every value between A and B at some point in between. This theorem is the mathematical justification behind root-finding algorithms like the bisection method.
Define Terms
Visual Model
The full process at a glance. Click Start tour to walk through each step.
Continuity requires three conditions. When met, the Intermediate Value Theorem guarantees no values are skipped.
Code Example
// Check continuity: is f defined, does limit exist, does limit = f(a)?
function checkContinuity(f, a, h = 0.00001) {
// Check if f(a) is defined
let fa;
try {
fa = f(a);
if (!isFinite(fa)) {
console.log(`f(${a}) is not finite: ${fa}`);
return false;
}
} catch (e) {
console.log(`f(${a}) is undefined`);
return false;
}
// Approximate left and right limits
const leftLimit = f(a - h);
const rightLimit = f(a + h);
console.log(`f(${a}) = ${fa}`);
console.log(`Left limit approx: ${leftLimit.toFixed(6)}`);
console.log(`Right limit approx: ${rightLimit.toFixed(6)}`);
const limitsAgree = Math.abs(leftLimit - rightLimit) < 0.001;
const limitEqualsValue = Math.abs((leftLimit + rightLimit) / 2 - fa) < 0.001;
if (!limitsAgree) {
console.log("Discontinuous: one-sided limits differ (jump)");
return false;
}
if (!limitEqualsValue) {
console.log("Discontinuous: limit does not equal f(a) (removable)");
return false;
}
console.log("Continuous at x =", a);
return true;
}
// Continuous: x^2 at x = 2
checkContinuity(x => x * x, 2);
console.log("---");
// Jump discontinuity: sign function at x = 0
checkContinuity(x => (x > 0 ? 1 : -1), 0);
console.log("---");
// Bisection method (uses IVT)
function bisection(f, a, b, tol = 0.0001) {
let steps = 0;
while (b - a > tol) {
const mid = (a + b) / 2;
if (f(mid) * f(a) < 0) b = mid;
else a = mid;
steps++;
}
const root = (a + b) / 2;
console.log(`Root found: ${root.toFixed(6)} in ${steps} steps`);
return root;
}
// Find root of x^2 - 2 (sqrt(2)) on [1, 2]
bisection(x => x * x - 2, 1, 2);Interactive Experiment
Try these exercises:
- Test
checkContinuityon1/xat x = 0. What type of discontinuity is this? - Create a piecewise function that has a removable discontinuity at x = 1 by assigning a wrong value there.
- Use the bisection method to find the cube root of 5 by finding the root of
x^3 - 5on [1, 2]. - Modify the bisection method to print each midpoint so you can watch it converge to the root.
- Test continuity of
Math.floor(x)at several integer and non-integer points. What pattern do you see?
Quick Quiz
Coding Challenge
Write a function called `findDiscontinuities` that takes a function f and an array of x-values to check. For each x-value, determine if the function is approximately continuous by comparing the left limit, right limit, and f(x). Use h = 0.0001 for limit approximation. Return an array of the x-values where the function is discontinuous (where either the one-sided limits differ by more than 0.01, or the average of the limits differs from f(x) by more than 0.01).
Real-World Usage
Continuity matters far beyond pure mathematics:
- Root-finding algorithms: The bisection method, Newton method, and secant method all rely on continuity (specifically the IVT) to guarantee convergence.
- Computer graphics: Smooth curves and surfaces require continuous (often differentiable) functions. Bezier curves and splines are designed to be continuous.
- Control systems: A continuous control signal avoids sudden jumps that could damage mechanical systems. Discontinuous inputs cause instability.
- Numerical methods: Finite difference and finite element methods assume the underlying function is continuous and sufficiently smooth.
- Machine learning: Activation functions like ReLU are continuous but not differentiable at 0. The sigmoid function is smooth (infinitely differentiable), which aids gradient-based optimization.