What Makes a Graph a Function: Vertical Line Test

A graph is a function if every x-value on the graph corresponds to exactly one y-value. In practical terms, this means no input (horizontal position) can produce two or more outputs (vertical positions). If you can find even a single spot where an x-value lines up with two different y-values, the graph is not a function.

This rule comes from the core definition of a function: a rule that assigns exactly one output to each input. On a coordinate plane, inputs run along the x-axis and outputs run along the y-axis, so the question becomes whether any point along the x-axis maps to more than one point on the curve above or below it.

The Vertical Line Test

The fastest way to check whether a graph represents a function is the vertical line test. Imagine dragging a vertical line across the graph from left to right. At every position, check how many times that vertical line touches the curve. If it never touches more than once at any position, the graph is a function. If it crosses the curve twice or more at any position, the graph fails the test.

The logic is straightforward. A vertical line captures every point that shares the same x-value. If the line hits the graph in two places, that single x-value is paired with two different y-values, which violates the one-output-per-input rule. You only need to find one such vertical line to disqualify the entire graph.

Graphs That Pass

Straight lines with any slope (except perfectly vertical) always pass the vertical line test. A line like y = 2x + 3 gives you one y-value for every x-value you plug in, so there’s no way a vertical line can hit it twice.

Parabolas that open upward or downward (like y = x²) also pass. Even though two different x-values can produce the same y-value (for instance, x = 2 and x = -2 both give y = 4), each individual x-value still produces only one y. That’s the key distinction: a function can reuse outputs, it just can’t assign multiple outputs to one input.

Other common graphs that qualify as functions include exponential curves, sine and cosine waves, logarithmic curves, and cubic equations. Despite their varied shapes, none of them allow a vertical line to intersect them more than once.

Graphs That Fail

Circles are one of the most common examples of graphs that are not functions. Take the equation x² + y² = 9, which draws a circle with radius 3. At x = 0, the circle has points at both y = 3 and y = -3. A vertical line through the center crosses the circle twice, so it fails the test.

Ellipses fail for the same reason: they’re stretched circles, and most vertical lines will cross them in two places. Sideways parabolas (where x depends on y² instead of the other way around) also fail because they curve back on themselves horizontally. The equation y = ±√x, for example, gives both a positive and negative y-value for every positive x.

A perfectly vertical line, like x = 5, is another classic non-function. Its domain is a single x-value, but its range is every real number. That one input corresponds to infinitely many outputs.

How Open and Closed Dots Matter

Piecewise graphs, where different rules apply to different sections of the x-axis, sometimes have breaks at their boundaries. At those break points, you’ll often see open circles (hollow dots) and closed circles (filled dots). An open circle means “this point is not included,” and a closed circle means “this point is included.”

This distinction is critical for the function test. If one piece of the graph ends with a closed dot at a particular x-value, and the next piece starts with an open dot at the same x-value, there’s still only one actual output at that x. The graph is a function. But if both pieces have closed dots at the same x-value with different y-values, that x-value maps to two outputs, and the graph fails.

Scatter Plots and Discrete Points

Not all graphs are smooth curves. Scatter plots and data tables produce graphs made of individual, unconnected points. The function rule still applies the same way: check whether any two points share the same x-coordinate. If two dots sit directly above each other (same x, different y), the set of points is not a function. If every dot has a unique x-coordinate, it qualifies.

You can still use the vertical line test here. Sweep a vertical line across the plot. If it never passes through more than one dot at a time, the discrete graph is a function.

Functions vs. Relations

Every function is a relation, but not every relation is a function. A relation is simply any connection between x-values and y-values on a graph. It places no restrictions on how many y-values can pair with a single x. A function adds one strict requirement: each x gets exactly one y.

This means circles, ellipses, and sideways parabolas are all perfectly valid relations. They describe real geometric shapes with useful properties. They just don’t meet the stricter standard of being a function, because their x-values don’t map to unique outputs.

Reading Domain and Range From a Graph

Once you’ve confirmed a graph is a function, you can read its domain and range directly. The domain is the full spread of x-values the graph covers, read from left to right. The range is the full spread of y-values, read from bottom to top. If the graph has arrows indicating it continues beyond what’s shown, the domain or range extends further than the visible portion.

For example, a parabola opening upward with its lowest point at y = -2 has a range of -2 to infinity. Its domain, assuming it stretches left and right without stopping, is all real numbers. Identifying these boundaries helps you understand not just that the graph is a function, but what inputs it accepts and what outputs it can produce.