POST · MATHEMATICS

What Is a Function?

A simple visual guide to inputs, outputs, domain, range, and why functions are the rule-following machines of math.

8 MIN READ · INTERACTIVE DIAGRAMS INSIDE

You've used functions your whole life — at a vending machine, on a calculator, even when converting currencies. Here's what makes a function a function, explained visually and without the jargon.

In mathematics, a function is a rule that takes an input and produces exactly one output. That's the entire idea, and everything else — domain, range, notation, graphs — is just a way of describing or checking that one simple promise: one input, one output.

CORE IDEA

Input → Output

A function is a rule that assigns exactly one output to every valid input.

DOMAIN & RANGE

The Full Picture

The domain is all possible inputs; the range is all possible outputs.

THE TEST

Vertical Line

If a vertical line crosses a graph twice, it's not a function.

What Makes Something a Function?

THE ONE-OUTPUT RULE

A function is a special kind of relationship between two sets of numbers. For every input you choose, the function gives you exactly one output. Not zero, not two — exactly one.

Think of a vending machine. You press B4 (the input), and you get exactly one snack (the output). Press B4 again, you get the same snack. That's a function. Now imagine a machine where pressing B4 sometimes gives you chips and sometimes gives you a soda — that's not a function, because one input produced two different outputs.

Simple definition

A function is a rule that maps each input to exactly one output. The set of all valid inputs is called the domain, and the set of all resulting outputs is called the range.

Functions vs. relations

A relation is any set of ordered pairs — it's a looser idea. A function is a relation with a strict condition: no input can be repeated with different outputs. Every function is a relation, but not every relation is a function.

Input (x)Output (y) — Relation AOutput (y) — Relation B
133
255
377 or 9
4911

Relation A is a function — every input maps to one output. Relation B is not a function, because input 3 produces two possible outputs. The vertical line test on a graph is just a visual way of checking this same rule.

Domain and Range: The Full Description

INPUTS AND OUTPUTS

The domain is the complete set of inputs a function is allowed to accept. The range is the complete set of outputs it actually produces. Together, they tell you everything about what a function can and cannot do.

f: X → Y X = domain (all valid inputs)  ·  Y = codomain (target set)  ·  range = actual outputs produced

Here's a real example. For the function f(x) = 1 / x:

  • The domain is all real numbers except 0 — because dividing by zero is undefined.
  • The range is all real numbers except 0 — because 1 divided by any non-zero number is never exactly 0.
  • If you graph it, the curve never touches the x-axis or y-axis — those missing values are exactly the ones excluded from domain and range.

Function Notation: What Does f(x) Mean?

READING THE SYMBOLS

When you see f(x), it does not mean f multiplied by x. It means "the output of function f when the input is x." The letter f is just a name — you could call it g, h, or anything else.

f(x) = 2x + 3 If x = 4, then f(4) = 2(4) + 3 = 11. The input 4 produced the output 11.

This notation is powerful because it lets you evaluate a function at any input, compose functions, and describe behavior compactly. For example, f(2) means "plug 2 into the rule and see what comes out."

The Vertical Line Test: A Visual Check

GRAPH → FUNCTION?

If you draw a graph on the coordinate plane, the vertical line test tells you whether it represents a function. The rule is simple: if any vertical line crosses the graph more than once, it is not a function.

Why does this work? Because a vertical line represents a single x-value. If it hits the graph twice, that one input has two outputs — breaking the core rule of functions.

Quick check

A straight line that isn't vertical passes the test → it's a function. A circle fails the test → not a function, because most x-values inside the circle hit two y-values.

Functions in the Real World

Functions aren't abstract — they're everywhere you look, and recognizing them makes the math feel natural.

  • Temperature conversion: Celsius to Fahrenheit is a function — one Celsius value always gives one Fahrenheit value.
  • Currency exchange: Convert dollars to euros at a fixed rate — one input, one output.
  • Vending machine: Press a code, get one specific item.
  • Tax brackets: Your income determines your tax owed — a function of income.
  • Speedometer: Your car's speed at a given moment is a function of time.

Mapping Diagrams: Seeing Functions Clearly

A mapping diagram shows two sets side by side — the domain on the left, the range on the right — with arrows connecting each input to its output. It's one of the clearest ways to see whether a relation is a function.

A function: every input has exactly one arrow out.

Functions vs. Non-Functions at a Glance

FeatureFunctionNot a Function
Input ruleEvery input has exactly one outputAt least one input has multiple outputs
Vertical line testPasses — no vertical line hits twiceFails — some vertical line hits twice
Mapping diagramOne arrow per inputTwo or more arrows from one input
Exampley = x²x = y² (opens sideways)

Why Functions Matter

Functions are the building blocks of algebra, calculus, computer science, and almost every quantitative field. They let us describe relationships precisely, predict outputs from inputs, and build models of the real world. Once you see a function as a rule that assigns exactly one output to each input, everything else — graphs, notation, domain, range — falls into place.

The one-sentence takeaway

A function is a rule that gives exactly one output for every valid input — and the vertical line test is how you check that visually.

FAQ

Questions people actually ask.

The short answers — with the long ones one tap away.

What is a function in simple words?+

A function is a rule that takes an input and gives exactly one output. Think of it as a machine: you put a number in, it follows a rule, and you get one specific number out.

What is the difference between a relation and a function?+

A relation is any set of ordered pairs. A function is a special relation where every input has exactly one output. All functions are relations, but not all relations are functions.

What are domain and range?+

The domain is the set of all possible inputs a function can accept. The range is the set of all possible outputs the function can produce. Together they describe the full behavior of a function.

What is the vertical line test?+

The vertical line test checks if a graph represents a function. If any vertical line crosses the graph more than once, it is not a function because that input would have multiple outputs.

What does f(x) mean?+

f(x) is function notation. It means "the output of function f when the input is x." It is read as "f of x" and does not mean f multiplied by x.

What is a real-world example of a function?+

A vending machine is a perfect example: press button A1 (input), and you get exactly one specific snack (output). Every input gives exactly one output — that's a function.