Limits and continuity


A clear knowledge of limits and continuity is essential to understand more advanced topics in calculus, such as derivatives.

This article will prepare you for these concepts.


To understand limits and continuity, we recommend familiarity with the concepts in

Follow the above links to first get acquainted with the corresponding concepts.


The sigmoid function is a popular function in machine learning. It is defined as follows

$$ \begin{align} & \sigma(x) = \frac{1}{1 + \exp^{-x}} \\ \end{align}$$

Crazy people like us, the machine learners, often wonder: what is the maximum and minimum value of \( \sigma(x) \) for \( x \in \real \)?

We try various values of \( x \). Try this interactive function plot to explore the values of the sigmoid function as you change value of \( x \) by dragging the grey circle.

We observe a few things.

  • For positive increasing values of \( x \), the outputs are increasing. Moreover, they are getting closer to 1.0, but not quite there.
  • For negative decreasing values of \( x \), the outputs are decreasing and approaching 0.0, but not quite there.

How do we denote these concepts mathematically? With the limits notation.

$$ \lim_{x \to \infty} \sigma(x) = 1 $$ $$ \lim_{x \to -\infty} \sigma(x) = 0 $$

We read this to mean that as the input \( x \) moves closer to \( \infty \), the output of the function \( \sigma(x) \) approaches 1. Does it actually take on the value 1 will depend on what it means for the \( x \) to take on the value \( \infty \).

Limits are an important mathematical concept regarding the behavior of a function near a point. So, \( \lim_{x \to p} f(x) = L \), means that the output of the function \( f(x) \) gets closer to \( L \) as the input \( x \) gets closer to \( p \).

Limits of example functions

Below, we have provided some example functions and their limits.

One-sided limits

Let's take another popular function in machine learning. The Heaviside step function or the unit step function is defined as follows

$$ H(x) = \begin{cases} 1, \text{ if } x \ge 0 \\ 0, \text{ otherwise } \\ \end{cases} $$

So, we know that \( H(0) = 1 \). We can also write this in the limits notation introduced earlier as

$$ \lim_{x \to 0} H(x) = 1 $$

Or, can we? Are we coming closer to zero from the positive side or the negative side? If we are approaching from the positive side, then sure, we can claim that to be 1. But, if we are visiting zero from the negative side then a point very very very very close to zero will have a \(H(x) = 0 \). Mathematically, if \( 0^+ \) and \( 0^{-} \) denote the positive and negative side of zero respectively, then we can denote this as follows

$$ \lim_{x \to 0^+} H(x) = 1 $$ $$ \lim_{x \to 0^-} H(x) = 0 $$

Such one-sided limits, that depend on the direction of approach, are known as, well, one-sided limits.


In the case of the Heaviside function, we note that the two one-sided limits do not match. This means cannot really write \( \lim_{x \to 0} H(x) \), without specifying the direction of approach.

In other words, the limit \( \lim_{x \to 0 } H(x) \) does not exist!

It is then said that the function \( H(x) \) is discontinuous at the point 0. For any other input in the domain of \( x \), the limit exists. Thus, one says that the function \( H(x) \) is continuous on the negative interval and on the positive interval, but not continous at zero.

In general, for any function \( f(x) \), if \( \lim_{x \to p^+} f(x) \neq \lim_{x \to p^-} f(x) \), then it is said that the limit does not exist at the point \( p \).

A function \( f(x) \) is said to be continuous at a point \( p \), if the limit \( \lim_{x \to p} f(x) \) exists, and that \( \lim_{x \to p} f(x) = f(p) \).

A function \( f(x) \) is said to be continuous within an interval \( [a,b] \), if it is continuous at every point within the interval \( [a,b] \).

So, is sigmoid a continuous function on \( \real \)? Figure that one out.

Examples of discontinuous functions

Below, we have provided some example functions and their limits. The points of discontinuity are highlighted in red.

Where to next?

With a sound understanding of limits and continuity, it is time to dive into derivatives.

Already a calculus expert? Check out comprehensive courses on multivariate calculus, machine learning or deep learning.

Please share

Let your friends, followers, and colleagues know about this resource you discovered.

Let's connect

Please share your comments, questions, encouragement, and feedback.