Sub topic 1
What is a function?
A function is a rule that assigns exactly one output to each allowed input. The input is the value you start with. The output is the value produced by the rule.
This chapter assumes you can simplify algebraic expressions, solve simple equations and inequalities, and plot points on a coordinate plane.
Prerequisites
You should be comfortable with:
- Arithmetic with integers, fractions, and decimals
- Basic algebraic expressions and exponents
- Solving simple equations and inequalities
- Plotting ordered pairs such as \((2, 5)\)
The defining rule
Suppose a machine receives an input \(x\), applies a rule, and produces an output \(y\). The relationship is a function if every allowed input has one and only one output.
An input cannot produce two different outputs. However, two different inputs may produce the same output.
For example, the rule \(f(x)=x^2\) is a function:
- \(f(2)=4\)
- \(f(-2)=4\)
The inputs \(2\) and \(-2\) share the output \(4\). That is allowed.
The following relationship is not a function:
- \(1 \mapsto 3\)
- \(1 \mapsto 5\)
The input \(1\) has two outputs, \(3\) and \(5\).
Four ways to represent a function
A function can be shown with a mapping, table, graph, or equation. Each representation describes the same input-output relationship in a different way.
| Representation | What to check |
|---|---|
| Mapping | Each input has exactly one arrow leaving it |
| Table | No input appears with two different outputs |
| Graph | No vertical line crosses the graph more than once |
| Equation | Each allowed input gives one output |
Consider the function \(f(x)=2x+1\). Several representations of this function are shown below.
Mapping
A mapping uses arrows from inputs to outputs:
- \(0 \mapsto 1\)
- \(1 \mapsto 3\)
- \(2 \mapsto 5\)
Table
| Input \(x\) | Output \(f(x)\) |
|---|---|
| 0 | 1 |
| 1 | 3 |
| 2 | 5 |
Graph
The ordered pairs \((0,1)\), \((1,3)\), and \((2,5)\) can be plotted as points. If the rule applies to every real number, the points form a straight line.
A graph represents a function when every vertical line meets the graph at most once. This check is called the vertical line test. A vertical line represents one input value. If it crosses the graph twice, that input would have two outputs.
Equation
The equation \(f(x)=2x+1\) gives a calculation for every allowed input. For example, substituting \(x=4\) gives:
\[ f(4)=2(4)+1=9 \]
Function or not a function?
Use the defining rule rather than the appearance of the data.
The pairs \(\{(1,4),(2,4),(3,9)\}\) represent a function. Each input appears once, even though two inputs have output \(4\).
The pairs \(\{(1,4),(1,7),(3,9)\}\) do not represent a function. The input \(1\) is paired with two different outputs.
A repeated pair, such as \((1,4)\) listed twice, does not create two different outputs. It still represents the same input-output assignment.
Domain and range
The domain is the set of allowed inputs. The range is the set of outputs produced by those inputs.
For the pairs \(\{(1,4),(2,4),(3,9)\}\):
- Domain: \(\{1,2,3\}\)
- Range: \(\{4,9\}\)
The range lists each output once. It does not repeat \(4\), even though two inputs produce it.
def is_function(pairs):
outputs = {}
for x, y in pairs:
if x in outputs and outputs[x] != y:
return False
outputs[x] = y
return True
print(is_function([(1, 4), (2, 4), (3, 9)])) # True
print(is_function([(1, 4), (1, 7), (3, 9)])) # FalseExercise
Is the relation \(\{(-1,2),(0,2),(1,3)\}\) a function? State its domain and range.
Show answer
Yes. Each input has exactly one output. The domain is \(\{-1,0,1\}\), and the range is \(\{2,3\}\).