Commit 2c7ca556 authored by Jim Hefferon's avatar Jim Hefferon

working on inverses

parent f7fa8ddf
......@@ -261,13 +261,14 @@ qed=\qedsymbol
\newlist{jhitems}{enumerate*}{1}
\setlist*[jhitems,1]{%
mode=unboxed,
before=\unskip{\hspace*{.5em plus .05em minus .02em}\linebreak[1]},
before={},
% before=\unskip{\hspace*{.5em plus .05em minus .02em}\linebreak[1]},
after={},
itemjoin={\unskip{\hspace{.5em plus .05em minus .02em}}\linebreak[1]},
label={ (\roman*)},
}
\newenvironment{items}{%
\begin{jhitems}
\begin{jhitems}%
}{%
\end{jhitems}
}
......
......@@ -2090,7 +2090,7 @@ or as $\setbuilder{p\in\N}{\text{$p$ is prime and $p<10$}}$
(read the vertical bar as ``such that'';
some authors instead use a colon,~`$:$').
\begin{problem}[\midlength]
\begin{problem}[\midlength] \label{ex:DecideJustifySets}
Decide if each is true and justify your decision.
\begin{items}
\item $\set{1,3,5}=\set{5,3,1}$
......@@ -2963,41 +2963,48 @@ up element-by-element and thus have the same number of elements.
\section{Cartesian product}
\begin{df}
A \definend{sequence} $\seq{x_0, x_1, \ldots, x_{n-1}}$
is an ordered list of its \definend{terms}
$x_0$, $x_1$, \ldots, $x_{n-1}$.
Its \definend{length} $\lh(\seq{x_0, x_1, \ldots, x_{n-1}})$
is the number of terms~$n$.
Two sequences are equal if and only if
they have the same length and
A \definend{sequence} $\seq{x_0, x_1, \ldots\, x_{n-1}}$
is an ordered list.
Its elements
$x_0$, $x_1$, \ldots{} $x_{n-1}$ are \definend{terms}.
Its \definend{length} $\lh(\seq{x_0, x_1, \ldots\, x_{n-1}})$
is the number of terms,~$n$.
Two sequences are equal if and only if they have the same length and
the same terms, in the same order.
\end{df}
\begin{problem}\pord.
\begin{problem}
True or false?
\begin{items}
\item $\sequence{3, 4, 5}=\sequence{4, 3, 5}$
\item $\sequence{3, 4, 4, 5}=\sequence{3,4,5}$
\item $\seq{1,3,5}=\seq{5,3,1}$
\item $\seq{2, 4, 6}=\seq{2, 4, 6, 4}$
\end{items}
\Writetofile{answers}{\protect\item[\protect\remark]
Compare these with the answers for Exercise~\ref{ex:DecideJustifySets}.
}
\begin{answer}
\begin{items}
\item These sequences are not equal because they differ in the first term.
\item These are unequal because they differ in their third terms.
In contrast with sets, in sequences the order matters.
\item These are unequal because the first has length three while
the second has length four
In contrast with sets, in sequences any repeats do not collapse.
\end{items}
\end{answer}
\end{problem}
\begin{df}
For sets $A_0$, $A_1$, \ldots, $A_{n-1}$
the \definend{Cartesian product}
is the set of all length~$n$ sequences
$A_0\times A_1\times \cdots \times A_{n-1}
=\setbuilder{\sequence{a_0,a_1,\ldots,a_{n-1}}}{\text{$a_0\in A_0$, \ldots, and~$a_{n-1}\in A_{n-1}$}}$.
We write $A^n$ for for the
Cartesian product of $n$~equal sets $A\times\cdots\times A$.
For sets $A_0$, $A_1$, \ldots\ $A_{n-1}$,
the collection of all sequences
$\sequence{a_0,a_1,\ldots\,a_{n-1}}$ where $a_0\in A_0$, $a_1\in A_1$ \ldots,
is the \definend{Cartesian product}, denoted
$A_0\times A_1\times \cdots \times A_{n-1}$.
If the sets are equal we write $A^n=A\times\cdots\times A$.
\end{df}
Note the distinction between the diamond brackets $\sequence{\cdots}$
that denote sequences and the curly braces $\set{\cdots}$ for sets.
% Note the distinction between the diamond brackets
% for sequences, $\sequence{\cdots}$,
% and the curly braces for sets,~$\set{\cdots}$.
A sequence of length two is often called an \definend{ordered pair} and
written with parentheses $(x_0,x_1)$
(similarly we have ordered triples, four-tuples, etc.).
......@@ -3035,25 +3042,25 @@ Thus $A^0=B^0=\set{\sequence{}}$.
Similarly, $A\times\emptyset=\emptyset$.
For the other implication,
if neither set is empty then there exist some $a\in A$ and~$b\in B$, so
$(a,b)\in A\times B$, and thus $A\times B$ is not empty.
if neither set is empty then there exist some $a\in A$ and~$b\in B$.
Then $(a,b)\in A\times B$, and $A\times B$ is not empty.
\end{answer}
\begin{exercise}
Show that there are sets so that $A\times B\neq B\times A$.
Under what circumstances is $A\times B=B\times A$?
Under what circumstances are they equal?
\end{exercise}
\begin{answer}
An example where $A\times B\neq B\times A$ is if
$A=\set{0}$ and~$B=\set{1}$.
Then $A\times B=\set{\sequence{0,1}}$ while
$B\times A=\set{\sequence{1,0}}$ and the two sets are not equal.
$B\times A=\set{\sequence{1,0}}$.
If $A\times B$ and $B\times A$ are the same set then either that set is empty
and so either $A$ is empty or $B$ is empty,
If $A\times B$ and $B\times A$ are equal then either that set is empty
or it is not.
If it is empty then $A=B=\emptyset$.
If it is not empty then for each of its elements $\sequence{x,y}$,
we have both that $x\in A$ and that $x\in B$ (and similarly for~$y$).
Clearly in this case $A=B$.
we have both that $x\in A$ and that $x\in B$, and likewise for~$y$.
Thus in this case $A=B$.
\end{answer}
% \begin{exercise}
% Is $(A\times B)\times C$ equal to $A\times (B\times C)$?
......@@ -3072,36 +3079,36 @@ Thus $A^0=B^0=\set{\sequence{}}$.
% \remark we could prove that they are equal only if one of them is empty.
% \end{answer}
\begin{exercise}
Show that this statement is false:
Show that this is false:
$A\times B\subseteq \hat{A}\times \hat{B}$ if and only if
$A\subseteq \hat{A}$ and $B\subseteq \hat{B}$.
Patch the statement to make it true.
Patch it to make it true.
\end{exercise}
\begin{answer}
The example
$A=\emptyset$, $B=\set{1,2}$, $\hat{A}=\set{a}$, $\hat{B}=\set{1}$
shows that the statement is false since
An example where the statement does not hold is
$A=\emptyset$, $B=\set{1,2}$, $\hat{A}=\set{0}$, $\hat{B}=\set{1}$,
since
$A\times B=\emptyset\subseteq \hat{A}\times \hat{B}$ but
$B\not\subseteq \hat{B}$.
The adjusted statement is: for all nonempty sets,
The patched version is:~if the sets are nonempty then
$A\times B\subseteq \hat{A}\times \hat{B}$ if and only if
$A\subseteq \hat{A}$ and $B\subseteq \hat{B}$.
We will prove the `if' and `only if' clauses separately.
For `only if' suppose that $A\subseteq \hat{A}$ and~$B\subseteq \hat{B}$.
Then any element of~$A\times B$ is a pair $\sequence{a,b}$.
Because of the subset relationship, $a\in \hat{A}$ and~$b\in \hat{B}$
First suppose that $A\subseteq \hat{A}$ and~$B\subseteq \hat{B}$.
Then any element of~$A\times B$ is a pair $\sequence{a,b}$ with
$a\in A$ and $b\in B$.
By the subset assumption, $a\in \hat{A}$ and~$b\in \hat{B}$,
and so $\sequence{a,b}\in \hat{A}\times \hat{B}$.
Thus $A\times B\subseteq \hat{A}\times \hat{B}$.
Now assume that $A\not\subseteq \hat{A}$ (the case
of $B\not\subseteq \hat{B}$ is similar) and that $a\in A$
but~$a\notin \hat{A}$.
Because $B$ is not empty there is a~$b\in B$ and
so~$\sequence{a,b}\in A\times B$.
But $\sequence{a,b}\notin \hat{A}\times \hat{B}$,
and so $A\times B$ is not a subset of $\hat{A}\times \hat{B}$.
Now assume that $A\not\subseteq \hat{A}$ (the
$B\not\subseteq \hat{B}$ case is similar).
Fix $a\in A$ such that $a\notin \hat{A}$.
The set $B$ is not empty so there is a~$b\in B$.
Then $\sequence{a,b}\in A\times B$
but $\sequence{a,b}\notin \hat{A}\times \hat{B}$.
Thus $A\times B$ is not a subset of $\hat{A}\times \hat{B}$.
\end{answer}
\end{exes}
\end{problem}
......@@ -3111,7 +3118,8 @@ Thus $A^0=B^0=\set{\sequence{}}$.
\begin{exes}
\begin{exercise}
Prove that $(A\union B)\times C=(A\times C)\union(B\times C)$.
What is the interaction of Cartesian product and intersection?
What about intersection?
% What is the interaction of Cartesian product and intersection?
\end{exercise}
\begin{answer}
For union we will use mutual containment.
......@@ -3119,11 +3127,12 @@ Thus $A^0=B^0=\set{\sequence{}}$.
assume that $\sequence{x,c}\in (A\union B)\times C$.
Then $x\in A\union B$ and so either $x\in A$ or~$x\in B$.
If $x\in A$ then $\sequence{x,c}\in A\times C$, while
if $x\in B$ then $\sequence{x,c}\in B\times C$, and so
$\sequence{x,c}\in (A\times C)\union (B\times C)$.
Thus $(A\union B)\times C\subseteq (A\times C)\union (B\times C)$.
if $x\in B$ then $\sequence{x,c}\in B\times C$.
In either case
$\sequence{x,c}\in (A\times C)\union (B\times C)$ and
thus $(A\union B)\times C\subseteq (A\times C)\union (B\times C)$.
To get containment in the other direction assume that
For right-to-left containment assume that
$\sequence{x,c}\in (A\times C)\union (B\times C)$.
Then either $\sequence{x,c}\in A\times C$ or~$\sequence{x,c}\in B\times C$.
If $\sequence{x,c}\in A\times C$ then~$x\in A$ and so
......@@ -3131,12 +3140,12 @@ Thus $A^0=B^0=\set{\sequence{}}$.
The $\sequence{x,c}\in B\times C$ case is similar.
Thus $(A\times C)\union (B\times C)\subseteq (A\union B)\times C$.
As to intersection,
As to intersection, it distributes over Cartesian product:
$(A\intersection B)\times C = (A\times C)\intersection (B\times C)$.
The membership relation $\sequence{x,c}\in (A\intersection B)\times C$
Membership $\sequence{x,c}\in (A\intersection B)\times C$
holds if and only if both
$x\in A\intersection B$ and~$c\in C$.
That is true if and only if both
That's true if and only if both
$\sequence{x,c}\in A\times C$ and~$\sequence{x,c}\in B\times C$ are true,
which in turn is equivalent to
$\sequence{x,c}\in (A\times C)\intersection (B\times C)$.
......@@ -3146,9 +3155,9 @@ Thus $A^0=B^0=\set{\sequence{}}$.
$\setcomp{A}\times\setcomp{B}$.
\end{exercise}
\begin{answer}
Fix the universe~$\universalset=\Z$.
If
$A=\set{0}$ and $B=\set{1}$ then $A\times B=\set{\sequence{0,1}}$,
Let the universe be~$\universalset=\Z$,
let $A=\set{0}$ and let $B=\set{1}$.
Then $A\times B=\set{\sequence{0,1}}$ and
so $\setcomp{(A\times B)}=\Z^2-\set{\sequence{0,1}}$,
while $\setcomp{A}\times\setcomp{B}=(\Z-\set{0})\times(\Z-\set{1})$.
The two sets are not equal;
......@@ -3172,12 +3181,12 @@ Thus $A^0=B^0=\set{\sequence{}}$.
\chapter{Functions and relations}
% http://gowers.wordpress.com/2009/06/08/why-arent-all-functions-well-defined/
\begin{df}
A \definend{function}~$f$ (or \definend{map} or \definend{morphism})
A \definend{function} or \definend{map}~$f$
from \definend{domain} set~$D$
to \definend{codomain} set~$C$, written $\map{f}{D}{C}$,
is a sequence consisting of the two sets along with a \definend{graph},
is a triple consisting of the two sets along with a \definend{graph},
a set of pairs $(d,c)\in D\times C$.
This graph must be
The function must be
\definend{well-defined}: for each $d\in D$ there is
exactly one $c\in C$ such that $(d,c)$ is an element of the graph.
Functions are equal only if they have the same domain, codomain,
......@@ -3225,63 +3234,63 @@ with arrows that begin with a bar.
\item This is a function.
By inspection, for each pair $(x,y)\in G$ we have that
$x\in D$ and that~$y\in C$.
Also by inspection we have that for each $x\in D$ there is one and only
one~$c\in C$ such that~$(x,y)\in G$.
\item This is a function; the fact that there is a value associated with
two separate arguments is not an issue.
The proof is the same as for the prior item.
Also by inspection we have that for each argument $x\in D$
there is one and only
one value~$y\in C$ such that~$(x,y)\in G$.
\item This is a function by the same reasoning as the prior item.
The fact that the value~$3$ is associated with
two separate arguments, $0$ and~$2$, is not relevant.
\item This is not a function.
There is an element of the domain,
$2\in D$, with no associated value.
That is, there is no $c\in C$ such that $(2,c)\in G$.
\item This is a function; the fact that the codomain contains many
That is, there is no $y\in C$ such that $(2,y)\in G$.
\item This is a function.
The fact that the codomain contains many
elements that are not associated with any argument in the domain is
not an issue.
The verification is the same as for the first item.
not an issue.
\item This is not a function.
There is an element of the domain. $3\in D$, that is not associated with
any value; that is, there is no $c\in C$ such that $(3,c)\in G$.
There are elements of the domain, one of which is $3\in D$,
not associated with any value.
That is, there is no $y\in C$ such that $(3,y)\in G$.
\item This is not a function because there is an element of the domain,
$0\in D$, that is associated with two different values.
\item This is a function.
First, for each pair $(x,y)\in G$ we have that
For each pair $(x,y)\in G$ we have that
$x\in D$ and that~$y\in C$.
Also, we have that for each $x\in D$ there is one and only
one associated~$c\in C$, namely $c=d^2$.
Also, for each $x\in D$ there is one and only
one associated~$y\in C$, namely $y$ is the square of $x$.
\end{items}
\end{answer}
\end{problem}
Do not think that a function must have a formula.
The final item in the prior exercise has a formula but for other items
$G$ just consists of arbitrary pairings.
the graph~$G$ just has arbitrary pairings.
\begin{problem}[\midlength]
The \definend{hailstone function} $\map{h}{\N}{\N}$ is defined by cases,
The \definend{hailstone function} $\map{h}{\N}{\N}$ is defined by cases.
\begin{equation*}
h(n)=\begin{cases}
n/2 &\text{-- if $n$ is even} \\
3n+1 &\text{-- otherwise}
\end{cases}
\end{equation*}
using a different formula when the input is even than when it is odd.
\begin{items}
\end{equation*}%
\begin{items}%
\item Compute $h(n)$ for $n=0$, \ldots, $n=9$.
\item Starting with $n=6$ iterate the function, that is,
compute $h(n)$, then $h(h(n))$, etc., until the result is $1$.
\item Iterate the function starting with input~$6$, that is,
compute $h(6)$, then $h(h(6))$, etc., until the result is $1$.
How many steps does it take?
\item How many steps does it take starting with $n=11$?
\end{items}
(The \definend{Collatz conjecture} is that for every natural number starting
value, iteration will eventually reach~$1$.
No one knows if it is true.)
The \definend{Collatz conjecture} is that for every starting
value greater than zero, iteration will eventually reach~$1$.
No one knows if it is true.
\begin{answer}
\begin{items}
\item $h(0)=0$, $h(1)=4$, $h(2)=1$, $h(3)=10$, $h(4)=2$, $h(5)=16$,
$h(6)=3$, $h(7)=22$, $h(8)=4$, $h(9)=28$.
\item $h(6)=3$, $h(C(6))=10$, etc.
It takes eight steps: from $6$, to~$3$, and to~$10$, to~$5$,
\item
It takes eight steps: from $6$ to~$3$, then to~$10$, to~$5$,
then~$16$, after that~$8$, and~$4$, then~$2$, and finally~$1$.
\item Starting with $11$ takes fourteen steps, with successive
values $11$, $34$, $17$, $52$, $26$, $13$, $40$, $20$, $10$, $5$,
......@@ -3290,35 +3299,33 @@ No one knows if it is true.)
\end{answer}
\end{problem}
We are often not careful about the distinction between a function and its graph.
We often blur the distinction between a function and its graph.
For instance we may say, ``a function is an input-output relationship''
when technically it is the function's graph that is the pairing.
% (We've already done some of this blurring,
% in the sentence following the definition.)
(The distinction between function and graph
(The distinction
is there only because the graph does not determine the codomain and
so we must specify it separately.
The graph does, however, determine the domain.)
In the edge case that the domain is the empty set, the only function possible
is the empty set of ordered pairs.
has an empty graph.
\begin{problem}[\maxlength]
Show that
$\setbuilder{\sequence{q,n}\in \Q^+\!\!\times\Z^+}{\text{$n$ is $q$'s numerator}}$
$\setbuilder{\sequence{x,y}\in \R^2}{y^2=x}$
is not the graph of a function.
\begin{answer}
It is not well-defined.
The rational number $1/2$ can be written $2/4$, in which case the numerator
is different.
For instance, this set contains both pairs $\sequence{4,2}$ and
$\sequence{4,-2}$.
\end{answer}
\end{problem}
\begin{problem}[\maxlength]
When $D$ and $C$ are finite sets,
how many functions are there from $D$ to $C$?
how many functions are there from $D$ to~$C$?
\begin{answer}
For each element of the domain, in making a function we have a choice
To make a function, for each element of the domain we have a choice
of associating it with any of $|C|$-many values.
Thus the number of possible function is $|C|^{|D|}$.
\end{answer}
......@@ -3326,8 +3333,9 @@ Thus the number of possible function is $|C|^{|D|}$.
\begin{df}
The \definend{characteristic function} of a set~$A$ is a map
$\charfcn{A}$ (or $\mathbb{1}_A$), whose domain is the universe, such that
$\charfcn{A}(x)=1$ if~$x\in A$, and $\charfcn{A}(x)=0$ if~$x\notin A$.
$\charfcn{A}$ (some authors write $\mathbb{1}_A$),
whose domain is the universe, such that
$\charfcn{A}(x)=1$ if~$x\in A$ and $\charfcn{A}(x)=0$ if~$x\notin A$.
\end{df}
A function may have multiple arguments; one example is the function
......@@ -3336,9 +3344,9 @@ $\sequence{x,y}\mapsto x^2-2y^2$.
We typically write
$f(x,y)$ rather than
$f(\sequence{x,y})$.
We say this $f$ is a \definend{$2$-ary} function (similarly there
are $3$-ary functions, etc.);
the number of arguments is the function's \definend{arity}.
We say that this $f$ is \definend{$2$-ary} and similarly there
are $3$-ary functions, etc.
The number of arguments is the function's \definend{arity}.
\begin{df}
The \definend{range} of $\map{f}{D}{C}$ is
......@@ -3357,21 +3365,22 @@ if it is a function then find its range.
\item The range is $\set{3}$.
\item This is not a function.
\item This is not a function.
\item The range is the set of perfect squares $\setbuilder{a^2}{a\in\N}$.
\item The range is the set of perfect squares,
$\range(f)=\set{0,1,4,9,16,\ldots}$.
\end{items}
\end{answer}
\end{problem}
\begin{df} \label{def:InvImage}
Let $\map{f}{D}{C}$.
The \definend{restriction} of $f$ to $B\subseteq D$ is
the function $\map{\restrictionmap{f}{B}}{B}{C}$ whose action is given by
The \definend{restriction} of $f$ to the subset $B\subseteq D$ is
the function $\map{\restrictionmap{f}{B}}{B}{C}$ given by
$\restrictionmap{f}{B}(b)=f(b)$ for all $b\in B$
(we also say that
$f$ is an \definend{extension} of~$\restrictionmap{f}{B}$).
The \definend{image} of the set $B$ under $f$,
denoted $\image(f)$ (or $f(B)$),
is the range of the function $\restrictionmap{f}{B}$.
The \definend{image of the subset},
denoted $\image(f)$ or~$f(B)$,
is the range of~$\restrictionmap{f}{B}$.
In the other direction,
the \definend{inverse image of the element}~$c\in C$ is
the set $f^{-1}(c)=\setbuilder{d\in D}{f(d)=c}$, and
......@@ -3379,27 +3388,28 @@ the \definend{inverse image of the set}~$A\subseteq C$
is $f^{-1}(A)=\setbuilder{d\in D}{f(d)\in A}$.
\end{df}
Observe that $f^{-1}(c)$ is a set,
Observe that in that definition $f^{-1}(c)$ is a set,
not an element.
\begin{problem}
\begin{items}
Where $\map{f}{\R-\setbuilder{(2n+1)\pi/2}{n\in\Z}}{\R}$
Where $\map{f}{\R-\setbuilder{(2n+1)\cdot\pi/2}{n\in\Z}}{\R}$
is the function $f(x)=\tan(x)$,
\item find the image under $f$ of the interval
$\leftclosed{\pi/4}{\pi/2}=\setbuilder{x\in\R}{\pi/4\leq x<\pi/2}$
\item find the image of the set \set{-\pi/3}
$\leftclosed{\pi/4}{\pi/2}=\setbuilder{x\in\R}{\pi/4\leq x<\pi/2}$,
\item find the image of the single-element set \set{-\pi/3},
\item find the inverse image of the number $1$.
% \item find the inverse image of the interval
% $\closed{16}{25}=\setbuilder{y\in\R}{16\leq y\leq 25}$
\end{items}
\begin{answer}
\begin{items}
\item $f(\leftclosed{\pi/4}{\pi/2})=\leftclosed{1}{\infty}
=\setbuilder{x\in\R}{1\leq x<\infty}$
\item $f(\set{\pi/3})=\set{\sqrt{3}}$
\item There are many angles with a tangent of $1$ so the
solution is the set $\setbuilder{(\pi/4)+n\pi}{n\in \N}$.
\item The image is $f(\,\leftclosed{\pi/4}{\pi/2}\,)=\leftclosed{1}{\infty}
=\setbuilder{x\in\R}{1\leq x<\infty}$.
\item The image of this one-element set is a one-element set,
$f(\set{\pi/3})=\set{\sqrt{3}}$.
\item There are many angles with a tangent of $1$.
The inverse image is the set $\setbuilder{(2n+1)\cdot\pi/4}{n\in \Z}$.
% \item It is the infinite union of intervals
% $\setbuilder{\closed{\arctan(16)+n\pi}{\arctan(25)+n\pi}}{n\in \N}$.
\end{items}
......@@ -3410,11 +3420,12 @@ $\leftclosed{\pi/4}{\pi/2}=\setbuilder{x\in\R}{\pi/4\leq x<\pi/2}$
\begin{problem}
Prove that $f^{-1}(A)$ is the union of the sets $f^{-1}(a)$ over all $a\in A$.
\begin{answer}
Where $D$ is the domain,
$f^{-1}(A)=\setbuilder{d\in D}{f(d)\in A}$.
Restated, this is $\setbuilder{d\in D}{\text{$f(d)=a$ for some $a\in A$}}$.
We have
$f^{-1}(A)=\setbuilder{d\in D}{f(d)\in A}
=\setbuilder{d\in D}{\text{$f(d)=a$ for some $a\in A$}}$,
where $D$ is the domain.
This is the union over all $a\in A$ of the
sets $S_a=\setbuilder{d\in D}{f(d)=a}$.
sets $f^{-1}(a)=\setbuilder{d\in D}{f(d)=a}$.
\end{answer}
\end{problem}
......@@ -3437,43 +3448,44 @@ $\composed{g}{f}(d)=g(f(d))$.
\includegraphics{asy/bean_fcn_comp.pdf}
\end{center}
Read $\composed{g}{f}$ aloud as ``$g$ circle $f$''
or as~``$g$ composed with $f$''
(or~``$g$ following $f$'').
Note that while
in the expression $\composed{g}{f}$ the $g$ is read first,
the function that is applied first is~$f$.
Note also that the codomain of~$f$ is the domain of~$g$
(we sometimes
allow a composition when the domain of~$g$ is not the
entire codomain of~$f$ but instead is a superset of its range).
\begin{problem} Let $D=\set{0,1,2}$, $C=\set{a,b,c,d}$,
and $B=\set{\alpha,\beta,\gamma}$ (these letters are not variables, they are
distinct set elements).
Let $\map{f}{D}{C}$ be given by $0\mapsunder{} a$, $1\mapsunder{} c$,
$2\mapsunder{} d$ and let $\map{g}{C}{B}$
Read $\composed{g}{f}$ aloud as ``$g$ composed with $f$''
(or~``$g$ circle $f$'' or~``$g$ following $f$'').
Note that there is an awkwardness about the expression $\composed{g}{f}$:
while you read the $g$ first,
the function that you apply first is~$f$.
Note also that the domain of~$g$ is the codomain of~$f$.
We are sometimes casual about this and
don't object as long as the domain of~$g$ is a superset of the range of~$f$.
\begin{problem} Let $D=\set{0,1,2}$, $C=\set{10,11,12,13}$,
and $B=\set{20,21,22}$.
Let $\map{f}{D}{C}$ be given by $0\mapsunder{} 10$, $1\mapsunder{} 12$,
$2\mapsunder{} 13$ and let $\map{g}{C}{B}$
be given by
$a\mapsunder{}\alpha$, $b\mapsunder{} \beta$, $c\mapsunder{}\gamma$,
and $d\mapsunder{}\alpha$.
$10\mapsunder{}20$, $11\mapsunder{} 21$, $12\mapsunder{}22$,
and $13\mapsunder{}20$.
\begin{items}
\item Compute $\composed{g}{f}$ on all arguments or show that the composition
is not defined.
\item Compute $\composed{f}{g}$ on all arguments or show that it is not defined.
\item Find the range of $f$, $g$, as well as $\composed{f}{g}$
\item Find the range of $f$ and~$g$, as well as $\composed{f}{g}$
and~$\composed{g}{f}$ if they are defined.
\end{items}
\begin{answer}
\begin{items}
\item The function $\map{\composed{g}{f}}{D}{B}$ is given by
$0\mapsunder{}\alpha$, $1\mapsunder{}\gamma$, and $2\mapsunder{}\alpha$.
\item This map is not defined since the outputs from $g$ are not the inputs
to~$f$, that is, the codomain of~$g$ is not equal to
the domain of~$f$.
\item The range of~$f$ is $\set{a,c,d}$.
The range of~$g$ is $\set{\alpha,\beta,\gamma}$.
The range of $\composed{g}{f}$ is $\set{\alpha,\gamma}$.
$0\mapsunder{}20$, $1\mapsunder{}22$, and $2\mapsunder{}20$.
\item Composition is this order is not defined since the outputs from $g$,
the $20$, $21$, and $22$
are not the inputs to~$f$.
That is, the codomain of~$g$ is not equal to the domain of~$f$.
\item The range of~$f$ is $
range(f)=\set{10,12,13}$.
The range of~$g$ is $\range(g)=\set{20,21,22}$.
The prior item says that $\composed{f}{g}$ is not defined.
The range of $\composed{g}{f}$ is $\range(\composed{g}{f})=\set{20,22}$.
(Incidentally, observe that the range of $g$
and the range of $\composed{g}{f}$ are different.)
\end{items}
\end{answer}
\end{problem}
......@@ -3501,14 +3513,15 @@ but the formula is~$\composed{f}{g}(x)=(3x+1)^2=9x^2+6x+1$.
\begin{answer}
\begin{items}
\item
By definition a function is a triple consisting of a domain, a codomain,
and a graph.
By definition, functions are equal if they have the same domain, codomain,
and graph.
The domain of a composition is the domain of the map applied first.
Both the map $\composed{h}{(\composed{g}{f})}$ and the map
$\composed{(\composed{h}{g})}{f}$ have~$f$ applied first, so they have
the same domain.
$\composed{(\composed{h}{g})}{f}$ have~$f$ applied first so they have
the same domain, the domain of~$f$.
Similarly, the codomain of a composition is the codomain of the map
applied last, and so these two have the same codomain.
applied last and so these two have the same codomain, the codomain of~$h$.
As to the graph of the two, the action of the map on the left side
is $(\composed{h}{(\composed{g}{f})})(x)=h(\composed{g}{f})(x)
......@@ -3516,8 +3529,9 @@ but the formula is~$\composed{f}{g}(x)=(3x+1)^2=9x^2+6x+1$.
The action of the map on the right side
is $(\composed{(\composed{h}{g})}{f})(x)=(\composed{h}{g})(f(x))
=h(g(f(x)))$.
The two actions are equal\Dash they give the same association of inputs
with outputs\Dash so the graphs are equal.
The two actions are equal\Dash they both associate
each input~$x$ with the output~$h(g(f(x)))$\Dash and
so the graphs are equal.
\item
An example of noncommutativity is $\map{f,g}{\R}{\R}$ given by
$f(x)=x+2$ and $g(x)=3x+4$.
......@@ -3534,23 +3548,23 @@ but the formula is~$\composed{f}{g}(x)=(3x+1)^2=9x^2+6x+1$.
% .....................................
\section{Inverse}
The definition of a function specifies that for every input
The definition of function specifies that for every input
there is exactly one associated output.
This is asymmetric because the
definition puts no such condition on elements of the codomain.
\begin{df}
A function is \definend{one-to-one} (or an \definend{injection})
A function is \definend{one-to-one}, or an \definend{injection},
if for each value there is at most
one associated argument, that is, if $f(d_0)=f(d_1)$ implies that $d_0=d_1$
for all elements $d_0,d_1$ of the domain.
A function is \definend{onto} (or a \definend{surjection})
A function is \definend{onto}, or a \definend{surjection}
if for each value there is at least
one associated argument, that is, if for each element $c$ of the codomain
there exists an element $d$ of the domain such that $f(d)=c$.
A function that is both one-to-one and onto, so that for every value there
is exactly one associated argument, is a
\definend{correspondence} (or \definend{bijection}, or \definend{permutation}).
\definend{correspondence} or \definend{bijection}.
\end{df}
\begin{problem}
......@@ -3558,7 +3572,7 @@ is exactly one associated argument, is a
$\map{g}{\R}{\R}$ be $g(x)=x^2+1$.
\begin{exes}
\begin{exercise}
Show that $f$ is one-to-one, and onto.
Show that $f$ is one-to-one and onto.
\end{exercise}
\begin{answer}
For one-to-one, suppose that $f(x_0)=f(x_1)$ for $x_0,x_1\in\R$.
......@@ -3572,12 +3586,12 @@ is exactly one associated argument, is a
Thus $f$ is onto.
\end{answer}
\begin{exercise}
Show that $g$ is not one-to-one, and not onto.
Show that $g$ is not one-to-one and not onto.
\end{exercise}
\begin{answer}
The function~$g$ is not one-to-one because $g(2)=g(-2)$.
It is not onto because no element of the domain~$\R$ is mapped by~$g$
to the element $-1$ of the codomain.
to the element $0$ of the codomain.
\end{answer}
\end{exes}
\end{problem}
......@@ -3586,75 +3600,76 @@ is exactly one associated argument, is a
Let $D$ and~$C$ be finite sets.
Prove that if there is a correspondence~$\map{f}{D}{C}$
then the two have the same number of elements.
We do this in two parts, each of which is useful on its own.
We do this in two parts.
\begin{exes}
\begin{exercise}
If $f$ is one-to-one then $|C|\geq |D|$.
\end{exercise}
\begin{answer}
Assume that $\map{f}{D}{C}$ is one-to-one.
We give two proofs.
\smallskip
\noindent\textit{Proof by Pigeonhole Principle.}
The $|C| < |D|$ case would violate the Pigeonhole Principle,
because the average number of inputs asociated with each output is
greater than~$1$.
\smallskip
\noindent\textit{Proof by induction on the cardinality of the codomain.}
We will do induction on the number of elements in~$C$.
We will will prove this by induction on the number of elements in~$C$.
The base step is that~$|C|=0$.
The only map with an empty codomain is the empty map,
which is vacuously one-to-one, and $|C|\geq |D|$.
For the inductive step assume the statement is true when
$|C|=0$, \ldots, $|C|=k$, and consider the $|C|=k+1$ case.
Fix some element $c\in C$ (there is such an element since $|C|>0$).
The only map with an empty codomain has an empty graph.
This is indeed one-to-one (vacuously) but in any event
for this function the domain is empty and $|C|\geq |D|$.
For the inductive step assume the statement is true for all one-to-one
functions where the codomains satisfy
$|C|=0$, \ldots, $|C|=k$, and consider a
one-to-one function~$f$ with $|C|=k+1$.
Fix some element of the codomain $c\in C$;
such an element exists because $|C|>0$.
Let $\hat{C}=C-\set{c}$.
There are two cases: (1)~that there is a $d\in D$ with $f(d)=c$,
and (2)~that there isn't any such~$d$.
In both cases we will consider a map
derived from~$f$.
There are two cases: (1)~there is
a domain element $d\in D$ with $f(d)=c$,
and (2)~there isn't any such~$d$.
Case~(2) is easier, since the graph of the function
$\map{\hat{f}}{D}{\hat{C}}$ equals the graph of $f$,
and by the inductive hypothesis $|\hat{C}|\geq |D|$, and therefore
Case~(2) is easier.
Consider the function
$\map{\hat{f}}{D}{\hat{C}}$ given by $\hat{f}(d)=f(d)$.