# 7.2: Properties of Functions

- Page ID
- 80527

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\id}{\mathrm{id}}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\kernel}{\mathrm{null}\,}\)

\( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\)

\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\)

\( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)

\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)

\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vectorC}[1]{\textbf{#1}} \)

\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)## Properties

Consider the following functions:

Let \(A = \{1, 2, 3, 4\}\) and \(B = \{a, b, c, d\}\text{,}\) and define \(f:A \rightarrow B\) by

\begin{equation*} f(1) = a, f(2) = b, f(3) = c \textrm{ and } f(4) = d \end{equation*}

Let \(A = \{1, 2, 3, 4\}\) and \(B = \{a, b, c, d\}\text{,}\) and define \(g:A \rightarrow B\) by

\begin{equation*} g(1) = a , g(2) = b, g(3) = a \textrm{ and } g(4) = b. \end{equation*}

The first function, \(f\text{,}\) gives us more information about the set \(B\) than the second function, \(g\text{.}\) Since \(A\) clearly has four elements, \(f\) tells us that \(B\) contains at least four elements since each element of \(A\) is mapped onto a different element of \(B\text{.}\) The properties that \(f\) has, and \(g\) does not have, are the most basic properties that we look for in a function. The following definitions summarize the basic vocabulary for function properties.

Definition \(\PageIndex{1}\): Injective Function, Injection

A function \(f: A \rightarrow B\) is injective if

\begin{equation*} \forall a, b\in A, a\neq b \Rightarrow f(a) \neq f(b) \end{equation*}

An injective function is called an injection, or a one-to-one function.

Notice that the condition for an injective function is logically equivalent to

\begin{equation*} f(a) = f(b) \Rightarrow a = b\text{.} \end{equation*}

for all \(a, b\in A\text{.}\) This is often a more convenient condition to prove than what is given in the definition.

Definition \(\PageIndex{2}\): Surjective Function, Surjection

A function \(f: A \rightarrow B\) is surjective if its range, \(f(A)\text{,}\) is equal to its codomain, \(B\text{.}\) A surjective function is called a surjection, or an onto function.

Notice that the condition for a surjective function is equivalent to

\begin{equation*} \textrm{For all } b \in B\textrm{, there exists } a\in A \textrm{ such that } f(a)=b\text{.} \end{equation*}

Definition \(\PageIndex{3}\): Bijective Function, Bijection

A function \(f: A \rightarrow B\) is bijective if it is both injective and surjective. Bijective functions are also called one-to-one, onto functions.

The function \(f\) that we opened this section with is bijective. The function \(g\) is neither injective nor surjective.

Example \(\PageIndex{1}\): Injective but Not Surjective Function

Let \(A = \{1, 2, 3\}\) and \(B = \{a, b, c, d\}\text{,}\) and define \(f:A \rightarrow B\) by \(f(1) = b\text{,}\) \(f(2) = c\text{,}\) and \(f(3) = a\text{.}\) Then \(f \) is injective but not surjective.

Example \(\PageIndex{2}\): Characteristic Functions

The characteristic function, \(\chi _S\text{,}\) in Exercise 7.1.4 is surjective if \(S\) is a proper subset of \(A\text{,}\) but never injective if \(\lvert A \rvert \gt 2\text{.}\)

## Counting

Example \(\PageIndex{3}\): Seating Students

Let \(A\) be the set of students who are sitting in a classroom, let \(B\) be the set of seats in the classroom, and let \(s\) be the function which maps each student into the chair he or she is sitting in. When is \(s\) one to one? When is it onto? Under normal circumstances, \(s\) would always be injective since no two different students would be in the same seat. In order for \(s\) to be surjective, we need all seats to be used, so \(s\) is a surjection if the classroom is filled to capacity.

Functions can also be used for counting the elements in large finite sets or in infinite sets. Let's say we wished to count the occupants in an auditorium containing 1,500 seats. If each seat is occupied, the answer is obvious, 1,500 people. What we have done is to set up a one-to-one correspondence, or bijection, from seats to people. We formalize in a definition.

Definition \(\PageIndex{4}\): Cardinality

Two sets are said to have the same cardinality if there exists a bijection between them. If a set has the same cardinality as the set \(\{1,2,3,\ldots , n\}\text{,}\) then we say its cardinality is \(n\text{.}\)

The function \(f\) that opened this section serves to show that the two sets \(A=\{1, 2, 3, 4\}\) and \(B=\{a, b, c, d\}\) have the same cardinality. Notice in applying the definition of cardinality, we don't actually appear to count either set, we just match up the elements. However, matching the letters in \(B\) with the numbers 1, 2, 3, and 4 is precisely how we count the letters.

Definition \(\PageIndex{5}\): Countable Set

If a set is finite or has the same cardinality as the set of positive integers, it is called a countable set.

Example \(\PageIndex{4}\): Counting the Alphabet

The alphabet \(\{A, B, C, . . . , Z\}\) has cardinality 26 through the following bijection into the set \(\{1,2,3,\ldots ,26\}\text{.}\)

\begin{equation*} \begin{array}{ccccc} A & B & C & \cdots & Z \\ \downarrow & \downarrow & \downarrow & \cdots & \downarrow \\ 1 & 2 & 3 & \cdots & 26 \\ \end{array}\text{.} \end{equation*}

Example \(\PageIndex{5}\): As Many Evens as All Positive Integers

Recall that \(2\mathbb{P}= \{b\in \mathbb{P} \mid b= 2k \textrm{ for some } k \in \mathbb{P} \}\text{.}\) Paradoxically, \(2\mathbb{P}\) has the same cardinality as the set \(\mathbb{P}\) of positive integers. To prove this, we must find a bijection from \(\mathbb{P}\) to \(2\mathbb{P}\text{.}\) Such a function isn't unique, but this one is the simplest: \(f:\mathbb{P} \rightarrow 2\mathbb{P}\) where \(f(m) = 2m\text{.}\) Two statements must be proven to justify our claim that \(f\) is a bijection:

- \(f\) is one-to-one.

Proof: Let \(a, b \in \mathbb{P}\) and assume that \(f(a) = f(b)\text{.}\) We must prove that \(a = b\text{.}\)

\begin{equation*} f(a) = f(b) \Longrightarrow 2a = 2b \Longrightarrow a = b. \end{equation*} - \(f \) is onto.

Proof: Let \(b \in 2\mathbb{P}\text{.}\) We want to show that there exists an element \(a \in \mathbb{P}\) such that \(f(a) = b\text{.}\) If \(b \in 2\mathbb{P}\text{,}\) \(b = 2k\) for some \(k \in \mathbb{P}\) by the definition of \(2\mathbb{P}\text{.}\) So we have \(f(k) = 2k = b\text{.}\) Hence, each element of 2\(\mathbb{P}\) is the image of some element of \(\mathbb{P}\text{.}\)

Another way to look at any function with \(\mathbb{P}\) as its domain is creating a list of the form \(f(1),f(2), f(3), \ldots\text{.}\) In the previous example, the list is \(2, 4, 6, \ldots\text{.}\) This infinite list clearly has no duplicate entries and every even positive integer appears in the list eventually.

A function \(f:\mathbb{P}\to A\) is a bijection if the infinite list \(f(1), f(2), f(3), \ldots\) contains no duplicates, and every element of \(A\) appears on in the list. In this case, we say the \(A\) is **countably infinite**, or simply **countable**.

Readers who have studied real analysis should recall that the set of rational numbers is a countable set, while the set of real numbers is not a countable set. See the exercises at the end of this section for an another example of such a set.

We close this section with a theorem called the Pigeonhole Principle, which has numerous applications even though it is an obvious, common-sense statement. Never underestimate the importance of simple ideas. The Pigeonhole Principle states that if there are more pigeons than pigeonholes, then two or more pigeons must share the same pigeonhole. A more rigorous mathematical statement of the principle follows.

Theorem \(\PageIndex{1}\): The Pigeonhole Principle

Let \(f\) be a function from a finite set \(X\) into a finite set \(Y\text{.}\) If \(n\geq 1\) and \(\lvert X\rvert > n\lvert Y\rvert\text{,}\) then there exists an element of \(Y\) that is the image under \(f\) of at least \(n + 1\) elements of X.

**Proof**-
Assume no such element exists. For each \(y \in Y\text{,}\) let \(A_y = \{x\in X \mid f(x) =y \}\text{.}\) Then it must be that \(\lvert A_y \rvert \leq n\text{.}\) Furthermore, the set of nonempty \(A_y\) form a partition of \(X\text{.}\) Therefore,

\begin{equation*} \lvert X \rvert = \sum_{y\in Y}{\lvert A_y \rvert} \leq n \lvert Y \rvert \end{equation*}

which is a contradiction.

Example \(\PageIndex{6}\): A Duplicate Name is Assured

Assume that a room contains four students with the first names John, James, and Mary. Prove that two students have the same first name. We can visualize a mapping from the set of students to the set of first names; each student has a first name. The pigeonhole principle applies with \(n = 1\text{,}\) and we can conclude that at least two of the students have the same first name.

## Exercises

Exercise \(\PageIndex{1}\)

Determine which of the functions in Exercise 7.1.1 of Section 7.1 are one- to-one and which are onto.

**Answer**-
The only one-to-one function and the only onto function is \(f\text{.}\)

Exercise \(\PageIndex{2}\)

- Determine all bijections from \(\{1, 2, 3\}\) into \(\{a, b, c\}\text{.}\)
- Determine all bijections from \(\{1, 2, 3\}\) into \(\{a, b, c, d\}\text{.}\)

Exercise \(\PageIndex{3}\)

Which of the following are one-to-one, onto, or both?

- \(f_1:\mathbb{R} \rightarrow \mathbb{R}\) defined by \(f_1(x) = x^3 - x\text{.}\)
- \(f_2 :\mathbb{Z} \rightarrow \mathbb{Z}\) defined by \(f_2(x)= -x + 2\text{.}\)
- \(f_3:\mathbb{N} \times \mathbb{N}\to \mathbb{N}\) defined by \(f_3(j, k) =2^j3^k\text{.}\)
- \(f_4 :\mathbb{P} \rightarrow \mathbb{P}\) defined by \(f_4(n)=\lceil n/2\rceil\text{,}\) where \(\lceil x\rceil\) is the ceiling of \(x\text{,}\) the smallest integer greater than or equal to \(x\text{.}\)
- \(f_5 :\mathbb{N} \rightarrow \mathbb{N}\) defined by \(f_5(n)=n^2+n\text{.}\)
- \(f_6:\mathbb{N} \rightarrow \mathbb{N} \times \mathbb{N}\) defined by \(f_6(n)= (2n, 2n+1)\text{.}\)

**Answer**-
- \(f_1\) is onto but not one-to-one: \(f_1(0)=f_1(1)\text{.}\)
- \(f_2\) is one-to-one and onto.
- \(f_3\) is one-to-one but not onto.
- \(f_4\) is onto but not one-to-one.
- \(f_5\) is one-to-one but not onto.
- \(f_6\) is one-to-one but not onto.

Exercise \(\PageIndex{4}\)

Which of the following are injections, surjections, or bijections on \(\mathbb{R}\text{,}\) the set of real numbers?

- \(f(x) = -2x\text{.}\)
- \(g(x) = x^2- 1\text{.}\)
- \(\displaystyle h(x)=\left\{ \begin{array}{cc} x & x < 0 \\ x^2 & x\geq 0 \\ \end{array} \right.\)
- \(\displaystyle q(x)=2^x\)
- \(\displaystyle r(x) =x^3\)
- \(\displaystyle s(x) = x^3-x\)

Exercise \(\PageIndex{5}\)

Suppose that \(m\) pairs of socks are mixed up in your sock drawer. Use the Pigeonhole Principle to explain why, if you pick \(m + 1\) socks at random, at least two will make up a matching pair.

**Answer**-
Let \(X=\{\textrm{socks selected}\}\) and \(Y=\{\textrm{pairs of socks}\}\) and define \(f:X \to Y\) where \(f(x) =\)the pair of socks that \(x\) belongs to . By the Pigeonhole principle, there exist two socks that were selected from the same pair.

Exercise \(\PageIndex{6}\)

In your own words explain the statement “The sets of integers and even integers have the same cardinality.”

Exercise \(\PageIndex{7}\)

Let \(A =\text{ }\{1, 2, 3, 4, 5\}\text{.}\) Find functions, if they exist that have the properties specified below.

- A function that is one-to-one and onto.
- A function that is neither one-to-one nor onto.
- A function that is one-to-one but not onto.
- A function that is onto but not one-to-one.

**Answer**-
- \(f(n)=n\text{,}\) for example
- \(f(n)=1\text{,}\) for example
- None exist.
- None exist.

Exercise \(\PageIndex{8}\)

- Define functions, if they exist, on the positive integers, \(\mathbb{P}\text{,}\) with the same properties as in Exercise \(\PageIndex{7}\) (if possible).
- Let \(A\) and \(B\) be finite sets where \(|A|=|B|\text{.}\) Is it possible to define a function \(f:A \rightarrow B\) that is one-to-one but not onto? Is it possible to find a function \(g:A \rightarrow B\) that is onto but not one-to-one?

Exercise \(\PageIndex{9}\)

- Prove that the set of natural numbers is countable.
- Prove that the set of integers is countable.
- Prove that the set of rational numbers is countable.

**Answer**-
- Use \(s:\mathbb{N}\to \mathbb{P}\) defined by \(s(x)=x+1\text{.}\)
- Use the function\(f:\mathbb{N}\to \mathbb{Z}\) defined by \(f(\text{x0}=x/2\) if \(x\) is even and \(f(x)=-(x+1)/2\) if \(x\) is odd.
- The proof is due to Georg Cantor (1845-1918), and involves listing the rationals through a definite procedure so that none are omitted and duplications are avoided. In the first row list all nonnegative rationals with denominator 1, in the second all nonnegative rationals with denominator 2, etc. In this listing, of course, there are duplications, for example, \(0/1=0/2=0\text{,}\) \(1/1=3/3=1\text{,}\) \(6/4=9/6=3/2\text{,}\) etc. To obtain a list without duplications follow the arrows in Figure \(\PageIndex{1}\), listing only the circled numbers.

We obtain: \(0,1,1/2,2,3,1/3,1/4,2/3,3/2,4/1,\ldots\) Each nonnegative rational appears in this list exactly once. We now must insert in this list the negative rationals, and follow the same scheme to obtain:

\begin{equation*} 0,1,-1,1/2,-1/2,2,-2,3,-3,1/3,-1/3, \ldots \end{equation*}

which can be paired off with the elements of \(\mathbb{N}\text{.}\)

Figure \(\PageIndex{1}\): Enumeration of the rational numbers.

Exercise \(\PageIndex{10}\)

- Prove that the set of finite strings of 0's and 1's is countable.
- Prove that the set of odd integers is countable.
- Prove that the set \(\mathbb{N}\times \mathbb{N}\) is countable.

Exercise \(\PageIndex{11}\)

Use the Pigeonhole Principle to prove that an injection cannot exist between a finite set \(A\) and a finite set \(B\) if the cardinality of \(A\) is greater than the cardinality of \(B\text{.}\)

**Answer**-
Let \(f\) be any function from \(A\) into \(B\text{.}\) By the Pigeonhole principle with \(n=1\text{,}\) there exists an element of \(B\) that is the image of at least two elements of \(A\text{.}\) Therefore, \(f\) is not an injection.

Exercise \(\PageIndex{12}\)

The important properties of relations are not generally of interest for functions. Most functions are not reflexive, symmetric, antisymmetric, or transitive. Can you give examples of functions that do have these properties?

Exercise \(\PageIndex{13}\)

Prove that the set of all infinite sequences of 0's and 1's is not a countable set.

**Answer**-
The proof is indirect and follows a technique called the Cantor diagonal process. Assume to the contrary that the set is countable, then the elements can be listed: \(n_1,n_2,n_3,\ldots\) where each \(n_i\) is an infinite sequence of 0s and 1s. Consider the array:

\begin{equation*} \begin{array}{c} n_1=n_{11}n_{12}n_{13}\cdots\\ n_2=n_{21}n_{22}n_{23}\cdots\\ n_3=n_{31}n_{32}n_{33}\cdots\\ \quad \vdots\\ \end{array} \end{equation*}

We assume that this array contains all infinite sequences of 0s and 1s. Consider the sequence \(s\) defined by \(s_i=\begin{cases} 0 & \textrm{ if } n_{\textrm{ii}}=1 \\ 1 & \textrm{ if } n_{\textrm{ii}}=0 \end{cases}\)

Notice that \(s\) differs from each \(n_i\) in the \(i\)th position and so cannot be in the list. This is a contradiction, which completes our proof.

Exercise \(\PageIndex{14}\)

Prove that the set of all functions on the integers is an uncountable set.

Exercise \(\PageIndex{15}\)

Given five points on the unit square, \(\{(x,y) \mid 0 \leq x, y \leq 1 \}\text{,}\) prove that there are two of the points a distance of no more than \(\frac{\sqrt{2}}{2}\) from one another.