Relations and Functions
Learning goals
- Define a relation as a set of ordered pairs
- Ask which variable is the input before calling it a function
- Treat the domain as part of the function, not a leftover
- Separate the natural domain from a declared one
- Distinguish the range from the codomain it sits inside
A relation is the object underneath
Before a function there is a relation. A relation between two variables and is simply a set of ordered pairs . An equation in and is one way to name such a set. The equation carves out of the whole plane exactly those points whose coordinates make the equation true, and that set of points is the relation. The equation names a line, the equation names a circle, and the equation names a sideways parabola. In every case the primitive thing is the set of points; the equation is just its description.
A function is not a new kind of object. It is a relation with one extra property laid on top, and we lay it there for a definite reason. We want to be able to evaluate, to feed in a value and get a single answer back. A relation lets a point sit anywhere; a function insists that once you fix the input, the output is pinned down with no ambiguity. So a function is a relation in which each input is paired with exactly one output. Everything in this lesson comes from taking that sentence apart, and the first surprise is hiding in the word input.
The same curve, two different questions
Which variable is the input? Nothing in a set of points answers that; it is a choice you make. And the whole verdict “function or not” can flip depending on the choice. The cleanest example is the sideways parabola .
Read it with as the input. Ask for the output at : you need with , and there are two, namely and . One input, two outputs, so with as the input this relation is not a function. Now read the identical set of points with as the input instead. Ask for the output at any value of : the rule hands back the single number , one output every time. With as the input the very same relation is a function. The points on the page never moved. Only the question changed.
This is why the vertical line test is worth restating carefully. It is often remembered as a fact about the shape of a curve, but it is not. It is the test for whether reading as the input produces a function, and it is exactly the picture of “one output per input.”
The vertical line test decides whether is a legal input#
A relation is a set of points, each written as a pair (input candidate, output candidate) with the first coordinate measured horizontally and the second vertically. Suppose we want to read as the input. Fix one input value . The points of the relation that use this input are exactly the ones whose first coordinate is . Those points are precisely the ones lying on the vertical line , since that line is by definition the set of all points with first coordinate . So the outputs the relation assigns to the input are the second coordinates of the points where the vertical line crosses the relation.
Now apply the definition of a function. Reading as the input gives a function exactly when each input has at most one output, which means each vertical line crosses the relation at most once. If instead some vertical line crossed it twice, those two crossings would share the input but carry two different outputs. An input carrying two outputs is exactly what the definition of a function forbids. The two statements are therefore equivalent, and that equivalence is the whole content of the test. Reading as the input is a function if and only if no vertical line meets the relation more than once.
Nothing in that argument singled out . An input value the relation never uses simply has no point on its vertical line. That absence is why a vertical line is allowed to miss the relation entirely; such an input is simply not in the domain.
Since nothing in the proof was special to , swap the roles of the two variables and the same argument runs word for word. Reading as the input is a function if and only if no horizontal line meets the relation more than once. The horizontal line test is not a second rule to memorize; it is the vertical line test asked about the other variable. Geometrically, swapping which variable is the input reflects the whole picture across the line , which turns every vertical line into a horizontal one. That reflection is exactly the move a later lesson will call forming the inverse of a function. A relation read with as the input is a function precisely when it passes the horizontal line test. So the question that opens this chapter, “can this rule be undone,” is underneath just the vertical line test asked about the second variable. We return to it in the inverse-functions lesson.
Two more relations are worth holding next to . The unit circle fails both tests. At it has the two points and , and at it has and , so the circle is a function of neither variable. The cubic passes both. Each gives the single output , and each comes from the single input equal to its cube root, so the cubic is a function of both. “Function” really does live in the pairing of a curve with a choice of input, not in the curve alone.
Worked example 1 Is the circle a function?
The question is incomplete until we say a function of which variable, so test both readings.
Read as the input and solve for the output :
At this gives , the two points and . One input, two outputs, so it is not a function of . A vertical line at would cut the circle twice.
Read as the input instead and solve for :
At this gives , the points and , so it is not a function of either. A circle is a function of neither variable, which fits the picture: no single output rule can follow a curve that doubles back on itself both horizontally and vertically.
Check your understanding
For the relation , which statement is true?
Read as the input and solve for the output .
At this gives , two outputs for one input, so it is not a function of . Now read as the input and solve for .
Each produces the single output , so it is a function of . The horizontal line test passes and the vertical line test fails.
The domain is part of the function, not a leftover
Here is the second idea, and it is easy to miss because in earlier courses it never came up. A function is not just a rule. Fully specified, it is three pieces of data at once: a domain, the set of allowed inputs, and a rule, telling you what to do to an input. The third piece is a codomain, a set you declare the outputs to fall inside. Change any one of the three and you have changed the function. The rule is the piece students notice, because it is the formula you can write down. The domain is just as much a part of the function, and forgetting it is the source of the trouble in this section.
In earlier courses “the domain” always meant one specific thing without anyone saying so: the largest set of inputs on which the formula returns a real number. That set has a name, the natural domain of the formula (also called the implied domain). It is a convention, the domain you assume when no other is stated. The natural domain is found the way you already know: throw out inputs that divide by zero or take an even root of a negative. For the natural domain is every real number except , and for it is every real number greater than or equal to .
A declared domain is different. It is a domain stated outright as part of the function, and it can be smaller than the natural domain. Writing “let for ” declares the domain to be the nonnegative numbers, even though the formula would happily accept every real number. The formula does not force this restriction; the author of the function chooses it, and it travels with the function from then on. Intro algebra only ever computed the natural domain and called it “the” domain, which quietly assumed the domain is always read off the formula. It is not. The natural domain is a default, and a declared domain overrides it.
You have already felt the domain acting as real data. In the Solving Linear Equations lesson of Chapter 1, clearing denominators in produced the candidate . That candidate had to be thrown out, because was never in the domain of the original equation. The exclusion did not come from the algebra after clearing; it came from the domain, which was fixed before any step was taken. That is the same lesson in a different costume: the domain is decided up front and constrains everything that follows.
Worked example 2 Find the natural domain of
No domain is declared, so find the natural domain: every real input for which the formula returns a real number. Two conditions must hold at once.
The square root requires a nonnegative inside, so
The denominator cannot be zero, so
Both must hold, so the natural domain is every real number with , except . Notice that satisfies the root condition, so it is only the denominator that removes it, while every number below is removed by the root. The domain is the overlap of the two requirements, not either one alone.
Check your understanding
What is the natural domain of ?
The expression sits in a denominator, so it must be defined and also nonzero. The root needs , and a nonzero denominator needs .
Combining the two conditions leaves the strict inequality . The value satisfies the root but makes the denominator zero, so it is excluded.
Same formula, different domain, different function
Because the domain is genuine data, two functions can share a formula letter for letter and still be different functions. This is not a technicality; it is the hinge the last lesson of this chapter turns on.
Compare with domain all real numbers against with domain . Same rule, different domains. They behave differently in a way that matters. The function is not one-to-one: and , so two different inputs share an output, and the horizontal line meets its graph twice. The function is one-to-one: on the inputs , if then , and since and are both nonnegative this forces . No horizontal line therefore meets the graph of more than once. One of these functions can be undone by a rule and the other cannot, purely because their domains differ.
Worked example 3 Show that restricting the domain changes the function
Let on all real numbers and let on the domain . Decide whether each is one-to-one, and say why they are different functions.
For , look for two inputs with the same output. The inputs and both work:
Two inputs, one output, so is not one-to-one.
For , the input is no longer allowed, because the domain is . Take any allowed inputs with :
Then or , and since both are nonnegative, can only happen when . Either way , so is one-to-one. The two functions share every letter of their formula yet differ in a real property, one-to-oneness, so they are genuinely different functions. The domain, not the formula, made the difference, and restricting a domain to gain one-to-oneness is exactly how the inverse-functions lesson will earn its inverses honestly.
Check your understanding
Let with domain all real numbers and with domain . Which statement is correct?
A function is its rule together with its domain, so equal formulas with different domains can still differ. Test one-to-oneness on each.
On the rule never repeats an output, so is one-to-one while is not. They are different functions, which is why the domain counts as data.
Range and codomain
The output side has its own pair of words, and keeping them apart avoids a common muddle. The codomain is the set you declare the outputs to live in when you set the function up. The codomain is often just “the real numbers,” for lack of a reason to say anything smaller. The range is sharper: it is the set of outputs the function actually produces, every value hit by some input in the domain.
The range always sits inside the codomain. The two sets need not be equal, because declaring a set for the outputs to live in does not promise that every element of it gets used. Take on all real numbers with codomain the real numbers. Every output is a square, and a square is never negative, so the outputs actually produced are the numbers greater than or equal to . The range is that nonnegative set, a strict part of the real-number codomain: the negative numbers sit in the codomain but are never outputs. When a problem asks for “the range,” it is asking what the function really hits. Answering that takes a moment’s thought about the rule, not just a glance at where you declared the outputs.
Worked example 4 Find the range of on all real numbers
The range is the set of values the output can actually take, so start from what the rule can reach.
The term is a square, so it is never negative:
Every output is therefore at least . The value itself is reached, at , and by taking large the outputs climb without bound, so every number greater than or equal to occurs. The range is all real numbers greater than or equal to . If this function were set up with codomain “all real numbers,” the range would be a strict part of it, since nothing below is ever output.
A bound can belong to the range or sit just outside it, and the two cases look alike until you check. Take on all real numbers. The denominator is at least , so every output lies in . The upper bound is attained: it is the genuine output at , since . The lower bound is only approached: as grows the outputs shrink toward , but a ratio of positive numbers is never , so no input ever produces it. A value belongs to the range exactly when some input actually produces it. That is why the range is , closed at the attained end and open at the approached end. Deciding this is never automatic: for each candidate bound you check whether it is a real output or only a value the outputs crowd against.
The rule and domain as a set of ordered pairs
Both ideas of this lesson fold into one object if you describe a function the way a set theorist does. A function’s rule and domain together are a set of ordered pairs in which no two different pairs share the same first coordinate. Declaring a codomain on top of those pairs completes the function. Read that description once for each idea.
Read for the first idea, “first coordinate” is a choice. Which entry of each pair you call first is which variable you are feeding in, and the rule against a repeated first coordinate is precisely the vertical line test. Swap the two entries of every pair and you get a new set of pairs. Whether that new set is again a function is precisely the horizontal line test, and the swapped set is the seed of the inverse.
Read for the second idea, the domain is not computed from anything. It is simply the set of first coordinates that appear among the pairs, so it is built in from the start; include different pairs and you have a different function. The range, in the same breath, is the set of second coordinates that appear. So the pairs carry the rule, the domain, and the range at once. The one piece they do not carry is the codomain, the larger set you declare the outputs to live in. So you state the codomain separately, and the function is then complete. Two ideas, one object.