One to one functions and the horizontal line test
A function turns each input into one output. When can you run it backwards, from an output to the single input that made it?
Where you are 5 in Inverse functions
Why this exists
A function runs one way. You give it an input and it hands back exactly one output. Very often, though, the question arrives the other way round. A thermometer reads 77 degrees Fahrenheit: what is that in Celsius? A box office took 84 dollars for tickets at 12 dollars each: how many tickets were sold? Each time you know the output and want the input.
For the temperature this works. The rule \displaystyle F = \frac{9}{5}C + 32 turns 25 degrees Celsius into 77 degrees Fahrenheit, and no other Celsius reading gives 77, so the answer is 25 and only 25. Squaring shows what can go wrong. If a squaring machine prints 9, the input was 3 or -3, and nothing in the 9 says which. The machine has thrown information away, and no amount of cleverness gets it back.
So before trying to run a function backwards, you need to know whether it ever sends two different inputs to the same output. The functions that never do are called one to one, and they are exactly the functions that can be undone by an inverse function.
Definition
A function f is one to one when different inputs always give different outputs. In symbols, for any two inputs a and b in the domain of f:
Turned round, the same statement says that equal outputs can only come from equal inputs. This is the form used in proofs:
A function is not one to one when two different inputs share an output: there are inputs a \neq b with f(a) = f(b). One such pair is enough, and it settles the question.
Set beside the definition of a function, the two conditions mirror each other. The first is about inputs, the second about outputs:
| Each input | Each output | |
|---|---|---|
| a function | has exactly one output | may come from many inputs |
| a one to one function | has exactly one output | comes from exactly one input |
When a function is given as a list of pairs, being one to one means no output appears twice. One to one is a property of functions only. A relation in which some input already has two outputs is not a function, so the question of being one to one does not arise for it; it comes after the relation has passed the vertical line test.
Intuition
Every point on the horizontal line y = c has second coordinate c. So the points where that line meets the graph of f are exactly the points of the graph whose output is c, and counting the crossings counts the inputs that give the output c.
- Two or more crossings mean two or more inputs share the output c. In panel (a) the line y = -2 meets the parabola above x = -3 and above x = 1, so h(-3) = h(1) = -2.
- Exactly one crossing means one input gives c.
- No crossing means no input gives c. That is allowed: c is simply not in the range.
This is the horizontal line test. Picture a ruler held level and slid from the bottom of the graph to the top. If at some height it touches the graph twice, the function is not one to one. The vertical line test asks whether any input has two outputs; the horizontal line test asks whether any output has two inputs.
The test also explains which shapes pass. A graph that keeps climbing from left to right never comes back to a height it has already left, so no level line can meet it twice. The same goes for a graph that keeps falling, like panel (b). A graph that turns, rising and then falling as a parabola or a V does, revisits its heights and fails.
Results
One to one, three ways to say it. For a function f, the following say the same thing:
- different inputs in the domain give different outputs;
- f(a) = f(b) only when a = b;
- no horizontal line meets the graph of f more than once.
Increasing or decreasing throughout. A function is strictly increasing on its domain when a < b always gives f(a) < f(b), and strictly decreasing when a < b always gives f(a) > f(b). A function that is strictly increasing over its whole domain, or strictly decreasing over its whole domain, is one to one. The reverse is false: a one to one function need not be either (Exercise 23).
Inverse. A function has an inverse function, a function that sends each output back to the input it came from, exactly when it is one to one.
Why it is true
The horizontal line test. The points where the line y = c meets the graph are the points (x, c) with f(x) = c. Suppose some horizontal line y = c meets the graph at two points, (a, c) and (b, c) with a \neq b. Then f(a) = c = f(b), two different inputs with one output, so f is not one to one. Conversely, suppose f is not one to one, so f(a) = f(b) for some a \neq b. Call that shared output c. The points (a, c) and (b, c) are both on the graph and both on the line y = c, and they are different points because a \neq b. So some horizontal line meets the graph twice. The test fails exactly when the definition fails.
Increasing implies one to one. Let f be strictly increasing and take two different inputs a \neq b. One of them is smaller; name them so that a < b. Then f(a) < f(b), so f(a) \neq f(b). Different inputs gave different outputs. The decreasing case is the same with f(a) > f(b).
One to one exactly when an inverse exists. An inverse has to send each output c back to an input that produced it. If f is one to one, each output c in the range came from exactly one input, so “send c back to that input” is a rule with one answer for every c: a function. If f is not one to one, some output c came from two inputs a \neq b, and a rule sending c back would have to give both a and b. That breaks the definition of a function, so no inverse function exists.
Worked examples
Lists of pairs
Decide whether each relation is a function, and if it is, whether it is one to one.
(a) \{(-2, 5), (0, 1), (3, 5), (4, -2)\}
(b) \{(-3, 7), (-1, 2), (2, 0), (6, -4)\}
(c) \{(1, 4), (2, 6), (1, 8)\}
Solution(a) The inputs -2, 0, 3 and 4 are all different, so each input has one output and the relation is a function. Now look down the outputs: 5 appears twice, in (-2, 5) and (3, 5). Two different inputs share the output 5, so this function is not one to one.
(b) The inputs -3, -1, 2 and 6 are all different, so this is a function. The outputs 7, 2, 0 and -4 are also all different, so no output comes from two inputs. This function is one to one.
(c) The input 1 appears with the output 4 and again with the output 8. One input has two outputs, so this relation is not a function, and being one to one is not a question that applies to it.
Two graphs and the horizontal line test
Figure 1 shows h(x) = (x + 1)^2 - 6 and k(x) = 3 - 2x^3. Use the horizontal line test to decide which is one to one, and confirm what the graphs show with a calculation.
SolutionThe parabola in panel (a) has its lowest point at (-1, -6) and rises on both sides. The level line y = -2 meets it twice, above x = -3 and above x = 1. The rule confirms it:
Two different inputs, one output, so h is not one to one. In fact every level line above the lowest point meets it twice, because the parabola is symmetric about the line x = -1; only the line y = -6 touches it once, at the lowest point, and lines below that miss it.
The curve in panel (b) falls the whole way across, and each of the three dashed lines meets it once. Take two of those heights and solve. For k(x) = 1, 3 - 2x^3 = 1 gives x^3 = 1, so x = 1, and that is the only real number whose cube is 1. For k(x) = 7, 3 - 2x^3 = 7 gives x^3 = -2, so \displaystyle x = -\sqrt[3]{2} \approx -1.26, again a single input. The graph says k is one to one. A picture shows only the window it was drawn in, though, so Example 6 proves it for every input.
A shared output, and every one of them
Show that v(x) = 2\lvert x - 3 \rvert + 1 is not one to one. Then describe every output that is shared by two inputs.
SolutionOne pair of inputs with the same output is all it takes. Try inputs the same distance either side of 3:
Since 1 \neq 5 and v(1) = v(5), the function v is not one to one. Figure 2 shows the line y = 5 meeting both arms of the V.
The choice of 1 and 5 was not luck. For any number t, the inputs 3 + t and 3 - t give
because \lvert t \rvert = \lvert -t \rvert. To find all the inputs for an output c, solve 2\lvert x - 3 \rvert + 1 = c, which gives \displaystyle \lvert x - 3 \rvert = \frac{c - 1}{2}:
- if c > 1, there are two inputs, \displaystyle x = 3 + \frac{c - 1}{2} and \displaystyle x = 3 - \frac{c - 1}{2};
- if c = 1, there is one input, x = 3, the corner of the V;
- if c < 1, there are none, since an absolute value is never negative.
So every output above 1 is shared by two inputs, and the one exception is the output 1 at the corner. For example, the output 9 comes from x = -1 and x = 7.
Proving a rational function is one to one
Show that \displaystyle r(x) = \frac{x + 3}{x - 2}, with domain all real numbers except 2, is one to one.
SolutionA graph can only suggest this; the proof uses the second form of the definition. Suppose a and b are in the domain and r(a) = r(b):
Neither denominator is zero, because 2 is not in the domain, so multiply both sides by (a - 2)(b - 2):
Expand each side:
Subtract ab - 6 from both sides, then gather the terms:
Equal outputs forced equal inputs, so r is one to one. As a check, \displaystyle r(7) = \frac{10}{5} = 2, and solving \displaystyle \frac{x + 3}{x - 2} = 2 gives x + 3 = 2x - 4, so x = 7 is the only input with output 2.
Tickets and a parking lot
(a) Concert tickets cost 12 dollars each, and one person may buy from 1 to 10. Is the total cost C(n) = 12n a one to one function of the number of tickets n? A receipt shows 84 dollars. How many tickets were bought?
(b) A parking lot charges 4 dollars an hour, up to a daily cap of 20 dollars. Stays are counted in whole hours, from 1 to 8. Is the charge a one to one function of the length of stay? What can a receipt for 20 dollars tell you, and what can a receipt for 12 dollars?
Solution(a) If C(a) = C(b), then 12a = 12b, and dividing by 12 gives a = b. So C is one to one: each total comes from exactly one number of tickets. The receipt fixes the input: 12n = 84 gives n = 7 tickets.
(b) The charges for 1 to 8 hours are:
| hours | charge (dollars) |
|---|---|
| 1, 2, 3, 4 | 4, 8, 12, 16 |
| 5, 6, 7, 8 | 20 each |
The output 20 comes from four different inputs, so the charge is not one to one. A receipt for 20 dollars says only that the stay was 5, 6, 7 or 8 hours. A receipt for 12 dollars appears once in the table, so it pins the stay down to 3 hours. A function that is not one to one can still be run backwards from some outputs; it is the shared outputs that lose information.
Proving the cubic is one to one
Prove that k(x) = 3 - 2x^3 from Example 2 is one to one for every real input, not just in the window of Figure 1.
SolutionSuppose k(a) = k(b). Subtract 3 from both sides and divide by -2:
The difference of two cubes factors. Multiplying out the right side below confirms it:
A product is zero only when a factor is zero, so a - b = 0 or a^2 + ab + b^2 = 0. The first gives a = b at once. For the second, complete the square in a:
Both terms on the right are squares times positive numbers, so neither is negative, and their sum is zero only when both are zero: b = 0, and then \displaystyle a + \frac{b}{2} = 0 gives a = 0. So this case also has a = b. Every way the equation can hold has a = b, and k is one to one. The same argument shows that the cube root of a real number is a single number: two numbers with the same cube are equal.
Boundaries
- Only for functions. The horizontal line test is run on a graph that has already passed the vertical line test. The sideways parabola x = y^2 meets every horizontal line at most once, but it is not a function at all (the input 4 has outputs 2 and -2), so it is not one to one.
- The domain is part of the answer. The rule x^2 on all real numbers is not one to one, since (-3)^2 = 3^2. The same rule on the domain x \geq 0 is one to one, because a number that is not negative is fixed by its square. Cutting a domain down like this is how an inverse is made for a function that turns.
- A picture is evidence, not proof. A graph shows only the window it was drawn in, and a curve that looks as if it keeps rising may turn just outside it. A pair of inputs with a shared output proves a function is not one to one; to prove it is one to one, use algebra, as in Examples 4 and 6.
- Increasing on each piece is not enough. A piecewise function can rise on every piece and still repeat an output. With f(x) = x + 1 for x < 0 and f(x) = x for x \geq 0, both pieces rise, yet \displaystyle f\left(-\frac{1}{2}\right) = \frac{1}{2} = f\left(\frac{1}{2}\right). The increasing result needs the function to increase across its whole domain.
- Missing a line is fine. The test counts lines that meet the graph twice. A horizontal line that misses the graph only says that height is not an output. Whether every height is reached is a separate question, whether the function is onto, taken up in injective, surjective and bijective functions.
Where this goes next
Being one to one is the condition for an inverse function, and the rest of that topic builds on it. With a table of values, the inverse comes from swapping the columns, and the swap gives a function because no output repeats. On a graph, the inverse is the reflection in the line y = x; that reflection turns horizontal lines into vertical ones, so the horizontal line test for f is the vertical line test for its reflection. From a rule, solving for the input gives the inverse, and the step “there is exactly one solution” is the one to one property at work. For a function that turns, such as h in Example 2, restricting the domain keeps a one to one piece. Later, exponential functions turn out to be one to one, which is why Logarithms exist as their inverses, and the same idea, under the name injective, runs through the study of functions in general.
Exercises
Lists of pairs
Decide whether each relation is a function, and if it is, whether it is one to one. If it is not one to one, name the shared output.
- \{(-4, 2), (-1, 0), (3, 6), (5, 9)\}
- \{(0, 3), (2, -1), (5, 3), (7, 8)\}
- \{(2, 1), (4, 3), (2, 5), (6, 7)\}
- \{(-2, 4), (-1, 1), (1, -1), (2, -4)\}
Reading graphs
Figure 3 shows the graphs of six functions. Use the horizontal line test to decide whether each is one to one. If it is not, name a horizontal line that meets it twice and the two inputs where it does.
- Graph A, the line \displaystyle y = \frac{1}{2}x + 1
- Graph B, the parabola \displaystyle y = 3 - \frac{1}{2}x^2
- Graph C, the V y = \lvert x + 1 \rvert - 2
- Graph D, the curve \displaystyle y = \sqrt{x + 4} - 1
- Graph E, the dots (-3, 2), (-1, -1), (0, 3), (2, -1) and (3, 1)
- Graph F, the curve \displaystyle y = 1 - \frac{1}{16}x^3
From a rule
Decide whether each function is one to one. If it is not, give two inputs with the same output. If it is, prove it by showing that f(a) = f(b) forces a = b.
- f(x) = 9 - 2x
- f(x) = x^2 - 8x
- f(x) = (x - 5)^2, with domain x \geq 5
- f(x) = \lvert 2x + 6 \rvert
- \displaystyle f(x) = \frac{4}{x + 1}, with domain all real numbers except -1
- f(x) = x^3 + 2
- \displaystyle f(x) = \frac{2x - 1}{x + 3}, with domain all real numbers except -3
In context
- A taxi charges 2.50 dollars plus 1.20 dollars a kilometer, so a ride of d kilometers costs F(d) = 2.5 + 1.2d dollars, for d \geq 0. Is F one to one? A ride cost 8.50 dollars. How far was it?
- A ball is thrown upward, and its height after t seconds is H(t) = 20t - 5t^2 meters, for 0 \leq t \leq 4. Is H one to one? What does that mean for the question “when is the ball 15 meters up?” Is H one to one on the shorter domain 0 \leq t \leq 2?
Reasoning
- A constant function gives the same output for every input. Explain why it is not one to one, unless its domain holds only one number.
- Kwame says: “The graph of x = y^2 passes the horizontal line test, so it is a one to one function.” Explain what is wrong with his reasoning.
- Suppose f and g are both one to one, and f(g(x)) is defined for every x in the domain of g. Prove that the composition f(g(x)) is one to one.
- Show that \displaystyle m(x) = \frac{1}{x}, with domain all real numbers except 0, is one to one, but that it is neither strictly increasing nor strictly decreasing over its whole domain.
Answers
- A function, and one to one. The inputs -4, -1, 3, 5 are all different, and so are the outputs 2, 0, 6, 9.
- A function, but not one to one. The output 3 comes from the inputs 0 and 5.
- Not a function. The input 2 has the outputs 1 and 5, so being one to one does not apply.
- A function, and one to one. The inputs are all different, and the outputs 4, 1, -1, -4 are all different.
- One to one. The line rises the whole way across, so every horizontal line meets it at most once: \displaystyle \frac{1}{2}a + 1 = \frac{1}{2}b + 1 gives a = b.
- Not one to one. The line y = 1 meets it at x = -2 and x = 2, since \displaystyle 3 - \frac{1}{2}(4) = 1 for both.
- Not one to one. The line y = 0 meets it at x = -3 and x = 1, since \lvert -2 \rvert - 2 = 0 and \lvert 2 \rvert - 2 = 0.
- One to one. The curve rises the whole way from its starting point (-4, -1), so every horizontal line meets it at most once.
- Not one to one. The line y = -1 passes through the two dots (-1, -1) and (2, -1), so the inputs -1 and 2 share the output -1.
- One to one. The curve falls the whole way across, so every horizontal line meets it at most once.
- One to one. 9 - 2a = 9 - 2b gives -2a = -2b, so a = b.
- Not one to one. f(0) = 0 and f(8) = 64 - 64 = 0.
- One to one. (a - 5)^2 = (b - 5)^2 with a - 5 \geq 0 and b - 5 \geq 0: two numbers that are not negative and have the same square are equal, so a - 5 = b - 5 and a = b.
- Not one to one. f(-1) = \lvert 4 \rvert = 4 and f(-5) = \lvert -4 \rvert = 4.
- One to one. \displaystyle \frac{4}{a + 1} = \frac{4}{b + 1}; multiply by (a + 1)(b + 1), which is not zero, to get 4(b + 1) = 4(a + 1), so a = b.
- One to one. a^3 + 2 = b^3 + 2 gives a^3 = b^3, and Example 6 showed that two real numbers with the same cube are equal, so a = b.
- One to one. Cross-multiplying \displaystyle \frac{2a - 1}{a + 3} = \frac{2b - 1}{b + 3} gives (2a - 1)(b + 3) = (2b - 1)(a + 3), that is 2ab + 6a - b - 3 = 2ab + 6b - a - 3, so 7a = 7b and a = b.
- One to one: 2.5 + 1.2a = 2.5 + 1.2b gives a = b. The ride was 5 kilometers, since 2.5 + 1.2d = 8.5 gives 1.2d = 6.
- Not one to one: H(1) = 20 - 5 = 15 and H(3) = 60 - 45 = 15, so “when is the ball 15 meters up?” has two answers, on the way up and on the way down. On 0 \leq t \leq 2 it is one to one: H(a) = H(b) factors as (a - b)\big(20 - 5(a + b)\big) = 0, so a = b or a + b = 4, and with a, b \leq 2 the second can only happen when a = b = 2.
- If the domain holds two different numbers a \neq b, then f(a) = f(b) because every output is the same constant, so two different inputs share an output. With only one number in the domain there are no two different inputs, so nothing can be shared and the function is one to one.
- The graph of x = y^2 is not the graph of a function: the vertical line x = 4 meets it at (4, 2) and (4, -2). One to one is a property of functions, so the horizontal line test only applies after the vertical line test has been passed.
- Suppose f(g(a)) = f(g(b)). Since f is one to one, equal outputs of f come from equal inputs, so g(a) = g(b). Since g is one to one, that gives a = b. So equal outputs of the composition force equal inputs.
- One to one: \displaystyle \frac{1}{a} = \frac{1}{b} with a, b \neq 0 gives b = a after multiplying by ab. Not strictly decreasing: -1 < 1 but m(-1) = -1 < m(1) = 1. Not strictly increasing: 1 < 2 but \displaystyle m(1) = 1 > m(2) = \frac{1}{2}.