The one-line answer: a relation is any set of ordered pairs, and a function is a relation where each input has exactly one output. To find the domain, collect the first coordinates; to find the range, collect the outputs that actually appear. Once the one-input-one-output rule is clear, domain, range, and mapping type fall into place.

Relation vs. function side by side

Relation Function
Definition Any set of ordered pairs Each input has exactly one output
Repeated input with different outputs Allowed Not allowed
Repeated output (different inputs) Allowed Allowed
Example {(1,2),(1,3),(2,3)}\{(1,2),(1,3),(2,3)\} {(1,2),(2,3),(3,3),(4,5)}\{(1,2),(2,3),(3,3),(4,5)\}
Graph test No restriction Passes the vertical line test

The relation R={(1,2),(1,3),(2,3)}R = \{(1,2),(1,3),(2,3)\} is not a function: the input 11 is paired with both 22 and 33. The set f={(1,2),(2,3),(3,3),(4,5)}f = \{(1,2),(2,3),(3,3),(4,5)\} is a function, because no first coordinate is paired with two different second coordinates. Different inputs sharing the same output is fine.

How to find domain and range

The domain is the set of all inputs, so it comes from the first coordinates. The range is the set of outputs that actually appear, so it comes from the second coordinates. Using

f={(1,2),(2,3),(3,3),(4,5)}f = \{(1,2),(2,3),(3,3),(4,5)\}

we get

domain(f)={1,2,3,4},range(f)={2,3,5}.\text{domain}(f) = \{1,2,3,4\}, \qquad \text{range}(f) = \{2,3,5\}.

Notice 33 appears twice as an output but is written once: the range lists distinct outputs, not how many times they occur. If a problem also gives a codomain, do not treat it as the range. The codomain is the larger target set outputs are allowed to come from; the range is the subset the function actually hits.

Which mapping types can be functions

When people classify relations and functions, they usually mean one of these patterns:

Mapping type Description Function?
One-to-one One output per input; different inputs give different outputs Yes
Many-to-one Different inputs can share an output Yes
One-to-many One input paired with more than one output No
Many-to-many Repeated inputs and outputs, less restricted No

Only the first two can be functions. A one-to-many relation is never a function, because one input would have multiple outputs.

Worked example: classify in one pass

Let

A={2,1,0,1,2},h={(x,x2):xA}.A = \{-2,-1,0,1,2\}, \qquad h = \{(x,x^2) : x \in A\}.

Writing out the pairs:

h={(2,4),(1,1),(0,0),(1,1),(2,4)}.h = \{(-2,4),(-1,1),(0,0),(1,1),(2,4)\}.

The domain is all first coordinates:

{2,1,0,1,2}.\{-2,-1,0,1,2\}.

The range is all outputs that occur:

{0,1,4}.\{0,1,4\}.

Is it a function? Yes — each input appears once with exactly one output. What type? Many-to-one, not one-to-one, because both 2-2 and 22 map to 44, and both 1-1 and 11 map to 11. The point students miss: repeated outputs do not break a function; repeated inputs with different outputs do.

Reading it from a graph

If a relation is shown as a graph, the vertical line test is the quick check. If some vertical line meets the graph at more than one point, one xx-value has more than one yy-value, so the graph is not a function. This works only because the graph is read as pairs (x,y)(x,y) — it is a visual restatement of the one-input-one-output rule.

Common confusion points

Thinking repeated outputs break a function

They do not. A function can be many-to-one. The breaker is repeated inputs with different outputs.

Mixing up range and codomain

If the codomain is, say, {0,1,2,3,4,5}\{0,1,2,3,4,5\}, the range might still be only {0,1,4}\{0,1,4\}. Range means actual outputs, not all allowed outputs.

Forgetting domain restrictions

A formula does not always tell the whole story. For example, f(x)=1/xf(x)=1/x is undefined at x=0x=0, so 00 cannot be in the domain.

Assuming every relation is a function

Relations are the broader idea; functions are the stricter case inside that category.

Where each idea is used

Relations describe which objects connect to which others — set theory, databases, graph theory, coordinate geometry. Functions are even more central: algebra, calculus, statistics, physics, and computer science all use them to describe how one quantity depends on another. Whenever you see "input this value, get that output," you are usually looking at a function.

Try the comparison yourself

Build a small relation on the domain {1,2,3}\{1,2,3\}. First make one that is not a function by giving one input two different outputs. Then change a single pair so it becomes a function, and compare the domain and range before and after. Seeing the same set flip from relation to function in one edit is the fastest way to lock in the distinction.

Frequently Asked Questions

What is the difference between a relation and a function?
A relation is any set of ordered pairs and can pair inputs with outputs in any way. A function is a relation in which each input has exactly one output. For example, a set containing both the pairs 1, 2 and 1, 3 is a relation but not a function, because the input 1 has two outputs.
How do you find the domain and range of a relation?
Collect the first coordinates to get the domain and the second coordinates to get the range. For the function with pairs 1, 2; 2, 3; 3, 3; and 4, 5, the domain is 1, 2, 3, 4 and the range is 2, 3, 5. Repeated outputs are written once, since a set lists distinct values.
Can two different inputs share the same output in a function?
Yes. The function rule only requires that each input has exactly one output, so different inputs sharing an output is allowed. That pattern is called many-to-one. What is not allowed is one-to-many, where a single input is paired with two or more different outputs, because that breaks the definition of a function.
What is the difference between range and codomain?
The codomain is the larger target set that outputs are allowed to come from, while the range is the subset of outputs the function actually hits. If a problem states a codomain, do not automatically treat it as the range; check which values actually appear as outputs of the function.

Need help with a problem?

Upload your question and get a verified, step-by-step solution in seconds.

Open GPAI Solver →