Tutorials › Real Analysis › Injective Functions

Sets and Functions · Tutorial 63 of 1000

Injective Functions

An injective function assigns different outputs to different inputs, a property that can be proved by comparing function values or disproved with a single pair of inputs.

Beginner 12 min read

What You'll Learn

  • The definition of an injective function in terms of equal outputs
  • How to prove injectivity by starting with two inputs
  • How one counterexample establishes that a function is not injective
  • Why the domain matters when deciding whether a function is injective
  • How injectivity behaves when a function is restricted to a smaller domain

When Do Different Inputs Have Different Outputs?

In the previous tutorial, Function Notation, we used \(f(a)\) to denote the output assigned by a function \(f\) to an input \(a\) in its domain. We now ask a further question about a function: can two different inputs be assigned the same output? An injective function does not allow this. Each output that occurs is associated with at most one input.

Let \(f:A\to B\). The domain \(A\) is the set of inputs, and the codomain \(B\) is the set in which the outputs lie. To decide whether \(f\) is injective, compare outputs belonging to inputs in \(A\). The definition concerns every pair of inputs in that domain; it is not enough to check a selection of typical values.

Definition (Injective Function). A function \(f:A\to B\) is injective if, for all \(x,y\in A\), $$ f(x)=f(y)\quad\Longrightarrow\quad x=y. $$ An injective function is also called one-to-one.

The statement is an implication. It says that whenever two function values are equal, their inputs must be equal. Equivalently, no two distinct elements of \(A\) have the same function value. The definition does not require every element of \(B\) to occur as a value; it restricts how many inputs can produce any one output.

Keep the sets in view. Injectivity is a property of the specified mapping \(f:A\to B\), including its domain \(A\). The formula alone may not determine whether the function is injective, because changing the domain can change which pairs of inputs need to be compared.

Two Useful Forms of the Definition

There are two natural ways to express the same requirement. The definition above begins with equal outputs and concludes that the inputs are equal. Alternatively, one can begin with distinct inputs and conclude that their outputs are distinct. The alternative form is often convenient when reasoning from a given pair of different inputs.

Proposition (Equal-Output and Distinct-Input Criteria). Let \(f:A\to B\). The following statements are equivalent:

  • \(f\) is injective;
  • for all \(x,y\in A\), if \(x\ne y\), then \(f(x)\ne f(y)\).

Proof. Suppose first that \(f\) is injective. Let \(x,y\in A\) and suppose \(x\ne y\). If \(f(x)=f(y)\), the definition of injectivity would imply \(x=y\), contradicting \(x\ne y\). Therefore \(f(x)\ne f(y)\).

Conversely, suppose that for all \(x,y\in A\), \(x\ne y\) implies \(f(x)\ne f(y)\). Let \(x,y\in A\) and suppose \(f(x)=f(y)\). If \(x\ne y\), the stated property would give \(f(x)\ne f(y)\), a contradiction. Thus \(x=y\). This is exactly the definition of injectivity, so \(f\) is injective. \(\square\)

This proposition supports two complementary proof approaches. To prove that a function is injective, assume \(f(x)=f(y)\) and derive \(x=y\). To prove that it is not injective, find \(x,y\in A\) with \(x\ne y\) but \(f(x)=f(y)\). The first task requires an argument that works for arbitrary inputs; the second requires only one verified counterexample.

1
For an injectivity proof: choose arbitrary \(x,y\) in the domain and assume \(f(x)=f(y)\).
2
Use the function rule: rewrite the equality of outputs using the formula, table, or other description of \(f\).
3
Reach the required conclusion: show that the assumed equality forces \(x=y\), using valid algebra and any stated domain conditions.
4
For a failure: give two distinct domain elements and calculate that their function values are equal.

Proving Injectivity from a Formula

A direct proof usually begins with two arbitrary domain elements, rather than with a particular numerical example. The equality \(f(x)=f(y)\) is then translated into an equation involving \(x\) and \(y\). The goal is to show that this equation cannot hold unless \(x=y\).

Worked Example: An Affine Function with Nonzero Slope

Let \(f:\mathbb R\to\mathbb R\) be defined by \(f(x)=5x-2\). We prove that \(f\) is injective. Let \(x,y\in\mathbb R\) and suppose \(f(x)=f(y)\). Using the definition of \(f\), $$ 5x-2=5y-2. $$ Adding \(2\) to both sides gives \(5x=5y\). Since \(5\ne0\), division by \(5\) gives \(x=y\). Thus equality of the function values implies equality of the inputs, so \(f\) is injective.

The same calculation shows why the nonzero coefficient matters. A nonzero coefficient multiplying the input can be cancelled, forcing the inputs to agree. In a proof, the algebraic step must be justified by the coefficient being nonzero; division by zero would not be valid.

This method is sometimes described as “assume equal outputs.” It follows the direction of the definition directly. Notice that no assumption \(x\ne y\) was needed: \(x\) and \(y\) were arbitrary elements of the domain, and the proof showed that equal outputs force them to be equal.

The Domain Can Change the Answer

A function rule may behave differently on different domains. In particular, the rule \(x\mapsto x^2\) is not injective on all of \(\mathbb R\), because opposite nonzero inputs have equal squares. But if the domain is restricted to nonnegative real numbers, the rule is injective. The domain restriction removes the pairs of opposite inputs that caused the failure.

Worked Example: Squaring on the Nonnegative Reals

Define \(f:[0,\infty)\to\mathbb R\) by \(f(x)=x^2\). We verify injectivity using arbitrary inputs from its stated domain. Let \(x,y\in[0,\infty)\) and suppose \(f(x)=f(y)\). Then \(x^2=y^2\). By the difference of squares, $$ x^2-y^2=(x-y)(x+y)=0. $$ If \(x+y>0\), the equality of the product to zero implies \(x-y=0\), so \(x=y\). The remaining case is \(x+y=0\). Since both \(x\geq0\) and \(y\geq0\), their sum can equal zero only if \(x=0\) and \(y=0\); again \(x=y\). In every case, equal function values force equal inputs, so \(f\) is injective.

The codomain here is \(\mathbb R\), but the range is \([0,\infty)\): each value \(x^2\) is nonnegative, and for every \(r\geq0\), the nonnegative real number \(\sqrt r\) satisfies \(f(\sqrt r)=r\). This example illustrates that injectivity does not require the range to equal the codomain.

For contrast, define \(g:\mathbb R\to\mathbb R\) by \(g(x)=x^2\), now with domain all of \(\mathbb R\). The inputs \(-3\) and \(3\) are distinct, but $$ g(-3)=(-3)^2=9=3^2=g(3). $$ Both inputs belong to the specified domain, so this single pair proves that \(g\) is not injective. The statements about \(f\) and \(g\) do not conflict: they use the same formula but different domains.

Worked Example: A Finite Function with a Repeated Output

Let \(A=\{u,v,w\}\), \(B=\{1,2,3\}\), and define \(h:A\to B\) by $$ h(u)=1,\qquad h(v)=3,\qquad h(w)=1. $$ The inputs \(u\) and \(w\) are distinct, since they are different elements of \(A\), while their outputs agree: \(h(u)=1=h(w)\). Therefore the equal-output criterion fails, and \(h\) is not injective. It does not matter that the other input \(v\) has a different output; one pair of distinct inputs with the same value is sufficient to disprove injectivity.

The repeated value \(1\) occurs twice in the function table. In terms of the graph, both \((u,1)\) and \((w,1)\) belong to the graph. That is allowed for a function: each input still has exactly one output. It is injectivity, not the definition of a function, that rules out two distinct inputs sharing an output.

Restriction Preserves Injectivity

If an injective function is considered only on a subset of its domain, it remains injective. The restricted function has fewer inputs to compare, so it cannot acquire a pair of distinct inputs with equal outputs that was absent from the original function.

Theorem (Restriction of an Injective Function). Let \(f:A\to B\) be injective, and let \(C\subseteq A\). Define the restriction \(f|_C:C\to B\) by \(f|_C(c)=f(c)\) for every \(c\in C\). Then \(f|_C\) is injective.

Proof. Let \(c_1,c_2\in C\), and suppose $$ (f|_C)(c_1)=(f|_C)(c_2). $$ By the definition of restriction, this equality is \(f(c_1)=f(c_2)\). Since \(C\subseteq A\), both \(c_1\) and \(c_2\) belong to \(A\). The injectivity of \(f\) therefore gives \(c_1=c_2\). We have shown that equal values of \(f|_C\) imply equal inputs in \(C\), so \(f|_C\) is injective. \(\square\)

The theorem is one-way: it says that restricting an injective function preserves injectivity. A function that is not injective on a larger domain can become injective on a smaller one, as the two versions of the squaring function demonstrated. Restricting a domain can remove a problematic pair, but it cannot create a new collision among the remaining inputs.

Injectivity is about uniqueness of inputs for attained values. For every \(b\) in the range of an injective function, there is exactly one input \(a\) in the domain such that \(f(a)=b\). The “at least one” part follows from \(b\) being in the range; the “at most one” part follows from injectivity. Elements of the codomain outside the range have no input mapping to them.

Reading and Writing Injectivity Proofs

The quantifiers in the definition explain why a proof of injectivity must address arbitrary inputs. A calculation with selected values can suggest that a function is injective, but it cannot establish the claim for every pair in an infinite domain. For example, checking \(f(0)\), \(f(1)\), and \(f(2)\) does not settle what happens for all real inputs. A direct proof begins with arbitrary domain elements and uses the function rule to reach the required equality of inputs.

Conversely, the negation of injectivity has a simple form: there exist \(x,y\in A\) such that \(x\ne y\) and \(f(x)=f(y)\). This is why a counterexample is decisive. However, the domain condition is essential. A proposed pair only disproves injectivity if both inputs actually belong to the stated domain.

When a formula is involved, be careful about cancellation and division. An equation such as \(x^2=y^2\) does not always imply \(x=y\); it can also imply \(x=-y\), as established earlier in this course. Whether the second possibility causes a failure depends on the domain. On all real numbers it does cause a failure for squaring, while on \([0,\infty)\) it forces the inputs to be equal.

1
State the mapping completely: record its domain, codomain, and rule or assignments.
2
For a proof: take arbitrary inputs from the domain and assume their outputs are equal.
3
Track every condition: use domain restrictions when factoring, cancelling, or excluding possible inputs.
4
For a disproof: exhibit two distinct inputs in the domain and verify that their outputs are equal.
Distinguish functionhood from injectivity. A function assigns exactly one output to each input. An injective function additionally ensures that distinct inputs never share an output. A function may satisfy the first condition and fail the second.

Check Your Understanding

  1. State the definition of an injective function \(f:A\to B\) using \(f(x)\) and \(f(y)\).
  2. Let \(p:\mathbb R\to\mathbb R\) be defined by \(p(x)=7x+4\). Prove that \(p\) is injective by assuming \(p(x)=p(y)\).
  3. Let \(q:\mathbb R\to\mathbb R\) be defined by \(q(x)=|x|\). Give two distinct inputs with equal function values and use them to show that \(q\) is not injective.
  4. Define \(r:[0,\infty)\to\mathbb R\) by \(r(x)=x^2\). Which part of the domain condition is used in showing that \(r\) is injective?
  5. If \(f:A\to B\) is injective and \(C\subseteq A\), must the restriction \(f|_C:C\to B\) be injective? Name the result that justifies your answer.