In a standard calculus course, we often learn functions that are differentiable, namely functions that are continuous, have no “sharp turns”, and have no vertical tangent line. So, a function like \(f(x) = x\) is differentiable but \(g(x) = \vert x \vert\) and \(h(x) = \sqrt[3]{x}\) are not since \(g\) has a “sharp turn” at 0 and \(h\) has a vertical tangent line at 0.

To be more precise, a function \(f \colon A \to \mathbb{R}\) is said to be differentiable at \(c \in A\) if \(f'(x) = \lim_{x \to c} \frac{f(x)-f(c)}{x-c}\) exists. One beautiful result of this definition is that differentiability implies continuity.

**Theorem 1.1.1.** *If \(f \colon A \to \mathbb{R}\) is differentiable at \(c \in A\), then \(f\) is continuous at \(c\). *

*Proof. * Suppose \(f\) is differentiable at \(c\), so \(f'(x) = \lim_{x \to c} \frac{f(x)-f(c)}{x-c}\) exists. Notice that \(\lim_{x \to c} (f(x)-f(c)) = \lim_{x \to c} (\frac{f(x)-f(c)}{x-c})(x-c) = f'(c) \cdot 0 = 0\). Therefore, \(\lim_{x \to c} f(x) = f(c)\), thus \(f\) is continuous at \(c\). ∎

Now you may wonder, what are the functions that are integrable? Is there even a function that is not integrable? What is the relationship between continuity and integrability? To answer these questions, we need to rigorously define what it means to be integrable just like how we did for differentiability.

In a standard calculus course, it is not often discussed whether a function is integrable. We learn about Riemann sums and how the upper sum is an overestimation and how the lower sum is an underestimation of the area under the curve. And to find the exact area under the curve, we make the width of each rectangle infinitesimally small, so that when you add all those rectangles up, you get the exact area under the curve. So, you have probably seen this: \(\int_a^b f(x) \, dx = \lim_{n \to \infty} \sum_{i=1}^n f(x_i^*) \Delta x_i\) where \(x_i^*\) is any number that is in the \(i^{th}\) subinterval.

Now consider \(f \colon \mathbb{R} \to \{0, 1\}\) where \(f(x) = \begin{cases} 1 & \text{if } x \in \mathbb{Q}, \\ 0 & \text{if } x \notin \mathbb{Q}. \end{cases}\). This function is also known as the Dirichlet function, named after the German mathematician *Peter Gustav Lejeune Dirichlet .*

Say we want to compute \(\int_0^1 f(x) dx\). No matter how we partition \([0,1]\), you can find a rational number and an irrational number in each subinterval since \(\mathbb{Q}\) and \(\mathbb{I}\) are both dense in \(\mathbb{R}\). This means that our smallest value in each subinterval is 0 and the largest value in each subinterval is 1. This implies that letting \(f(x_i^*)\) be the smallest value in that subinterval results in \(\int_0^1 f(x) dx = 0\), but letting \(f(x_i^*)\) be the largest value in that subinterval results in \(\int_0^1 f(x) dx = 1\). We all know that \(0 \not= 1\), so… what went wrong?

We need to know for sure that \(f\) is integrable before we can compute \(\int_0^1 f(x) dx\). Before we do that, let’s introduce some notation. Let \(P\) of \([a,b]\) be a finite set of points in \([a,b]\) (we call this a partition of \([a,b]\)). The convention is to list these points in increasing order, so an example of \(P\) in \([0,1]\) might be \(P=\{0, 0.2, 0.4, 0.5, 0.7, 0.9 ,1\}\). Now, let arbitary \(P=\{a=x_0, x_1, x_2, ... ,x_n=b\}\). We define \(m_k = \inf\{f(x) \vert x \in [x_{k-1}, x_k] \}\) (the smallest value of \(f(x)\) in \(k^{th}\) subinterval) and \(M_k = \sup\{f(x) \vert x \in [x_{k-1}, x_k] \}\) (the largest value of \(f(x)\) in \(k^{th}\) subinterval). Then, the lower and upper sum of \(f\) with the partition \(P\) is given by \(L(f,P) = \sum_{k=1}^n m_k(x_k - x_{k-1})\) and \(U(f,P) = \sum_{k=1}^n M_k(x_k - x_{k-1})\) respectively. Now, let \(\mathcal{P}\) be the set of all possible partitions of \([a,b]\). So, any \(P\) of \([a,b]\) is an element of \(\mathcal{P}\). We define lower integral of \(f\) as \(L(f) = \sup\{L(f,P) \vert P \in \mathcal{P} \}\) (greatest \(L(f,P)\) out of every partition \(P\)). Similarily, we define upper integral of \(f\) as \(U(f) = \inf\{U(f,P) \vert P \in \mathcal{P} \}\) (smallest \(U(f,P)\) out of every partition \(P\)). It is not hard to see that \(U(f) \geq L(f)\) if \(f\) is bounded.

Finally, let us define what it means for a function to be integrable (more specifically, Riemann-integrable).

**Definition 1.1.2.** *A bounded function \(f\) defined on \([a,b]\) is Riemann-integrable if \(U(f) = L(f)\).*

If \(f\) is Riemann-integrable, then \(\int_a^b f(x) dx = U(f) = L(f)\). One nice aspect of this definition is that continuity implies integrability.

Now using the Definition 1.1.2, let’s show that the Dirichlet function \(f\) is not Riemann-integrable on \([0,1]\).

*Proof. * Let \(P\) be a partition of \([0,1]\). If \([a,b] \subseteq [0,1]\) with \(a < b\), then \(\sup\{f(x) \vert x \in [a, b] \} = 1\) becasue \(\mathbb{Q}\) is dense in \(\mathbb{R}\) and \(\inf\{f(x) \vert x \in [a, b] \} = 0\) because \(\mathbb{I}\) is dense in \(\mathbb{R}\) as well. This implies that for every partition \(P\), it follows that \(L(f, P) = 0\) and \(U(f, P) = 1\). Therefore, \(L(f) = 0\) and \(U(f) = 1\). Since \(L(f) \not = U(f)\), then \(f\) is not Riemann-integrable on \([0,1]\). ∎

Indeed, you can extend this to show that the Dirichlet function is not Riemann-integrable on \(\mathbb{R}\).

You can now see that Riemann-integration is not perfect. In addition to poor handling of functions with many discontinuities, it also has a problem with unbounded functions, such as \(\int_{-1}^1 \frac{1}{x} dx\). Now you are wondering, is there a solution to these problems? The answer is yes: Lebesgue-integration. Lebesgue definition of integral uses horizontal slabs that are not necessarily rectangles unlike Riemann’s, and it can compute intergrals for a much wider range of functions including the Dirichlet function.

Learning more about the Lebesgue-integration is left as an exercise to the reader.