We discuss the important class of continuous functions of one variable. We teach you how to prove that a function is continuous. We also provide several examples and exercises with detailed answers to illustrate our course.

To fully understand the content of this page, some tools on the limit of functions are necessary.

## Generalities on continuous functions

Throughout this paragraph, $\mathscr{D}$ is a subset of $\mathbb{R}$ and $f:\mathscr{D}\to \mathbb{R}$ is a function. The set $\mathscr{D}$ is called the domain of $f$.

**Definition:** We say that $f$ is continuous at point $a\in D$ if $f$ admit a limit $f(a)$ at the point $a$. That is, for any $\varepsilon>0,$ there exists $\delta>0$, such that for any $x\in D,$ $|x-a|<\delta$ implies that $|f(x)-f(a)|<\varepsilon$.

We say that $f$ is continuous on $\mathscr{D}$ if $f$ is continuous on each point of $\mathscr{D}$.

If $f$ and $g$ are continuous functions, the sum, the product, the composition, and the quotient of these functions are also continuous.

**Classical examples:** All polynomial functions are continuous on $\mathscr{D}=\mathbb{R}.$ The square root function $x\mapsto \sqrt{x}$ is continuous on $\mathscr{D}=[0,+\infty)$. The trigonometric function $x\mapsto \sin(x)$ and $x\mapsto \cos(x)$ are continuous on $\mathbb{R}$. The logarithmic function $x\mapsto \ln(x)$ is continuous on $\mathscr{D}=(0,+\infty)$. The exponential function $x\mapsto e^x$ is continuous on $\mathscr{D}=\mathbb{R}$.

The other functions are usually the sum, product, composition, inverse, and quotient of the classical functions above.

**Continuity using sequences**: the function $f$ is continuous at $a\in \mathscr{D}$ if and only if for any sequence $(u_n)_n$ of $\mathscr{D}$ converging to $0,$ the image sequence $( f (u_n))_n$ converges to $f(a)$.

This result is very useful if we want to prove that the function $f$ is not continuous at a point $a$. To do this, it suffices to find two sequences both converging towards $a,$ while their images converge towards different points.

**Theorem:** If $f:[a,b]\to\mathbb{R}$ is continuous then $f$ is bounded on $[a,b]$, this is there exists a real number $M>0$ such that $|f(x)|\le M$ for any $x\in [a,b]$. Moreover, there exists $\alpha,\beta\in [a,b]$ such that \begin{align*} f(\alpha)=\sup_{x\in [a,b]}f(x),\qquad f(\beta)=\inf_{x\in [a,b]}f(x).\end{align*}

## A selection of exercises on continuity of functions

**Exercise:** Determine if the following functions are continuous or not: \begin{align*} f(x)=\begin{cases}\displaystyle\frac{\sin(2x)-\sin(5x)}{\sin(3x)},& x\neq 0,\cr -1,& x=0.\end{cases}\qquad g(x)=\begin{cases} x^x,& x>0,\cr 2,&x=0.\end{cases} \end{align*}

**Solution:** 1) The function $f$ is continuous on $\mathbb{R}\backslash\{0\}$ as the sum and the quotient of continuous functions. Now let us verify the continuity of $f$ at $0$. For that purpose, we shall calculate the limit of $f$ as $0$ and check if it is equal to $f(0)$. Before doing so we recall the following standard result \begin{align*} \lim_{x\to 0,\;x\neq 0} \frac{\sin(x)}{x}=1. \end{align*} Now for any $x\neq 0,$ we have \begin{align*} f(x)&=\frac{x}{\sin(3x)}\times \left(\frac{\sin(2x)}{x}-\frac{\sin(5x)}{x}\right)\cr &= \frac{1}{3}\frac{3x}{\sin(3x)}\times \left(2\frac{\sin(2x)}{2x}-5\frac{\sin(5x)}{5x}\right). \end{align*} Hence \begin{align*} \lim_{x\to 0,\;x\neq 0}f(x)=\frac{1}{3}(2-5)=-1=f(0). \end{align*} It follows that $f$ is continuous on $\mathbb{R}$.

2) For any $x>0$ we can write \begin{align*} g(x)=e^{\ln(x^x)}=e^{x \ln(x)}. \end{align*} This shows that $g$ is continuous on $(0,\infty)$. On the other hand we now that \begin{align*} \lim_{x\to 0^+}x\ln(x)=0. \end{align*} This implies that \begin{align*} \lim_{x\to 0^+} g(x)=1\neq g(0). \end{align*} Then $g$ is not continuous at $0$.

**Exercise:** Consider the function \begin{align*} f(t)=\begin{cases}\frac{\ln(1+2t^2)}{\sin^2(t)} ,& t > 0,\cr 0,& x=2. \end{cases} \end{align*} Prove that $f$ is continuous on $[0,+\infty)$.

**Solution:** The function $f$ is continuous on $(0,+\infty)$, as the quotient of continuous functions. We now show what happens if $t$ is very closed to $0$. For $t\neq 0,$ we have \begin{align*} f(t)=2\frac{\ln(1+2t^2)}{2t^2}\left(\frac{t}{\sin(t)}\right)^2 \end{align*} As \begin{align*} \lim_{t\to 0,t\neq 0} \frac{\ln(1+2t^2)}{2t^2}=1, \end{align*} then \begin{align*} \lim_{t\to 0,t\neq 0}f(x)=2=f(0). \end{align*} This shows that $f$ is also continuous at $0$.

**Exercise:** Let $f$ be defined by \begin{align*} f(x)=\begin{cases} 1,& x\in \mathbb{Q},\cr 0,& x\notin \mathbb{Q}.\end{cases} \end{align*} Prove that $f$ is not continuous at any point of $\mathbb{R}$.

**Solution:** We recall that $g:A\subset \mathbb{R}\to \mathbb{R}$ is continuous at $x\in A$ if and only if for any sequence $(u_n)_n\subset A$ such that $u_n\to x$ as $n\to\infty,$ we have $g(u_n)\to g(x)$.

Using this result, to prove that $f$ is not continuous at $x\in \mathbb{R}$ it suffices to find two sequences $(u_n)_n$ and $(v_n)_n$ both converging to $x$ as $n\to \infty$ but the limits of $f(u_n)$ and $f(v_n)$ as $n\to\infty$ are different. In fact, let $x\in \mathbb{R}$. By density of $\mathbb{Q}$ in $\mathbb{R}$ there exists $(u_n)_n\subset \mathbb{Q}$ such that $u_n\to x$ as $n\to \infty$. By definition of $f$ we have $f(u_n)=1$, so the limit of $f(u_n)$ at infinity is $1$. On the other hand, by the density of $\mathbb{R}\backslash\mathbb{Q}$ in $\mathbb{R}$ there exists $(v_n)_n\subset \mathbb{R}\backslash\mathbb{Q}$ such that $v_n\to x$ as $n\to infty$. By definition of $f,$ we have $f(v_n)=0,$ so the limit of $f(v_n)$ at infinity is $0$. We then conclude that $f$ is not continuous at $x$.