Sub topic 5
Testing Graphs with the Vertical Line Test
Assume you can plot points on a coordinate plane and understand that an ordered pair \((x,y)\) gives an input \(x\) and an output \(y\). In this chapter, you will use a graph to decide whether a relation is a function.
The test
A function assigns exactly one output to every allowed input. On a graph, this means that one \(x\)-value cannot be paired with two different \(y\)-values.
A vertical line has the form \(x=c\), where \(c\) is a fixed number. Imagine sliding this line from left to right across the graph:
- If every vertical line touches the graph at most once, the graph represents a function of \(x\).
- If even one vertical line touches the graph more than once, the graph does not represent a function of \(x\).
This method is called the vertical line test.
Why the test works
Suppose a vertical line at \(x=3\) meets a graph at \((3,2)\) and \((3,5)\). The same input, \(3\), has two outputs, \(2\) and \(5\). That violates the definition of a function.
By contrast, a graph can have two different inputs with the same output. For example, the graph of \(y=x^2\) contains both \((-2,4)\) and \((2,4)\). The inputs are different, so this is allowed. A horizontal line may touch a function more than once.
| Graph | Vertical line test | Function of \(x\)? |
|---|---|---|
| \(y=x^2\) | Every vertical line meets it at most once | Yes |
| A circle | Some vertical lines meet it twice | No |
| \(x=y^2\) | Some vertical lines meet it twice | No |
| A line such as \(y=2x-1\) | Every vertical line meets it once | Yes |
Reading domain and range from a graph
The vertical line test also helps you read the domain and range.
- The domain is the set of \(x\)-values for which the graph has at least one point.
- The range is the set of \(y\)-values that occur on the graph.
To find the domain, project the graph onto the \(x\)-axis. To find the range, project it onto the \(y\)-axis. These projections do not decide whether the graph is a function. The vertical line test decides that.
For a graph with an endpoint, check whether the endpoint is included. A filled dot includes its coordinate. An open circle excludes its coordinate. For example, a graph that begins at a filled point with \(x=-2\) includes \(-2\) in its domain. A graph that begins at an open circle does not.
Common errors
Confusing the vertical and horizontal tests
The vertical line test answers this question:
> Is \(y\) a function of \(x\)?
The horizontal line test answers a different question about whether a function is one-to-one. Do not use a horizontal line to decide whether a relation is a function of \(x\).
Checking only one line
A graph may pass at most \(x\)-values but fail at one value. The test must work for every vertical line that could meet the graph.
Assuming every equation gives a function
The equation \(x^2+y^2=9\) describes a circle, but it does not define \(y\) as a function of \(x\). At \(x=0\), the circle has the two points \((0,3)\) and \((0,-3)\).
The equation can be split into two functions:
\[ y=\sqrt{9-x^2} \quad\text{and}\quad y=-\sqrt{9-x^2}. \]
Each semicircle passes the vertical line test on the domain \([-3,3]\).
Exercise
Does the graph of \(x=y^2+1\) represent a function of \(x\)? Explain using the vertical line test.
Show answer
No. At \(x=2\), the graph contains \((2,1)\) and \((2,-1)\), so one input has two outputs. A vertical line at \(x=2\) meets the graph twice.