% This is lecture no. 2 of MH1100/: Calculus I.

\chapter{Limits}%
\label{cha:limits}

\section{Intuition}%
\label{sec:intuition}

Here is how we denote a limit:
\[
	\lim_{x \to a} f(x)
.\]
read as the limit of the function $f(x)$ as $x$ approaches $a$.
Think about the function:
\[
	f(x) = \frac{\sin(x)}{x}
.\]
Focus on how it looks close to the point $x=0$.
Even though $f(x) = \frac{\sin(x)}{x}$ has no value defined at the point $x=0$, we can still look at the values $f$ takes at points cles to $x=0$, and see if those values are approaching some fixed value as $x$ gets closer and closer to 0.
The limit of a function $f(x)$ at a point $a$ is a number $L$ which the values of the function get closer and closer to as the variable $x$ gets closer and closer to $a$.

We know that:
\[
	\lim_{x \to 0}f(x) = \lim_{x \to 0}\frac{\sin(x)}{x} = 1
.\]

\begin{definition}
	Tangent line to a graph.
	Let $D \subset \mathbb{R}$ and let $f:D\rightarrow \mathbb{R}$ be a function.
	Then we define the \textbf{tangent line} to the graph of $f(x)$ at the point $x_0$ to be the line going through the point $(x_0,f(x_0))$ with gradient:
	\[
		\lim_{x\to x_0}\frac{f(x) - f(x_0)}{x-x_0}
	.\]
	if the limit exists.
	If this limit does not exist then we say that the graph does not have a tangent at that point.
\end{definition}

\begin{exmp}
	Suppose that a ball is dropped from a tower 450m above the ground. Find the velocity of the ball after 5 seconds.

	\begin{sol}
		We are dealing with a single instant of time ($t=5$), so no time interval is involved.
		We can approximate the desired quantity by computing the average velocity over the brief time interval $\tau$ seconds starting at time $t=5$:
		\begin{align*}
			\text{average velocity} & = \frac{\text{change in position}}{\text{time elapsed}} \\
						& = \frac{s(5 + \tau) - s(5)}{\tau} \\
						& = \frac{4.9(5 + \tau) - 4.9 \times 5^2}{\tau} \\
						& = 49 + 4.9\tau
		\end{align*}
		As the time interval $\tau$ gets smaller and smaller, this quantity will be a better approximation fo the instantaneous velocity at time $\tau$.
		The instantaneous velocity after 5 seconds is $v = 49m/s$.
	\end{sol}
\end{exmp}

\section{Limit Laws}%
\label{sec:limit_laws}

We use theorems called limit laws to build up more complicated limits from simpler pieces.

\begin{thrm}
	\label{sumlaw}
	Sum Law.
	Let $f$ and $g$ be functions and let $a \in \mathbb{R}$.
	If the limits:
	\[
		\lim_{x\to a}f(x)
		\quad
		\text{and}
		\quad
		\lim_{x\to a}g(x)
	.\]
	exist, then $\lim_{x\to a}(f(x) + g(x))$ exists and is:
	\[
		\lim_{x\to a}(f(x) + g(x)) = \lim_{x\to a}f(x) + \lim_{x\to a}g(x)
	.\]
	The limit of a sum of functions is the sum of the limits of those functions.
\end{thrm}

\begin{thrm}
	\label{prodlaw}
	Product Law.
	Let $f$ and $g$ be functions and let $a \in \mathbb{R}$.
	If the limits:
	\[
		\lim_{x\to a}f(x)
		\quad
		\text{and}
		\quad
		\lim_{x\to a}g(x)
	.\]
	exist, then
	\[
		\lim_{x\to a}f(x)g(x)
	.\]
	exists and
	\[
		\lim_{x\to a}f(x)g(x) = \lim_{x\to a}f(x)\lim_{x\to a}g(x)
	.\]
	The limit of a product of functions is the product of the limits of those functions.
\end{thrm}

\begin{thrm}
	\label{quotlaw}
	Quotient Law.
	Let $f$ and $g$ be functions and let $a \in \mathbb{R}$.
	If the limits:
	\[
		\lim_{x\to a}f(x)
		\quad
		\text{and}
		\quad
		\lim_{x\to a}g(x)
	.\]
	exist and
	\[
		\lim_{x\to a}g(x) \neq 0
	.\]
	then
	\[
		\lim_{x\to a}\frac{f(x)}{g(x)}
	.\]
	exists and
	\[
		\lim_{x\to a}\frac{f(x)}{g(x)} = \frac{\lim_{x\to a}f(x)}{\lim_{x\to a}g(x)}
	.\]
	The limit of a quotient of functions is the quotient of the limits of those functions.
\end{thrm}

There are also two simple functions whose limits we can assume.

\begin{thrm}
	Limits of simple functions.

	Let $a,c \in \mathbb{R}$, then:
	\begin{align*}
		\lim_{x\to a}c & = c\\
		\lim_{x\to a}x & = a
	\end{align*}
\end{thrm}

\begin{thrm}
	Constant Multiple Law.
	Let $f$ be a function, and let $a \in \mathbb{R}$.
	Suppose that $c$ is a constant.
	If the limit:
	\[
		\lim_{x\to a}f(x)
	.\]
	exist, then
	\[
		\lim_{x\to a}cf(x)
	.\]
	exists and
	\[
		\lim_{x\to a}cf(x)=c\lim_{x\to a}f(x)
	.\]
	The limit of a constant times a function is the constant times the limit of the function.
\end{thrm}

If we use the product law in theorem \ref{prodlaw} repeatedly with $g(x) = f(x)$, we obtain the following power law:

\begin{thrm}
	Power Law.
	Let $f$ be a function and let $a \in \mathbb{R}$.
	Suppose that $n$ is a positive integer.
	If the limit:
	\[
		\lim_{x\to a}f(x)
	.\]
	exists, then
	\[
		\lim_{x\to a}[f(x)]^n
	.\]
	exists, and
	\[
		\lim_{x\to a}[f(x)]^n = \left[\lim_{x\to a}f(x)\right]^n
	.\]
\end{thrm}

And lastly,

\begin{thrm}
	\label{rlaw}
	Root Law.
	Let $f$ be a function and let $a\in \mathbb{R}$.
	Suppose that $n$ is a positive integer.
	If the limit:
	\[
		\lim_{x \to a}f(x)
	.\]
	exists, then
	\[
		\lim_{x \to a}\sqrt[\leftroot{-2}\uproot{2}n]{f(x)}
	.\]
	exists, and
	\[
		\lim_{x \to a}\sqrt[\leftroot{-2}\uproot{2}n]{f(x)} = \sqrt[\leftroot{-2}\uproot{2}n]{\lim_{x \to a}f(x)}
	.\]
	If $n$ is even, we assume that $\lim_{x \to a}f(x) > 0$.
\end{thrm}

\begin{exmp}
	Does the following limit exist, and if it does, evaluate it:
	\[
		\lim_{x \to 3}(x^2 - 9)
	.\]
	We see that:
	\begin{align*}
		\lim_{x \to 3}(x^2 - 9) & = \lim_{x \to 3}x^2 + \lim_{x \to 3}(-9) \\
					& = \lim_{x \to 3}x \cdot \lim_{x \to 3}x + \lim_{x \to 3}(-9) \\
					& = 3 \times 3 + (-9) \\
					& = 0.
	\end{align*}
	Therefore, the limit exists and is equal to 0.
\end{exmp}

\begin{thrm}
	Direct Substitution Property.
	If $f$ is a polynomial or a rational function and $a$ is in the domain of $f$, then:
	\[
		\lim_{x \to a} = f(a)
	.\]
	Functions with this property are called \textit{continuous}.
\end{thrm}

\begin{exmp}
	Evaluate the limit:
	\[
	\lim_{x \to 1}\frac{x^2 -1}{x-1}
	.\]
	Note that $\lim_{x \to 1}(x-1)=0$.
	This means we cannot use the quotient law in theorem \ref{quotlaw}, but must take an alternative approach:
	\begin{align*}
		\lim_{x \to 1}\frac{x^2-1}{x-1} & = \lim_{x \to 1}\frac{(x-1)(x+1)}{x-1} \\
						& = \lim_{x \to 1}(x+1) \\
						& = 1 + 1 \\
						& = 2.
	\end{align*}
	This solution implicitly uses a very simple and important fact known as the replacement law.
\end{exmp}

\begin{thrm}
	Replacement Law.
	Let $f$ and $g$ be functions and let $a\in \mathbb{R}$.
	Assume that $f(x) = g(x)$ whenever $x\neq a$.
	Then either both $f$ and $g$ have limits at $a$ and:
	\[
		\lim_{x \to a}f(x) = \lim_{x \to a}g(x)
	.\]
	or, neither limit exists.
\end{thrm}

\begin{exmp}
	Evaluate the limit:
	\[
		\lim_{t \to 0}\frac{\sqrt{t^2 + 9}-3}{t^2}
	.\]
	Unable to apply quotient law in theorem \ref{quotlaw}, since limit of the denominator is 0.
	We can rationalise the numerator (called multiplying by the conjugate):
	\begin{align*}
		\lim_{t \to 0}\frac{\sqrt{t^2+9}-3}{t^2} & = \lim_{t \to 0}\frac{\sqrt{t^2+9}-3}{t^2}\cdot \frac{\sqrt{t^2 + 9} + 3}{\sqrt{t^2 + 9} + 3} \\
							 & = \lim_{t \to 0}\frac{(t^2+ 9)-9}{t^2\left(\sqrt{t^2 + 9}+3\right)} \\
							 & = \lim_{t \to 0}\frac{t^2}{t^2\left(\sqrt{t^2+9}+3\right)} \\
							 \intertext{Using the quotient law in theorem \ref{quotlaw}:}
							 & = \frac{\lim_{t \to 0}1}{\lim_{t \to 0}\left(\sqrt{t^2 + 9}+3\right)} \\
							 \intertext{Using the sum law in theorem \ref{sumlaw}:}
							 & = \frac{1}{\lim_{t \to 0}\sqrt{t^2+9}+\lim_{t \to 0}3} \\
							 \intertext{Using the root law in theorem \ref{rlaw}:}
							 & = \frac{1}{\sqrt{\lim_{t \to 0}(t^2+9)}+\lim_{t \to 0}3} \\
							 & = \frac{1}{6}
	\end{align*}
\end{exmp}

Some limits are best calculated by first finding the left and right hand limits.

\begin{thrm}
	\label{tsides}
	This statement holds true:
	\[
		\lim_{x \to a}f(x) = L
	.\]
	if and only if:
	\[
		\lim_{x \to a^-}f(x) = L = \lim_{x \to a^+}f(x)
	.\]
	A two sided limit exists if and only if both of the one-sided limits exist and are equal.
\end{thrm}

\begin{exmp}
	Prove that the following limit does not exist:
	\[
	\lim_{x \to 0}\frac{|x|}{x}
	.\]
	Using the facts that $|x| = x$ when $x>0$ and $|x| = -x$ when $x<0$, approaching from the right:
	\begin{align*}
		\lim_{x \to 0^+}\frac{|x|}{x} & = \lim_{x \to 0^+}\frac{x}{x} \\
					      & = \lim_{x \to 0^+}1 \\
					      & = 1 \\
					      \intertext{Approaching from the left:}
		\lim_{x \to 0^-}\frac{|x|}{x} & = \lim_{x \to 0^-}\frac{-x}{x} \\
					      & = \lim_{x \to 0^-}(-1) \\
					      & = -1
	\end{align*}
	Since the right and left hand limits are different, if follows from theorem \ref{tsides} that $\lim_{x \to 0}\frac{|x|}{x}$ does not exist.
\end{exmp}
\bigbreak
The next two theorems give two additional properties of limits.

\begin{thrm}
	Let $f$ and  $g$ be functions, and let $a \in \mathbb{R}$.
	Assume that:
	\[
		\lim_{x \to a}f(x)
		\quad
		\text{and}
		\quad
		\lim_{x \to a}g(x)
		\quad
		\text{exist}
	.\]
	And that $f(x) \leqslant g(x)$ for all $x$ in an open interval of the form $(a-\delta ,a+\delta)$ for some positive $\delta \in \mathbb{R}$ (except possibly at $a$ itself).
	Then:
	\[
		\lim_{x \to a}f(x) \leqslant \lim_{x \to a}g(x)
	.\]
\end{thrm}

\newpage

\section{The Squeeze Theorem}%
\label{sec:the_squeeze_theorem}



\begin{thrm}
	Squeeze Theorem.
	Let $f$, $g$, and $h$ be functions, and let $a\in \mathbb{R}$.
	Assume that:
	\[
		\lim_{x \to a}f(x)
		\ 
		\text{exists}
	.\]
	\[
		\lim_{x \to a}h(x)
		\ 
		\text{exists}
	.\]
	\[
		\lim_{x \to a}f(x) = \lim_{x \to a}h(x)
		\ 
		\text{is true}
	.\]
	And that $f(x) \leqslant g(x) \leqslant h(x)$ for all $x$ in an open interval of the form $(a-\delta ,a+ \delta)$ for some positive $\delta \in \mathbb{R}$ (except possibly at $a$ itself).

	Then:
	\[
		\lim_{x \to a}g(x)
		\ 
		\text{exists}
	.\]

	And:
	\[
		\lim_{x \to a}g(x) = \lim_{x \to a}f(x) = \lim_{x \to a}h(x)
		\ 
		\text{is true}
	.\]
\end{thrm}

\begin{exmp}
	Show that:
	\[
	\lim_{x \to 0}x^2 \sin \frac{1}{x} = 0
	.\]
	\begin{sol}
		Note that we cannot use:
		\[
		\lim_{x \to 0}x^2 \sin \frac{1}{x} = \lim_{x \to 0}x^2 \cdot \lim_{x \to 0}\sin \frac{1}{x}
		.\]
		because $\lim_{x \to 0}\sin \frac{1}{x}$ does not exist.
		Instead, we apply the squeeze theorem.
		Note that the function in question is bounded by the $\sin \frac{1}{x}$ function as such:
		\[
		-1 \leqslant \sin \frac{1}{x} \leqslant 1
		.\]
		The inequality remains true when multiplied by a positive number.
		Since we know that all values of $x^2$ are positive, we can do the following:
		\[
		-x^2 \leqslant x^2 \sin \frac{1}{x} \leqslant x^2
		.\]
		And we know that:
		\[
		\lim_{x \to 0}x^2 = 0
		\quad
		\text{and}
		\quad
		\lim_{x \to 0}-x^2 = 0
		.\]
		Therefore using the squeeze theorem we can conclude that:
		\[
		\lim_{x \to 0}x^2 \sin \frac{1}{x} = 0
		.\]
	\end{sol}
\end{exmp}

\section{The Precise Definition of a Limit}%
\label{sec:the_precise_definition_of_a_limit}

Consider the function:
\[
	f(x) =
	\begin{cases}
		2x-1 & \text{if } x \neq 3\\
		6 & \text{if } x = 3
	\end{cases}
.\]
It is clear that $\lim_{x \to 3}f(x) = 5$.
\bigbreak
\noindent
Now let us ask:
\begin{quote}
	How close to 3 does $x$ have to be so that $f(x)$ differs from 5 by less than 0.1?
\end{quote}
The distance from $x$ to 3 is $|x-3|$ and the distance from $f(x)$ to 5 is $|f(x)-5|$ so we need a number $\delta$ such that:
\[
	|f(x)-5| < 0.1
	\quad
	\text{if}
	\quad
	|x-3| < \delta
	\quad
	\text{but}
	\ 
	x \neq 3
.\]
Note that if $|x-3|>0$ then $x\neq 3$ so:
\[
	|f(x)-5| < 0.1
	\quad
	\text{if}
	\quad
	0<|x-3| < \delta
.\]
Notice that if $0<|x-3|<(0.1)/2 = 0.05$, then:
\begin{align*}
	|f(x)-5| & = |(2x-1)-5|\\
		 & = |2x-6|\\
		 & = 2|x-3| < 2(0.05) = 0.1
\end{align*}
And therefore
\[
	|f(x)-5| < 0.1
	\quad
	\text{if}
	\quad
	0<|x-3|<0.05
.\]
Note that we can generalise to:
\[
	|f(x)-5| < \varepsilon
	\quad
	\text{if}
	\quad
	0<|x-3|<\frac{\varepsilon}{2}
.\]
Which can be rewritten to:
\[
\text{if}
\quad
3-\delta < x < 3+\delta
\quad
\text{then}
\quad
5-\varepsilon < f(x) < 5+\varepsilon
.\]
Which is a precise way of saying that $f(x)$ is close to 5 when $x$ is close to 3, because we can make $f(x)$ within an arbitrary distance $\varepsilon$ from 5 by restricting the values of $x$ to be within a distance $\frac{\varepsilon}{2}$ from 3.
\begin{definition}
	Precise definition of a Limit.
	Let $f$ be a function defined on some open interval that contains the number $a$, except possibly at $a$ itself.
	Then we say that the limit of $f(x)$ as $x$ approaches $a$ is $L$, and we write:
	\[
		\lim_{x \to a}f(x) = L
	.\]
	if for every number $\varepsilon > 0$ there is a number $\delta > 0$ such that:
	\[
		\text{if}
		\quad
		0<|x-a|<\delta
		\quad
		\text{then}
		\quad
		|f(x)-L|<\varepsilon
	.\]
	or in clearer terms:
	\[
		\text{if}
		\quad
		a- \delta < x < a+\delta
		\quad
		\text{then}
		\quad
		L-\varepsilon < f(x) < L + \varepsilon
	.\]
\end{definition}

\begin{exmp}
	Prove that:
	\[
		\lim_{x \to 3}(4x-5) = 7
	.\]
	Step 1: Preliminary analysis of the problem (guessing a value for $\delta$).
	Let $\varepsilon$ be a given positive number.
	We want to find a number $\delta$ such that:
	\[
		\text{if}
		\quad
		0< |x-3|<\delta
		\quad
		\text{then}
		\quad
		|(4x-5)-7|<\varepsilon
	.\]
	But we can see that:
	\begin{align*}
		|(4x-5)-7| & = |4x-12|\\
			   & = |4(x-3)|\\
			   & = 4|x-3|
	\end{align*}
	Therefore we want a $\delta$ such that:
	\[
		\text{if}
		\quad
		0< |x-3|<\delta
		\quad
		\text{then}
		\quad
		4|x-3|<\varepsilon
	.\]
	Which therefore means that:
	\[
		\text{if}
		\quad
		0< |x-3|<\delta
		\quad
		\text{then}
		\quad
		|x-3|<\frac{\varepsilon}{4}
	.\]
	Which suggests that we should choose $\delta = \frac{\varepsilon}{4}$.
	\bigbreak
	\noindent
	Step 2: Proof.
	Given $\varepsilon>0$, choose $\delta = \frac{\varepsilon}{4}$.
	If $0<|x-3|<\delta$, then:
	\begin{align*}
		|(4x-5)-7| & = |4x-12|\\
			   & = 4|x-3|< 4\delta\\
		4\delta	   & = 4\left(\frac{\varepsilon}{4}\right)\\
			   & = \varepsilon.
	\end{align*}
	Thus:
	\[
		\text{if}
		\quad
		0<|x-3|<\delta
		\quad
		\text{then}
		\quad
		|(4x-5)-7|<\varepsilon
	.\]
	Therefore, by the definition of the limit:
	\[
		\lim_{x \to 3}(4x-5) = 7
	.\]
\end{exmp}

\subsection{One Sided Limits}%
\label{sub:one_sided_limits}


The intuitive definitions of one-sided limits can be precisely formulated as follows:

\begin{definition}
	Left-Hand Limit.
	The following equation holds true:
	\[
		\lim_{x \to a^-}f(x) = L
	.\]
	if for every number $\varepsilon>0$ there is a number $\delta >0$ such that:
	\[
		\text{if}\quad a-\delta < x < a\quad \text{then}\quad |f(x)-L| < \varepsilon
	.\]
\end{definition}

\begin{definition}
	Right-Hand Limit.
	The following equation holds true:
	\[
		\lim_{x \to a^+}f(x) = L
	.\]
	if for every number $\varepsilon>0$ there is a number $\delta >0$ such that:
	\[
		\text{if}\quad a< x < a+\delta \quad \text{then}\quad |f(x)-L| < \varepsilon
	.\]
\end{definition}

\begin{exmp}
	Use the right hand limit definition to prove that $\lim_{x \to 0^+}\sqrt{x}=0$ :

	First, guess a value for $\delta$.
	Let $\varepsilon$ be a given positive number.
	Here $a=0$ and $L=0$, so we want to find a number $\delta$ such that:
	\[
		\text{if}
		\quad
		0 < x < \delta
		\quad
		\text{then}
		\quad
		|\sqrt{x}-0|<\varepsilon
	.\]
	or:
	\[
		\text{if}
		\quad
		0 < x < \delta
		\quad
		\text{then}
		\quad
		\sqrt{x}<\varepsilon
	.\]
	If we square both sides of the inequality $\sqrt{x}<\varepsilon$, we get:
	\[
		\text{if}
		\quad
		0 < x < \delta
		\quad
		\text{then}
		\quad
		x<\varepsilon^2
	.\]
	Suggesting that we should choose $\delta = \varepsilon^2$.
	Now we need to show that this $\delta$ works.

	Given that $\varepsilon > 0$, let $\delta = \varepsilon^2$.
	If $0<x<\delta$, then:
	\[
		\sqrt{x}<\sqrt{\delta} = \sqrt{\varepsilon^2} = \varepsilon
	.\]
	so
	\[
		|\sqrt{x}-0| < \varepsilon
	.\]
	According to the definition of the right hand limit, this shows that:
	\[
		\lim_{x \to 0^+}\sqrt{x} = 0
	.\]
\end{exmp}

\subsection{Infinite Limits}%
\label{sub:infinite_limits}

Infinite limits can also be defined in a precise way.

\begin{definition}
	Infinite Limit.
	Let $f$ be a function defined on some open interval that contains the number $a$, excepts possibly at $a$ itself.
	Then:
	\[
		\lim_{x \to a}f(x) = \infty
	.\]
	means that for every positive number $M$ there is a positive number $\delta$ such that:
	\[
		\text{if}
		\quad
		0 < |x-a| < \delta
		\quad
		\text{then}
		\quad
		f(x) > M
	.\]
\end{definition}

\begin{exmp}
	Use the definition of the infinite limit to prove that $\lim_{x \to 0}\frac{1}{x^2}= \infty$.

	First, let $M$ be a given positive number. We want to find a number $\delta$ such that:
	\[
		\text{if}
		\quad
		0 < |x-0| < \delta
		\quad
		\text{then}
		\quad
		\frac{1}{x^2} > M
	.\]
	But:
	\begin{align*}
		\frac{1}{x^2} > M  & \iff x^2 < \frac{1}{M}\\
				   & \iff \sqrt{x^2} < \sqrt{\frac{1}{M}}\\
				   & \iff |x| < \frac{1}{\sqrt{M}}
	\end{align*}
	So if we choose $\delta= \frac{1}{\sqrt{M}}$ and $0<|x|<\delta=\frac{1}{\sqrt{M}}$, then $\frac{1}{x^2} > M$.
	This shows that $\frac{1}{x^2}\to \infty$ as $x\to\infty$.
\end{exmp}

\bigbreak
\noindent
Similarly, the following is a precise definition of the negative infinite limit.

\begin{definition}
	Let $f$ be a function defined on some open interval that contains the number $a$, except possible at $a$ itself.
	Then:
	\[
		\lim_{x \to a}f(x) = - \infty
	.\]
	means that for every negative number $N$ there is a positive number $\delta$ such that:
	\[
		\text{if}
		\quad
		0 < |x-a| < \delta
		\quad
		\text{then}
		\quad
		f(x) < N
	.\]
\end{definition}
