Functions or Mappings
Introduces the concept of function or mapping in mathmatics.
Functions or Mappings
Definition of a Function
Let \(A\) and \(B\) be nonempty sets. A function from \(A\) to \(B\) is a relation \(f\subseteq A\times B\) such that every element of \(A\) is related to exactly one element of \(B\).
In symbols, \[ \forall a\in A,\ \exists! b\in B \text{ such that } (a,b)\in f. \] The unique element \(b\) is denoted by \(f(a)\), so we write \[ f(a)=b. \] The notation \[ f:A\to B \] means that \(f\) has domain \(A\) and codomain \(B\).
Clarification of Some Common Concepts
Function and Relation
A relation from \(A\) to \(B\) is an arbitrary subset of \(A\times B\):
\[ R\subseteq A\times B. \]
A function \(f:A\to B\) is a special relation satisfying two extra conditions:
- every \(a\in A\) has an output, i.e., \(\operatorname{Dom}(f)=A\);
- the output of each \(a\in A\) is unique.
For example, \[ R={(1,2),(1,3),(2,4)} \] is not a function from \({1,2}\) to \({2,3,4}\), because \(1\) has two outputs.
Also, \[ S={(1,2)} \] is not a function from \({1,2}\) to \({2,3,4}\), because \(2\) has no output.
Domain, Codomain, and Range
Recall that for a relation \(R\) from \(A\) to \(B\), \[ \operatorname{Dom}(R)\subseteq A,\qquad \operatorname{Ran}(R)\subseteq B. \] Here \(A\) and \(B\) are usually called the source set and target set.
For a function \[ f:A\to B, \] \(A\) is the domain, since \(\operatorname{Dom}(f)=A\); and \(B\) is called the codomain.
We don’t define codomain for relation \(R\) as codomain, because not every \(a\in A\) necessarily has an output, so defining codomain for R is useless.
The range, or image, of \(f\) is the set of values actually attained by \(f\): \[ f(A)={f(a):a\in A}. \] Thus,
\[ f(A)\subseteq B. \]
The codomain and the range need not be the same. For example, \[ f:\mathbb{R}\to\mathbb{R},\qquad f(x)=x^2 \] has codomain \(\mathbb{R}\), but range \([0,\infty)\).
Image and Preimage
Let \[ f:A\to B. \] For \(A_1\subseteq A\), the image of \(A_1\) under \(f\) is \[ f(A_1)={f(a):a\in A_1}. \]
So image is range. But we use the term image more frequently when the set \(A_1\) we map from is not the domain \(A\), but only subset of \(A\).
For \(B_1\subseteq B\), the preimage of \(B_1\) under \(f\) is \[ f^{-1}(B_1)={a\in A:f(a)\in B_1}. \]
The notation \(f^{-1}(B_1)\) does not require \(f\) to be invertible; it denotes the preimage of a set, not necessarily an inverse function.
Function and Mapping
In most mathematical contexts, function and mapping mean the same thing.
The word function is common in numerical settings, such as
\[ f:\mathbb{R}\to\mathbb{R},\qquad f(x)=x^2. \]
The word mapping is common in more abstract settings, where the domain and codomain may be arbitrary sets or mathematical structures.
In this post, we use function and mapping as synonyms.
Basic Properties of Functions
Source of the image: https://www.mathsisfun.com/sets/injective-surjective-bijective.html
Injective
A function \(f:A\to B\) is called injective, or one-to-one, if distinct inputs always have distinct outputs.
Formally, \(f\) is injective if for all \(a_1,a_2\in A\),
\[ f(a_1)=f(a_2)\implies a_1=a_2. \]
Equivalently,
\[ a_1\neq a_2\implies f(a_1)\neq f(a_2). \]
For example,
\[ f:\mathbb{R}\to\mathbb{R},\qquad f(x)=2x+1 \]
is injective.
But
\[ g:\mathbb{R}\to\mathbb{R},\qquad g(x)=x^2 \]
is not injective, because
\[ g(1)=g(-1)=1. \]
Injectivity means that no two different inputs collapse to the same output.
Surjective
A function \(f:A\to B\) is called surjective, or onto, if every element of the codomain is hit by the function.
Formally, \(f\) is surjective if for every \(b\in B\), there exists an \(a\in A\) such that
\[ f(a)=b. \]
Equivalently,
\[ f(A)=B. \]
For example,
\[ f:\mathbb{R}\to\mathbb{R},\qquad f(x)=x^3 \]
is surjective, because every real number has a real cube root.
But
\[ g:\mathbb{R}\to\mathbb{R},\qquad g(x)=x^2 \]
is not surjective, because no real number \(x\) satisfies
\[ x^2=-1. \]
However, if we change the codomain, then
\[ h:\mathbb{R}\to [0,\infty),\qquad h(x)=x^2 \]
is surjective.
This shows again that surjectivity depends on the codomain.
Bijective
A function \(f:A\to B\) is called bijective, or a bijection, if it is both injective and surjective.
That means:
- every element of \(A\) maps to exactly one element of \(B\);
- no two different elements of \(A\) map to the same element of \(B\);
- every element of \(B\) is hit.
Equivalently, \(f\) is bijective if every element \(b\in B\) has exactly one preimage in \(A\).
That is, for every \(b\in B\), there exists a unique \(a\in A\) such that
\[ f(a)=b. \]
For example,
\[ f:\mathbb{R}\to\mathbb{R},\qquad f(x)=2x+1 \]
is bijective.
It is injective because different inputs give different outputs. It is surjective because for every \(y\in\mathbb{R}\), we can solve
\[ y=2x+1 \]
and get
\[ x=\frac{y-1}{2}. \]
Thus every real number \(y\) is hit by exactly one real number \(x\).
Inversible
If \(f:A\to B\) is bijective, then \(f\) has an inverse function
\[ f^{-1}:B\to A. \]
The inverse function sends each output back to its unique input.
That is, if
\[ f(a)=b, \]
then
\[ f^{-1}(b)=a. \]
A function has an inverse function exactly when it is bijective.
If \(f\) is not injective, then some output comes from more than one input, so the inverse is not well-defined.
If \(f\) is not surjective, then some element of the codomain has no preimage, so the inverse cannot be defined on all of \(B\).