\documentclass{article}
\input{preamble.tex}
\title{Day 15}
\date{Tuesday June 12, 2012}
\newcommand{\df}{\textbf}
\usepackage{enumerate}
\def\Display{\@empty}
\newcommand{\Hide}[2]{\ifx \Display\undefined \strut \\ \vspace{#1} \\ \strut \else {\color{blue} #2} \fi }
\newcommand{\cod}{\opname{cod}}
\newcommand{\fin}{f^{-1}}
\begin{document}
\maketitle
\section{Properties of Function}
So far we have talked about different things we can talk about with respect to a function. So far if $f:A\to B$ we have the following features:
\begin{itemize*}
\item A domain: the function only allows inputs from this set, and gaurentees for each input there will be only one, unique output. In the above, the domain is $A$.
\item A codomain: the function promises that all outputs will lie here. In the above, the codomain is $B$.
\item The image: these are the values of the function that that function will actually hit in the codomain.
\end{itemize*}
A natural question why would you want to make your codomain larger than the image?
\begin{enumerate*}
\item One reason is that it is easier to generalize certain results. For instance, you might have a theorem that pertains to all $f:\R \to \R$; you might be able to use this theoreom to tell you something about your function, even if yours actually only maps into $\R^+$ or $(0,1)$.
\item The second reason is simply that it's often hard to calculate the image of a function. You can see this in programming. You often specify that an output of some subroutine is an \texttt{int} even though the function never outputs negatives and $0$.
\item Similar to the second, it often doesn't matter. Your codomain acts as a gaurentee to the person using your function. You may be able to say, ``I promise this will be a real number, except it's never an even natural or a decimal number with a finite number of $2$'s,'' but your end user (the person using the function) would probably be just happy knowing that you promise that it's a real.
\end{enumerate*}
We also know, if $f:A\to B$ and $A'\sbs A$ and $B'\sbs B$ then
\begin{itemize}
\item $f[A']$ is the image of $f$ under $A$; it is the set of values in $B$ that can be achieved using values in $A'$.
\item $f^{-1}[B']$ is the pre-image (or inverse image) of $B'$; it is the set of values in $A$ that would land in $B'$.
\end{itemize}
We will make use of all these notions in out definitions of properties, so it's best that we are pretty fluent in them.
\subsection{Properties of Images and Pre-Images}
There's some very basic properties of the image and preimage that we will not prove, but you should check:
\begin{thm}
If $f:A\to B$ then
\begin{enumerate*}
\item $f[A] \neq \emptyset$.
\item $f^{-1}[B]\neq \emptyset$.
\end{enumerate*}
\end{thm}
A very useful property of the pre-image is the following
\begin{thm}
If $f:A\to B$ and $X,Y\sbs B$ then
\[
f^{-1}[X\cap Y] = f^{-1}[X] \cap f^{-1}[Y]
\]
\end{thm}
\begin{proof}
\Hide{1in}{
($\sbs$) Take an $x\in f^{-1}[X\cap Y]$. Then we know there is some $y\in X\cap Y$ such that $f(x) = y$. As $y\in X\cap Y$, we know it is in $X$ and $Y$. Thus $x\in f^{-1}[X]$ and $x\in f^{-1}[Y]$ as there is some element of $X$, namely $y$, that $x$ hits, and similarly for $y$.
($\sps$) Take $x\in f^{-1}[X]\cap f^{-1}[Y]$. Then $x\in f^{-1}[X]$ and $x\in f^{-1}[Y]$. So we know there is some $y\in X$ such that $f(x) = y$ and some $z\in Y$ such that $f(x) = z$. But, as $f$ is a function, $z=y$, so $y\in X\cap Y$. Therefore, as $f(x) =y$ we know $x\in f^{-1}[X\cap Y]$
}
\end{proof}
\begin{thm}
If $f:A\to B$ and $X,Y\sbs B$ then
\[
f^{-1}[X\cup Y] = f^{-1}[X] \cup f^{-1}[Y]
\]
\end{thm}
\begin{proof}
\Hide{1in}{
($\sbs$) Take $x \in\fin[X\cup Y]$. Then there is some $y\in X\cup Y$ such that $f(x) = y$. If $y\in X$ then $x\in\fin[X]$. Otherwise, $y\in Y$, and so $x\in\fin[Y]$. Regardless, $x\in\fin[X]\cup\fin[Y]$.
($\sps$) Take $x\in \fin[X]\cup\fin[Y]$. If $x\in \fin[X]$ then there is some $y\in X$ such that $f(x) = y$. Thus, $y\in X\cup Y$ and so $x\in \fin[X\cup Y]$. Otherwise, $x\in \fin[Y]$, which is analogous.
}
\end{proof}
\begin{rmk}
Less details are being presented in these proofs as they would normally as we are expected to be good at the mechanics of a double containment proof. You should not omit these details until you reach a point of fluency.
Like any language, fluency in creation always comes after fluency in comprehension.
\end{rmk}
There are analogous theorems of the forward image of a set
\begin{thm}
If $f:A\to B$ and $X,Y\sbs A$ then
\begin{itemize}
\item $f[A\cup B] = f[A]\cup f[B]$
\item $f[A\cap B] \sbs f[A] \cap f[B]$
\end{itemize}
\end{thm}
We won't prove these, but you should prove them on your own for practice.
\subsection{Injections}
Consider the following application for functions: $A$ and $B$ are sets of codewords, and $f:A\to B$ is a channel that is used to communicate between two people. $f$ sends messages with codes from $A$ through the channel to the other person, who reads the codewords in $B$.
\begin{question}
Why might this be a bad thing?
\end{question}
\begin{ans}
\Hide{1cm}{
Well, if two code words in $A$ get sent to the same codeword of $B$, then person two will not be able to always discern what codeword was actually sent along the channel.
}
\end{ans}
This leads us to our first property of a function, which is called \df{injectivity}. A function is injective, essentially, when it is an encoding of elements from the domain into elements of the codomain, with the restriction that value encoded is recoverable.
Another, perhaps simpler way to say it, is two values in the domain do not get sent to the same place in the codomain.
\begin{dfn}
$f:A\to B$ is \df{injective} or \df{1-1} iff
\[
\A x,y\in A \stt x\neq y \to f(x) \neq f(y)
\]
or, alternatively, by looking at the contrapositive
\[
\A x,y\in \A \stt f(x)= f(y) \to x=y
\]
\end{dfn}
\begin{question}
Can you think of an alternative definition for injective using preimages?
\end{question}
\begin{ans}
\Hide{1cm}{ $\A y\in B \stt f^{-1}[\s{y}]\mbox{ either has $0$ or $1$ element in it}$ , or, perhaps better, $\A y\in f[A] \stt f^{-1}[\s{y}]\mbox{ is a singleton}$}
\end{ans}
\begin{eg}
The prototypical example of a non-injective function is $f:\R\to\R$ defined by $f(x) = x^2$. Here, $-1$ and $1$ get sent to the same point. Therefore, if you know the function outputted $1$, it is impossible to discern whether the input was $1$ or $-1$.
Another non-example is $\sin(x)$, from $\R\to\R$. We have that $f(0) = f(2\pi)$. Or, said another way, if you knew the output of the function was $0$ it would be impossible to discern what angle was plugged in.
\end{eg}
\begin{rmk}
Injectivity is very much tied to what the domain is. For instance, in the above, if we looked at $x^2$ with domain $\R^+$, or $\sin(x)$ with domain $[-\frac{\pi}{2},\frac{\pi}{2}]$, they would be injective.
\end{rmk}
Many functions that we encounter are injective however.
\begin{eg}
Consider the function $f:\N\times \N \to \N$ defined by
\[
f(n,m) = 2^n(2m+1) - 1
\]
We claim this is an injection.
\Hide{2in}{
Take $n_1,n_2,m_1,m_2\in\N$ and suppose $f(n_1,m_1) = f(n_2,m_2)$; want to show that $n_1 = n_2$ and $m_1 = m_2$.
So we have
\[
2^{n_1}(2m_1 + 1) - 2^{n_2}(2m_2 + 1) = 0
\]
Suppose that $n_1\neq n_2$. Without loss of generality, $n_2 > n_1$, so
\[
2^{n_1}\left( (2m_1 + 1) - 2^{n_2-n_1}(2m_2 + 1)\right) = 0
\]
The interior of the parenthetical must be $0$, so
\[
(2m_1 + 1) - 2^{n_2-n_1}(2m_2 + 1) = 0
\]
If $n_2 - n_1 > 0$ then the left part of the difference is even, and thus the difference will be odd, which cannot happen as it is $0$. Thus $n_2 - n_1 = 0$, and so $n_2 = n_1$.
Thus we have $n_1 = n_2$. Now we need only show that $m_1 = m_2$. We now have:
\[
2^{n_1}(2m_1 + 1) = 2^{n_1}(2m_2 + 1)
\]
This is just as true over the rationals over the integers, so we may divide by $2^{n_1}$, subtract one, and then divide by $2$. What we are left with is $m_1 = m_2$.
}
\end{eg}
\subsection{Surjection}
Let's say that we are in the same example as above with $A$ and $B$ being codewords, $f$ being some channel, and one person communicating to another through $f$. Let's imagine that the receiver of the message wants to send a message along this channel. It would be bad if he had codewords that have no translation in $A$.
Said a little bit differently, if would be bad if and English-Spanish dictionary did not contain all the Spanish words that one would expect to hear, since the dictionary should act as both a way to translate into Spanish, but also out of Spanish.
This leads us to our next property of a function, which is \df{surjectivity}. A function is surjective when it actually hits everything in it's codomain.
\begin{dfn}
A function $f:A\to B$ is \df{surjective} or \df{onto} iff
\[
\A y\in B \st \E x \in A \stt f(x) = y
\]
\end{dfn}
\begin{question}
Can you think of an alternative definition for surjective using images?
\end{question}
\begin{ans}
\Hide{1cm}{$\im(f) = \cod(f)$}.
\end{ans}
\begin{eg}
One again, the first example usually given of a non-surjective function is $f:\R\to\R$, $f(x) = x^2$ is not surjective. The reason being that $-1$ is never actually hit by the function; so if you were trying to code $-1$ to communicate it along the channel of $f$ as the message reciever, you'd have serious trouble.
The other example I gave above of $\sin(x)$ from $\R\to\R$ is also not surjective. $2$ is not struck by $\sin(x)$ but it is in the codomain.
\end{eg}
\begin{rmk}
Surjectivity is very much tied to what the codomain is. For instance, in the above, if we looked at $x^2$ with codomain $\R^+$, or $\sin(x)$ with codomain $[-1,1]$ they would be surjective.
\end{rmk}
\begin{eg}
Consider $f:\Z_4 \to \Z_2$ by $[x]_4 \mapsto [x]_2$. You can check this is well defined. We claim that it is surjective. \Hide{1in}{As $\Z_2 = \s{[0]_2, [1]_2}$ we need only show both of these get hit, and they certain do, by $[0]_4$ and $[1]_4$. }
This is not injective. $f([1]_4) = f([3]_4) = [1]_2$.
\end{eg}
\begin{eg}
Consider $g:\N\times \N \to \Z$ by $g(x,y) = x-y$. We claim this is surjective. \Hide{2cm}{Take an arbitrary $n\in \Z$. If $n \geq 0$ then $n$ is natural, so then $g(n,0) = n-0 = n$, so $n$ gets hit. Otherwise, $n < 0$. Then $-n$ is natural, so then $g(0,-n) = 0 -(-n) = n$, so $n$ gets hit}
This is not injective. \Hide{1cm}{$g(1,1) = g(2,2) = 0$. }
\end{eg}
\begin{eg}
Let $P$ be the set of functions $\R$ to $\R$ which are polynomials (what do you suppose this set looks like?). Define the function $D:P\to P$, defined by $f\mapsto f'$, that is a polynomial maps to its derivative. This is surjective but not injective. Can you see why?
\end{eg}
\begin{eg}
Let $A$ be a nonempty set. Consider $f:A \to \wp(A)$ by $x\mapsto \s{x}$. This is injective. \Hide{2cm}{Take $a,b\in A$, and suppose that $f(a) = f(b)$. Then $\s{a} = \s{b}$. But, this means everything in the left is in the right; as $a$ is in the left, it is in the right. As only $b$ is in the right, $a=b$.}
This is not surjective. \Hide{1cm}{What set in the codomain surely doesn't get hit?}
\end{eg}
\begin{eg}
Consider the function $f:\N\times \N \to \N$ defined by
\[
f(n,m) = 2^n(2m+1) - 1
\].
We claim this is a surjection. \Hide{2in}{ To show surjective, we are trying to show that every $x\in \N$, there is some $(n,m)\in\N\times\N$ such that $f(n,m) = x$. We prove thsi by induction.
If $x=0$, then we can set $(n,m) = (0,0)$ and this works.
$x\in \N$, $x>0$, and assume that for all $y < x$ we know that $y$ is hit by $f$. So for every $y < x$ we get some $n_y$ and $m_y$ such that $f(n_y,m_y) = y$.
We do cases on whether $x$ is even or odd.
If $x$ is even, then $x = 2y$ for some $y\in\N$. Then $f(0,y) = 2^{0}(2y+1)-1 = 2y = x$.
If $x$ is odd, then $x = 2y+1$ for some $y\in \N$. By induction hypothesis, $f(n_y,m_y) = y$ as $y< x$.
\begin{center}
\framebox[3in]{
\begin{minipage}{2in}
Scratch work:
\begin{align*}
&& y &= 2^{n_y}(2m_y + 1) - 1 \\
&& 2y &= 2^{n_y + 1}(2m_y + 1) -2 \\
&& 2y + 1 &= 2^{n_y + 1}(2m_y + 1) -1
\end{align*}
\end{minipage}
}
\end{center}
We claim that $f( n_y + 1, m_y)$ works. Well,
\begin{align*}
f( n_y + 1, m_y) &= 2^{n_y + 1}(2m_y + 1) -1 \\
&= 2^{n_y + 1}(2m_y + 1) -2 + 1 \\
&= 2( 2^{n_y}(2m_y + 1) - 1) + 1 \\
&= 2y + 1
\end{align*}
}
\end{eg}
\subsection{Composition}
Thinking of $f:A\to B$ and $g:C\to D$ as machines, we might want to compute what $f$ does to some $A$, and then feed the result of this computation directly to $g$. But, of course, this isn't always possible. It might be possible of course that $f$'s output would be bananas, and $g$'s inputs would be coconuts. In this case, it's not possible to send in $f$'s outputs to $g$.
\begin{dfn}
If $f:A\to B$ and $g:C\to D$ and $B\sbs C$ then the \df{$g$ composed with $f$} is
\[
g\circ f : A \to D
\]
And this is defined by
\[
(g\circ f)(x) = g(f(x))
\]
\end{dfn}
\begin{rmk}
The order of composition (whether it is $f\circ g$ or $g\circ f$) is a little contentious. It used to be moreso. Currently, in almost all branches of math and applications this is the way that composition is done. The contention nowadays usually lies in should function application be a ``rightward'' action, or a ``leftward'' action. We won't make a fuss about this, but you might see it come up, especially in an algebra course.
Usually, you can tell by context which it is anyway as the codomain of the function you perform first must be a subset of the domain of the second.
To remember which order $g\circ f$ is, you should pronounce it in one of the following way:
\begin{itemize*}
\item $g$ following $f$ of \ldots
\item first $f$ then $g$ of \ldots
\end{itemize*}
\end{rmk}
\begin{eg}
We are very well acquainted with compositions already. For instance, Consider $f:\R \to \R$ defined by $f(x) = x^2$, and $g:\R \to \R$ defined by $g(x) = \sin(x)$. Then we can ask for $f\circ g$, which is ``first do $g$ then do $f$,'' so it would be
\[
f\circ g = (\sin(x))^2
\]
Which is (regrettably) usually written $\sin^2(x)$. Other composition the other way however is $g\circ f$ which is ``first do $f$ then do $g$,'' so it woul dbe
\[
g\circ f = \sin(x^2)
\]
We can see then that function composition is not communitive.
\end{eg}
\begin{rmk}
Function composition is associative!
\[
f\circ(g\circ h) = (f \circ g) \circ h
\]
This is a completely trivial fact if one thinks about what it means, but it's importance is often overlooked. It's one of those things that is trivial when thought about, but really this is a truly beautiful thing that occurs in mathematics.
\end{rmk}
\begin{thm}
Let $f:A\to A$. Then the following are equivalent:
\begin{enumerate}[(a)]
\item $f$ surjective.
\item $f\circ f$ is surjective.
\end{enumerate}
\end{thm}
\begin{proof}
\Hide{2in}{
($(a)\implies(b)$) Suppose that $f$ is surjective. Want to show that $f\circ f$ is surjective. Well, To do this, we take $a\in A$, and want to find a $b\in A$ such that $f(f(b))=a$. Well, we know, as $f$ is surjective we know there is some $c\in A$ such that $f(c) = a$. Moreover, we know there is some $b\in B$ such that $f(b) = c$. Therefore, $f(f(b))=f(c)=a$.
($(b)\implies (a)$) suppose that $f\circ f$ is surjective. We want to show that $f$ is surjective. So, take $a\in A$, and we want to find a $b\in A$ such that $f(b) = a$. Well, Well, we $f\circ f$ is surjective, we can find a $c\in B$ such that $f(f(c))=a$. Then, letting $b=f(c)$, we see that $f(f(c)) = f(b) = a$.
}
\end{proof}
\end{document}