Skip to main content
Mathovia

Algebra / Graphing and Functions

Functions: The One-Output Rule and the Vertical Line Test

A function is a relation with one rule attached: every input gets exactly one output. That single restriction is what makes the whole language of f(x), domain and range possible, because it guarantees there is always a definite answer to 'what does this give for x?'. This lesson covers the definition, the three ways to test for it, why sharing outputs is allowed while sharing inputs is not, and the vertical line test that settles the question on any graph.

M
Written by
Mathovia Team
Editorial Team

Nearly all of algebra past this point assumes you can ask “what does this give for ?” and get one answer back. Functions are the guarantee that you can.

Definition of a function as a relation with exactly one output per input
The defining rule of a function

The Definition

A function is a relation in which every input is paired with exactly one output.

Everything else follows from that. A relation is free to send an input to two places; a function is not. That is the entire difference between the two words.

A function machine: the input x = 4 drops into a box labelled double it, add 1, and the output 9 comes out
Put a value in, get exactly one value out.

The machine picture is worth keeping. A function is a rule that processes an input and returns an output — and a machine that returned two different answers for the same input would be broken.

Note “exactly one” rules out two possibilities. An input cannot have several outputs, and it cannot have none. If a value is in the domain, it must produce something.

Repeated Outputs Are Fine

The most common misunderstanding here. Look at which side is repeating.

A mapping diagram where inputs negative 2 and 2 both point to output 4, and 0 points to 0, labelled still a function
Two inputs sharing an output is allowed — it is still a function.

sends and . Ask “what is ?” and there is one answer. Ask “what is ?” and there is one answer. Nothing is ambiguous, so it is a function.

The rule is about inputs, not outputs:

SituationFunction?
One input, one outputYes
Two inputs, same outputYes
One input, two outputsNo
An input with no outputNo

Three Ways to Test

From a list of pairs — check for a repeated first coordinate with different second coordinates.

is a function. is not.

From a mapping diagram — count the arrows leaving each input. Two arrows from one element and it fails.

From a graph — use the vertical line test.

The Vertical Line Test

Sweep an imaginary vertical line across the graph from left to right. If it ever touches the curve in two or more places at the same time, the graph is not a function.

The reason is direct: a vertical line is the set of all points with one particular -value. If it hits the curve twice, that has two -values.

A parabola with a dashed vertical line crossing it at exactly one point, labelled passes the vertical line test
A parabola: every vertical line meets it at most once.

A parabola passes, even though it doubles back, because the doubling is left-to-right — for any single there is still one height.

A circle with a dashed vertical line crossing it at two points, labelled fails and not a function
A circle fails: most vertical lines cut it twice.

A circle fails. So does a sideways parabola, and so does any relation where the curve loops back over itself vertically.

One counterexample is enough. You do not need to check every position; find a single vertical line hitting twice and the answer is no.

Familiar Shapes, Tested

GraphFunction?Why
Line Yesone height per
Vertical line Noone , infinitely many
Horizontal line Yesevery input gives the same output
Parabola Yespasses the vertical line test
Sideways parabola Notwo -values for most
CircleNotop and bottom halves
Yesthe radical sign means the positive root only

That last row is worth pausing on. The equation is not a function, but is — because the radical symbol is defined to return only the non-negative root. Choosing one half of a relation is a standard way to force a function out of something that was not one.

One-to-One and Many-to-One

Among functions there is a further split.

  • One-to-one: every output comes from exactly one input. is one-to-one.
  • Many-to-one: several inputs share an output. is many-to-one.

One-to-One Functions covers the horizontal line test and the algebraic proof in full. Both are functions. The distinction matters for inverses: only a one-to-one function has an inverse that is itself a function. Reversing gives , which fails the one-output rule.

There is a graphical test for this too — the horizontal line test. If no horizontal line crosses the graph more than once, the function is one-to-one.

Functions in Ordinary Language

The idea shows up constantly outside mathematics, usually where a lookup has to be unambiguous.

  • A vending machine: press B4, get one specific item.
  • A person’s date of birth: everyone has exactly one.
  • A postcode lookup: one postcode returns one address record.

And the failures are just as recognisable. “Children of a parent” is not a function — one parent may have several. “Parent of a child” is closer, but a child has two biological parents, so that fails too. “Biological mother of a person” works: exactly one.

Worked Example A: From a List

Is a function?

Inputs: — all different. Yes, a function. The output repeating is irrelevant.

Worked Example B: From a List Again

Is a function?

The input appears twice, with outputs and . Not a function.

Worked Example C: From an Equation

Is a function of ?

Solve for : . The is the tell — gives both and . Not a function.

Worked Example D: A Piecewise Rule

Is this a function?

Yes. The two rules cover different, non-overlapping stretches of , so every input matches exactly one rule and produces one output. Piecewise definitions only fail when the pieces overlap and disagree.

Worked Example E: One-to-One?

Is one-to-one?

No. and , so two inputs share an output. It is a function, but many-to-one — a horizontal line at crosses the graph twice.

Common Mistakes to Avoid

  • Thinking repeated outputs break the rule. They do not. Only repeated inputs with different outputs do.
  • Applying the horizontal line test for functionhood. The vertical test decides whether it is a function; the horizontal test decides whether it is one-to-one.
  • Checking only one vertical line. Passing at one position proves nothing; failing at one position proves everything.
  • Calling a vertical line a function. It is the clearest failure there is.
  • Forgetting that “exactly one” excludes zero. An input with no output also breaks the rule.
  • Assuming and are the same. The radical returns only the non-negative root.

Where Functions Lead Next

  • Function notation, which only makes sense because the output is unique.
  • Domain and range — the input and output sets.
  • Graphing functions and recognising standard shapes.
  • Inverse functions, which exist only for one-to-one functions.
  • Calculus, which is built almost entirely on functions of one variable.
  • Programming, where a “pure function” means exactly this: same input, same output, every time.

Practice Problems

Work each one before opening the answer.

Problem 1. Is a function?

Show answer

Yes — all inputs are different.

Problem 2. Is a function?

Show answer

No — the input has two outputs.

Problem 3. Is a function?

Show answer

Yes. A shared output is fine.

Problem 4. Does define a function?

Show answer

Yes. It is a non-vertical line, so it passes the vertical line test.

Problem 5. Does define a function?

Show answer

No — it is a circle, and a vertical line through, say, meets it at and .

Problem 6. Is a function?

Show answer

No. It is a vertical line: one input, infinitely many outputs.

Problem 7. Is a function?

Show answer

Yes. Every input returns 5, which satisfies “exactly one output”.

Problem 8. Is one-to-one?

Show answer

Yes. Each output comes from exactly one input, and no horizontal line crosses the graph twice.

Problem 9. A relation has the pairs and listed twice. Is it a function?

Show answer

Yes. The same pair repeated is still one pairing — the input 2 has only the output 7.

Problem 10. Explain why “the square root of a number” is a function but “a number whose square is ” is not.

Show answer

The radical symbol is defined to return the non-negative root, so it returns one value. “A number whose square is ” allows both and , which is two outputs.

Quick Reference

QuestionAnswer
DefinitionEach input has exactly one output
From pairsNo repeated input with different outputs
From a mappingOne arrow leaving each input
From a graphPasses the vertical line test
Repeated outputsAllowed
Vertical line Not a function
Horizontal line A function
One-to-onePasses the horizontal line test too
Has a function inverseOnly if one-to-one

A function is a relation with the one-output rule; once you have one, function notation gives you a way to talk about it, and domain and range describe what goes in and comes out. See Graphing Functions for drawing them. More Algebra lessons are available.

Frequently Asked Questions

What is a function in math?+

A function is a relation in which every input is paired with exactly one output. Given any value from the domain, there is one and only one corresponding value in the range — never two, never none.

What is the vertical line test?+

Imagine sweeping a vertical line across a graph. If the line ever crosses the curve at two or more points at once, the graph is not a function, because that single -value would have several outputs.

Can two different inputs give the same output?+

Yes, and it is very common. sends both and to , and it is still a function. The rule restricts what one input may do, not how many inputs may share an output.

Why is a circle not a function?+

A circle fails the vertical line test. For most -values inside the circle there are two points, one on the top half and one on the bottom, so a single input has two outputs.

Is a vertical line a function?+

No. A vertical line contains every point with , so the single input 3 has infinitely many outputs. A horizontal line is a function — every input gives the same output, which is allowed.

What is the difference between one-to-one and many-to-one?+

In a one-to-one function every output comes from exactly one input. In a many-to-one function several inputs share an output. Both are functions; only one-to-one functions have inverses that are also functions.

Related lessons