The Sandwich Theorem is a theorem that is used to solve limits that would otherwise be considered undefined. It works on the principle that if a function is ‘sandwiched’ between two other functions for a period, the value it converges (i.e. the limit) will also between the limit of the two functions.
It also uses a similar principle to finding the Big-Theta time complexity of an algorithm.

Definition
Sandwich Theorem
Let all be real-valued function that operate over a domain . Then if we have
- for all . That is, is bounded between and
Then:
In other words, if is strictly bound between and over a domain and both limits of and exist and are equal, then the limit of is equal to the limit of and .
In Two Dimensions
In two dimensions i.e. for bivariate functions, the sandwich theorem still holds, albeit slightly modified:
Then we have:
\usepackage{pgfplots}
\pgfplotsset{width=15cm,compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[colormap/bluered]
\addplot3[
mesh,
samples=20,
domain=-2:2
]
{0};
\addplot3[
mesh,
samples=20,
domain=-2:2,
]
{x^2 + y^2};
\addplot3[
mesh,
samples=20,
domain=-2:2,
]
{-x^2-y^2};
\end{axis}
\end{tikzpicture}
\end{document}Examples
- The trig functions and are a godsend here, as they are always bound between so any function multiplied by them can be used as and :
1: Trig Functions
Evaluate the limit:
Solution domain of the sine function is . Hence:
The
We can use this information to determine an upper and lower bound:
Since |x| and -|x| are defined to be upper and lower bound functions, and their Limit (Calculus) exist and are equal at 0, trivially, then using the Sandwich Theorem:
Hence,
- Another important function to use for bounds is the absolute value function, .
2: More complex functions
Evaluate the limit:
Solution (Multiplying by the conjugate)
Now, to use the sandwich theorem, we need to find 2 appropriately bounded functions to act as upper and lower bound. Let's call the lower bound and the upper bound .
So, our lower bound function So, our upper bound function
Now, to use the sandwich theorem: (By Standard Limits, as ) Similarly,
Hence, as and , via Sandwich Theorem.At first, this limit might look daunting without the presence of any trig functions. However, it can still be simplified (or at least converted into a form which allows the use of the sandwich theorem).
Bivariate
3: Bivariate Sandwich Theorem ^e3
Evaluate
Solution and an upper bound . First note that the domain of is , because at , we would have the denominator being zero, and we cannot divide by zero. Hence the domain
We need to find a lower bound
- Let . Since is undefined for , and has sums of squared terms, we know it is also . Hence
- We can take . This is essentially the adding to . So by ordered field axioms, we have
- Thus we have
We can evaluate the limits of and :
Thus, the limits of the bounds exist and are equal. Thus, by the Sandwich theorem, we have:
Visuals