Although anyone who has completed a basic course in Maths knows what a function is, it is a good idea to review this basic concept and associated terminology, just in case you need a refresher.

This article is a quick recap of some essential ideas for understanding calculus. We have a detailed treatise on functions, in case you are interested.


To better understand functions, we recommend familiarity with the concepts in

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


A function is a relationship that defines how one quantity depends on another.

A function takes an input from a set and maps it to an output from another set. The input set is known as the domain and the output set is known as the codomain or target set of the function. There are many ways to denote functions in machine learning literature, or in Mathematics. Here's the more popular ones.

\begin{aligned} & f: \sX \rightarrow \sY \\ & y = f(x), x \in \sX, y \in \sY \\ & f: x \mapsto y, x \in \sX, y \in \sY \\ \end{aligned}

In these, \( \sX \) is the domain, \( \sY \) is the codomain, \( x \) is the input variable and \( y \) is the output variable.

Note that the codomain provides a set of possible values for the output of the function. The function may not actually realize all possible values in the codomain. For example, consider the square function \( y = x^2 \) defined over the set of natural numbers, \( x \in \natural \). In this case, the domain and the codomain are both \( \natural \). However, for the input sequence \( 1, 2, 3, 4 \ldots \), the output sequence is \( 1, 4, 9 , 16, \ldots \). The natural numbers \(2, 3, 5, 6, 7, \ldots \) are missing from the outputs of the function. In other words, all natural numbers are not realized by the square function. This restricted set of output values that are actually generated by the function is known as its range or the image of the function. Remember this subtle difference between range and codomain of a function. Succinctly, \( \text{image of } f \subseteq \text{codomain of } f \). Note that some texts use range interchangeably to mean codomain or image, rendering it ambiguous. To be precise, it is better to stick with codomain and image and avoid using range, which might be misinterpreted.

Example functions

Where to next?

This was a quick article on functions. Just the essential concepts to understand calculus. Explore functions in more depth in our comprehensive article on functions or choose some other topic from mathematical foundations.

Feeling satisfied with functions? Move on to limits and continuity.

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.