Function basics
This work by Jephian Lin is licensed under a Creative Commons Attribution 4.0 International License.
$\newcommand{\trans}{^\top} \newcommand{\adj}{^{\rm adj}} \newcommand{\cof}{^{\rm cof}} \newcommand{\inp}[2]{\left\langle#1,#2\right\rangle} \newcommand{\dunion}{\mathbin{\dot\cup}} \newcommand{\bzero}{\mathbf{0}} \newcommand{\bone}{\mathbf{1}} \newcommand{\ba}{\mathbf{a}} \newcommand{\bb}{\mathbf{b}} \newcommand{\bc}{\mathbf{c}} \newcommand{\bd}{\mathbf{d}} \newcommand{\be}{\mathbf{e}} \newcommand{\bh}{\mathbf{h}} \newcommand{\bp}{\mathbf{p}} \newcommand{\bq}{\mathbf{q}} \newcommand{\br}{\mathbf{r}} \newcommand{\bx}{\mathbf{x}} \newcommand{\by}{\mathbf{y}} \newcommand{\bz}{\mathbf{z}} \newcommand{\bu}{\mathbf{u}} \newcommand{\bv}{\mathbf{v}} \newcommand{\bw}{\mathbf{w}} \newcommand{\tr}{\operatorname{tr}} \newcommand{\nul}{\operatorname{null}} \newcommand{\rank}{\operatorname{rank}} %\newcommand{\ker}{\operatorname{ker}} \newcommand{\range}{\operatorname{range}} \newcommand{\Col}{\operatorname{Col}} \newcommand{\Row}{\operatorname{Row}} \newcommand{\spec}{\operatorname{spec}} \newcommand{\vspan}{\operatorname{span}} \newcommand{\Vol}{\operatorname{Vol}} \newcommand{\sgn}{\operatorname{sgn}} \newcommand{\idmap}{\operatorname{id}} \newcommand{\am}{\operatorname{am}} \newcommand{\gm}{\operatorname{gm}} \newcommand{\mult}{\operatorname{mult}} \newcommand{\iner}{\operatorname{iner}}$
Let $S$ and $T$ be two sets.
A function $f$ from $S$ to $T$ is an assignment of each element $s\in S$ with an element $f(s)\in T$.
We usually write
to describe a function.
We call $S$ and $T$ the domain and the codomain of $f$.
A function $f:S\rightarrow T$ is injective if
Equivalently, $f$ is injective if $f(s_1) = f(s_2)$ implies $s_1 = s_2$.
The term "injective" is also known as "one-to-one".
An injection is an injective function.
A function $f : S \rightarrow T$ is surjective if
The range of a function $f$ is
$$ \range(f) = \{f(s) : s\in S\}. $$Therefore, $f$ is surjective if and only if $\range(f) = T$.
The term "surjective" is also known as "onto".
A surjection is a surjective function.
If a function $f$ is both injective and surjective, then it is bijective.
A bijection is a bijective function.
If $f$ is a bijection, then one may define its inverse as
$$ \begin{aligned} f^{-1} : T &\rightarrow S \\ t &\mapsto f^{-1}(t), \end{aligned} $$where $f^{-1}(t)$ is defined as the unique element $s\in S$ such that $f(s) = t$.
(Here the existence of $s$ is because $f$ is surjective, and the uniqueness of $s$ is because $f$ is injective.)
The function
$$ \begin{aligned} \idmap_S : S &\rightarrow S \\ s &\mapsto s \end{aligned} $$is called the identity map on $S$, denoted as $\idmap_S$.
Let $f : S \rightarrow T$ be a function.
If $S'\subseteq S$, then the image of $S'$ is
If $T'\subseteq T$, then the preimage of $T'$ is
$$ f^{-1}(T') = \{ s\in S : f(s) \in T'\}. $$Therefore, $\range(f) = f(S)$.
Note that although both the inverse and the preimage use the notation $f^{-1}$, the inverse is a function of elements in $T$ while the preimage is a function of subsets in $T$, so they should be distinguishable.
When the domain $S$, the codomain $T$, and a formula $f$ are given, we say $f$ is well-defined if $f$ is indeed a function.
Here are some examples.
執行以下程式碼。
Run the code below.### code
set_random_seed(0)
print_ans = False
inj = choice([True, False])
sur = choice([True, False])
S = list(range(1,5))
if inj and sur:
T = list(range(1,5))
if inj and not sur:
T = list(range(1,6))
if not inj and sur:
T = list(range(1,4))
if not inj and not sur:
T = list(range(1,5))
while True:
f = {s: choice(T) for s in S}
ran = list(set(f.values()))
if inj == (len(ran) == len(S)) and sur == (len(ran) == len(T)):
break
print("S =", S)
print("T =", T)
print("f : S --> T")
for s in S:
print("f(%s) ="%s, f[s])
if print_ans:
print("Injective?", inj)
print("Surjective?", sur)
print("range(f) =", ran)
判斷 $f$ 是否為嵌射函數。
Is $f$ injective?判斷 $f$ 是否為映射函數。
Is $f$ surjective?寫出 $f$ 的值域。
Find the range of $f$.找出符合各條件的函數。
Find examples of functions satisfying the following conditions.給兩個函數的例子﹐一個是嵌射、一個不是。
Give an example of an injective function and an example of a non-injective function.給兩個函數的例子﹐一個是映射、一個不是。
Give an example of a surjective function and an example of a non-surjective function.令 $S = \{1,2,3,4\}$、
$T = \{1,2,3,4\}$、且
求 $f(\{1,3\})$。
Find $f(\{1,3\})$.求 $f^{-1}(\{1,3\})$。
Find $f^{-1}(\{1,3\})$.寫出 $f$ 的反函數。
Find the inverse function of $f$.求 $f^{-1}(\{1\})$。
Find $f^{-1}(\{1\})$.求 $f^{-1}(1)$。
Find $f^{-1}(1)$.令 $f:S\rightarrow T$ 為一函數。
證明以下關於投影區和送影區的性質。
證明對任何子集 $S'\subseteq S$ 都有 $S'\subseteq f^{-1}(f(S'))$。
找一個例子讓 $S'\subsetneq f^{-1}(f(S'))$。
證明對任何子集 $T'\subseteq T$ 都有 $T'\supseteq f(f^{-1}(T'))$。
找一個例子讓 $T'\supsetneq f(f^{-1}(T'))$。
證明若 $f$ 是嵌射﹐
則對任何子集 $S'\subseteq S$ 都有 $S'= f^{-1}(f(S'))$。
證明若 $f$ 是映射﹐
則對任何子集 $T'\subseteq T$ 都有 $T'= f(f^{-1}(T'))$。
在以下集合中找到一個對射。
(兩個集合間如果存在一個對射﹐則它們的 數量級 就被視為是一樣的。
這個現象在個數有限的時候很自然﹐
但當個數無限多的時候會出現一個集合和它的子集個數一樣多的狀況﹐有些違反直覺﹐
但其實這現象就類似於 $\infty + 1 = \infty$ 這種概念﹐在無限大的時候是可接受的。
所有和自然數同樣數量級的集合﹐我們就說這樣的集合大小是 無窮可數 多個。
所以在當代的數學定義裡 $|\mathbb{N}| = |\mathbb{Z}| = |\mathbb{Q}|$﹐
但 $|\mathbb{R}| \neq |\mathbb{N}|$。)
令 $S = \{1,2,3\}$ 且 $T = \{x,y,z\}$。
找一個 $S$ 到 $T$ 的對射。
令 $S = \mathbb{Z}$ 且 $T = 2\mathbb{Z} = \{2z: z\in\mathbb{Z}\}$。
找一個 $S$ 到 $T$ 的對射。
令 $S = 2\mathbb{Z} = \{2z : z\in\mathbb{Z}\}$ 且 $T = 2\mathbb{Z} + 1 = \{2z+1 : z\in\mathbb{Z}\}$。
找一個 $S$ 到 $T$ 的對射。
令 $S = \mathbb{N} = \{1,2,3,\ldots\}$ 且 $T = \mathbb{Z}$。
找一個 $S$ 到 $T$ 的對射。