Precalculus Advanced

Sandwich (Squeeze) Theorem Illustrator

Given g(x) ≤ f(x) ≤ h(x) near x = a, and lim g(x) = lim h(x) = L, the Sandwich Theorem guarantees lim f(x) = L. Explore three classic examples with animated squeeze, numerical verification, and step-by-step reasoning.

3 preset examples
Animated zoom-to-limit
Numerical verification table
User-defined functions
Example & Functions
g(x) = −x²
f(x) = x²·sin(1/x)
h(x) =
x → a = 0
g(x) =
f(x) =
h(x) =
a =
Showing the classic squeeze: −x² ≤ x²sin(1/x) ≤ x², all tending to 0 as x → 0.
Limit Result & Verification
Concluded by Sandwich Theorem
limx→0 x²sin(1/x)
= 0
Numerical Verification: g(x) ≤ f(x) ≤ h(x) near x = a
x g(x) f(x) h(x) g≤f≤h?
Theorem Conditions & Verification
Squeeze Visualization
g(x) — lower bound
f(x) — squeezed
h(x) — upper bound
Vertical dashed line at x = a · Horizontal dashed line at y = L (limit) · Click "Animate Squeeze" to watch x → a
The Sandwich Theorem (Formal Statement)
If g(x) ≤ f(x) ≤ h(x) near x = a,
and lim g(x) = lim h(x) = L,
then lim f(x) = L.

Three conditions must all hold:

  • Bounding inequality — g(x) ≤ f(x) ≤ h(x) must hold for all x sufficiently close to a (but not necessarily at a itself).
  • Common limit from below — limx→a g(x) = L must exist and equal L.
  • Common limit from above — limx→a h(x) = L must also equal L.

When all three hold, f is forced to converge to L — it is squeezed between two functions that both converge to the same value.

Note: f(x) does not need to be defined at x = a for the limit to exist. This is exactly what makes it powerful for functions like x²sin(1/x).
Why the Sandwich Theorem Is Useful
f(x) = x²·sin(1/x) — direct limit fails at x=0

Some functions are hard or impossible to evaluate directly at a limit point:

  • x²sin(1/x) — sin(1/x) oscillates wildly near 0, so substitution fails. But |sin(1/x)| ≤ 1 gives us −x² ≤ x²sin(1/x) ≤ x², and both bounds → 0.
  • sin(x)/x — classic indeterminate form 0/0 at x = 0. The geometric inequality cos(x) ≤ sin(x)/x ≤ 1 near 0 squeezes the limit to 1 — the foundation of all trig derivative formulas.
  • General strategy — use a known bound (often |f(x)| ≤ M·|x−a|ⁿ for some M and n > 0), then both bounding functions tend to 0.
The Sandwich Theorem also appears in real analysis (proving convergence of sequences) and multivariable calculus (showing 2-variable limits exist).

Need help with limits and the Squeeze Theorem?

A focused tutoring session can build the intuition behind all the major limit theorems — from Sandwich to L'Hôpital — so you're fully prepared for calculus.

Book a Session →