A function is a relation between two sets, in which each element of the domain corresponds to a unique element of the codomain. In this section, we will analyze the formal definition, the domain, the codomain, the image, and the main properties such as injectivity, surjectivity, and bijectivity.
- Definition of Function
- Domain, Codomain and Image
- Examples of Functions
- Properties of Functions
- Injective Functions
- Non-injective Functions
- Exercises on Injective Functions
- Surjective Functions
- Non-surjective Functions
- Exercises on Surjective Functions
- Some Examples
- Bijective Functions
- Inverse Function
- Exercises on Bijective Functions
- Restriction of a Function
- Example of Restriction: Logarithmic Function
- Exercises on Function Restriction
Definition of Function
Formally, a function is a rule (or mapping) that assigns to each element of a set \(X\) (called the domain) a unique element of another set \(Y\) (called the codomain). The notation used to express a function is as follows:
\[ f: X \to Y \quad , \quad x \mapsto f(x) \]
Or:
\[ \begin{align*} f \, : \, & X \longrightarrow Y \\ & x \longmapsto f(x) \end{align*} \]
In this way, it is stated that the function \(f\) is defined on the set \(X\) and the values it takes belong to the set \(Y\). The term \(f(x)\) refers to the element \(y \in Y\) that is associated with every \(x \in X\), with the function \(f\) specifying the correspondence rule between the elements of \(X\) and those of \(Y\).
Domain, Codomain and Image
As mentioned earlier, the domain of a function \(f\) is the set \(X\) consisting of all the elements for which the function is defined. Formally:
\[ \text{Dom}(f) = X \]
For example, the function:
\[ f \, : \, \mathbb{R} \to \mathbb{R} \quad , \quad x \mapsto \frac{1}{x^2+1} \]
is defined on the entire real line. Thus, \( \text{Dom}(f) = \mathbb{R} \). The image, on the other hand, is the set of values assumed by the function, which in this particular case is \( \text{Imm}(f) = (0, 1] \).
The codomain is the set \(Y\) that contains all the values that can be reached by the function \(f\), although not all these values necessarily have to be actually obtained. The image (or range) of a function \(f\) is the set of elements of \(Y\) that are actually reached by the function, and is defined as:
\[ \text{Imm}(f) = f(X) = \{ y \in Y \mid \exists x \in X \, : \, f(x) = y \} \]
Examples of Functions
A classic example of a function is the linear function, which represents a straight line and can be formally written as:
\[ f: \mathbb{R} \to \mathbb{R} \quad , \quad f(x) = mx + q \]
where \(m\) and \(q\) are real constants. Another significant example is the quadratic function, which describes a parabola and is expressed as:
\[ g: \mathbb{R} \to \mathbb{R} \quad , \quad g(x) = ax^2 + bx + c \quad , \quad a \neq 0 \]
Properties of Functions
Functions possess some fundamental properties that allow them to be characterized more precisely.
Injective Functions
A function \( f: X \to Y \) is called injective if distinct values correspond to distinct images. In other words, if two elements of \( X \) are distinct, their images under \( f \) are also distinct. Mathematically, the function is injective if:
\[ x_1 \neq x_2 \implies f(x_1) \neq f(x_2) \]
Another way to state that a function is injective is that if two elements are mapped to the same value, they must be equal. That is:
\[ f(x_1) = f(x_2) \implies x_1 = x_2 \]
An example of an injective function is the function \( f \, : \, \mathbb{R} \to \mathbb{R} \) defined as \( f(x) = x^3 \). Let's see why this function is injective:
- If \( x_1 \neq x_2 \), then \( x_1^3 \neq x_2^3 \), which means that the images of \( x_1 \) and \( x_2 \) are distinct.
- In other words, for every pair of distinct values \( x_1 \) and \( x_2 \) belonging to \( \mathbb{R} \), their cubes will never be equal.
Non-Injective Functions
Not all functions are injective. A function is called non-injective when there exist at least two distinct elements of \( X \) that have the same image in \( Y \). In other words, there exist \( x_1 \neq x_2 \) such that \( f(x_1) = f(x_2) \).
Examples of non-injective functions include:
- The quadratic function \( f(x) = x^2 \), which is not injective on \( \mathbb{R} \). In fact, \( f(2) = f(-2) = 4 \), but \( 2 \neq -2 \), so \( f(x) = x^2 \) is not injective.
- The sine function \( f(x) = \sin(x) \), which is not injective on \( \mathbb{R} \), since \( \sin(0) = \sin(\pi) = 0 \), but \( 0 \neq \pi \), so it is not injective.
Exercises on Injective Functions
Exercise 1: Determine whether the function \( f(x) = 2x + 3 \) is injective.
Solution: The function is injective if, for every pair of distinct values \( x_1 \) and \( x_2 \), the images \( f(x_1) \) and \( f(x_2) \) are distinct. Suppose that \( f(x_1) = f(x_2) \), that is:
\[ 2x_1 + 3 = 2x_2 + 3 \]
Subtracting 3 from both sides, we get:
\[ 2x_1 = 2x_2 \]
Dividing by 2:
\[ x_1 = x_2 \]
Since \( x_1 = x_2 \), the function is injective.
Exercise 2: Determine whether the function \( f(x) = x^2 \) is injective on \( \mathbb{R} \).
Solution: The function \( f(x) = x^2 \) is not injective on \( \mathbb{R} \). Indeed, consider the values \( x_1 = -2 \) and \( x_2 = 2 \). Both satisfy \( f(x_1) = f(x_2) \), that is:
\[ (-2)^2 = 2^2 = 4 \]
But \( -2 \neq 2 \), so the function is not injective. The function is injective only if defined on \( \mathbb{R}^+ \) or \( \mathbb{R}^- \), since in these domains each number has a unique positive square.
Exercise 3: Verify whether the function \( f(x) = \sin(x) \) is injective on \( \mathbb{R} \).
Solution: The function \( f(x) = \sin(x) \) is not injective on \( \mathbb{R} \), since multiple values of \( x \) yield the same result. For example, \( \sin(0) = \sin(\pi) = 0 \), but \( 0 \neq \pi \). Therefore, the function is not injective on \( \mathbb{R} \). If we restricted the domain of the function, for instance to \( \left[ 0, \frac{\pi}{2} \right] \), the function would be injective.
Exercise 4: Determine whether the function \( f(x) = \ln(x) \) is injective on the domain \( (0, \infty) \).
Solution: The function \( f(x) = \ln(x) \) is injective on the domain \( (0, \infty) \), since if \( \ln(x_1) = \ln(x_2) \), then necessarily \( x_1 = x_2 \). This holds for all values of \( x_1 \) and \( x_2 \) belonging to the domain \( (0, \infty) \).
Exercise 5: Verify whether the function \( f(x) = \frac{1}{x} \) is injective on \( \mathbb{R}^* \) (all real numbers except 0).
Solution: The function \( f(x) = \frac{1}{x} \) is injective on \( \mathbb{R}^* \), because if \( \frac{1}{x_1} = \frac{1}{x_2} \), then \( x_1 = x_2 \), since numbers cannot be equal unless their reciprocals are also equal.
Surjective Functions
A function \( f: X \to Y \) is surjective if, for every \( y \in Y \), there exists at least one \( x \in X \) such that:
\[ f(x) = y \]
In other words, a function is surjective if every element of the codomain \( Y \) is the image of at least one element of \( X \).
An example of a surjective function is the function \( f: \mathbb{R} \to \mathbb{R} \), defined as \( f(x) = x^3 \). Let's see why this function is surjective:
- For every \( y \in \mathbb{R} \), there exists an \( x \in \mathbb{R} \) such that \( x^3 = y \). For example, if \( y = 8 \), then \( x = 2 \) because \( 2^3 = 8 \).
- In general, for every value of \( y \), there exists a value \( x \) that satisfies \( x^3 = y \), so the function is surjective.
Non-Surjective Functions
A function is called non-surjective if there exists at least one element \( y \in Y \) that is not the image of any element \( x \in X \). In other words, there are values in the codomain \( Y \) that are not the image of any element in the domain \( X \).
Examples of non-surjective functions include:
- The function \( f(x) = x^2 \) defined on \( \mathbb{R} \). The codomain of this function is \( \mathbb{R}^+ \) (the set of non-negative real numbers), meaning there are no values of \( x \) that yield negative results. For example, there is no \( x \) such that \( f(x) = -1 \), so the function is not surjective over \( \mathbb{R} \).
- The function \( f(x) = \sin(x) \), defined on \( \mathbb{R} \), has a codomain of \( [-1, 1] \). Therefore, for instance, there is no value of \( x \) that gives \( f(x) = 2 \), so the function is not surjective over \( \mathbb{R} \).
Exercises on Surjective Functions
Exercise 1: Determine whether the function \( f(x) = 2x + 3 \) is surjective from \( \mathbb{R} \) to \( \mathbb{R} \).
Solution: The function is surjective if for every \( y \in \mathbb{R} \), there exists an \( x \in \mathbb{R} \) such that \( f(x) = y \). Suppose we have \( y \in \mathbb{R} \). Solving the equation \( f(x) = 2x + 3 = y \), we get:
\[ 2x = y - 3 \]
\[ x = \frac{y - 3}{2} \]
Since \( x \) exists for every \( y \in \mathbb{R} \), the function is surjective.
Exercise 2: Determine whether the function \( f(x) = x^2 \) is surjective from \( \mathbb{R} \) to \( \mathbb{R} \).
Solution: The function \( f(x) = x^2 \) is not surjective from \( \mathbb{R} \) to \( \mathbb{R} \), because there are no values of \( x \) such that \( f(x) = -1 \) (since the square of a real number is always non-negative). The codomain of this function is \( \mathbb{R}^+ \), so it is not surjective over \( \mathbb{R} \).
Exercise 3: Verify whether the function \( f(x) = \sin(x) \) is surjective from \( \mathbb{R} \) to \( \mathbb{R} \).
Solution: The function \( f(x) = \sin(x) \) is not surjective from \( \mathbb{R} \) to \( \mathbb{R} \), because the value of \( \sin(x) \) is limited to the interval \( [-1, 1] \). Therefore, there are no values of \( x \) that can give \( \sin(x) = 2 \), so it is not surjective over \( \mathbb{R} \).
Some Examples
Exercise 4: Determine whether the function \( f(x) = \ln(x) \) is surjective on \( (0, \infty) \) from \( (0, \infty) \) to \( \mathbb{R} \).
Solution: The function \( f(x) = \ln(x) \) is surjective from \( (0, \infty) \) to \( \mathbb{R} \) because for every \( y \in \mathbb{R} \), there exists an \( x \in (0, \infty) \) such that \( \ln(x) = y \). Indeed, if \( y \in \mathbb{R} \), we can find \( x = e^y \) such that \( \ln(x) = y \).
Exercise 5: Verify whether the function \( f(x) = \frac{1}{x} \) is surjective on \( \mathbb{R}^* \) (all real numbers except 0) from \( \mathbb{R}^* \) to \( \mathbb{R}^* \).
Solution: The function \( f(x) = \frac{1}{x} \) is surjective on \( \mathbb{R}^* \) because for every \( y \in \mathbb{R}^* \), there exists an \( x \in \mathbb{R}^* \) such that \( \frac{1}{x} = y \). Indeed, if \( y \in \mathbb{R}^* \), we can find \( x = \frac{1}{y} \) such that \( f(x) = y \).
Bijective Functions
A function \( f \) is called bijective if it is both injective and surjective. In this case, \( f \) establishes a one-to-one correspondence between the elements of the domain and those of the codomain, and it admits an inverse function:
\[ f^{-1}: Y \to X \]
This inverse satisfies the relation:
\[ f^{-1}(y) = x \quad \text{where} \quad f(x) = y \]
The inverse function \( f^{-1} \) is defined for every \( y \in Y \), and it is both a right and left inverse, since for every \( y \in Y \), it satisfies the following identities:
\[ f(f^{-1}(y)) = y \quad \text{and} \quad f^{-1}(f(x)) = x \]
Example of a Bijective Function
Consider the function \( f: \mathbb{R} \to \mathbb{R} \) defined as \( f(x) = 2x + 1 \). Let's verify that this function is bijective:
- The function is injective: suppose that \( f(x_1) = f(x_2) \), i.e., \( 2x_1 + 1 = 2x_2 + 1 \). Solving, we get \( x_1 = x_2 \), so the function is injective.
- The function is surjective: for every \( y \in \mathbb{R} \), we can solve the equation \( 2x + 1 = y \), obtaining \( x = \frac{y - 1}{2} \), which is a real value for every \( y \in \mathbb{R} \). Therefore, the function is surjective.
- Since the function is both injective and surjective, it is bijective and admits an inverse function \( f^{-1}: \mathbb{R} \to \mathbb{R} \) defined by \( f^{-1}(y) = \frac{y - 1}{2} \).
Inverse Function
The inverse function \( f^{-1}(y) = \frac{y - 1}{2} \) satisfies the following identities:
- For every \( y \in \mathbb{R} \), \( f(f^{-1}(y)) = f\left(\frac{y - 1}{2}\right) = 2\left(\frac{y - 1}{2}\right) + 1 = y \), therefore the relation \( f(f^{-1}(y)) = y \) is satisfied.
- For every \( x \in \mathbb{R} \), \( f^{-1}(f(x)) = f^{-1}(2x + 1) = \frac{(2x + 1) - 1}{2} = x \), therefore the relation \( f^{-1}(f(x)) = x \) is satisfied.
Example of a Non-Bijective Function
Consider the function \( f(x) = x^2 \) defined on \( \mathbb{R} \). This function is not bijective, because:
- It is not injective: for example, \( f(2) = 4 \) and \( f(-2) = 4 \), but \( 2 \neq -2 \), therefore the function is not injective.
- It is not surjective: for example, there is no \( x \) such that \( f(x) = -1 \), therefore the function is not surjective on \( \mathbb{R} \).
- Since it is neither injective nor surjective, it is not bijective and therefore does not have an inverse function on \( \mathbb{R} \).
Exercises on Bijective Functions
Exercise 1: Determine if the function \( f(x) = 3x - 4 \) is bijective from \( \mathbb{R} \) to \( \mathbb{R} \). If it is bijective, write the inverse function.
Solution: The function is injective because if \( f(x_1) = f(x_2) \), that is \( 3x_1 - 4 = 3x_2 - 4 \), we obtain \( x_1 = x_2 \). Moreover, it is surjective because for every \( y \in \mathbb{R} \), we can solve \( 3x - 4 = y \) to get \( x = \frac{y + 4}{3} \). The function is therefore bijective and its inverse is \( f^{-1}(y) = \frac{y + 4}{3} \).
Exercise 2: Verify if the function \( f(x) = x^2 \) is bijective from \( \mathbb{R}^+ \) to \( \mathbb{R}^+ \).
Solution: The function is injective on \( \mathbb{R}^+ \) because \( x_1^2 = x_2^2 \) implies \( x_1 = x_2 \) for \( x_1, x_2 \in \mathbb{R}^+ \). It is also surjective on \( \mathbb{R}^+ \), since for every \( y \in \mathbb{R}^+ \), there exists an \( x = \sqrt{y} \) such that \( f(x) = y \). The function is therefore bijective on \( \mathbb{R}^+ \) and its inverse is \( f^{-1}(y) = \sqrt{y} \).
Exercise 3: Determine if the function \( f(x) = x^3 \) is bijective from \( \mathbb{R} \) to \( \mathbb{R} \). Write the inverse function.
Solution: The function \( f(x) = x^3 \) is both injective (since \( x_1^3 = x_2^3 \) implies \( x_1 = x_2 \)) and surjective (for every \( y \in \mathbb{R} \), there exists an \( x = \sqrt[3]{y} \) such that \( f(x) = y \)). The function is therefore bijective and its inverse is \( f^{-1}(y) = \sqrt[3]{y} \).
Additional Exercises
Exercise 4: Verify if the function \( f(x) = e^x \) is bijective from \( \mathbb{R} \) to \( (0, \infty) \).
Solution: The function \( f(x) = e^x \) is injective (since \( e^{x_1} = e^{x_2} \) implies \( x_1 = x_2 \)) and surjective on \( (0, \infty) \), since for every \( y \in (0, \infty) \), there exists an \( x = \ln(y) \) such that \( f(x) = y \). The function is therefore bijective and its inverse is \( f^{-1}(y) = \ln(y) \).
Exercise 5: Determine if the function \( f(x) = x + 2 \) is bijective from \( \mathbb{R} \) to \( \mathbb{R} \).
Solution: The function \( f(x) = x + 2 \) is bijective, since it is both injective and surjective. The inverse function is \( f^{-1}(y) = y - 2 \).
Restriction of a Function
The restriction of a function is a concept of fundamental importance, which allows us to restrict the domain of a function to a specific subset. This operation is particularly useful when we want to ensure that a function is injective and surjective, necessary conditions for invertibility. For example, consider the quadratic function \( f(x) = x^2 \), which is not injective on \( \mathbb{R} \) because for every \( y > 0 \) there are two preimages \( x_1 = \sqrt{y} \) and \( x_2 = -\sqrt{y} \). However, restricting the domain to \( [0, +\infty) \), we obtain an injective function, thus allowing the existence of a defined inverse function.
Example of Restriction: Quadratic Function
Consider the function \( f(x) = x^2 \) defined on \( \mathbb{R} \). This function is not injective, because there exist two distinct values \( x_1 \) and \( x_2 \) such that \( f(x_1) = f(x_2) \). For example, \( f(2) = f(-2) = 4 \). However, if we restrict the domain of \( f(x) \) to the subset \( [0, +\infty) \), the function becomes injective. In fact, for \( x_1, x_2 \in [0, +\infty) \), the equality \( f(x_1) = f(x_2) \) implies \( x_1 = x_2 \), ensuring that the function is now injective.
The restriction of the function to \( [0, +\infty) \) makes the function injective, and we can define its inverse function:
\[ f^{-1}(y) = \sqrt{y}, \quad y \geq 0. \]
Example of Restriction: Logarithmic Function
Consider the logarithmic function \( f(x) = \ln(x) \), defined on \( (0, +\infty) \). The function is injective and surjective if the codomain is \( \mathbb{R} \), therefore it is bijective. However, if we restrict the domain to \( [1, +\infty) \), the image becomes \( [0, +\infty) \) and the function remains injective. In this case, the inverse function is:
\[ f^{-1}(y) = e^y, \quad y \in [0, +\infty) \]
Other Examples of Restriction
The restriction of a function can be applied in various contexts to simplify the behavior of the function or to adapt it to a specific context:
- If \( f(x) = \sin(x) \) on \( \mathbb{R} \), we can restrict the domain to \( [-\frac{\pi}{2}, \frac{\pi}{2}] \) to make it injective. In this case, the inverse function will be \( f^{-1}(y) = \arcsin(y) \), with \( y \in [-1, 1] \).
- If \( f(x) = \tan(x) \), defined on \( \left(-\frac{\pi}{2}, \frac{\pi}{2}\right) \), the function is injective and surjective on this domain, and its inverse is \( f^{-1}(y) = \arctan(y) \).
Exercises on Function Restriction
Exercise 1: Determine if the function \( f(x) = x^3 \) is injective on \( \mathbb{R} \). Then, restrict the domain so that the function is bijective and find its inverse function.
Solution: The function \( f(x) = x^3 \) is already injective on \( \mathbb{R} \), since \( f(x_1) = f(x_2) \) implies \( x_1 = x_2 \). No restriction is necessary, and the inverse function is \( f^{-1}(y) = \sqrt[3]{y} \).
Exercise 2: The function \( f(x) = x^2 \) is not injective on \( \mathbb{R} \). Restrict the domain to an interval where the function is injective and find the inverse function.
Solution: To make the function injective, we restrict the domain to \( [0, +\infty) \). In this case, the inverse function will be \( f^{-1}(y) = \sqrt{y} \), with \( y \geq 0 \).
Exercise 3: Consider the function \( f(x) = \ln(x) \) defined on \( (0,+\infty) \). Restrict the domain to \( [1,+\infty) \) and write the inverse function.
Solution: The logarithmic function is injective and surjective on \( (0,+\infty) \) (with codomain \( \mathbb{R} \)). If we restrict the domain to \( [1,+\infty) \), the image becomes \( [0,+\infty) \) (since \( \ln(1)=0 \) and \( \ln(x) \) is strictly increasing). Consequently, the inverse function is:
\[ f^{-1}(y)=e^y, \quad y\in [0,+\infty). \]
Exercise 4: The function \( f(x) = \sin(x) \) is not injective on \( \mathbb{R} \). Restrict the domain to an interval where the function is injective and find the inverse function.
Solution: The function \( f(x) = \sin(x) \) is injective on \( [-\frac{\pi}{2}, \frac{\pi}{2}] \). The inverse function will be \( f^{-1}(y) = \arcsin(y) \), with \( y \in [-1, 1] \).
The restriction of a function allows us to manipulate the domain of a function to obtain desired properties such as injectivity, surjectivity, or bijectivity.