兩個函數可以串成生產線:先讓 f 加工,再把成品餵給 g。唯一要小心的是接口——f 的輸出未必都是 g 收得下的輸入,收不下的原料只能整批退回。把這件事寫進定義:
2.2 DEFINITION
Let f have domain D(f) in A and range R(f) in B, and let g have domain D(g) in B and range R(g) in C. The compositiong∘f (note the order!) is the set g∘f = {(a, c) ∈ A × C : there exists b ∈ B with (a, b) ∈ f and (b, c) ∈ g}.
合成 g∘f 收「經 f 到 b、再經 g 到 c」走得通的頭尾對 (a, c)。注意次序:g∘f 是先 f 後 g——記號從右往左讀,跟穿衣服一樣,先穿的寫在裡面。
For any functions f and g, the composition g∘f is a function, with D(g∘f) = {x ∈ D(f) : f(x) ∈ D(g)}, R(g∘f) = {g(f(x)) : x ∈ D(g∘f)}.
合成必是函數,而且帳目分明:定義域是「f 收得下、且加工品 g 也收得下」的輸入全體;值域是這些輸入一路加工到底的成品全體。
正例:f(x) = x − 1(全域)、g(x) = 1/x(定義域 x ≠ 0)——D(g∘f) = {x : x ≠ 1},在 x = 1 處 f 的成品 0 被 g 退貨。反例:接口可以全空——例 2 的第二筆帳給出一對處處接不上的函數,合成是「空函數」。
PROOF
「g∘f 真是函數」這一步常被略過,此處補齊;兩條帳目由定義直讀。
Proof. First, g∘f obeys the function condition. Suppose (a, c) and (a, c′) both belong to g∘f: some b gives (a, b) ∈ f, (b, c) ∈ g, and some b′ gives (a, b′) ∈ f, (b′, c′) ∈ g. Because f is a function, b = b′; and because g is a function, c = c′.
這一步的所求:驗證接力線守販賣機條款。同一個起點 a 若走出兩條路,先看中繼站——f 是函數,所以 a 的加工品只有一個,b = b′;中繼站既然相同,再看終點——g 是函數,同一個 b 的輸出只有一個,c = c′。兩關的唯一性一棒傳一棒,合成的唯一性就是這麼繼承來的。
Next the bookkeeping. An input x admits a completed chain exactly when x ∈ D(f) and the intermediate product f(x) lies in D(g) — this is the stated domain. For such x the chain ends at g(f(x)), so the outputs are precisely the values g(f(x)) — the stated range.
A function f is injective (or one-one) when: whenever (a, b) and (a′, b) belong to f, then a = a′. An injective function is called an injection. Equivalently: a ≠ a′ in D(f) forces f(a) ≠ f(a′).
Let f be an injection with domain D(f) in A and range R(f) in B. The set g = {(b, a) ∈ B × A : (a, b) ∈ f} is an injection with D(g) = R(f) and R(g) = D(f); it is called the function inverse to f, written f⁻¹. Thus b = f(a) if and only if a = f⁻¹(b).
反函數 f⁻¹=把 f 的每個有序對前後對調。定義域與值域跟著對調:D(f⁻¹) = R(f)、R(f⁻¹) = D(f);讀法對調:b = f(a) ⟺ a = f⁻¹(b)。只有 injection 有反函數——資格審查在前,對調才合法。
Proof. Write g = {(b, a) : (a, b) ∈ f}. First, g is a function: if (b, a) and (b, a′) belong to g, then (a, b) and (a′, b) belong to f, and injectivity of f forces a = a′. Second, g is injective: if (b, a) and (b′, a) belong to g, then (a, b) and (a, b′) belong to f, and the function condition on f forces b = b′.
修剪:取 f = F | {x : x ≥ 0}。驗 injective——設 x, y ≥ 0 且 x² = y²,補上一句常被跳過的「why」:移項得 x² − y² = (x − y)(x + y) = 0(平方差是高中代數;展開靠的分配律與「乘積為零必有因子為零」都在 §4 立案,先記帳),於是 x = y 或 x + y = 0;後者配上兩人皆 ≥ 0 只剩 x = y = 0(「兩個非負數相加得零則兩者皆零」屬 §5 的順序工具——若 x > 0 則 x + y > 0——同樣先記帳)。兩案都是 x = y——不同的非負數平方必不同。
由 2.6,f⁻¹ 存在,D(f⁻¹) = R(f)、讀法 y = x² ⟺ x = f⁻¹(y)——它就是日後的正平方根函數√。有一筆帳要誠實記下:R(f) 是「非負數的平方」全體,而「每個非負實數都躺在 R(f) 裡」(亦即人人有平方根)眼下還證不動——那正是 §6 完備性(6.8)的工作。本篇只登記機制:只要 y 真是某個非負數的平方,f⁻¹(y) 就唯一地交出那個數。