# Continuous Functions

posted February 18, 2012

In this post I'll explain some definitions and mechanics of continuous functions. I assume familiarity with function signature notation and related terminology such as domain, codomain, preimage, etc.).

In Calculus we need to differentiate functions, but not all functions are differentiable. A function is differentiable if its derivative exists at every point in its domain. For example, $$f(x) = x^2$$ is differentiable everywhere in its domain $$\mathbb{R}$$ but the absolute value function $$\mbox{abs}(x) = |x|$$ is differentiable only at $$x \ne 0$$. $$\mbox{abs}$$ is differentiable arbitrarily close to $$x = 0$$ on either side, but at $$x = 0$$, $$\mbox{abs}$$ has a cusp, or a singular point with no neighboring points in the curve of the function. We can't decide what the slope of the derivative is at $$x = 0$$, so $$\mbox{abs}$$ is not differentiable at $$x = 0$$.

Cusps are one such example of situations in which a function is not differentiable; another example is a break. A break in a function is just what it sounds like: imagine drawing the graph of such a function, except that at the break point you have to lift your pencil and move elsewhere before resuming the graph.

The graph of this function has two lines: a line approaching the $$y$$ axis from the left at $$y = -1$$ and a line starting at the $$y$$ axis going right at $$y = 1$$. The break is at $$x = 0$$.

If a function contains a "break", we say it is discontinuous. It turns out that one of the requirements for differentiability is continuity. A continuous function is one which has a "smooth" curve at every point in its domain. One way to think about continuity is by looking at whether the function's graph has any breaks. But since we need a general way to test for continuity, we need something more practical and precise than drawing the graph of every function we want to test.

## Sequences and Limits

Another way to test for a function $$f$$ for continuity at a point $$a$$ is to ask, "As inputs to $$f$$ approach $$a$$, does the result $$f(x)$$ approach any particular value?" We can express these inputs as a sequence $$\langle x_n \rangle = \langle x_0, x_1, \ldots, x_n \rangle$$ and express the result as $$f\langle x_n \rangle$$. This is essentially the limit concept; if the sequence has a limit, i.e., if it converges on a specific value, then perhaps the function is continuous at $$a$$.

But this has a problem: limits must be tested from both the left and the right. A function's so-called "left-hand" limit might differ from its "right-hand" limit.

Take $$g(x)$$ as an example. If we were to compute the left-hand limit at $$x = 0$$ with a sequence such as $$x_n = \langle -1.0, -0.5, -0.25, -0.0001, \ldots \rangle$$, we'd see that the function appears constant, i.e., $$g\langle x_n \rangle = -1$$. However, if we tested from the right with $$x_n = \langle 1.0, 0.5, 0.25, 0.0001, \ldots \rangle$$, we'd see that $$g\langle x_n \rangle$$ clearly approaches $$1$$. If both of these limits were equal, we could say that the function has a limit at $$x = 0$$ and is differentiable there.

By now we might be convinced that any continuous function $$f$$ will approach the same limit from both the left and the right, but this does not guarantee that the function is continuous. Limits only describe the potential for the function to be defined at some $$x$$. Consider the function $$f(x) = 1/x$$; no limit exists at $$x = 0$$ since $$1/x$$ is not defined for $$x = 0$$.

## The "$$\epsilon-\delta$$" Definition of Continuity

The idea behind using sequences and limits to think about continuity is the expectation that as inputs to a function get closer and closer to some value $$a$$, so should the value of the function get closer and closer to $$f(a)$$. While this may appear to be the case when looking at the limit behavior of the function to either side of $$a$$, we still need a way to guarantee that there are no "gaps" in the function.

The so-called "$$\epsilon-\delta$$" definition of continuity says that if a function $$f$$ is continuous at $$a$$, the values of the function are sufficiently close to $$f(a)$$ whenever the inputs are sufficiently close to $$a$$. This is essentially a different way of stating what we have already said; formally, for any $$\epsilon > 0$$ such that $$|f(x)-f(a)| < \epsilon$$, there exists some $$\delta > 0$$ such that $$|x - a| < \delta$$.

Put another way, no matter how much we constrain the outputs of the function, there is a corresponding set of inputs we can map to those outputs. For example, what if we were to set $$\epsilon = 0.00000001$$? This definition of continuity says that there is some "margin" of inputs around $$a$$ that map to this interval of $$(f(a) - \epsilon, f(a) + \epsilon)$$. If not, then the function is discontinuous at $$a$$.

Consider another contrived example:

You can see from the graph that $$f$$ is not continuous at $$x = 3$$, but let's apply the test. Let $$\epsilon = 2$$. For values of the function over the interval $$(f(3) - 2, f(3) + 2)$$ we need to find some $$\delta > 0$$ such that $$|x - 3| < \delta$$. Letting $$\delta = 1$$ is sufficient; the values of $$f$$ over the interval $$(f(3) - 2, f(3) + 2)$$ are $$(2, 4)$$, and the corresponding inputs are $$(3 - \delta, 3 + \delta)$$ or $$(2, 4)$$. But let's try a smaller value for $$\epsilon$$.

Suppose $$\epsilon = \frac{1}{2}$$. Then the corresponding interval of interest is $$(f(3) - \frac{1}{2}, f(3) + \frac{1}{2})$$ or $$(3 \frac{1}{2}, 4 \frac{1}{2})$$. Let's try $$\delta = 1$$ again. Then whenever $$|x - 3| < 1$$, $$|f(x) - f(3)| < \frac{1}{2}$$. This means $$x$$ must be in the interval $$(2, 4)$$, but the corresponding values of $$f$$ are $$(f(2), f(4))$$ or $$(2, 4)$$; we have restricted the values of $$f$$ to $$(3 \frac{1}{2}, 4 \frac{1}{2})$$, so $$\delta = 1$$ will not work. We won't be able to find a value for $$\delta$$ because the values of $$f(x)$$ for $$x$$ near $$a$$ are nowhere nearby!

Since the continuity definition states that we should be able to find a $$\delta$$ for any $$\epsilon$$ and we haven't been able to find one for $$\epsilon = \frac{1}{2}$$, we can conclude that $$f$$ is not continuous. The key idea in this example is that the inability to find a matching $$\delta$$ value for $$\epsilon$$ indicates that the trend of the function is inconsistent. We would expect values of $$f$$ to be nearby $$f(a)$$ if $$f$$ were continuous, but the $$\epsilon - \delta$$ method allows us to show that the inputs near $$a$$ result in values of $$f$$ that are nowhere close to $$f(a)$$.

## Open Sets

The values of $$\epsilon$$ and $$\delta$$ mentioned above define the intervals on which the function is continuous; for example, $$|x - a| < \delta$$ indicates that $$f$$ is continuous on the interval $$(a - \delta, a + \delta)$$, and similarly for the Y-axis interval $$(f(a) - \epsilon, f(a) + \epsilon)$$.

These intervals are open intervals; an open interval $$(a, b)$$ is the set of points $$x$$ where $$a < x < b$$. We contrast this with closed intervals such as $$[a, b]$$ which include the points $$a \le x \le b$$.

The epsilons and deltas in the preceding method are hard to deal with; the method asserts that such values exist, but to apply the method successfully we must find them. This requires successive laborious testing, and in some cases we may need to use extremely small values of $$\epsilon$$ to show that no such $$\delta$$ exists. In any case, an exhaustive search would be required. We need a better representation for this idea.

The open intervals described above are a specific case of a more general structure called an open set. A set $$S \subseteq \mathbb{R}$$ is open if for every $$x \in S$$ and some $$\delta > 0$$ there is an open interval $$(x - \delta, x + \delta)$$ contained in $$S$$. This says that for any point in $$S$$, there is a "neighborhood" of points around $$x$$ which are also in $$S$$.

To see how this is possible, consider $$S = (1, 2)$$. For values very close to $$1$$ there are always values even closer to $$1$$ that we can use to outline some "breathing space" around $$1$$. Take, for example, $$1.1$$. Since we're dealing with real numbers it's easy to come up with a real number even closer to $$1$$, such as $$1.09$$. We can use the difference ($$0.01$$) to create an open interval around $$1.1$$, $$(1.1 - 0.01, 1.1 + 0.01)$$. Using this technique it should be clear that this is possible for any $$x$$ in the interval $$(1, 2)$$ because we are excluding the endpoints of the interval and we can always find points between the point of interest and one of the endpoints. In summary, the idea is that for any $$x$$ there must be some points around $$x$$ also contained in $$S$$. The value of $$\delta$$ will usually depend on the value of $$x$$.

An equivalent expression of the $$\epsilon - \delta$$ definition using open sets is as follows:

If a function $$f: \mathbb{R} \to \mathbb{R}$$ is continuous, then $$f^{-1}(S)$$ is open whenever $$S$$ is open.