Function Terminology
A function is a relation between a set of inputs (called the domain) and a permissible set of outputs (called the codomain), such that each input is related to exactly one output. We often denote a function on one variable by \( f\). When \( x\) is an element of the domain, we say that the value of the output is \( f(x)\).
Contents
Terminology
- Function: A function is a relation between each element in the domain and a unique element in the codomain. This is denoted by \( f \colon X \rightarrow Y \).
- Domain: The domain of a function is the set of inputs of the function. This is denoted by \(X\).
- Codomain: The codomain of a function is the set of all permissible outputs. This is denoted by \(Y.\)
- Range: The range of a function is set of all attained outputs. By definition, the range is a subset of the codomain. This is denoted by \(f(X) \).
- Image of \(A\): The image of a set \(A\) is the set of all attained outputs whose inputs are elements in the set \(A\). This is denoted by \( \text{Im}(A) = \{\, y \in Y \mid \exists a \in A, f(a) = y \, \}.\)
- Composition: The composition of 2 functions \( f\) and \(g\) is denoted by \( f \circ g \). In order for this function to be well defined, the range of \(g\) must be a subset of the domain of \(f\).
- Inverse of an element: The inverse of an element \(y\) in \(Y\) is the set of all possible values \( x\) in \(X\) such that \( f(x) = y \). This is denoted by \( f^{-1} (y) = \{\, x \in X \mid f(x) = y \, \} \).
- Graph: The graph of a function is the set of all ordered pairs \( (x, f(x) ) \).
- Injective: An injective function is one that maps every value in the domain to a unique value in the codomain, such that for any given value in the range there is only one corresponding value in the domain. Injective functions are also called "one-to-one" functions.
- Surjective: A surjective function is one that covers every element in the codomain, such that there are no elements in the codomain that are not a value of the function. In a surjective function the range and the codomain will be identical.
- Bijective: A bijective function is both injective and surjective.
Further details
Note that the domain and codomain need not always be the set of real numbers. Other common sets that are used are the complex numbers, positive integers, people, matrices, graphs, etc. For example, consider the function \( \text{Citizen} (\cdot) \) which takes as input the name of a Brilliant student and outputs the country of citizenship of that student. In this case, the domain is the set of names of Brilliant students, while the codomain is the set of countries. In order for this to be truly a function, we must make the assumption that a student is a citizen of only 1 country. In order to deal with the possibility of dual citizenships, we must add pairs of countries to our codomain.
We can certainly add irrelevant items to the codomain, like {alligator}, {purple}, and {Calvin}. As such, we define the range of a function (also called the image) to be the set of all outputs. Note that by definition, the range of a function has to be a subset of the codomain.
The mathematical shorthand (since mathematicians are lazy) to state that \( f\) is a function from set \( A\) to set \( B\) is \( f\colon A \to B\). For example, since \( \mathbb{C}\) stands for complex numbers, \( \mathbb{Z}\) stands for integers, and \( \mathbb{N}\) stands for positive integers, \( f \colon \mathbb{C} \to \mathbb{N}\) refers to a function from the set of complex numbers to the set of positive integers. Because we mainly deal with functions of real numbers, if the domain and codomain are not explicitly stated (or immediately obvious from the setup), they are assumed to be the set of real numbers,
While it is common for the domain and codomain to be the same set, it is important to make a clear distinction between the two. The identity function is the unique function on a set, which maps every element to itself. We denote this function be \( \text{Id}_A \colon A \to A\), where \( \text{Id}_A (a) = a \) for all elements \( a\) of \( A\).
If we were to change the domain of a function, then we will get a different function. For example, \( \text{Id}_\mathbb{R} \colon \mathbb{R} \to \mathbb{R} \) is a very different function from \( \text{Id}_\mathbb{N} \colon \mathbb{N} \to \mathbb{N}\). This is because we have \( \text{Id}_\mathbb{R} (0.5) = 0.5\), while \( \text{Id}_\mathbb{N} (0.5)\) does not make any sense. As such, we say that 2 functions \( f\colon A \to B\) and \( g\colon C \to D\) are equal if \( A=C\) and for all values \( a\) in \( A\), \( f(a) = g(a)\). The codomain is less important, since by our previous observation we can add arbitrary elements to it while not affecting the essence of the function.
Given a function \( f\colon A \to B\) and any subset \( C \subset A\), we say that the image of \( C\) is the set of all values \( f(c)\), where \( c\) is an element of \( C\). Given a subset \( D \subset B\), we say that the preimage of \( D\) is the set of all values \( x\) where \( f(x)\) is an element of \( D\). Using this terminology, we say that the range is the image of the domain. Essentially, the range is the part of the codomain that we really care about, which is why we will like to restrict our attention to just the range.
When the domain is the set of real numbers, we like to think of \( f(x)\) as the graph of the function. Conversely, given any graph, it is a function if each \(x\)-value corresponds to at most 1 \(y\)-value. Such a graph must pass the vertical line test: every vertical line cuts the graph in at most 1 point.
What if we want to find all possible inputs, which give a certain output? For example, if I want to know who are all the Brilliant students that are citizens of India, I am asking for the list of students who satisfy \( \text{Citizen} (\cdot) = \text{India}.\) The inverse of a function need not always be a function (as in this example). In order for an inverse to be an actual function, the original function needs to pass the horizontal line test: every horizontal line cuts the graph in at most 1 point.
If the inverse is a function, we denote it as \( f^{-1}\). What is the domain and codomain of \( f^{-1}\)? Can we take the inverse of any value in the codomain? We certainly could, though it might not make sense. For example, \( \text{Citizen}^{-1} (\text{Calvin}) \) would not be valid. As such, we often restrict our attention to simply the range of the original function (which, as you recall, is the image of the domain). What is the codomain of the inverse? It would be the pre-image of the range. Note that the pre-image of the range need not be the entire domain of \( f\).
In the event that the inverse is not a function, we can restrict our attention to a subset of the domain. Specifically, if \( f\colon A \to B\) and \( C \subset A\), we define the function \( f|_C \colon C \to B\) as \( f|_C (c) = f(c)\) for all values \( c\) in \( C\). For example, the function \( S \colon \mathbb{R} \to \mathbb{R}\) given by \( S(x) = x^2\) does not have an inverse function because it doesn't satisfy the horizontal line test. However, since \( S|_{{\mathbb{R}\leq 0}}\) does satisfy the horizontal line test, it has an inverse. In this case, we know that \( S|_{{\mathbb{R}\leq 0}} ^{-1} (x) = -\sqrt{x}\).
A function is injective (or one-to-one) if \( f(a_1) \neq f(a_2)\) for any 2 distinct elements \( a_1, a_2\) in the domain. A function is surjective (or onto) if for every element \( b\) in the codomain, there exists an element \( a\) in the domain such that \( f(a) = b\). A function is bijective if it is both injective and surjective. With this terminology, an injective function has an inverse that is a function. A bijective function \( f\colon A \to B\) has an inverse (which is a function by the previous observation) whose domain is \( B\).
Now that we've built up this vocabulary, we can talk about the composition of functions. You may not always be able to compose 2 functions. For example, \( \text{Citizen} \circ \text{Citizen}\) will not make any sense, no matter what we try to do. Let's understand how to make composition of functions work.
Assuming that we have 2 functions \( f \colon A \to B\) and \( g\colon C \to D\), when does \( g \circ f\) make sense? Given any value \( a\) in the domain A, we must be able to apply \( g\) to the value \( f(a)\). Hence, this implies that \( B\) must be a subset of \( C\). With this condition, we can define \( g \circ f\colon A \to D \) to be equal to \( (g \circ f) (a) = g ( f(a) ) \). Note that the order of composition is important, since we might not be able to define \( f \circ g\), unless we further know that \( D\) is a subset of \( A\).
Example Problems
Let \(X = \{1, 2, 3, 4, 5, 6, 7, 8\}\) and \(Y = \{2, 4, 6, 8, 10\}.\) For a given pair \((a, b)\) of numbers, let \(f(a) = b.\) Is \(f\) a function \( f\colon X \to Y \) for the following set of pairs:
\[\{(1, 2), (2, 10), (3, 4), (4, 4), (5, 3), (6, 3), (7, 4), (8, 2)\}?\]
For \(f\) to be a function, the following conditions must be satisfied:
- \(f\) is evaluated for every element in the domain;
\(\Rightarrow f\) at 1 through 8 have their own evaluations (satisfied).- \(f\) has only one evaluation for each element in the domain;
\(\Rightarrow f\) at 1 through 8 each has only one output (satisfied).- The outputs of \(f\) should be elements of the codomain;
\(\Rightarrow f(5)=f(6)=3\notin Y\) (unsatisfied).Condition 3 is not satisfied, so \(f\) is not a function \( f: X \rightarrow Y. \ _\square \)
Let \(X =\{ \, x \mid 0 \le x \le 3, x \in \mathbb{Z} \, \}\) and \(Y = \mathbb{Z},\) where \(\mathbb{Z}\) is the set of integers. When \(f(x) = 2x + 1,\) what is the sum of all elements in the image of \(f?\)
We have
\[\begin{align} f(0)&=1\\ f(1)&=3\\ f(2)&=5\\ f(3)&=7. \end{align}\]
Therefore, the image of \(f\) is \(\{1,3,5,7\},\) so the answer is \(1+3+5+7=16.\) \( _\square \)
Let \(X =Y = \mathbb{R}.\) Is \(f(x) = x^2\) a surjective function?
The square of a real number is positive or zero. Therefore, the range of \(f\) is smaller than \(Y,\) and \(f\) is not a surjective function. \( _\square \)