Unit 1, lesson 16

One-to-One Functions and the Horizontal Line Test

What it means for a function to be one-to-one, how to prove it with algebra or disprove it with one repeated output, how the horizontal line test reads it from a graph, and why strictly increasing functions pass.

  • Theory part 31
  • Practice part 32
  • Combining and Inverting Functions

Give every student a locker. If no two students share a locker, then a locker number tells you exactly whose locker it is. Functions face the same question. When two different inputs can produce the same output, the output alone cannot tell you where it came from, and the process cannot be run backward. One-to-one functions are the ones where every output leads back to a single input.

Key terms

One-to-one function

Definition A function ff with domain DD is one-to-one if no two different inputs in DD have the same output. Equivalently, each number in the range of ff is the output of exactly one input in DD. Whether a function is one-to-one depends on its domain as well as on its rule.

In plain words No output is used twice. If you know an output, you know the input it came from.

Example The function f(x)=2x+1f(x) = 2x + 1 on R\mathbb{R} is one-to-one, because different numbers xx have different doubles and so different values 2x+12x + 1. The function g(x)=x2g(x) = x^2 on R\mathbb{R} is not, since g(−3)=g(3)=9g(-3) = g(3) = 9. With the domain [0,∞)[0, \infty) the same rule is one-to-one. If 0≤a<b0 \le a < b, then

b2−a2=(b−a)(b+a)>0,b^2 - a^2 = (b - a)(b + a) > 0,

so two different nonnegative numbers always have different squares.

Injective

Definition Injective is the standard name for one-to-one in the language of sets. A function f ⁣:A→Bf\colon A \to B is injective, or an injection, if f(x1)=f(x2)f(x_1) = f(x_2) implies x1=x2x_1 = x_2 for all x1x_1 and x2x_2 in AA. Being injective puts no condition on how much of the codomain BB is reached. An injective function need not reach every element of BB, and its range can be a proper subset of BB. A one-to-one function should not be confused with a one-to-one correspondence, which is a function that is injective and whose range is all of BB.

In plain words Injective and one-to-one mean the same thing. The word is about outputs never repeating, not about covering every possible output.

Example The function s ⁣:[0,∞)→Rs\colon [0, \infty) \to \mathbb{R} given by s(x)=xs(x) = \sqrt{x} is injective. If x1=x2\sqrt{x_1} = \sqrt{x_2}, squaring both sides gives x1=x2x_1 = x_2. Its range is [0,∞)[0, \infty), so it never reaches −1-1, and it is not a one-to-one correspondence between [0,∞)[0, \infty) and R\mathbb{R}.

Distinct inputs give distinct outputs

Definition The defining condition can be written in two equivalent forms. For all x1x_1 and x2x_2 in the domain of ff,

x1≠x2  ⟹  f(x1)≠f(x2),or equivalentlyf(x1)=f(x2)  ⟹  x1=x2.\begin{gathered} x_1 \ne x_2 \implies f(x_1) \ne f(x_2), \\[0.4em] \text{or equivalently} \\[0.4em] f(x_1) = f(x_2) \implies x_1 = x_2. \end{gathered}

The second form is the contrapositive of the first, so the two say the same thing, and it is the form used in proofs. Assume two outputs are equal and show by algebra that the inputs must be equal.

In plain words Different in means different out. To prove it, start from equal outputs and show there was only one input all along.

Example Let f(x)=2x+1x−3f(x) = \frac{2x + 1}{x - 3} for x≠3x \ne 3, and suppose f(a)=f(b)f(a) = f(b) with a≠3a \ne 3 and b≠3b \ne 3. Multiplying both sides by the nonzero number (a−3)(b−3)(a - 3)(b - 3) gives

(2a+1)(b−3)=(2b+1)(a−3).(2a + 1)(b - 3) = (2b + 1)(a - 3).

Expanding gives

2ab−6a+b−3=2ab−6b+a−3,\begin{aligned} &2ab - 6a + b - 3 \\[0.4em] &\quad = 2ab - 6b + a - 3, \end{aligned}

and collecting terms leaves −7a=−7b-7a = -7b. So a=ba = b, and ff is one-to-one.

Showing a function is not one-to-one

Definition A function ff fails to be one-to-one exactly when there are inputs x1≠x2x_1 \ne x_2 in its domain with f(x1)=f(x2)f(x_1) = f(x_2). A single such pair is a complete proof. The reverse does not work. Checking many inputs and finding no repeated output is evidence, not a proof that ff is one-to-one.

In plain words One repeated output is enough to say no. Saying yes needs an argument that covers every input.

Example For f(x)=x2−4xf(x) = x^2 - 4x the values f(1)=−3f(1) = -3 and f(3)=−3f(3) = -3 already settle the question. To see every such pair, set f(a)=f(b)f(a) = f(b) and factor,

a2−b2−4(a−b)=(a−b)(a+b−4)=0.\begin{aligned} &a^2 - b^2 - 4(a - b) \\[0.4em] &\quad = (a - b)(a + b - 4) = 0. \end{aligned}

So f(a)=f(b)f(a) = f(b) with a≠ba \ne b happens exactly when a+b=4a + b = 4, that is, for inputs placed symmetrically about 22.

Horizontal line test

Definition A function ff is one-to-one if and only if every horizontal line meets the graph of ff in at most one point. The reason is that the line y=cy = c meets the graph at the points (x,c)(x, c) with f(x)=cf(x) = c, one point for each input whose output is cc. The test applies to the graph over the whole domain. A sketch or a calculator picture can suggest the answer but does not prove it.

In plain words Slide a horizontal line up and down. If it ever touches the graph twice, two inputs share an output. The vertical line test asks whether a graph belongs to a function at all, and the horizontal line test asks whether that function is one-to-one.

Example The line y=4y = 4 meets the graph of y=x2y = x^2 at (−2,4)(-2, 4) and (2,4)(2, 4), so squaring on R\mathbb{R} fails the test. A picture can mislead. On the window −2≤x≤2-2 \le x \le 2 the graph of f(x)=x3−0.01xf(x) = x^3 - 0.01x looks just like the graph of x3x^3, which passes the test. But

f(x)=x(x−0.1)(x+0.1),f(x) = x(x - 0.1)(x + 0.1),

so the line y=0y = 0 meets the graph at x=−0.1x = -0.1, x=0x = 0 and x=0.1x = 0.1, and ff is not one-to-one.

Strict monotonicity as a sufficient condition

Definition A function ff is strictly increasing on a set SS in its domain if f(x1)<f(x2)f(x_1) < f(x_2) whenever x1<x2x_1 < x_2 in SS, and strictly decreasing on SS if f(x1)>f(x2)f(x_1) > f(x_2) whenever x1<x2x_1 < x_2 in SS. These are the conditions that the lesson on reading graphs calls increasing and decreasing. If ff is strictly increasing on its whole domain, or strictly decreasing on its whole domain, then ff is one-to-one. Indeed, two different inputs can be named so that x1<x2x_1 < x_2, and then f(x1)f(x_1) and f(x2)f(x_2) are strictly ordered, so they differ. The inequalities must be strict. Allowing f(x1)≤f(x2)f(x_1) \le f(x_2) would permit a flat piece, and a flat piece repeats outputs. The converse is false in general. For a function whose domain is an interval and whose graph has no breaks it does hold, which follows from the intermediate value theorem.

In plain words A graph that always climbs, or always falls, can never come back to a height it already reached. So it passes the horizontal line test automatically.

Example Let f(x)=x3+xf(x) = x^3 + x. Solving y=x3+xy = x^3 + x for xx is hard, but if x1<x2x_1 < x_2 then x13<x23x_1^3 < x_2^3, and adding x1<x2x_1 < x_2 gives f(x1)<f(x2)f(x_1) < f(x_2). So ff is strictly increasing on R\mathbb{R} and therefore one-to-one. The converse fails for g(x)=1xg(x) = \frac{1}{x}, whose domain has a gap at 00. It is one-to-one, since 1x1=1x2\frac{1}{x_1} = \frac{1}{x_2} forces x1=x2x_1 = x_2. Yet it is neither increasing nor decreasing on its domain, because g(−1)=−1<1=g(1)g(-1) = -1 < 1 = g(1) while g(1)=1>12=g(2)g(1) = 1 > \frac{1}{2} = g(2).

Check yourself

  1. Is f(x)=(x+1)2f(x) = (x + 1)^2 one-to-one on R\mathbb{R}? Is it one-to-one on [−1,∞)[-1, \infty)?
Show the answer

Not on R\mathbb{R}, since f(−3)=4=f(1)f(-3) = 4 = f(1). On [−1,∞)[-1, \infty) it is. If −1≤a<b-1 \le a < b then 0≤a+1<b+10 \le a + 1 < b + 1, so (a+1)2<(b+1)2(a + 1)^2 < (b + 1)^2. The function is strictly increasing there and therefore one-to-one.

  1. Prove that g(x)=3x−1x+2g(x) = \frac{3x - 1}{x + 2}, with x≠−2x \ne -2, is one-to-one.
Show the answer

Suppose g(a)=g(b)g(a) = g(b) with a,b≠−2a, b \ne -2. Multiplying by the nonzero number (a+2)(b+2)(a + 2)(b + 2) gives

(3a−1)(b+2)=(3b−1)(a+2),(3a - 1)(b + 2) = (3b - 1)(a + 2),

that is

3ab+6a−b−2=3ab+6b−a−2.\begin{aligned} &3ab + 6a - b - 2 \\[0.4em] &\quad = 3ab + 6b - a - 2. \end{aligned}

This simplifies to 7a=7b7a = 7b, so a=ba = b.

  1. Does h(x)=x3−3xh(x) = x^3 - 3x pass the horizontal line test?
Show the answer

No. The values h(−1)=2h(-1) = 2 and h(2)=2h(2) = 2 are equal, so the line y=2y = 2 meets the graph at (−1,2)(-1, 2) and (2,2)(2, 2). One repeated output is enough, and hh is not one-to-one.

How this lesson connects

Where this leads in Calculus