Testing graphs and equations for functions
A graph has endless points and an equation has endless solutions. How can you tell whether any input has been given two outputs without listing them all?
Where you are 5 in What a function is
When you reach for it
A function gives each input exactly one output. Relations and functions sets that definition out, and when the pairs come as a list you test it by looking for an input that appears twice with different outputs. A graph is different: a curve holds endless points, and an equation such as x = y^2 has endless solutions. You cannot list them and scan.
This lesson gives two ways to answer the question anyway. On a graph, slide a vertical line across it and count how many times it meets the graph. From an equation, fix an input, solve for y, and count how many values come out.
Reach for it whenever a graph or an equation is offered as a function: before naming it f, before reading a value off the graph, and before asking for its domain. Throughout, x is the input, measured across, and y is the output, measured up, as in graphs of functions.
The procedure
Why a vertical line
Every point on the vertical line x = a has first coordinate a. So the points where that line meets a graph are exactly the points of the graph whose input is a. Counting crossings is counting outputs.
- No crossing means the input a has no output. That is allowed: a is simply not in the domain.
- One crossing means a has exactly one output.
- Two or more crossings, say at (a, b) and (a, c) with b \ne c, means the single input a is paired with two different outputs. The graph is not a function.
Figure 1 shows the third case. The vertical line x = 16 meets the curve at (16, 4) and at (16, -4), so the input 16 is paired with both 4 and -4.
The vertical line test. A graph shows y as a function of x exactly when every vertical line meets it at most once. If even one vertical line meets it twice or more, it does not.
The test is the definition of a function said in pictures, so it works in both directions: a line meeting the graph twice is an input with two outputs, and no such line means no such input.
One line is enough to fail. To show a graph is not a function, name one vertical line and two points where it meets the graph. That is the same as naming one input and two of its outputs.
Passing needs every line. You cannot draw every vertical line, so a “yes” rests on the shape: traced from left to right, the graph never turns back on itself and never has two points stacked in one column.
The shapes that come up
Lines. A slanted or horizontal line passes: y = mx + b gives the input a the single output ma + b. A vertical line such as x = 3, the kind graphing a line meets when the equation has no y, fails, and vertical lines are the only lines that do (Example 1).
Curves. A circle fails at the vertical line through its center, though its upper half on its own passes (Example 2). The sideways parabola x = y^2 fails, as Figure 1 shows, while the upright parabola y = x^2 of the shape of a parabola passes.
Separate dots. A graph made of dots fails exactly when two dots are stacked in the same column, which is the repeated input of a list of pairs seen as a picture (Example 3).
From an equation: solve for y
An equation in x and y is a relation: its graph is every point (x, y) that makes it true. It defines y as a function of x when each input x leaves at most one y that makes it true. So fix an input, solve for y, and count.
In practice, get y alone. If you reach
and the expression is built from steps that each give one result, such as adding, multiplying, dividing, taking an absolute value, the square root sign \displaystyle \sqrt{\ } (which means the non-negative root) or a cube root, then each input gives at most one output, and the equation is a function. Trouble comes only from undoing something done to y that two different numbers share: y^2 = 9 is true for y = 3 and for y = -3, and so is \lvert y \rvert = 3.
Four equations show the range of cases.
y = 4x - 9. Already solved. Each input gives one number, for instance x = 2 gives y = -1 and nothing else. A function.
x = y^2. Take x = 16. Then y^2 = 16, so y = 4 or y = -4, and both check: 4^2 = 16 and (-4)^2 = 16. One input, two outputs. Not a function, and this is the curve of Figure 1.
x^2 + y^2 = 50. Take x = 1. Then y^2 = 49, so y = 7 or y = -7; both make 1 + 49 = 50 true. Not a function. Its graph is a circle centered at the origin.
y = \lvert x \rvert. The absolute value of a number is one number: \lvert -3 \rvert is 3 and nothing else. So each input has one output. A function, even though x = 3 and x = -3 both give 3, because two inputs sharing an output is allowed.
Notice where the square and the absolute value sit. A square or an absolute value of x is worked out from the input and gives one answer. A square or an absolute value of y has to be undone, and undoing it gives two.
Worked examples
Three straight lines
Decide whether each line in Figure 2 is the graph of a function: (a) \displaystyle y = -\frac{1}{2}x + 2, (b) y = -1, (c) x = 3.
(a) The dashed lines x = -2, x = 1 and x = 3 each meet the graph once, at heights \displaystyle -\frac{1}{2}(-2) + 2 = 3, then \displaystyle -\frac{1}{2}(1) + 2 = \frac{3}{2}, then \displaystyle -\frac{1}{2}(3) + 2 = \frac{1}{2}. Three lines prove nothing on their own, but the equation does: for any input a the only output is \displaystyle -\frac{1}{2}a + 2. A function.
(b) The vertical line x = a meets y = -1 only at (a, -1). Every input has the output -1, and that repetition is fine, since each input still has just one output. A function, a constant one.
(c) The test line x = 3 lies along the whole graph, meeting it at (3, -2), (3, 1), (3, 3) and every other point on it. The input 3 has endless outputs. Not a function.
A circle and half of it
Figure 3(a) shows the circle with center (2, 1) and radius 3, and Figure 3(b) shows only its upper half, including the two end points (-1, 1) and (5, 1). Which is the graph of a function?
(a) Take the vertical line through the center, x = 2. Counting squares from the center, it meets the circle 3 above and 3 below, at (2, 4) and (2, -2). The input 2 has two outputs, 4 and -2. Not a function. That the lines x = -1 and x = 5 touch it only once does not rescue it.
(b) The upper half runs from (-1, 1) over the top to (5, 1) and never doubles back. Each vertical line between x = -1 and x = 5 meets it exactly once; the line x = 2 now meets it only at (2, 4). Lines outside that strip miss it. A function, whose inputs are the numbers from -1 to 5.
Graphs made of dots
Figure 4(a) shows the dots (-2, 1), (-1, 3), (0, 3), (1, -1), (2, 0). Figure 4(b) shows the dots (-2, 2), (-1, 0), (1, 3), (1, -2), (2, 1). Which is the graph of a function?
A vertical line meets a dot only if the dot lies on it, so only the lines through the dots matter, and such a line fails only if two dots share it.
(a) The inputs -2, -1, 0, 1, 2 are all different, so no column holds two dots. A function. The dots (-1, 3) and (0, 3) sit at the same height: two inputs sharing the output 3, which is allowed.
(b) The dots (1, 3) and (1, -2) are stacked in the column x = 1, and the dashed line meets both. The input 1 has two outputs. Not a function.
A trail drawn two ways
Vilja walks a loop trail that starts and ends at the same hut. Figure 5 shows the walk two ways. On the left is the elevation profile: distance walked in kilometers across, elevation in meters up. On the right is the trail on a map: kilometers east across, kilometers north up.
(a) Is elevation a function of distance walked? (b) On the map, is the north position a function of the east position?
(a) At each moment Vilja is at one elevation, and the distance she has walked only ever increases. So each distance has one elevation: every vertical line from 0 to 8 kilometers meets the profile once, and the dashed line at 3 kilometers meets it at 600 meters. A function. The elevation 400 meters comes up at both 0 and 8 kilometers, because the loop ends where it began; two inputs sharing an output is allowed.
(b) The vertical line 3 kilometers east meets the loop twice: on the northern side, about 4.1 kilometers north, and on the southern side, about 0.9 kilometers north. One input, two outputs. Not a function.
Every closed loop fails this way: a vertical line through its inside meets it on the way out and again on the way back. The profile escapes because its input, distance walked, never repeats.
Solving for y
Decide whether each equation defines y as a function of x. For (b), also say which inputs have two outputs, which have exactly one, and which have none.
(a) 4x - 3y = 6 \qquad (b) y^2 = x + 4 \qquad (c) xy = -8
Solution(a) Subtract 4x from both sides, then divide both sides by -3:
Each step can be undone, so no solution was lost or gained, and the right side is one number for each x. A function, whose graph is a line of slope \displaystyle \frac{4}{3}.
(b) Here y is squared, and undoing a square gives two signs. How many values of y square to x + 4 depends on the sign of x + 4.
- If x > -4, then x + 4 is positive and has two square roots, \displaystyle y = \sqrt{x + 4} or \displaystyle y = -\sqrt{x + 4}. For instance x = 5 gives y^2 = 9, so y = 3 or y = -3, and both check: 3^2 = 9 and (-3)^2 = 9.
- If x = -4, then y^2 = 0, and only y = 0 works.
- If x < -4, then y^2 would have to be negative, which no real number allows: no output.
Not a function, because every input above -4 has two outputs. The graph is a sideways parabola opening to the right from (-4, 0). Keeping only the non-negative root, \displaystyle y = \sqrt{x + 4}, keeps its top half, and that half is a function.
(c) For any input other than 0, divide both sides by x:
one value for each input; for instance x = 2 gives y = -4 only. The input 0 needs its own look, because dividing by x was allowed only when x \ne 0. With x = 0 the equation reads 0 \cdot y = -8, that is 0 = -8, false for every y. So the input 0 has no output, which is allowed: 0 is outside the domain, the subject of the implied domain of a formula. A function.
Boundaries
The input must run across. The test asks whether y is a function of x with x on the horizontal axis. If a graph puts its input up the side, vertical lines answer a different question.
A drawing shows only what is drawn. A sketch cannot settle a piece too steep or a gap too small to see; when that matters, go to the equation.
Open and closed dots. An open dot marks a point that is not on the graph. A vertical line through one closed dot and one open dot meets the graph once. Two closed dots in the same column fail.
Solving must not lose or add solutions. Dividing by an expression is allowed only where it is not zero, which is why xy = -8 needed the input 0 checked on its own. Undoing an even power or an absolute value of y needs both signs; dropping one hides the second output and gives a wrong “yes”.
Where this goes next
Once a graph or an equation passes, it can be named f and written in function notation. Its inputs and outputs become its domain and range, and inputs with no output, like x = 0 for xy = -8, are what the implied domain collects.
Turn the test on its side and it asks a new question. A horizontal line that meets a function’s graph twice means two inputs share one output, and that is the horizontal line test, which decides whether a function can be run backwards as an inverse function. Keeping one half of a graph that fails, as with the upper half of the circle or \displaystyle y = \sqrt{x + 4}, comes back when the inverse trig functions are built.
Exercises
Reading graphs
Figure 6 shows six graphs. Each grid runs from -4 to 4 both ways, one square per unit, so count squares from the origin to read a point. Decide whether each is the graph of a function. If it is not, name an input and two of its outputs.
- Graph A
- Graph B
- Graph C
- Graph D
- Graph E
- Graph F
Lines
- Is the line x = -2 the graph of a function? If not, give an input and two of its outputs.
- Is the line y = -4 the graph of a function?
From an equation
Decide whether each equation defines y as a function of x. If it does, solve for y. If it does not, give an input and two of its outputs.
- 3x + 2y = 10
- x = y^2 + 1
- x^2 + y^2 = 289
- y = \lvert x - 2 \rvert
- \lvert y \rvert = x + 1
- y^3 = x
- x^2 y = 4
- For the equation x + y^2 = 4, which inputs have two outputs, which have exactly one, and which have none?
The trail
- Teodoro walks an out-and-back trail: 3 kilometers from a hut to a waterfall, then back the same way. (a) Is his elevation a function of the distance he has walked, from 0 to 6 kilometers? (b) On a map, his route is drawn once, since the way back lies on top of the way out. Does walking the path twice stop the north position from being a function of the east position?
Reasoning
- The test says “at most once”, not “exactly once”. Explain why a vertical line that misses the graph does not spoil a function, using \displaystyle y = -\frac{8}{x} as an example.
- Explain why every line that is not vertical passes the vertical line test, and why every vertical line fails it.
- A graph has a closed dot at (2, 1) and an open dot at (2, 4), with no other points on the line x = 2. Does the line x = 2 show that the graph is not a function? What if both dots were closed?
Answers
- A function. Traced from left to right, the zigzag always moves rightward, so every vertical line from -4 to 4 meets it exactly once.
- Not a function. The line x = 3 meets it at (3, 4) and (3, -4), so the input 3 has the outputs 4 and -4. Every vertical line to the right of x = -1 meets it twice.
- Not a function. The line x = 1 meets the oval at (1, 3) and (1, -3), so the input 1 has the outputs 3 and -3.
- A function. At x = 1 the graph holds only the closed dot (1, 2); the open dot (1, -1) is not on the graph. Every other vertical line meets exactly one of the two pieces once. Graphs built from pieces like this are piecewise functions.
- Not a function. The dots (-1, 3) and (-1, -2) are stacked in the column x = -1, so the input -1 has the outputs 3 and -2.
- A function. The curve rises, falls, then rises again, but it always moves rightward, so every vertical line meets it once.
- Not a function. The input -2 has every number as an output, for instance (-2, 0) and (-2, 5) are both on the line. Every other input has no output.
- A function. Every input has the single output -4; the repeated output is allowed.
- A function: \displaystyle y = 5 - \frac{3}{2}x. Subtract 3x, then divide both sides by 2.
- Not a function. At x = 5, y^2 = 4, so y = 2 or y = -2.
- Not a function. At x = 8, y^2 = 289 - 64 = 225, so y = 15 or y = -15.
- A function. \lvert x - 2 \rvert is one number for each x. The inputs 0 and 4 both give 2, which is allowed.
- Not a function. At x = 2, \lvert y \rvert = 3, so y = 3 or y = -3. (The input -1 has only the output 0, and inputs below -1 have none.)
- A function: \displaystyle y = \sqrt[3]{x}. Cubing keeps the sign, so every real number has exactly one real cube root: x = 8 gives only y = 2, and x = -27 only y = -3.
- A function: \displaystyle y = \frac{4}{x^2} for every input except 0. At x = 0 the equation reads 0 = 4, so the input 0 has no output, which is allowed.
- From y^2 = 4 - x: every input x < 4 has two outputs, \displaystyle y = \sqrt{4 - x} and \displaystyle y = -\sqrt{4 - x} (for instance x = 0 gives 2 and -2); the input x = 4 has exactly one, y = 0; every input x > 4 has none.
- (a) Yes. At each distance walked Teodoro is in one place at one elevation, so every vertical line from 0 to 6 kilometers meets the profile once; elevations repeat on the way back, which is allowed. (b) No. A map shows a set of points, and walking over a point twice adds no new point. Only the path’s shape decides: it fails only if one east position appears at two different north positions.
- A vertical line that misses the graph marks an input outside the domain, and the definition asks only that each input in the domain have one output. For \displaystyle y = -\frac{8}{x}, the line x = 0 misses the graph, yet every other input has exactly one output, so it is a function.
- A line that is not vertical has an equation y = mx + b, so the vertical line x = a meets it only at (a, ma + b): once. A vertical line x = c is met by the test line x = c at every one of its points, for instance (c, 0) and (c, 1), so the input c has two outputs.
- No. The open dot is not a point of the graph, so x = 2 meets the graph only at (2, 1), and the input 2 has the single output 1. If both dots were closed, the input 2 would have the outputs 1 and 4, and the graph would not be a function.