Skip to main content

Function: the Most Important Concept in Mathematics

Example of a Function Rule
Level 2 (without higher mathematics)
Level 2 requires school mathematics. Suitable for pupils.
Updated by Alexander Fufaev on
Table of contents
  1. Necessary ingredient: Sets
  2. Defining a function
  3. Image set of a function
  4. Graph of a function
  5. Injective, surjective or bijective function

Necessary ingredient: Sets

A function needs the concept of a mathematical set. A set \(\mathbb{X}\) is a collection of well-distinguishable elements. You can think of a set as a bag full of all kinds of different toys (elements). In mathematics, it's usually the numbers that are in that bag. Exactly such bags with numbers are needed for the concept of a function. And these numbers are distinct, that is no equal numbers may occur in the set.

The elements of the set \(\mathbb{X}\) are written in curly brackets, separated by a comma:

Example of a set with four elements
Formula anchor

The set \(\mathbb{X}\) consists of four elements. These do not have to be sorted in a particular way. In addition, as it MUST BE, no element (no number) occurs twice in the set.

For example, another set \(\mathbb{Y}\) might look like this:

Example set with six elements
Formula anchor

There is also an empty set \(U\) which has no elements:

Empty set
Formula anchor

Or there can also be an infinite set \(N\) which has infinitely many elements:

Set of natural numbers
Formula anchor

You can then introduce, for example, a variable \(y\) which is a placeholder for one of the elements of the set \(\mathbb{X}\). Mathematically written down, \( y \in \mathbb{X}\) means that \(y\) stands for any element of \(\mathbb{X}\). It is said "\(y\) is an element of \(\mathbb{X}\)".

Let's look at the following set:

Set with elements 1 5 3 6
Formula anchor

What does \( y \in \mathbb{X}\) mean? This means that the variable \(y\) can take the following values: \(y = 1\), \(y = 5\), \(y = 3\) or \(y = 6\). You may, of course, name the variable as you wish: \(y\) or \(x\) or even \(\psi\) (Greek letter "Psi"). It is just a placeholder for the elements of the set.

Defining a function

Let us now define the concept of a function \(f\). For this we need two sets \(\mathbb{X}\) and \(\mathbb{Y}\). What the sets actually contain for elements depends on the specific function. However, since we want to define a function in general, we do not specify the sets concretely. For the definition it is also unimportant what is in the sets. There are any numbers there, but which one does not matter.

A function \(f\) is defined by assigning to each element of one set \(\mathbb{X}\) some element of the other set \(\mathbb{Y}\). Thus, the two sets are not equal. We need to select a set where we need to assign ALL elements. For the other set, we can also leave some of its elements unassigned.

  • We call the set \(\mathbb{X}\), where we have to assign all elements, the domain of a function.

  • We call the other set \(\mathbb{Y}\), where not all elements have a partner in the other set, a codomain (or set of destination).

The function \(f\), its domain \(\mathbb{X}\), and its codomain \(\mathbb{Y}\) are notated as follows:

Notation of the function rule
Formula anchor

Now we have to concretely assign to each element \(x \in \mathbb{X}\) an element \(y \in \mathbb{Y}\). Then we defined a concrete function. The assignment is notated as follows:

Function value and function argument
Formula anchor

That means: Take the element \(x\) from the domain \(\mathbb{X}\) and assign to this element the element \(y\) from the codomain. Which element \(y\) it is exactly depends on the specific function \(f\). This is indicated by the notation \(f(x)\). Here \(x\) is called the function argument and \(f(x)\) the function value.

Example: Assign elements and thus define a function

Consider two following sets:

Two example set
Formula anchor

To construct a function \(f\), we need to specify a domain and a codomain. Let \(\class{blue}{\mathbb{X}}\) be the domain and \(\class{green}{\mathbb{Y}}\) be the codomain. In math notation:

Notation of an example function
Formula anchor
Example of a Function Rule
Function rule of an example function

You have learned that EACH element of the domain \(\class{blue}{\mathbb{X}}\) must be assigned some value from the domain \(\class{green}{\mathbb{Y}}\). The set \(\class{blue}{\mathbb{X}}\) has 4 elements - this corresponds to 4 assignments that must be made to construct a specific function. Let's do that. For this we introduce the variable \(\class{blue}{x} \in \class{blue}{\mathbb{X}}\) and \(\class{green}{y} \in \class{green}{\mathbb{Y}}\). The following collection of assignments is calledfunction rule:

  • To the element \(\class{blue}{x} = \class{blue}{1}\) we assign the element \(\class{green}{y} = \class{green}{10}\): \(f(\class{blue}{1}) = \class{green}{10}\).

  • To the element \(\class{blue}{x} = \class{blue}{5}\) we assign the element \(\class{green}{y} = \class{green}{10}\): \(f(\class{blue}{5}) = \class{green}{10}\).

  • To the element \(\class{blue}{x} = \class{blue}{3}\) we assign the element \(\class{green}{y} = \class{green}{42}\): \(f(\class{blue}{3}) = \class{green}{42}\).

  • To the element \(\class{blue}{x} = \class{blue}{6}\) we assign the element \(\class{green}{y} = \class{green}{2}\): \(f(\class{blue}{6}) = \class{green}{2}\).

As you can see, we have associated each element \(\class{blue}{x} \in \class{blue}{\mathbb{X}}\) with an element \(\class{green}{y} \in \class{green}{\mathbb{Y}}\). Here we did not use \(\class{green}{y} = \class{green}{4}\) and \(\class{green}{y} = \class{green}{3} \) at all, because that is allowed for elements of the codomain.

Let us summarize: Domain \(\mathbb{X}\) and the codomain \( \mathbb{Y} \) together with the corresponding assignment rule \( f(x) = y\) define a function \(f: ~\mathbb{X} ~\rightarrow~ \mathbb{Y} \).

Image set of a function

Since we do not need to assign value \(x\) (element of the domain \(\mathbb{X}\)) to each \(y\) value (element of the codomain \(\mathbb{Y}\)), some \(y\) elements remain unassigned. All elements \(y\) which have been assigned an element \(x\) form a set which we call image set \(\mathbb{im}(f)\). This set is a subset of \(\mathbb{Y}\): \(\mathbb{im}(f) \subseteq \mathbb{Y}\).

Definition: Image of a function
Formula anchor

The image \(\mathbb{im}(f)\) of the function \(f\) is a subset of \(\mathbb{Y}\) containing all \(y\) elements from \(\mathbb{Y}\) which have been assigned an element \(x\).

Example: Image of a function
Example of the Image Set of a Function
Image set of \(f\).

For the function \(f: ~\class{blue}{\mathbb{X}} ~\rightarrow~ \class{green}{\mathbb{Y}}\) constructed above in the example, the image set \(\class{green}{\mathbb{im}(}f\class{green}{)}\) of this function is:

Example of an image set
Formula anchor

The elements \(\class{green}{y}=\class{green}{3}\) and \(\class{green}{y}=\class{green}{4}\) are not in the image set because no \(\class{blue}{x}\) element was assigned to these elements. Also, it is clear from the example that the image set is a subset of the codomain \(\class{green}{\mathbb{Y}}\):

Image set is subset of codomain
Formula anchor

By the way, if each element of \(\class{green}{\mathbb{Y}}\) has a partner \(\class{blue}{x}\), then the image set would be exactly the codomain: \( \class{green}{\mathbb{im}(}f\class{green}{)} = \class{green}{\mathbb{Y}}\).

Graph of a function

The image set (that is, the set of all \(y\) elements to which an \(x\) element has been assigned) together with the associated \(x\) elements, forms a graph. The graph of a function \(f\) is also a set. Let us denote it by \(\mathbb{G}(f)\). However, in this set \(\mathbb{G}(f)\) there are not directly numbers \(x\), \(y\) in it, but tuples \((x,y)\) of numbers. With the tuple notation we indicate that the \(x\)- and \(y\)-elements, combined in the tuple, belong together. Mathematically, the graph set can be notated as follows:

Definition: Graph of a function
Formula anchor

Here \(\mathbb{X} \times \mathbb{Y}\) is a so-called cartesian product of two sets \(\mathbb{X}\) and \(\mathbb{Y}\). \(\mathbb{X} \times \mathbb{Y}\) is a set in which all tuples \((x,y)\) are in without having to satisfy the property \(y = f(x)\), as in the case of the graph:

Definition of the Cartesian product
Formula anchor
Example: Graph of a function

For the function \(f: ~\class{blue}{\mathbb{X}} ~\rightarrow~ \class{green}{\mathbb{Y}}\) constructed in the example, the graph is \(\mathbb{G}(f)\):

Graph set example
Formula anchor

And the Cartesian product \(\class{blue}{\mathbb{X}} \times \class{green}{\mathbb{Y}}\) is the following quantity:

Example for the Cartesian product
Formula anchor

The graph \(\mathbb{G}(f)\) of a function \(f\) can be visualized by plotting on one axis the \(x\) elements (we call it \(x\) axis). And on the other axis, which is perpendicular to the \(x\)-axis, all \(y\)-elements (we call it \(y\)-axis) are plotted, to which an \(x\)-element was assigned.

Consider the graph set from the above example (equation 15). If you now draw a horizontal line through a \(y\) point and a vertical line through the corresponding \(x\) point, this will create an intersection of the two lines. This intersection is marked. This is exactly what is done with all the other tuples of the graph set. In such a way you can visualize the function \(f\):

Example of the Graph of a Function
Visualized graph of the example function.

Injective, surjective or bijective function

Three important properties of a function \(f\), from which further properties can be derived, are: Injection, Surjection, Bijection.

A function \(f\) is injective if each element \(x\) in \(\mathbb{X}\) is assigned a different \(y\) element in \(\mathbb{Y}\):

Example of an Injective Function
Each \(x\)-element in \(\mathbb{X}\) refers to a different \(y\)-element in \(\mathbb{Y}\) (Injection).

Mathematically, an injective function is defined as follows:

Definition: Injective function

A function \(f\) is injective if the following property is satisfied for all \(x_1\), \(x_2 \in \mathbb{X}\):

Injective function
Formula anchor

Translated it means: \(f(x_1)\) is a \(y\) element to which \(x_1\) in \(\mathbb{X}\) has been assigned. And \(f(x_2)\) is a \(y\) element to which \(x_2\) in \(\mathbb{X}\) was assigned. Now if the two \(y\) elements are equal: \(f(x_1) = f(x_2)\)then the corresponding \(x\) elements must also be equal: \(x_1 = x_2 \). If this is satisfied, then the function \(f\) is injective.

A function \(f\) is surjective if each element \(y\) in \(\mathbb{Y}\) has been assigned an \(x\) element in \(\mathbb{X}\). So the image set is equal to the codomain: \(\text{im}(f) = \mathbb{Y}\) if the function is surjective:

Example of a Surjective Function
Each \(y\)-element in \(\mathbb{Y}\) has an \(x\)-element assigned to it (surjection).
Definition: Surjective function

A function \(f\) is surjective if for all \(y \in \mathbb{Y}\) there exists an \(x \in \mathbb{X}\) such that: \( f(x) = y \).

If a function \(f\) satisfies both the surjectivity property and the injectivity property, then the function is called bijective. So bijection is just a combination of surjection and injection under one term. Instead of saying: "The function \(f\) is injective and surjective" one says: "The function \(f\) is bijective". For physicists, bijective functions are the functions that cause the least problems!

Definition: Bijective function

A function \(f\) is bijective if it is injective AND surjective.

With this basic knowledge, you should now have no problems constructing a function, writing it down mathematically, or checking whether it is injective, surjective, or bijective.