A function is one-to-one when no two distinct input values share the same output, and on a graph that means no horizontal line crosses the curve more than once. The horizontal line test is the whole rule: draw any horizontal line across the graphed relation, and if every one of them touches the curve at most one time, the function is one-to-one. Fail at a single height and the function maps two different x-values to the same y-value, so it is not one-to-one. That one condition is the boundary everything else builds on.
The test is easy to state and surprisingly easy to misread. Most errors come from testing the wrong axis, skimming a curve that looks flat but isn't, or forgetting that "one-to-one" needs a function first. Below is the full procedure for reading it off a graph, with the failure cases and the edge scenarios examiners actually use.
The horizontal line test in plain terms and what it proves
A function is one-to-one when f(a) = f(b) forces a = b. Flip that into geometry: if two points on the graph sit at the same height, they have the same y-value with different x-values, which breaks the condition. A horizontal line at that height hits both points, so the test is just the visual version of the definition.
The test only runs after you confirm the relation is a function at all. A circle fails the vertical line test, so it never gets to the horizontal line stage — "not a function" and "not one-to-one" are different verdicts and the horizontal line test has nothing to say about a non-function. State the function check first, then run the horizontal pass.
What the test proves is injectivity: each output belongs to exactly one input. It does not prove the function is onto, surjective, or continuous. A parabola opening upward is a function, fails the horizontal line test, and is therefore not one-to-one, even though it's perfectly continuous. Keep those ideas separate, because mixing them up is the most common conceptual slip on this topic.
A quick numeric check backs up the visual read. For f(x) = x², f(2) = 4 and f(−2) = 4, so two inputs share one output and the horizontal line at y = 4 crosses the parabola twice. For f(x) = x³, f(2) = 8 and f(−2) = −8, so the line at y = 8 hits only x = 2. The graph confirms what the arithmetic already shows.
Reading the test off the screen: axis, height, and what counts as one crossing
You draw a horizontal line by fixing a y-value and asking which x-values produce it. That means you scan left to right at a single height, not top to bottom. Students who draw vertical lines by habit are running the wrong test and will pass functions that clearly aren't one-to-one — any parabola looks "fine" under a vertical scan because it is a function.
What counts as one crossing is one distinct point. A curve that touches a horizontal line and turns back — tangency, like the vertex of a parabola at its exact minimum — is still two nearby x-values converging to the same output at the turning point, and the function fails there. If the line merely grazes a single peak with the curve approaching from both sides, that height is shared, so it is not a one-to-one function.
On a graphing calculator or app, the practical version is to evaluate the function at two symmetric inputs. On Desmos or a TI-84, plug in x = 2 and x = −2, then x = 3 and x = −3. If any symmetric pair returns the same output, the function is not one-to-one. This is faster than eyeballing a curve and catches near-symmetric cases the eye misses.
For a graph drawn on paper, pick heights that pass through obvious features: the vertex of a parabola, the peak of a sine wave, the turning point of a cubic. Those are exactly where a second crossing hides. A horizontal line placed at a random height often misses the double crossing, which is why "I tried one line and it only hit once" is not a valid conclusion.
The one failure that trips most readers: flat-looking curves that are not flat
The classic false pass is a curve that looks almost horizontal over part of its domain. Take f(x) = x³ − 3x, whose graph rises, dips, and rises again. A casual glance at the middle section can read it as a gentle slope, but the horizontal line at y = 1 crosses it three times. A function with a local maximum above a local minimum always fails the test somewhere between those two turning heights.
The reason is structural, not cosmetic. Between any local maximum and the local minimum that follows it, a continuous function must pass through every intermediate value on the way down, and it passed through those same values on the way up. So every height between the two turning points is hit at least twice. Spot two turning points of opposite type, and you already know the answer without drawing a single line.
This is why the test rewards looking for turning points first. On a calculator screen the dip in a cubic can span a few pixels and read as flat. Zoom out and the failure disappears visually; zoom in and it reappears. The graph's appearance depends on the window, but the function's one-to-one status does not.
Use algebra as the tiebreaker. Set f(a) = f(b) and see whether you can cancel down to a = b without dividing by a variable expression that could be zero. For f(x) = x², f(a) = f(b) gives a² = b², so a = b or a = −b, and the second possibility is a genuine counterexample. For f(x) = 2x + 5, you get 2a + 5 = 2b + 5 and then a = b — no alternative branch, so the function is one-to-one. The algebra never lies about a near-flat curve.
Straight lines, parabolas, and cubics: a comparison of common function families
Different families behave predictably under the horizontal line test, and knowing the pattern lets you answer before you graph. The table below compares the families students meet most often, with the exact condition that decides each verdict.
| Function family | Example | Horizontal line test result | Deciding condition |
|---|---|---|---|
| Non-vertical line | f(x) = 3x − 4 | Passes — one-to-one | Slope ≠ 0 |
| Horizontal line | f(x) = 7 | Fails — not one-to-one | Every x shares output 7 |
| Parabola | f(x) = x² | Fails — not one-to-one | Vertex height is hit twice (or once at the vertex) |
| Cubic | f(x) = x³ | Passes — one-to-one | Strictly increasing, no turning points |
| Cubic with turning points | f(x) = x³ − 3x | Fails — not one-to-one | Local max above local min |
| Absolute value | f(x) = |x| | Fails — not one-to-one | Two branches meet at vertex |
| Restricted parabola | f(x) = x², x ≥ 0 | Passes — one-to-one | Domain cut at the vertex |
| Exponential | f(x) = 2ˣ | Passes — one-to-one | Strictly increasing for all x |
The table's verdict column is a summary, not a shortcut around the test — each entry traces back to the number of crossings at the decisive height. Notice that restricting the domain flips the parabola from a fail to a pass. That's a real move, not a technicality: f(x) = x² on x ≥ 0 is one-to-one because every y-value in its range now comes from exactly one non-negative input.
Straight lines deserve a note. A non-horizontal line is always one-to-one regardless of slope sign, because a single y-value pins down a single x. The exception is the horizontal line y = c, which is a function but maps every input to c and fails at every height. If a problem gives you "a line" without qualification, check whether the slope is zero.
Radicals follow the same logic. f(x) = √x is one-to-one on its domain x ≥ 0 because it's strictly increasing. But f(x) = √(x²) simplifies to |x| and fails, because it folds the negative side onto the positive outputs. Simplifying before testing saves you from graphing a function whose shape you already know.
What the test cannot tell you: range, domain, and the inverse question
Passing the horizontal line test guarantees that an inverse relation exists, and that the inverse is itself a function. That's the whole reason the test matters in precalculus and calculus: one-to-one functions are exactly the ones that can be undone. If a function fails, its inverse is a relation with two outputs for one input, and you'd need to restrict the domain to define an inverse function.
The test says nothing about the range. A one-to-one function can still miss values entirely — f(x) = eˣ never reaches zero or the negatives, yet every horizontal line above the x-axis crosses it once and every line at or below zero crosses it zero times. Zero and one crossings both satisfy "at most one," so both pass. Don't confuse "one-to-one" with "covers every real number."
Domain restrictions also complicate the visual. A graph showing only part of a curve can pass the test on the visible window while the full function fails. The reciprocal function f(x) = 1/x has a vertical asymptote at x = 0 and two branches; a horizontal line at y = 2 crosses only the right branch, and a line at y = −2 crosses only the left, so the function is one-to-one on its full domain. But if you only plotted the right branch, you'd reach the same verdict for the wrong reason.
For calculus readers, the derivative offers a stronger tool than the picture. If f′(x) > 0 for all x in an interval, f is strictly increasing there and therefore one-to-one on that interval. If f′ changes sign, the function turns and fails somewhere between the turning heights. The derivative doesn't replace the graph on an exam that hands you a picture, but it's the reliable check when the graph is approximate.
Worked examples: five graphs, five verdicts, with the deciding height
Walking through concrete cases builds the pattern faster than any rule. Each example below names the decisive height — the y-value where the crossing count settles the verdict.
1: f(x) = x² on all reals — not one-to-one. The height y = 4 crosses at x = −2 and x = 2. One line with two crossings ends the question. 2: f(x) = x³ — one-to-one. Every horizontal line crosses exactly once. At y = 8 the only solution is x = 2; at y = −27, only x = −3. 3: f(x) = |x| — not one-to-one. The height y = 3 crosses at x = −3 and x = 3. The vertex at the origin is where the two branches merge. 4: f(x) = x², x ≥ 0 — one-to-one. The height y = 9 crosses only at x = 3; the negative root is excluded by the domain. The restricted graph is half a parabola. 5: f(x) = x³ − 3x — not one-to-one. The height y = 1 crosses three times, near x = −1.5, x = −0.5, and x = 2. Three crossings at one height is the clearest possible fail.
Run the same five through a calculator to see how quickly the verdicts fall out. On Desmos, plot each function, then add y = 4, y = 8, y = 3, y = 9, and y = 1 as constants. The crossing counts appear on screen and match the list above. It takes about four minutes for all five.
Notice example 5 hides its failure in a small dip. Between the local maximum near x = −1 and the local minimum near x = 1, the cubic descends through heights it already reached on the way up. That's why testing at the turning points, not at arbitrary heights, is the efficient habit.
How one-to-one questions actually appear on exams and in textbooks
The most common exam format shows a graph with no equation and asks a yes-or-no question. The scoring is almost always about naming the counterexample height, not about the yes or no. An answer that says "no, because a horizontal line crosses twice" earns full credit; "no, because it's a parabola" may not, since the grader wants the visual evidence.
A second format gives the equation and asks you to restrict the domain so an inverse exists. Here the horizontal line test tells you where to cut. For f(x) = x², the natural cut is at the vertex x = 0, giving either x ≥ 0 or x ≤ 0. For f(x) = sin x, the standard restriction is [−π/2, π/2], the interval where the sine curve is strictly increasing and passes the test.
Textbook problems sometimes present a piecewise graph and ask whether it's one-to-one. Read each piece separately, then check the overlap. If both pieces share a y-value, the function fails even if each piece alone would pass. The failure height is usually where the pieces meet or where their ranges overlap.
A familiar trap: a table of values instead of a graph. You can't draw the line, but you can list the outputs and look for repeats. If y = 3 appears twice with different x-values, the answer is no. If every y-value is distinct, the tabulated data is consistent with one-to-one, though a table only shows sampled points and can't prove a function is one-to-one across its whole domain.
When the graph lies: window settings, discontinuities, and near-misses
Graphing windows can hide failures. Plot f(x) = x³ − 3x on a window where the y-range is 0 to 10 and the dip below the x-axis never appears on screen. The visible portion looks monotonic, and you'd wrongly pass the function. The function itself hasn't changed; the window cut off the evidence. Always set the window to show the function's full turning behavior before trusting the picture.
Discontinuities create a subtler issue. A jump or hole means the function's values can repeat across branches without the curve looking continuous. For a rational function, check each branch separately and then compare their ranges. If two branches produce the same output, the function fails at that height even though neither branch alone would.
Vertical asymptotes don't break the test, but they split it. Functions like tan x are not one-to-one across their full domain because each branch repeats the same outputs — the height y = 1 occurs at x = π/4, x = 5π/4, and infinitely many other points. Restrict tan x to (−π/2, π/2) and it becomes one-to-one. The pattern repeats: unrestricted periodic functions fail, and restriction to one period (or half-period for sine and cosine) fixes it.
Horizontal asymptotes matter too. A function that approaches y = 2 from below and another part that approaches y = 2 from above will share no value at exactly 2 if the asymptote is never reached, but will share many nearby values if the approach is one-sided. Read the graph's actual path, not the dotted asymptote line, and check whether the curve reaches the same heights on both sides.
Building the habit: a four-step check that catches every case
Here is the procedure to run on any graph, in order, so nothing gets skipped.
1: Verify it's a function. Scan vertically. If any vertical line hits the curve twice, it's not a function and the horizontal line test doesn't apply — stop and say so. 2: Find the turning points. Locate local maxima and minima, plus the vertex of any parabola or absolute value. These are where double crossings hide. 3: Draw horizontal test lines at the turning heights and at the vertex heights. Count crossings. A single height with two or more crossings settles the verdict as not one-to-one. 4: If no turning points exist, spot-check symmetric inputs. Evaluate f(2) and f(−2), f(3) and f(−3). Equal outputs confirm a failure; distinct outputs at a few heights support a pass. A derivative that stays positive on the domain confirms one-to-one more strongly than any number of spot checks.
Step 3 is the one that catches the cubic-with-a-dip case, and step 1 is the one that saves you from testing a circle. Skipping either produces a wrong answer with confident reasoning, which is worse than a blank.
Time the habit: about 30 seconds per graph once the turns are visible. On a calculator, add 15 seconds to set the window. That's faster than the algebra for most problems and matches what a grader expects to see written down.
FAQ
Does a function have to be continuous to be one-to-one?
No. Continuity is unrelated to injectivity. The function f(x) = x for x < 0 and f(x) = x + 1 for x ≥ 0 is one-to-one despite a jump at zero, because every output still comes from exactly one input. The horizontal line test still works: draw a horizontal line and it crosses at most once.
What's the difference between the vertical and horizontal line tests?
The vertical line test decides whether a relation is a function at all — a vertical line must hit at most once. The horizontal line test decides whether that function is one-to-one — a horizontal line must hit at most once. Passing the vertical test is a prerequisite for running the horizontal one; the two tests answer different questions.
Is every increasing function one-to-one?
A strictly increasing function on its domain is always one-to-one, and the same holds for strictly decreasing functions. The converse fails: f(x) = 1/x is one-to-one on its domain but is not increasing across the hole at x = 0, because the two branches are separate. Strict monotonicity on each interval is sufficient, not necessary.
Can a one-to-one function fail to have an inverse?
It can't fail on the set of values it actually produces — a one-to-one function always has an inverse function on its range. What it might lack is an inverse defined on all real numbers, because it doesn't reach every real number. Restricting the codomain to the range fixes that, and the inverse is then defined.
How do I know a graph is one-to-one without drawing a line?
Look for turning points first. A function with no local maxima or minima — a strictly rising or falling curve — passes. A function with a local max above a local min fails somewhere between them. Parabolas, absolute values, and cubics with dips are the usual failures, and all of them announce themselves with turns.
Why does f(x) = x² fail on all reals but pass on x ≥ 0?
On all reals, f(2) and f(−2) both equal 4, so two inputs share one output. Restricting to x ≥ 0 removes the negative input, so every output now comes from exactly one non-negative input. The restricted function is one-to-one and has an inverse, the square root function, on its range.
What does a horizontal line crossing a curve zero times mean?
Zero crossings is fine. The test only requires at most one crossing per horizontal line. A value the function never produces is a gap in its range, not a failure of injectivity. For f(x) = eˣ, every horizontal line at or below the x-axis crosses zero times and the function still passes.
Can two different one-to-one functions have the same graph shape?
Shape can repeat, but the position on the axes matters. f(x) = x³ and g(x) = x³ + 5 have identical shape shifted vertically; both are one-to-one. A vertical shift never creates a double crossing, but a vertical stretch can flatten a curve near a turning point without removing the turn. Test the specific function's turns, not the family's typical look.