We learned that a function is a rule that assigns one and only one value to each element of its domain. However a function may assign the same value to two or more elements in its domain. For example $f(x)=x^{2}$ assigns 4 to both $x=2$ and $x=-2$. Or $f(x)=|x|$ assigns the same value to both $x=a$ and $x=-a$. Or $f(x)=c$ where $c$ is a constant, takes on the same value $c$ at all $x$. But some functions assign distinct values to distinct elements of their domains. For example, $f(x)=2x+3$ takes on a different value at each value of $x$. Such functions are called one-to-one or 1-1 functions.

Definition: A function $f:A\to B$ is one-to-one (or an injection) if for all
$x_{1},x_{2}$ in $A$
\[
f(x_{1})=f(x_{2})\qquad\text{implies}\qquad x_{1}=x_{2}.\qquad{\small (\text{a})}
\]
  •  Equivalently we can say that a function is one-to-one whenever $x_{1}\neq x_{2}$ in $A$, then $f(x_{1})\neq f(x_{2})$.
    \[
    x_{1}\neq x_{2}\Rightarrow f(x_{1})\neq f(x_{2}).\qquad\quad{\small (\text{b})}
    \]
  •  The above definition states that a one-to-one function $y=f(x)$ takes on each value in its range only once. If the graph of the function is cut by a horizontal line $y=c$ at more than one point, the value
    $y=c$ will correspond to more than one value of $x$, and the function will not be one-to-one. We may use the following test to specify whether or not a function is one-to-one.

Horizontal line test for one-to-one functions:

A function is one-to-one if and only if each horizontal line $y=c$ intersects the graph of $y=f(x)$ at most once.

Example 1
Let $f(x)=mx+b$ ($m\neq0$). Is $f$ a one-to-one function?
Solution
Method 1: If $mx_{1}+b=mx_{2}+b$ then $x_{1}=x_{2}$. Thus $f$ is a one-to-one function.
Method 2: Each horizontal line $y=c$ intersects the graph of $f$ exactly once (not twice or more). So $f$ is a one-to-one function.

Figure 1: Graph of a linear function is cut by each horizontal line once

Example 2
Let $f(x)=x^{2}+1$. Is $f$ a one-to-one function?
Solution
Method 1: If $x_{1}^{2}+1=x_{2}^{2}+1$ then $x_{1}=x_{2}$ or $x_{1}=-x_{2}$. Therefore, $f$ is not a one-to-one function.
Method 2: Because a horizontal line $y=c$ where $c>1$ intersects the graph of $f$ twice, it is not a one-to-one function.

Figure 2: $y=x^{2}+1$ is not one-to-one on its entire domain $ \mathbb{R}=(-\infty,\infty)$

 

Note that in the above example, although $f$ is not a one-to-one function on its entire natural domain $\mathbb{R}$, if we restrict the domain to $x\geq0$ , i.e. $f:[0,\infty)\to\mathbb{R}$ with $f(x)=x^{2}+1$, then the horizontal line test is passed and the function becomes one-to-one. Remark that the original and restricted functions are not the same functions because their domains are different. However, the two functions assume the same values on $[0,\infty)$.

  •  The function $f:(-\infty,0]\to\mathbb{R},$ $f(x)=x^{2}+1$ is also one-to-one.
Figure 3: Restricting the domain of $f(x)=x^{2}+1$ to $[0,\infty) $ makes it a one-to-one function. As we can see each horizontal line meets the graph at most once.

 

Example 3
Let $f:\mathbb{R-}\{0\}\to\mathbb{R}$, where $f(x)=1/x$. Is $f$ a one-to-one function?
Solution
Method 1: Yes, it is because if $1/x_{1}=1/x_{2}$ then $x_{1}=x_{2}$.
Method 2: Each horizontal line $y=c$ ($c\neq0$) intersects the graph of $f$ once and $y=0$ never intersects the graph of $f$.

Figure 4: Each horizontal line intersects the graph at most once

 

We can figure out whether or not a function is one-to-one just by looking at their graphs. In the following table, we have investigated some common functions:

function natural domain 1-1 on natural domain? Graphs
$f(x)=x^n$ 
($n$ is even)
$\mathbb{R}$ no
$f(x)=x^n$ 
($n$ is odd)
$\mathbb{R}$ yes
$f(x)=\sqrt[n]{x}$
($n$ is even)
$[0,\infty)$ yes
$f(x)=\sqrt[n]{x}$
($n$ is odd)
$\mathbb{R}$ yes
$f(x)=\dfrac{1}{x^n}$
($n$ is even)
$\mathbb{R}-{0}=\{x|\ x\neq 0\}$ no
$f(x)=\dfrac{1}{x^n}$
($n$ is odd)
$\mathbb{R}-{0}=\{x|\ x\neq 0\}$ yes
  • Note that every monotonic function is one-to-one. Recall that a monotonic function is a function that is increasing or decreasing. Suppose $f$ is an increasing function because if $x_{1}<x_{2}$ then $f(x_{1})<f(x_{2})$ and if $x_{2}<x_{1}$ then $f(x_{2})<f(x_{1})$. That is if $x_{1}\ne x_{2}$ then $f(x_{1})\neq f(x_{2})$. Similarly, we can show that if $f$ is a decreasing function, then it is one-to-one.

Every increasing or decreasing function is one-to-one.