Relations and Functions • Topic 2 of 3

Functions: One-One, Onto & Bijective

A function $f : A \to B$ is a special relation that assigns to every element of the domain $A$ exactly one element of the codomain $B$. Two demands must both hold: nothing in $A$ is left unmapped, and nothing in $A$ maps to two different outputs. In Class 12 we classify functions by how they fill the codomain.

One-one (injective) functions

$f$ is one-one (injective) if different inputs always give different outputs:

$$f(x_1)=f(x_2) \ \Rightarrow\ x_1=x_2 \qquad\text{equivalently}\qquad x_1 \ne x_2 \Rightarrow f(x_1)\ne f(x_2).$$

Graphically, a function of a real variable is one-one when no horizontal line meets its graph more than once (the horizontal-line test). A handy shortcut: a function that is strictly increasing or strictly decreasing on its whole domain is automatically one-one, because monotonicity rules out any repeat of a value. A function that is not one-one is called many-one.

How to disprove one-one: exhibit two distinct inputs with the same output. For $f(x)=x^2$ on $\mathbb{R}$, $f(-2)=f(2)=4$ settles it instantly.

Onto (surjective) functions

$f$ is onto (surjective) if every element of the codomain is actually hit — that is, the range equals the codomain:

$$\forall\, y \in B,\ \exists\, x \in A \text{ such that } f(x)=y, \qquad \text{i.e. } \operatorname{Range}(f) = B.$$

Onto-ness depends on the chosen codomain. The same formula can be onto or not depending on whether $B$ is $\mathbb{R}$, $[0,\infty)$, $\mathbb{N}$, and so on. So always read the codomain carefully. A function that is not onto is sometimes called into.

Bijective functions

$f$ is bijective if it is both one-one and onto. A bijection pairs up the two sets perfectly — each input has a unique output and each output has a unique pre-image. Only bijections are invertible (the subject of the next page).

TypeTestQuick check
One-one (injective)$f(x_1)=f(x_2)\Rightarrow x_1=x_2$no horizontal line cuts the graph twice
Onto (surjective)$\operatorname{Range}=B$solving $f(x)=y$ yields an $x\in A$ for every $y$
Bijectiveone-one and ontoperfect pairing of $A$ with $B$

Useful fact: when $A$ and $B$ are finite and of equal size, a function is one-one if and only if it is onto. This shortcut fails for infinite sets — for example $f:\mathbb{N}\to\mathbb{N},\ f(x)=2x$ is one-one but not onto.

How to prove it in an exam

  • One-one: assume $f(x_1)=f(x_2)$ and algebraically force $x_1=x_2$.
  • Onto: take an arbitrary $y\in B$, solve $f(x)=y$ for $x$, and check that this $x$ lies in $A$.
  • To disprove: give one explicit counter-example.

Counting functions (finite sets)

For finite sets these counts come up repeatedly in MCQs. Suppose $|A|=m$ and $|B|=n$.

Count ofFormulaCondition
all functions $A\to B$$n^{m}$each of the $m$ inputs has $n$ choices
one-one functions $A\to B$$\dfrac{n!}{(n-m)!} = {}^{n}P_{m}$needs $m \le n$, else $0$
bijections $A\to B$$n!$only when $m = n$, else $0$

For example, the number of one-one maps from a $3$-element set to a $5$-element set is $\,{}^{5}P_{3}=5\times 4\times 3=60$, and the number of bijections between two $4$-element sets is $4!=24$.

Four mapping diagrams: one-one, onto, bijective and not a function Classifying maps f : A → B One-one distinct → distinct Onto every B hit Bijective one-one + onto Not a function one input, two outputs One-one: no two arrows land on the same dot of B. Onto: no dot of B is left without an incoming arrow. A genuine function sends each A-dot to exactly one B-dot.
1
Worked Example
Show that $f:\mathbb{R}\to\mathbb{R}$ defined by $f(x)=2x+3$ is bijective.
Solution

One-one: Suppose $f(x_1)=f(x_2)$. Then $2x_1+3 = 2x_2+3 \Rightarrow 2x_1=2x_2 \Rightarrow x_1=x_2$. So $f$ is one-one.

Onto: Take any $y\in\mathbb{R}$. Solve $2x+3=y \Rightarrow x=\dfrac{y-3}{2}$, which is a real number, so it lies in the domain $\mathbb{R}$ and $f(x)=y$. Hence $f$ is onto.

Answer: Being one-one and onto, $f$ is bijective.

2
Worked Example
Examine whether $f:\mathbb{R}\to\mathbb{R},\ f(x)=x^2$ is one-one and/or onto.
Solution

One-one? $f(-2)=4=f(2)$ but $-2\ne 2$, so $f$ is not one-one.

Onto? Outputs are squares, so $f(x)\ge 0$ always. A negative codomain value such as $y=-1$ has no pre-image. So $f$ is not onto.

Note: If we shrink both sides — restrict to $f:[0,\infty)\to[0,\infty)$ — then $f(x)=x^2$ becomes bijective. Domain and codomain are part of the function.

Answer: $f$ is neither one-one nor onto.

3
Worked Example
Let $f:\mathbb{N}\to\mathbb{N}$ be $f(x)=x^2$. Classify it.
Solution

One-one: For natural numbers, $x_1^2=x_2^2$ with $x_1,x_2>0$ forces $x_1=x_2$. So it is one-one.

Onto: The value $y=3\in\mathbb{N}$ is not a perfect square, so no natural $x$ gives $f(x)=3$. Not onto.

Answer: $f$ is one-one but not onto — a reminder that the finite "one-one $\Leftrightarrow$ onto" shortcut does not apply to infinite sets.

4
Worked Example
Show that $f:\mathbb{R}\to\mathbb{R},\ f(x)=x^3$ is bijective.
Solution

One-one: $x^3$ is strictly increasing on $\mathbb{R}$ (if $x_1

Onto: For any $y\in\mathbb{R}$, the real number $x=y^{1/3}$ satisfies $f(x)=y$. Onto.

Answer: Hence $f$ is bijective.

5
Worked Example
Show that $f:\mathbb{R}\to\mathbb{R},\ f(x)=|x|$ is neither one-one nor onto.
Solution

One-one? $f(-3)=3=f(3)$ but $-3\ne 3$, so two distinct inputs share an output. Not one-one.

Onto? Since $|x|\ge 0$ for all $x$, no negative number is an output. The codomain value $y=-2$ has no pre-image. Not onto.

Answer: $f(x)=|x|$ is neither one-one nor onto on $\mathbb{R}$ (it is many-one and into).

6
Worked Example
Let $A=\{1,2,3\}$ and $B=\{4,5\}$. Show that no function $f:A\to B$ can be one-one, and find how many onto functions exist.
Solution

One-one is impossible: $|A|=3 > 2=|B|$, so by the pigeonhole principle at least two of the three inputs must land on the same output. Hence no $f:A\to B$ is one-one.

Onto count: Total functions $A\to B$ are $2^3=8$. The non-onto ones send everything to a single element of $B$ — either all to $4$ or all to $5$ — that is $2$ functions. So onto functions $=8-2=6$.

Answer: No one-one function exists, and there are $\mathbf{6}$ onto functions from $A$ to $B$.

7
Worked Example
Show that $f:\mathbb{R}\setminus\{2\}\to\mathbb{R},\ f(x)=\dfrac{x-1}{x-2}$ is one-one. Is it onto $\mathbb{R}$?
Solution

One-one: Suppose $f(x_1)=f(x_2)$, i.e. $\dfrac{x_1-1}{x_1-2}=\dfrac{x_2-1}{x_2-2}$. Cross-multiplying: $(x_1-1)(x_2-2)=(x_2-1)(x_1-2)$. Expanding both sides gives $x_1x_2-2x_1-x_2+2 = x_1x_2-2x_2-x_1+2$, so $-2x_1-x_2=-2x_2-x_1 \Rightarrow -x_1=-x_2 \Rightarrow x_1=x_2$. One-one.

Onto $\mathbb{R}$? Solve $y=\dfrac{x-1}{x-2}$ for $x$: $y(x-2)=x-1 \Rightarrow x(y-1)=2y-1 \Rightarrow x=\dfrac{2y-1}{y-1}$, which fails when $y=1$. So $y=1$ has no pre-image and the range is $\mathbb{R}\setminus\{1\}$.

Answer: $f$ is one-one but not onto $\mathbb{R}$; it becomes a bijection if the codomain is taken as $\mathbb{R}\setminus\{1\}$.

8
Worked Example
How many one-one functions are there from a set of $4$ elements to a set of $6$ elements?
Solution

For a one-one function we choose distinct images for the $4$ inputs from the $6$ available outputs, in order.

That is a permutation count: $\dfrac{6!}{(6-4)!}={}^{6}P_{4}=6\times 5\times 4\times 3$.

$$6\times 5\times 4\times 3 = 360.$$

Answer: There are $\mathbf{360}$ one-one functions.

9
Worked Example
Show that $f:\mathbb{R}\to[-1,1],\ f(x)=\sin x$ is onto but not one-one.
Solution

Onto: The range of $\sin x$ is exactly $[-1,1]$, which equals the stated codomain, so every value in $[-1,1]$ is attained. Onto.

One-one? $\sin 0 = 0 = \sin \pi$, yet $0\ne\pi$. Two distinct inputs share an output. Not one-one.

Answer: $f(x)=\sin x$ from $\mathbb{R}$ to $[-1,1]$ is onto but not one-one (it is many-one).

10
Worked Example
Let $f:\mathbb{R}\to\mathbb{R}$ be defined by $f(x)=3-4x$. Classify $f$ as one-one / onto / bijective.
Solution

One-one: If $f(x_1)=f(x_2)$ then $3-4x_1=3-4x_2 \Rightarrow -4x_1=-4x_2 \Rightarrow x_1=x_2$. One-one.

Onto: For any $y\in\mathbb{R}$, solve $3-4x=y \Rightarrow x=\dfrac{3-y}{4}\in\mathbb{R}$. So every $y$ has a pre-image. Onto.

Answer: $f(x)=3-4x$ is both one-one and onto, hence bijective.

Key Points

  • One-one (injective): $f(x_1)=f(x_2)\Rightarrow x_1=x_2$ — passes the horizontal-line test; otherwise the function is many-one.
  • Onto (surjective): range $=$ codomain; depends on which codomain is chosen; otherwise the function is into.
  • Bijective: one-one and onto; only bijections are invertible.
  • Strictly increasing or strictly decreasing $\Rightarrow$ one-one.
  • For finite sets of equal size, one-one $\iff$ onto; this fails for infinite sets (e.g. $f(x)=2x$ on $\mathbb{N}$).
  • Prove one-one by algebra; prove onto by solving $f(x)=y$ and checking $x$ is in the domain; disprove either with one counter-example.
  • Counting ($|A|=m,\ |B|=n$): all functions $=n^{m}$; one-one $={}^{n}P_{m}$ (needs $m\le n$); bijections $=n!$ (needs $m=n$).
Tap an option to check your answer0 / 4
Q1.The function $f:\mathbb{R}\to\mathbb{R},\ f(x)=x^2$ is:
Explanation: $f(-1)=f(1)$ kills one-one, and negative values are never attained, so it is not onto either.
Q2.Which function $f:\mathbb{R}\to\mathbb{R}$ is a bijection?
Explanation: A non-constant linear map $f(x)=5x-7$ is strictly increasing (one-one) and attains every real value (onto), hence bijective. The others fail one-one or onto.
Q3.$f:\mathbb{N}\to\mathbb{N},\ f(x)=2x$ is:
Explanation: $2x_1=2x_2\Rightarrow x_1=x_2$ (one-one), but odd numbers like $3$ are never of the form $2x$, so not onto.
Q4.If $|A|=|B|=4$, the number of bijections from $A$ to $B$ is:
Explanation: A bijection between equal finite sets is a permutation, so there are $4! = 24$ of them.