Sets are the objects of this chapter. The next
question is how to move between them, and the tool is a
function. Almost everything in linear algebra is a
question about a function: a linear map is a function, a
matrix will turn out to encode one, and “does
have a solution, and is it unique?” is a question about
whether a function is surjective and injective. This
section fixes the language of functions, composition,
and inverses, and proves the handful of facts about them
that the rest of the book uses without comment.
What a
function is
At school a function is usually a formula, such as
. A formula
alone is not enough. The same formula behaves differently
depending on which numbers we feed it and where we allow
the answers to land, and whether an equation can be solved
depends on exactly that information. So a function
carries three pieces of data, not one.
A function is a machine with a fixed input set
and a fixed target set that turns each input into
exactly one output.
Definition
0.4.1 (Function)
Let and be sets. A
function (or map)
is
a rule that assigns to every element
exactly one element . The set is the
domain of , the set is its
codomain, and is the
value of at . We also write .
Two functions and are equal if
, , and for every
.
In words: the first clause says every input gets an
output, so nothing in the domain is left out. The second
says the output is unique, so the rule never hesitates
between two values. The codomain is where outputs are
allowed to land; nothing says every element of
must be hit.
If you want a definition that avoids the vague word
“rule”, use the Cartesian product (Definition 0.3.10): a
function is
a subset such that for every there is exactly
one with
. The
set is the
graph of , and is that unique . Nothing in this book
depends on which version you prefer.
Example
(First examples)
Check each of the following against the two clauses
of Definition 0.4.1.
- (a) ,
.
Every real gives
one real number .
- (b) ,
.
The domain is a Cartesian product; each pair gives one
sum.
- (c) , sending a
string to its length. The empty string has length , which is why it
matters that
contains .
- (d) For any set
, the rule is a function
. It looks
too simple to matter, but it will play the role that the
number plays for
multiplication.
- (e) For any set
, there is exactly
one function , the empty function. Both
clauses are about elements of the domain, and there are
none, so they hold vacuously. It is a degenerate case
that makes statements like “for every set ” true without
exceptions.
The failures are just as instructive. The rule “ the real number
with ” is
not a function . At there is no such
, so the first
clause fails. At there are two, and , so the second clause fails. Repairing both
problems gives a genuine function ,
,
where
means the nonnegative root.
The equality clause says the codomain is part of the
function. The functions , and , have the same values but are
different functions. This is not
pedantry: we will see in a moment that one of them is
surjective and the other is not.
Quick check. Let
be and . Are and equal?
Solution. Yes. They have the same
domain and the same codomain, and for every real we have , because is the
nonnegative number whose square is . Different formulas
can describe the same function; what counts is the
values.
Images and
preimages
Often we want to push a whole set through a function,
or ask which inputs land in a given region. Both
operations get a name.
Definition
0.4.2 (Image and preimage)
Let be a function, , and .
- The image of under is . The set is called the
image of .
- The preimage of under is .
In words:
collects the outputs of the inputs in . The preimage collects every
input whose output lies in . So means “ for
some ”, while means “”, with no
existential quantifier at all.
Example
(Images and preimages of the squaring map)
Let , . Compute , , and .
Solution. As runs over , the square takes every value in
: values in
come from
, values in
from , and no square is
negative or exceeds on this interval. Hence .
Next, means . Hence .
Finally, no real square lies in , so . A preimage may be empty; that is
not an error.
Warning. The symbol is defined for
every function, invertible or not; it
does not mean that an inverse function exists. For the
same reason, pushing forward and pulling back need not
undo each other. With on : for we get and
; for we get and .
What does survive is one inclusion in each
direction.
Proposition
0.4.1 (Image and preimage inclusions)
Let , , and . Then
Proof. Let . By Definition 0.4.2,
for some
,
and
means .
Hence .
Let .
Then
by definition of the image, so by
definition of the preimage. This proves both
inclusions.
The warning shows both inclusions can be strict. In
Exercise (C3: When images and preimages undo each other)
you will find exactly which property of turns each one into an
equality.
Injective,
surjective, bijective
Given and a target , the most basic question is how many
solutions the equation has. There are two separate issues: whether
there is at least one solution, and
whether there is at most one. In linear
algebra these become “does
have a solution?” and “is the solution unique?”, and
they are answered by different tools. So the two halves
deserve separate names.
Injective means no two inputs collide; surjective
means every target is hit; bijective means both, so
every equation has exactly one solution.
Definition
0.4.3 (Injective, surjective, bijective)
Let be a function.
- is
injective (one-to-one) if for
all , implies .
- is
surjective (onto) if for
every there exists with . Equivalently,
.
- is
bijective if it is both injective and
surjective.
In words: injectivity says that if two inputs give
the same output, they were the same input. Equivalently,
by the contrapositive (Theorem 0.1.1),
distinct inputs give distinct outputs. Surjectivity says
the image of
fills the whole codomain. The quantifiers matter: in
surjectivity the
is allowed to depend on .
Negating these, as in Example (What “not injective” means)
and Example (What “not surjective” means),
tells us what a counterexample looks like. The map is not
injective when there exist with : one
collision is enough. It is not
surjective when there exists that equals for no : one missed
target is enough.
The standard moves. To prove injective, write
“Suppose ” and work towards . To prove surjective, write “Let
” and then
produce an ,
usually found backwards by solving on scrap paper,
and check forwards that .
The picture below shows maps between three-element
sets, drawn as arrows. A collision is two arrows landing
on one point; a missed target is a point with no
arrow.
Example
(Deciding injectivity and surjectivity)
Determine which of the following functions are
injective, surjective, or bijective.
- (a) ,
.
- (b) ,
.
- (c) ,
.
- (d) ,
, for
any set .
Solution.
(a) Bijective.
Suppose . Then , so , and dividing
by gives
. Hence
is injective. Let
. Solving
suggests
, and
indeed . Hence is surjective.
(b) Injective,
not surjective. Suppose ; then . But
is not hit:
has no integer solution, since is even. Note that the
same formula on is surjective; the failure comes
from the domain and codomain, not the formula.
(c) Surjective,
not injective. Let ; then , so is
surjective. But while , a collision, so is not
injective.
(d) Bijective. If
then directly, and every is hit by itself.
This degenerate case is the model of a bijection and
reappears as the identity function below.
The cleanest way to see that domain and codomain are
part of the question is to keep the formula fixed and
change only the sets. Write for the
nonnegative reals.
|
no: |
no: is not a
square |
|
no: |
yes: |
|
yes |
no: is not a
square |
|
yes |
yes |
For the injective rows: if and , then . Either , or , which for nonnegative numbers forces . In both
cases .
Read the table as a set of minimal changes. Shrinking
the domain from
to
removes the collision between and , so the injectivity
clause now holds. Shrinking the codomain removes the
missed targets, so the surjectivity clause now holds.
The formula never changed.
Warning. Do not confuse injectivity
with the statement “”. That
implication is true for every function;
it is the second clause of Definition 0.4.1.
Injectivity is its converse, “”, and on
satisfies the first but not the second.
Why these definitions. Surjectivity
depends on the codomain, and injectivity on the domain,
so neither is a property of a formula alone; this is why
Definition 0.4.1
insists on both sets. The names are descriptive:
“in-jective” throws the domain into the
codomain without collisions, and “sur-jective” (French
sur, onto) lands onto all of it. In
Chapter 2 we will meet a fast test for linear maps: a
linear map is injective exactly when the only input sent
to is
. That test
is special to linear maps and fails for general
functions, which is one reason the general definitions
come first.
Composition
If the outputs of one function can be fed into
another, we can run them in sequence. This is the
operation that matrix multiplication will describe in
Chapter 4.
Definition
0.4.4 (Composition)
Let and be functions. The
composition
is defined by
Read
as “ after ”: the function written
on the right acts
first. The definition needs the
codomain of to
equal the domain of , so that makes sense.
Example
(Order matters)
(a) Let
be and
. Compute
and .
(b) Let , , and , . Compute
and .
Solution.
(a) , while . At these are , so .
Composition is not commutative, even when both orders
make sense.
(b) is . In the other
order, is . So does nothing, while forgets the
sign of . The two
orders do not even have the same domain. We will return
to this pair when we discuss one-sided
inverses.
Although the order matters, the grouping does not.
This is what lets us write without brackets.
Theorem
0.4.2 (Associativity of composition)
Let , , and be functions. Then .
Proof. Both sides are functions
. Let . By Definition 0.4.4
applied twice on each side, Since the values agree at every , the two functions are
equal by Definition 0.4.1.
Next, the properties of the previous subsection pass
through composition.
Theorem
0.4.3 (Composition preserves injectivity and
surjectivity)
Let and be functions.
- (a) If and are injective, then
is
injective.
- (b) If and are surjective, then
is
surjective.
- (c) If and are bijective, then
is
bijective.
Idea. For (a), start from a
collision of and peel off one function at a time,
outermost first: injectivity of removes , then injectivity of
removes . For (b), run
backwards: reach
from some using
, then reach that
from some using .
Proof.
(a) Suppose , that is, .
Since is
injective, . Since is injective, . Hence is
injective.
(b) Let . Since is surjective, there is
with . Since is surjective, there is
with . Then . Hence is surjective.
(c) If and are bijective, then
is
injective by (a) and surjective by (b), so it is
bijective.
The converse of (a) is false, but half of it
survives, and that half is surprisingly useful. Suppose
is
injective. A collision of would be a collision of
, so must be injective; but
is only used on
the image , so
may still collide
outside it. The surjective case is dual.
Theorem
0.4.4 (Partial converse for
compositions)
Let and be functions.
- (a) If is injective,
then is
injective.
- (b) If is surjective,
then is
surjective.
Proof.
(a) Suppose . Applying
to both sides
gives . Since is injective,
. Hence
is
injective.
(b) Let . Since is surjective,
there is
with .
Put ;
then .
Hence is
surjective.
Identity
and one-sided inverses
The function that does nothing deserves a name,
because “undoing ”
means “composing with gives the function that
does nothing”.
Definition
0.4.5 (Identity function)
For a set , the
identity function on is ,
.
For every we have and , since both sides send to . Notice the
subscripts: on the right of the identity lives on
the domain, on the left on the codomain.
Now look again at Example (Order matters)
(b). There , but . So undoes from one side only.
This one-sided behavior is common enough to need a
word.
Definition
0.4.6 (Left and right inverses)
Let . A function is a left
inverse of if , and a
right inverse of if .
“Left” and “right” refer to where is written in the
composition. A left inverse recovers the input from the
output: . A right inverse picks, for each target , an input that reaches
it: . In
Example (Order matters)
(b), is a right
inverse of , and
is a left inverse
of . But is not
a left inverse of , because .
The descriptions “recovers the input” and “reaches
every target” should remind you of injective and
surjective. They are exactly that.
Theorem
0.4.5 (Left inverses and injectivity)
Let with
nonempty. Then has a left inverse if
and only if is
injective.
Idea. is Theorem 0.4.4 with
,
which is injective. For we must
define for
every . If
is in the image,
injectivity gives a unique with , and must be that . If is not in the image,
the condition says nothing about , so we send anywhere in . That is where
nonemptiness is used.
Proof. Suppose
.
The identity
is injective, so
is injective by Theorem 0.4.4 (a).
Suppose is
injective. Since , we may fix some . Define as
follows. If , there is some with , and this is unique because is injective; set . If , set . Every receives exactly one
value, so is a
function. For , the element lies in , and the unique
input sent to it is , so . Hence , as
claimed.
The hypothesis is not decoration. The empty
function is injective (there are no two inputs to
collide), but there is no function at
all, since would
have nowhere to go.
Theorem
0.4.6 (Right inverses and surjectivity)
Let . Then
has a right inverse if and only if is surjective.
Proof. Suppose
.
The identity
is surjective, so
is surjective by Theorem 0.4.4 (b).
Suppose is
surjective. For each the set is
nonempty, so we may choose one element of it and call it
. This defines
with
for every ,
that is, .
When is
infinite, the step “choose one element from each of
infinitely many nonempty sets at once” is an axiom of
set theory, the axiom of choice; we use
it freely and never mention it again in this
chapter.
Unlike an inverse in the usual sense, one-sided
inverses are rarely unique. For , , both and are right inverses: each
picks one of the two square roots.
Quick check. Give a function that
has a left inverse but no right inverse.
Solution. Take . It is
injective, since gives , so by Theorem 0.4.5 it has a
left inverse; explicitly, for and satisfies . It is not
surjective, since has no solution in . So by Theorem 0.4.6 it has
no right inverse.
Inverses
When a function has an inverse on both sides, the two
one-sided inverses turn out to coincide, and we get the
notion of inverse we know from and .
Definition
0.4.7 (Inverse function)
Let . A function is an inverse
of if If has
an inverse, is
invertible.
Both conditions are needed: Example (Order matters)
(b) shows a pair with one but not the other. The next
theorem says which functions are invertible and that
“the” inverse is justified.
Theorem
0.4.7 (Bijective if and only if
invertible)
A function is invertible if and only if it is bijective.
Moreover, an inverse of , when it exists, is
unique; we denote it .
Idea. For one could
combine the two one-sided theorems, but that route needs
and a choice. A bijection makes both unnecessary: every
has
exactly one preimage, so is forced. For
uniqueness, the standard move is to assume two inverses
and , and sandwich: .
Proof. Suppose
is an inverse of
. Since is
injective, is
injective by Theorem 0.4.4 (a).
Since is surjective, is surjective by Theorem 0.4.4 (b).
Hence is
bijective.
Suppose is
bijective, and let . Since
is surjective, some has , and since is injective, this
is unique. Define
to be this
. Then for every
, so . For
, the unique
input sent to
is itself, so
, and
.
Hence is an
inverse of .
(Uniqueness) Suppose and are both inverses of
. Then where the third equality is Theorem 0.4.2. This
proves the theorem.
The uniqueness computation used only and
.
So it proves more: if has a left inverse
and a right
inverse , then
, and
this common function is the inverse. The same sandwich
will prove that a matrix has at most one inverse.
Warning. The notation now has two
meanings. The preimage of a
set exists for every . The inverse function
, applied to
an element , exists only for
bijective .
Writing
for on
is meaningless,
while is fine. When is bijective the two
agree: .
Example
(Finding inverses)
For each function, decide whether it is invertible,
and if so find its inverse.
- (a) ,
.
- (b) ,
.
- (c) ,
.
- (d) , .
Solution.
(a) Solving gives . Put . Check:
and . So is an inverse of , and .
(b) , so . Hence is its own inverse:
.
(c) Not
invertible. , so
is not injective, hence not bijective, and Theorem 0.4.7 says it
has no inverse.
(d) Invertible.
By the table in the previous subsection is bijective, and the
inverse is : indeed for and for
.
To undo two steps, undo the last one first. When you
dress, the shirt goes on before the jacket; to undress,
the jacket comes off first.
Theorem
0.4.8 (Inverse of a composition)
Let and be bijective. Then is bijective
and
Proof. Using Theorem 0.4.2 to
regroup, and in the same way . Hence is an
inverse of . By Theorem 0.4.7, is bijective
and its unique inverse is , as
claimed.
The same reversal will appear for matrices as , and for the same reason.
Maps
between finite sets
For functions between two finite sets of the
same size, one of the two conditions comes for
free. This is the pigeonhole principle, and it is the
ancestor of a move used constantly from Chapter 2 on:
instead of checking both injectivity and surjectivity,
count, and check only one.
We write for the number of elements of a finite
set . We use two
counting facts about lists without proof: a list of
entries with a
repeated entry contains at most distinct elements,
and a subset of a finite set with elements
is all of .
Theorem
0.4.9 (Injective if and only if surjective for
finite sets of equal size)
Let and be finite sets with
, and let . Then is injective if and
only if is
surjective. In that case is bijective.
Idea. List the elements of as ; the
image is then
listed by . Injective means this list has no
repeats, so it has distinct entries and
must fill .
Surjective means the list fills , which has elements, so there is
no room for a repeat.
Proof. Let , and write with the distinct. By Definition 0.4.2,
consists of
the entries of the list .
Suppose is
injective. Since the are distinct, the
entries are distinct. Hence is a subset of with
elements, so , and
is surjective.
We
prove the contrapositive (Theorem 0.1.1).
Suppose is not
injective. Then for some , so the list has
a repeated entry and has at most elements. Hence
, and
is not
surjective.
So if is
injective or surjective, the two directions show that it
is both, that is, bijective.
For a finite set , this applies to every
:
such a map is injective if and only if it is surjective.
In Chapter 2 the same shape of statement returns for
linear maps
on a finite-dimensional space, with dimension playing
the role of the number of elements.
Warning. The theorem needs
finiteness. The map , , is injective but misses every odd number,
so it is not surjective, even though domain and codomain
are the same set. Infinite sets have room for an
injection into a proper part of themselves.
Exercises
A. Check your
understanding
Exercise
(A1)
- (a) State what it
means for to be injective, and what it means to be
surjective.
- (b) True or false:
the functions , and , are equal. Give a reason.
- (c) True or false:
if is
injective, then
is injective. Give a reason.
- (d) Write down the
first line of a proof that a function is injective, and the
first line of a proof that it is surjective.
- (e) True or false:
the preimage is defined only
when is
bijective.
- (f) True or false:
every injective function is bijective. Name the result you use.
Solution.
(a) is injective if for all
,
implies .
It is surjective if for every there exists
with .
(b) True. They
have the same domain and codomain, and
for every real .
Equality of functions is about values, not
formulas.
(c) False. In the
remark after Theorem 0.4.4,
is injective but . Only is forced to be
injective.
(d) Injective:
“Suppose satisfy .” Surjective: “Let .”
(e) False. makes sense for every function; see Definition 0.4.2 and
the warning after it.
(f) True, by Theorem 0.4.9: domain
and codomain are finite with the same number of
elements, so an injective map is surjective, hence
bijective.
B. Practice
Exercise
(B1: Injective or surjective?)
Determine whether each function is injective, and
whether it is surjective. Justify your answers.
- (a) ,
.
- (b) ,
.
- (c) ,
, the largest integer not exceeding
.
- (d) ,
.
Solution.
(a) Injective,
not surjective. Suppose . Then , so . But is not hit: would give
.
(b) Bijective.
Suppose . Then and .
Adding the two equations gives , and
subtracting gives , so . Hence is injective. Let . Then
Hence
is surjective.
(c) Surjective,
not injective. Let . Then , so is surjective. But
, a
collision, so is
not injective.
(d) Injective,
not surjective. Suppose . Comparing first coordinates gives . But is not hit: forces
and then
.
Exercise
(B2: Inverses)
- (a) Show that ,
, is
invertible and find .
- (b) Let
and define by . Show that really takes values in
, and that . Hence
deduce that is
bijective and find .
- (c) With as in B1(b), find . Hence find the
inverse of without computing first.
Solution.
(a) Put . Then
and . So is an inverse of , and by Theorem 0.4.7 is invertible with
.
(b) For the denominator
is nonzero,
so is a real
number. If , then , that is, , which is false. Hence . Next, for
, where the second equality multiplies numerator
and denominator by . So . This says is an inverse of
itself, so is
invertible, hence bijective by Theorem 0.4.7, and
.
(c) The solution
of B1(b) shows that
satisfies . Also ,
so . Hence . By Theorem 0.4.8, (As a check, , which indeed undoes.)
Exercise
(B3: Images of unions and intersections)
Let and .
- (a) Prove that .
- (b) Prove that .
- (c) Using on , give an example
where the inclusion in (b) is strict.
Solution.
- (a) We use double
inclusion (Theorem 0.3.1).
Let
. Then for some . If , then ; if , then . In either case .
Let
. If , then for some , so .
The case is the same with the roles of and swapped. This proves
the equality.
(b) Let .
Then for
some . Since , , and since , . Hence .
(c) Take and . Then , so , while . The inclusion is strict. The
collision is what goes wrong; for an injective , equality holds in
(b).
C. Going deeper
Exercise
(C1: Left inverses are not unique)
- (a) Let be
injective but not surjective, with
having at least
two elements. Prove that has at least two
different left inverses.
- (b) Find two
different left inverses of , .
- (c) Explain why a
bijective function has exactly one left inverse.
Hint for (a): look at the proof of Theorem 0.4.5 and ask
where it made a free choice.
Solution.
(a) Since is not surjective,
there is . Since has at least two
elements, there are in .
As in the proof of Theorem 0.4.5, for
let
be the
unique with
. Define
by for , and for . The proof of Theorem 0.4.5 shows
that each is a
left inverse of ,
since
uses only the values on . But , so .
(b) The only
element missed by
is . Define for and ; define for and . Both satisfy
for
every ,
and .
(c) Let be bijective, and let
be any left
inverse. By Theorem 0.4.7, has an inverse , which in
particular is a right inverse. By the observation
following that theorem, a left inverse and a right
inverse of the same function are equal, so . Hence every
left inverse equals . Conversely, is itself a left
inverse, since . So has exactly one left
inverse.
Exercise
(C2: Self-maps of finite and infinite sets)
- (a) Let be a finite set and
injective. Prove that is bijective.
- (b) Show that (a)
fails for :
give an injective that is not bijective.
- (c) Give a
surjective that is not bijective.
- (d) Let be finite and with
.
Prove that as well.
Hint for (d): first show that is bijective.
Solution.
(a) The domain
and codomain are the same finite set, so . By Theorem 0.4.9, the
injective map is
bijective.
(b) is
injective, since gives , but
is not of the form with . Hence is not surjective, so
not bijective.
(c) Take . By B1(c) it is surjective but not
injective.
(d) Since is
injective, is
injective by Theorem 0.4.4 (a). By
(a), is
bijective, so it has an inverse by Theorem 0.4.7. Then
using Theorem 0.4.2. Hence
, as claimed. (For this fails: with
and
from C1(b),
but . The
matrix version of (d), “ implies for square matrices”, is proved in Chapter
3.)
Exercise
(C3: When images and preimages undo each other)
Let .
- (a) Prove that for
every if and only if is surjective.
- (b) Prove that for
every if and only if is injective.
Hint: for each direction you need only one
well-chosen set; try a one-element set.
Solution.
- (a) Suppose the
equality holds for every , and let . Taking gives ,
so . Hence for some , and is surjective.
Suppose is
surjective, and let . The inclusion
is Proposition 0.4.1. For
the reverse, let . Since
is surjective, for some . Then , so , and hence . By Theorem 0.3.1, .
- (b) Suppose the
equality holds for every , and suppose . Taking
gives
. Since , we have
, so . Hence is injective.
Suppose is
injective, and let . The inclusion
is Proposition 0.4.1. For
the reverse, let . Then , so for some
. Since
is injective,
. By Theorem 0.3.1, .