Functions

One to One Function: How to Test and Prove It

A function ff is one-to-one when f(a)=f(b)f(a)=f(b) forces a=ba=b: different inputs always give different outputs. On a graph, that means no horizontal line crosses the curve more than once.

f(a)=f(b)  ⟹  a=bf(a)=f(b)\implies a=b

That single idea decides whether a function can be reversed. Proofs, restricted domains and inverses on this page all grow out of it.

What is a one-to-one function?

Every function already promises that each input has exactly one output (see relations and functions for that first rule). A one-to-one function adds the promise in the other direction: each output comes from exactly one input. Think of a coat check. Every ticket matches one coat, which makes it a function, and no two coats share a ticket, which makes it one-to-one.

The definition has two equivalent forms:

a≠b  ⟹  f(a)≠f(b)a\ne b \implies f(a)\ne f(b)

f(a)=f(b)  ⟹  a=bf(a)=f(b)\implies a=b

The second form is the one to use when proving anything. In function notation, f(a)=f(b)f(a)=f(b) is just an equation you can start from and simplify. The first form is the one to picture: spread the inputs apart and the outputs stay apart too.

The name “injective” means the same thing, and it is the word you will meet in college courses. Many-to-one is the opposite situation, where at least two inputs land on one output.

How does the horizontal line test work?

Sweep a horizontal line y=cy=c up and down the graph. If any position of that line hits the curve twice or more, two different inputs share the output cc, and the function is not one-to-one. The vertical line test asks a different question: it decides whether a graph is a function at all. Run the vertical test first, then the horizontal one.

The trap that costs the most points is stopping after one line. A single line that crosses once proves nothing, because a function can behave well at one height and fail at another. Failing only needs one bad line, while passing needs every line to behave.

The second trap is the window. A graph on a calculator screen can hide a bend just off the edge. Before declaring a function one-to-one, ask where it could turn around.

A faster mental check: a continuous function that only rises, or only falls, across its whole domain is one-to-one. Any turning point (a peak or a valley) breaks it. For lines, this is quick: y=mx+by=mx+b in slope-intercept form is one-to-one exactly when m≠0m\ne0. With m=0m=0 you get a horizontal line, which is a function but meets every horizontal line at every point or not at all.

Quick check

A graph meets the line y=5y=5 exactly once, but meets y=2y=2 three times. Is it one-to-one?

How do you prove a function is one-to-one algebraically?

Graphs suggest, algebra proves. The method follows directly from the definition:

  1. Assume f(a)=f(b)f(a)=f(b) for two arbitrary inputs.
  2. Clear fractions, expand and simplify.
  3. Show the only way the equation can hold is a=ba=b.
Why starting from the outputs works

Checking infinitely many pairs is impossible. Assuming f(a)=f(b)f(a)=f(b) and forcing a=ba=b shows that no counterexample can exist.

Example 1. Prove that f(x)=2x+1x−3f(x)=\dfrac{2x+1}{x-3} is one-to-one.

Assume f(a)=f(b)f(a)=f(b), with a,b≠3a,b\ne3:

2a+1a−3=2b+1b−3\frac{2a+1}{a-3}=\frac{2b+1}{b-3}

Cross-multiply:

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

Expand both sides:

2ab−6a+b−3=2ab−6b+a−32ab-6a+b-3=2ab-6b+a-3

Cancel 2ab2ab and −3-3, then collect terms:

−6a+b=−6b+a  ⟹  7b=7a  ⟹  a=b-6a+b=-6b+a \implies 7b=7a \implies a=b

The inputs must be equal, so ff is one-to-one.

The leftover 77 is not random. For any f(x)=px+qrx+sf(x)=\frac{px+q}{rx+s} the same algebra ends with (ps−qr)(a−b)=0(ps-qr)(a-b)=0. Here ps−qr=2(−3)−1⋅1=−7ps-qr=2(-3)-1\cdot1=-7. As long as ps−qr≠0ps-qr\ne0, the function is one-to-one, which is why every inverse of a rational function of this type exists.

How do you show a function is not one-to-one?

You only need one pair of different inputs with the same output. Finding it is a search for a repeated value.

Example 2. Show that f(x)=x3−3xf(x)=x^3-3x is not one-to-one.

Pick an output and solve for its inputs. Try the output 00:

x3−3x=0  ⟹  x(x2−3)=0  ⟹  x=0, 3, −3x^3-3x=0 \implies x(x^2-3)=0 \implies x=0,\ \sqrt3,\ -\sqrt3

Check one of them: f(3)=33−33=0f(\sqrt3)=3\sqrt3-3\sqrt3=0. Three different inputs all give 00, so the function fails.

This example punctures a popular belief. An odd-degree polynomial has opposite end behavior on each side, so it reaches every output, but that does not stop it from wiggling in the middle. x3x^3 is one-to-one, while x3−3xx^3-3x is not.

Symmetry gives a faster route. Any even function satisfies f(−x)=f(x)f(-x)=f(x), so f(1)=f(−1)f(1)=f(-1) is automatic, and the function fails unless its domain strips out the mirror pairs. A parabola y=a(x−h)2+ky=a(x-h)^2+k is symmetric about x=hx=h, so f(h+t)=f(h−t)f(h+t)=f(h-t) for every tt. If a graph has a line of symmetry, look there first.

Which common functions are one-to-one?

Most families give a fast answer once you know their shape.

Function One-to-one on its domain? Reason
2x+32x+3 Yes Always increasing
x2x^2 No f(2)=f(−2)=4f(2)=f(-2)=4
x3x^3 Yes Always increasing
∣x∣\lvert x\rvert No f(3)=f(−3)=3f(3)=f(-3)=3
1x\dfrac1x Yes Each output yy comes only from x=1yx=\frac1y
x\sqrt{x} Yes Increasing on x≥0x\ge0
2x2^x Yes Always increasing
sin⁡x\sin x No sin⁡0=sin⁡π=0\sin0=\sin\pi=0

Notice 1x\frac1x. It is not increasing or decreasing across its whole domain, since it falls on each side of 00 and jumps between the two sides. Yet it is one-to-one, because positive inputs give positive outputs and negative inputs give negative ones, so nothing repeats. The “only rises or only falls” shortcut is a sufficient test, not a necessary one.

Try this: Graph y=x3+xy=x^3+x and then y=x3−xy=x^3-x. For each one, ask how many times the line y=0y=0 crosses it. Then predict what happens to x3+kxx^3+kx as kk moves from positive to negative.

Can restricting the domain make a function one-to-one?

Yes, and this is how functions like x2x^2 and sin⁡x\sin x get inverses at all. Cut the domain so that no output repeats, and the shortened function passes the test. The cut has to happen at the turning point, and you keep either side.

Example 3. Restrict f(x)=x2−6x+4f(x)=x^2-6x+4 so it is one-to-one, then find its inverse.

Complete the square to find the vertex:

f(x)=(x−3)2−5f(x)=(x-3)^2-5

The turning point is at x=3x=3. Restrict to x≥3x\ge3, where the function only rises. Swap and solve:

x=(y−3)2−5  ⟹  (y−3)2=x+5  ⟹  y=3+x+5x=(y-3)^2-5 \implies (y-3)^2=x+5 \implies y=3+\sqrt{x+5}

The plus sign is chosen because the restricted inputs satisfy y≥3y\ge3. Check with a point: f(5)=25−30+4=−1f(5)=25-30+4=-1, and 3+−1+5=3+2=53+\sqrt{-1+5}=3+2=5. The inverse returns the original input. More on this process is in the inverse of a quadratic function.

A piecewise function hides a second trap. Take f(x)=x+2f(x)=x+2 for x<0x<0 and f(x)=x2f(x)=x^2 for x≥0x\ge0. Each piece is one-to-one alone, yet f(−1)=1f(-1)=1 and f(1)=1f(1)=1. The pieces also need non-overlapping output ranges.

Quick check

Let f(x)=xf(x)=x for x<2x<2 and f(x)=x−1f(x)=x-1 for x≥2x\ge2. Is ff one-to-one?

Why do one-to-one functions have inverses?

An inverse swaps inputs and outputs. If two inputs shared an output, the reversed rule would need to send that one output back to two different places, and then it would not be a function. One-to-one removes exactly that problem.

For example, f(x)=2x+3f(x)=2x+3 is one-to-one, so reversing it gives f−1(x)=x−32f^{-1}(x)=\frac{x-3}{2}. Check by composition of functions: f−1(f(x))=(2x+3)−32=xf^{-1}(f(x))=\frac{(2x+3)-3}{2}=x. The same pattern for any line is shown in the inverse of a linear function.

A composition test

If f∘gf\circ g is one-to-one, then gg must be one-to-one, but ff need not be. Take g(x)=2xg(x)=2^x and f(x)=x2f(x)=x^2: the composition f(g(x))=4xf(g(x))=4^x is one-to-one even though x2x^2 is not.

The graph shows this too. The graph of f−1f^{-1} is the reflection of ff over the line y=xy=x, and reflection turns horizontal lines into vertical ones. So ff passes the horizontal line test exactly when f−1f^{-1} passes the vertical line test.

One-to-one vs onto: what is the difference?

The two words describe different directions. One-to-one says no output is used twice. Onto says every value in the codomain is used at least once. A function can be one, both or neither.

Take f(x)=exf(x)=e^x with the real numbers as the codomain. It is one-to-one because it only rises, but it is not onto, because outputs are always positive and −3-3 is never reached. A function that is both is a bijection, and bijections are the functions with a full inverse on the whole codomain.

The codomain is declared in advance, while the range is what the function actually reaches. That is why “onto” depends on how a problem is stated, and why domain and range matter even in a one-to-one question. A function is always onto its own range, so on that range it is a clean pair.

Finally, “one-to-one correspondence” is a textbook phrase for a bijection, which is stronger than a one-to-one function. If a course uses it, check which one is meant.

Quick check

Take f(x)=exf(x)=e^x with domain and codomain both equal to all real numbers. Is it one-to-one? Is it onto?

Where are one-to-one functions used in real life?

Whenever something must be undone exactly, one-to-one is required.

  • Unit conversion: F=95C+32F=\frac95C+32 has nonzero slope, so every Fahrenheit reading comes from one Celsius reading. That is why you can convert back without ambiguity.
  • Encryption: A cipher must map each message to its own coded version, or decoding would be guesswork.
  • Identifiers: Student numbers, barcodes and licence plates work only because no two items share one.

Hash functions are the reverse case. They shrink large data into short codes, so collisions are unavoidable and they are deliberately not one-to-one, which is fine because nobody needs to reverse them.

Physical models need a restriction. A ball’s height h(t)h(t) is a parabola in time, and a given height (except the peak) is reached twice, once going up and once coming down. Limiting the model to the climb makes time recoverable from height. That is the same domain-restriction move as Example 3, applied to a real situation.

Practice problems

0 of 5 solved

  1. Is the set of pairs {(1,3),(2,5),(4,3)}\{(1,3),(2,5),(4,3)\} a one-to-one function?

  2. Show that f(x)=−4x+7f(x)=-4x+7 is one-to-one.

  3. Find two different inputs that show f(x)=x2−6xf(x)=x^2-6x is not one-to-one.

  4. What is the smallest value of cc that makes f(x)=x2+8xf(x)=x^2+8x one-to-one on x≥cx\ge c?

  5. Prove that f(x)=3x+2x−1f(x)=\dfrac{3x+2}{x-1} is one-to-one.

Common questions

What is a one-to-one function?

A one-to-one function is a function in which different inputs always produce different outputs. In symbols, f(a)=f(b)f(a)=f(b) implies a=ba=b. It is also called an injective function.

Is every function one-to-one?

No. Every function gives each input a single output, but many functions let two inputs share one output, such as f(x)=x2f(x)=x^2 where f(2)=f(−2)=4f(2)=f(-2)=4. Only functions that avoid repeated outputs are one-to-one.

Does passing the vertical line test make a function one-to-one?

No. The vertical line test only checks that a graph is a function. The horizontal line test is the one that checks whether it is also one-to-one.

Is a constant function one-to-one?

No. A constant function such as f(x)=5f(x)=5 sends every input to the same output, so a horizontal line meets its graph at every point.

Do all one-to-one functions have an inverse?

Yes, as a function on the range of the original. Each output traces back to exactly one input, so reversing the rule gives a valid function. Functions that are not one-to-one need a restricted domain first.

What is the difference between one-to-one and onto?

One-to-one means no output is used twice. Onto means every value in the codomain is used at least once. A function that is both is called a bijection.

Up next