\chapter{Continuous function}
\section{Limits}


\begin{definition}[Real function]
A \emph{real function} is a function $f : X \to \mathbb{R}$
\end{definition}
Many  (maybe even all) functions you'd be familiar with are real functions; polynomial functions, trigonometric functions, exponential functions, logarithms, rational functions, anything that sends a real number to another real number.


We are familiar with limits of real sequences, however there is a distinct but related notion of a limit of a real function.
\begin{definition}[Limit at a point of a real function]
For a real function $f$, its \emph{limit at $p$} is a number $L$ suuch that for any positive $\varepsilon$, we can find a positive $\delta$ so that whenever $|x-p|$ we have  $| f(x) -L\| < \varepsilon$. Basically, as $x$ converges to $p$, $f(x)$ converges to $L$.

\[ \lim_{x \to c} f(x) = L \iff \forall \varepsilon \in (0,\infty) ( \exists \delta \in (0,\infty) [ |x-c| < \delta \implies |f(x) - L| < \varepsilon ] )\]
\[ \lim_{x \to c} f(x) = L \iff \forall (x_n)_{n \in \mathbb{N}} [ \lim_{n \to \infty}x_n = c \implies \lim_{n \to \infty} f(x_n)=L ] \]
\end{definition}



\begin{definition}[Limit at a point of a real function]
Let $f : X \to \mathbb{R}$ be a real function, then the \emph{limit of $f$ at $p$} is a number $L$ such that any sequence $(x_n)$ contained in $X$ converging to $p$, $(f(x_n))$ converges to $L$
	%suuch that for any positive $\varepsilon$, we can find a positive $\delta$ so that whenever $|x-p|$ we have  $| f(x) -L\| < \varepsilon$. Basically, as $x$ converges to $p$, $f(x)$ converges to $L$.

%\[ \lim_{x \to c} f(x) = L \iff \forall \varepsilon \in (0,\infty) ( \exists \delta \in (0,\infty) [ |x-c| < \delta \implies |f(x) - L| < \varepsilon ] )\]
\[ \lim_{x \to p} f(x) = L \iff \forall (x_n)_{n \in \mathbb{N}} \subseteq X [ x_n \to p \implies \lim_{n \to \infty} f(x_n)=L ] \]
\end{definition}






Although our intuition already suggests this, it is important for the sake of mathematical rigor to check that a real function's limit at a point is a unique real number.


Since we are working in a 1-dimensional space, we can consider limits taken from the left (or right) side of the real line. This is known as a \emph{one-sided limit}.


-Left sided limit
-Right sided limit

Since these are the only 2 directions a limit may take on the real line, we have the following.

\begin{proposition}
\[\lim_{x\to c} f(x)= L \iff  \lim_{x\to c^{+}} f(x)= L  \land \lim_{x\to c^{-}} f(x)= L \]
\end{proposition}

\section{Continuous function}

\begin{definition}[Continuous real function]
A real function is \emph{continuous at $x_0$} iff the following limit exists.
\[ \lim_{x \to x_0} f(x) = f(x_0) \]
%\[  \forall \varepsilon \exists \delta [ |x-x_0| < \delta \implies |f(x)-f(x_0)| < \varepsilon ] \]
A function is said to be continuous on $U$ iff it is continuous for every $u \in U$.
A \emph{continuous function} is a function continuous on it's domain. 
\end{definition}


\begin{proposition}
A real function is continuous at $x_0$ iff the following limit exists.
\[ \lim_{x \to x_0} f(x) = f(x_0) \]
%A function is continuous on $U$ iff it is continuous for every $u \in U$.
%A \emph{continuous function} is a function continuous on it's domain. 
\end{definition}

We have just defined limits rigorously, so we understand that within our definition of continuity there is some epsilon-delta magic that awaits. If we want to prove a function to be continuous on some $U$, we often need to unravel the definition of a continuous functions to its epsilon-delta form.

There is also a more powerful definition for continuous functions that can be defined for any topological space. I highly suggest the interested student to read General Topology; Real Analysis with a side of General topology goes together like chocolate with a side of strawberrys. I will copy the definition from General topology here, however it contains terminology that belongs to the realm of General Topology.

\begin{definition}
A function is \emph{continuous at $x_0$} iff for any neighborhood $U \subseteq \mathrm{im}(f)$ of $f(x_0)$, $f^{-1}(U)$ is a neighborhood of $x_0$. 
\end{definition}

A 'neighborhood' of a point $p$ in a loose sense is an open set containing $p$. So any open interval with $p$ is a neighborhood. If you imagine a sequence of neighborhoods $(U_n)$ gradually shrinking around $f(x_0)$, continuity means we have a sequence of neighborhoods $(f^{-1}(U))$ slowly shrinking around $x_0$; this is one way to see roughly how this definition complements our limit definition. Again, check our General Topology if you want the full picture.


\begin{definition}[Uniformly continuous real function]
A real function is \emph{uniformly continuous on $U$} iff  
\[ f \text{ is uniformly continuous on } U \iff  \forall \varepsilon \exists \delta \forall x_1 , x_2 \in U [ |x_1 -x_2| < \delta \implies  |f(x_1)-f(x_2)| < \varepsilon ] \]
\end{definition}



\begin{definition}[Lipschitz continuous real function]
A real function is \emph{Lipschitz continuous on $U$} iff  
	\[ f \text{ is Lipschitz continuous on } U \iff \exists M [  \forall x_1 ,x_2 \in U [ |f(x_1)-f(x_2)| \leq M |x_1 -x_2| ] ] \]
\end{definition}

Uniformly continuous functions are continuous
Lipschitz functions are uniformly continuous


\section{Results}

\subsection{Extreme value theorem}

\begin{theorem}[Extreme value theorem]
Let $X \subseteq \mathbb{R}$ and $f : X \to \mathbb{R}$ be a real function continuous on some compact interval $[a,b]$, then there exists some maximum and minimum of $f$ on $[a,b]$.
\end{theorem}


\subsection{Intermediate value theorem}
\begin{theorem}[Intermediate value theorem]
Let $X \subseteq \mathbb{R}$ and $f : X \to \mathbb{R}$ be a real function continuous on some compact interval $[a,b]$, then for any $\eta \in [f(a),f(b)]$, there is some $\xi \in [a,b]$ such that $f(\xi)=\eta$.
\end{theorem}
