【函數及圖像 Functions and Graphs:定義域、對應域、值域】Functions and Graphs: Domain, Codomain, Range, Independent and Dependent Variables
SketchMath 數學團隊 SketchMath Maths Team | 更新 Updated 2026-10-20
函數及其圖像 Functions and Graphs 係數學 DSE 必考課題,就咁聽大家未必知係咩,但當中嘅「f(x) = y」概念卻係經常應用於二次或三次方程之中!重點技巧包括定義域 domain、對應域 codomain、值域 range、自變量 independent variable、應變量 dependent variable 等。A function gives exactly one output y = f(x) for every input x. Many inputs may give the same output, but one input may never give two. The domain is the set of allowed inputs and the range is the set of outputs that actually occur.
依家我哋重新代入返去數學嘅概念,假設 Function 執行嘅程序係將 Input 先乘 2 再加 3,設 Input 為「x」,Output 為「y」,我哋就可以得知其實成條 Function 可以寫成「2x + 3 = y」。
Think of a function as a machine that works in one direction only: it takes an input, runs a preset set of steps, and gives an output. For example, whole fruit goes in, a slicer cuts it, and sliced fruit comes out (sliced fruit cannot be stuck back together, so the machine only works one way).
In maths, suppose the function multiplies the input by 2 and then adds 3. Let the input be x and the output y; then the function is 2x + 3 = y.
Back to the fruit: if I throw in an orange, I always get orange slices, never watermelon slices. A function works the same way: in a relationship between input x and output y, for every x there is only one matching y. We write f(x) = y. For f(x) = 2x + 3, f(4) = 2(4) + 3 = 11:
Input x
4
5
6
Output y
11
13
15
Is f(x) = x² = y still a function? Put in −2 and 2 and both give 4; −3 and 3 both give 9. It is still a function: different inputs may give the same output (an apple and a red apple both give apple slices). What is not allowed is x = y²: putting in 4 gives y = 2 or y = −2, so one input gives two outputs.
To tell whether a graph is a function, draw a vertical line on the coordinate plane and sweep it from left to right across the whole graph. If the line meets the graph at more than one point anywhere, the relation is not a function.
移動垂直線:它與 y = x² 只相交一點(是函數),與 x = y² 則相交兩點(不是函數)。 Slide the vertical line: it meets y = x² once (a function) but x = y² twice (not a function).
Go back to f(x) = 2x + 3 with a story: on the table are 4 fruits, an orange (2 lb), an apple (3 lb), a pineapple (5 lb) and a watermelon (7 lb), and the cost to slice each is "twice the weight plus $3 for the cutter". So f(2) = 7, f(3) = 9, f(5) = 13 and f(7) = 17 dollars.
Domain: the inputs you are allowed to use. Here only 4 fruits, so the inputs are 2, 3, 5, 7.
Codomain: the set the outputs are allowed to lie in. Putting the smallest input 2 and the largest 7 in gives the interval 7 to 17.
Range: the outputs that actually occur: 7, 9, 13 and 17 only.
When a question puts no limit on the inputs, the codomain and range are treated as the same set.
沿 f(x) = √x − 1 移動 x:input 由 0 開始(定義域 x ≥ 0),output 由 −1 開始(值域 y ≥ −1)。 Slide x along f(x) = √x − 1: the inputs start at 0 (domain x ≥ 0) and the outputs start at −1 (range y ≥ −1).
Find the domain and range of each function (no limit on the inputs):
f(x) = 1/x: the denominator cannot be 0. Domain: all real numbers except 0. Range: all real numbers except 0.
f(x) = √x − 1: what is under the root cannot be negative, but can be 0. Domain: all non-negative real numbers. The smallest x is 0, giving output −1. Range: −1 and above.
f(x) = 1/(x − 2): the denominator cannot be 0, so x ≠ 2. Domain: all real numbers except 2. Range: all real numbers except 0.
我哋可以將方程以圖像嘅方式表達出嚟,咁就可以輕鬆搵到定義域 domain、值域 range:定義域是圖像覆蓋的 x 值,值域是圖像覆蓋的 y 值。
You can draw a function as a graph, and then read the domain and range straight off it: the domain is the set of x-values the graph covers, and the range is the set of y-values it covers.