Function
In mathematics, a function \( f \) from a set \( X \) to a set \( Y \) is a relation that associates each element of \( X \) with exactly one element of \( Y. \) This page describes the commonly used notation, terminology, and concepts pertaining to functions.
Contents
Definition
A function \( f \) from a set \( X \) to a set \( Y \) is a binary relation \( R \) that satisfies the following conditions:
- \( R \subseteq \{ (x, y) \mid x \in X, y \in Y \} = X \times Y. \)
- For every \( x \in X, \) there exists \( y \in Y \) such that \( (x, y) \in R. \)
- If \( (x, y) \in R \) and \( (x, z) \in R, \) then \( y = z. \)
The set \( X \) is called the domain of \( f \) and the set \( Y \) is called the codomain of \( f. \) The relation \( R \) is also known as the graph of \( f. \)
Notation
Let \( f \) be a function from a set \( X \) to a set \( Y. \) Then the name \( f \) represents the function and the notation \( f(x) \) represents the application of the function to the argument \( x, \) i.e., \( f(x) \) represents the value of \( f \) for the element \( x \in X. \) In other words, for all \( x \in X, \) we have \( (x, f(x)) \in R. \)
A function \( f \) with domain \( X \) and codomain \( Y \) is also written as \( f : X \to Y. \) The function \( f \) may also be written as \( x \mapsto f(x). \) This notation specifies a function that maps \( x \) to \( f(x). \)
Formally, \( f(x) \) denotes the application of the function \( f \) to the argument \( x. \) However, in practice, it is common to use the expression \( f(x) \) to refer to both the function itself and its output for a given \( x, \) which is a slight deviation from strict notation. Similarly, the function \( x \mapsto g(x) \) is often written as \( f(x) = g(x). \) For example, the function \( x \mapsto x^2 - 1 \) may also be written as \( f(x) = x^2 - 1. \)
Consider a function \( f \) that returns the square of a real number. The following are common notations used to define this function, roughly ordered from the most formal form to the least formal one:
- \( f : \mathbb{R} \to \mathbb{R} ; \; x \mapsto x^2, \)
- \( f : \mathbb{R} \to \mathbb{R} : x \mapsto x^2, \)
- \( f : x \mapsto x^2, \)
- \( f: \mathbb{R} \to \mathbb{R} \) where \( f(x) = x^2, \)
- \( f(x) = x^2. \)
Domain, Codomain, and Image
The domain of a function is the set of all values for which the function is defined.
A codomain of a function \( f \) is a set within which the values \( f(x) \) for all \( x \in X \) must lie, where \( X \) is the domain of \( f. \)
The image of a function \( f \) is the set \( \{ f(x) \mid x \in X \} \) where \( X \) is the domain of \( f. \)
The term range is often used as a synonym of image. However the use of this term is inconsistent across literature. Some old books use the term range to mean codomain while other books use this term to mean the image. Therefore it is best to use the term image because it is free from such ambiguity.
Injection, Surjection, and Bijection
A function \( f : X \to Y \) is injective if \( \forall a, b \in X, a \neq b \implies f(a) \neq f(b). \) A function is injective, if each element of the codomain is mapped to by at most one element of the domain. An injective function is also known as a one-to-one function or an injection.
A function \( f : X \to Y \) is surjective if \( \forall y \in Y, \exists x \in X \) such that \( y = f(x). \) A function is surjective, if each element of the codomain is mapped to by at least one element of the domain. A surjective function is also known as an onto function or a surjection.
A function \( f : X \to Y \) is bijective if \( \forall y \in Y, \) there exists exactly one \( x \in X, \) such that \( y = f(x). \) A function is bijective, if each element of the codomain is mapped to by exactly one element of the domain. A bijective function is also known as a one-to-one correspondence or bijection. A bijection is both injective and surjective. In other words, a bijection is both one-to-one and onto.
The function \( f : \mathbb{R} \to \mathbb{R}; \; x \mapsto e^x \) is injective but not surjective. It is injective because distinct values of \( x \) produce distinct values of \( e^x. \) However, it is not surjective as no value in the domain maps to negative numbers in the codomain, leaving some elements in the codomain unmapped.
The function \( f : \mathbb{R} \to \mathbb{R}; \; x \mapsto x^3 - x \) is surjective but not injective. It is surjective because every value in the codomain is mapped to by at least one value in the domain. However, it is not injective, as distinct values in the domain can map to the same value in the codomain. For example, \( f(-1) = f(0) = f(1) = 0. \)
The function \( f : \mathbb{R} \to \mathbb{R}; \; x \mapsto x + 1 \) is bijective. It is both injective and surjective. This function is invertible with the inverse given by the function \( x \mapsto x - 1. \)
The function \( f : \mathbb{R} \to \mathbb{R}; \; x \mapsto x^2 \) is neither injective nor surjective. First, the function is not injective because distinct values in the domain can map to the same value in the codomain. For example, \( f(-2) = f(2) = 4. \) Additionally, the function is not surjective because no value in the domain maps to the negative numbers in the codomain.