Sub topic 2
Four ways to show a function
Where this chapter fits
This chapter assumes you can plot points on the coordinate plane, evaluate an algebraic expression at a number, and you know the definition from the previous chapter: a function assigns exactly one output to each allowed input. Here you will learn the four standard ways to present a function. You will also learn how to move between them and how to test each one for the "exactly one output" rule.
The four forms are a mapping diagram, a table, a graph, and an equation. They are not four different functions. They are four views of the same rule, and each view makes some questions easy and others awkward.
One function in four forms
Use f(x) = 2x + 3 as the running example.
Equation
An equation gives a rule you can compute with. To find the output for any input, substitute the input for x and simplify. The equation y = 2x + 3 says: double the input, then add 3.
An equation is the most compact form. It covers every input at once, including ones you have not tried yet.
Table
A table lists chosen inputs and the output for each.
| x | -2 | -1 | 0 | 1 | 2 | 3 |
|---|---|---|---|---|---|---|
| f(x) | -1 | 1 | 3 | 5 | 7 | 9 |
A table shows only the inputs it lists. It says nothing about x = 1.5 unless that column appears. When a table is the whole definition, as with data from an experiment, the function is exactly those listed inputs and nothing else.
Mapping diagram
A mapping diagram has two columns. The left column holds inputs and the right column holds outputs. An arrow joins each input to its output.
The function rule is easy to check here: every input has exactly one arrow leaving it. Outputs may receive several arrows, but inputs may not send out several.
Graph
A graph plots each pair (x, f(x)) as a point. For f(x) = 2x + 3, the points (-2, -1), (-1, 1), (0, 3), (1, 5) and so on lie on a straight line. The line has slope 2 and crosses the y-axis at (0, 3).
To read f(1) from a graph, find x = 1 on the horizontal axis. Move vertically to the curve, then read the height. The height is the output, 5.
Graphs carry extra symbols you need to read correctly:
- An arrowhead at the end of a curve means it continues in that direction.
- A filled dot means that point is on the graph.
- An open dot means the curve approaches that point but the point is not included.
- A set of separate dots with no line between them means the function is defined only at those inputs.
Moving between the forms
The direction of travel matters. Going from an equation to a table is mechanical. Going from a table back to an equation requires you to notice a pattern, and a finite table never proves a single equation.
The following Python code converts an equation into a table, which is the easy direction. It then prints the pairs as a mapping.
def f(x):
return 2 * x + 3
inputs = [-2, -1, 0, 1, 2, 3]
table = {x: f(x) for x in inputs}
for x, y in table.items():
print(f"{x:>3} -> {y}")The output is:
-2 -> -1
-1 -> 1
0 -> 3
1 -> 5
2 -> 7
3 -> 9Going the other way, suppose a table gives (0, 3), (1, 5), (2, 7). The outputs rise by 2 for each step of 1 in the input, so f(x) = 2x + 3 fits. That is a hypothesis. Another rule could agree with those three points and differ elsewhere. Check any proposed equation against every row, and treat it as a guess until you know more about where the data came from.
Testing for "exactly one output" in each form
Each representation has its own test for the function rule.
| Form | How to test | A non-function looks like |
|---|---|---|
| Mapping diagram | Count the arrows leaving each input | An input with two or more arrows |
| Table | Look for a repeated input with different outputs | The same x in two columns with different f(x) values |
| Graph | Vertical line test: no vertical line meets the graph twice | A curve such as a sideways parabola or a circle |
| Equation | Solve for y and see whether one y results for each x | An equation that gives two y values for some x |
The graph test has its own chapter, so only the idea is given here. A vertical line at x = a represents the input a, and every point where it meets the graph is a possible output. Two meeting points would mean two outputs for one input.
The test for a table is a common source of mistakes, so here it is in code. It treats a repeated input with the same output as acceptable, because the rule only forbids two different outputs.
def is_function(pairs):
seen = {}
for x, y in pairs:
if x in seen and seen[x] != y:
return False
seen[x] = y
return True
table_a = [(1, 2), (2, 4), (3, 4)] # outputs repeat, inputs do not
table_b = [(1, 2), (1, 3), (2, 4)] # input 1 has two outputs
table_c = [(1, 2), (1, 2), (2, 4)] # input 1 repeated, same output
print(is_function(table_a)) # True
print(is_function(table_b)) # False
print(is_function(table_c)) # TrueEquations need more care
An equation in x and y is not automatically a function. The equation y = x² is a function: each x gives one y. The equation x² + y² = 25 is not. Setting x = 3 gives y² = 16, so y = 4 or y = -4. The equation x = y² fails for the same reason: x = 4 gives y = 2 or y = -2.
You can see this by listing integer points that satisfy each equation.
def is_function(pairs):
seen = {}
for x, y in pairs:
if x in seen and seen[x] != y:
return False
seen[x] = y
return True
square = [(x, x ** 2) for x in range(-5, 6)]
circle = [(x, y) for x in range(-5, 6) for y in range(-5, 6)
if x ** 2 + y ** 2 == 25]
print(is_function(square)) # True
print(is_function(circle)) # False
print((3, 4) in circle, (3, -4) in circle) # True TrueChoosing a representation
Each form has a job it does well.
| Form | Strength | Limitation |
|---|---|---|
| Equation | Exact for every input; easy to compute and manipulate | Behavior is hard to see at a glance |
| Table | Exact values with no calculation; matches measured data | Shows only the listed inputs |
| Mapping diagram | Makes "one arrow per input" visible | Impractical for more than a handful of inputs |
| Graph | Shows trends, peaks, and the overall shape | Values read from it are approximate |
A typical workflow combines them. You start with an equation, build a small table to check values, and sketch a graph to see the shape. When you are given a graph or table and asked for a rule, you move the other way.
Common errors
- Treating a repeated output as a violation. The function rule restricts inputs, not outputs. A mapping where two inputs point to the same output is still a function. For example, h(x) = x² sends both -2 and 2 to 4.
- Reading a table's order as significant. Reordering the columns of a table does not change the function. Only the pairs matter.
- Assuming a table is the whole function. If a function is defined by a rule, a table is a sample of it. If the table is the definition, no other inputs exist.
- Joining dots that should stay separate. If inputs are whole numbers, such as the number of tickets sold, the graph is a set of dots. Drawing a continuous line implies inputs like 2.5 tickets.
- Calling every equation with x and y a function. Check whether solving for y gives one value for each x.
- Mistaking an open dot for a point on the graph. An open dot marks an excluded point. The function has no value there, or has its value at some other filled dot.
- Fitting an equation to too few table rows. Two points fit a line, but they also fit infinitely many other curves.
Practice
Exercise
A table lists the pairs (0, 5), (1, 5), (2, 5), (3, 5). Is it a function? Explain using the mapping-diagram view.
Show answer
Yes. Each input 0, 1, 2 and 3 has exactly one arrow leaving it, and all four arrows end at the output 5. Several inputs may share one output, so this is a function. It is a constant function.
Exercise
The table has pairs (2, 7), (4, 9), (2, 8), (6, 11). Is it a function? Name the input that causes the problem.
Show answer
No. The input 2 appears with two different outputs, 7 and 8. In a mapping diagram, input 2 would have two arrows leaving it.
Exercise
Build a table of f(x) = x² - 1 for x = -2, -1, 0, 1, 2. Which outputs repeat, and does that stop f from being a function?
Show answer
The pairs are (-2, 3), (-1, 0), (0, -1), (1, 0), (2, 3). The outputs 3 and 0 each appear twice. This does not stop f from being a function, because each input still has exactly one output.
Exercise
Is the equation y² = x a function of x? Give a specific input that supports your answer.
Show answer
No. For x = 9, y² = 9 gives y = 3 or y = -3, so the input 9 has two outputs. Its graph is a parabola opening sideways, and a vertical line at x = 9 meets it twice.
Exercise
A bakery sells muffins for $3 each. Its cost function is C(n) = 3n, where n is the number of muffins bought. A student draws the graph as a solid line through the origin and calls it a function. What is the problem with the drawing, and how should it look?
Show answer
The number of muffins n must be a whole number, so the graph should be separate dots at (0, 0), (1, 3), (2, 6), and so on. A solid line implies inputs such as 1.5 muffins. The dots still satisfy the function rule, and the line drawn through them is only a visual guide.