# Sandwich Theorem

## Related Calculator: Limit Calculator

**Fact**. If `f(x)<=g(x)` when `x` is near `a` (except possibly at `a`) then `lim_(x->a)f(x)<=lim_(x->a)g(x)`.

This fact means that if values of `f(x)` are not larger than values of `g(x)` near `a`, then `f(x)` approaches not larger limit than `g(x)` as `x->a`.

**Sandwich Theorem (or Squeeze Theorem)**. Consider three functions `f(x),g(x),h(x)`. If we have that `f(x)<=g(x)<=h(x)`, when `x` near `a` (except possibly at `a`) and `lim_(x->a)f(x)=lim_(x->a)h(x)=L` then `lim_(x->a)g(x)=L`.

This theorem tells us folowing: if there are three functions, two of which have same

limit as `x` approaches `a` and third is "squeezed" between them, then third will have to approach same limit as `x` approaches `a` as first two.

**Example**. Find `lim_(x->0)x^2cos(1/x)`.

Since `-1<=cos(1/x)<=1` for all `x` (actually we are interested only in `x` near 0) then `-x^2<=x^2cos(1/x)<=x^2`. Since `lim_(x->0)x^2=lim_(x->0)-x^2=0` then by Squeeze theorem `lim_(x->0)x^2cos(1/x)=0`.

On the figure you can see that `x^2cos(1/x)` is squeezed between `x^2` and `-x^2`.