\section{A Review of Functions}

\definition{}
A \textit{function} or \textit{map} $f$ from a set $A$ (the \textit{domain}, $\mathcal{D}$) to a set $B$ (the \textit{range}, $\mathcal{R}$) is a rule that assigns an element of $B$ to each element of $A$. We write this as $f: A \to B$.

\vspace{2mm}

Consider a function $f: \mathbb{Z} \to \mathbb{Z}$. If $f(1) = 2$, we say that 2 is the \textit{image} of 1 and 1 is a \textit{preimage} of 2 under $f$.

\vspace{2mm}

An element in a function's domain must have exactly one image. However, an element in the range may have more than one preimage.

\problem{}
Consider the function $f: \mathbb{R} \to \mathbb{R}^+ \cap \{0\}$ defined by $f(x) = x^2$
\begin{itemize}
	\item[-] What is the image of 2?
	\item[-] What are the preimages of 9?
\end{itemize}

\vfill

\definition{}
We say a map is \textit{one-to-one} if $a = b \implies f(a) = f(b)$ for all $a, b$ in the domain. In other words, this means that each element of the range has at most one preimage.

\definition{}
We say a map $f$ is \textit{onto} if, for every $y \in \mathcal{R}$, there exists an $x \in \mathcal{D}$ so that $f(x) = y$. In other words, this means that every $y$ in the range has a preimage in the domain.

\problem{}
Find a function that is...
\begin{enumerate}
	\item[-] neither one-to-one nor onto
	\item[-] one-to-one and not onto
	\item[-] not one-to-one, but onto
	\item[-] both one-to-one and onto
\end{enumerate}
We say a function that is both one-to-one and onto is \textit{bijective}.

\vfill
\pagebreak

\definition{}
Let $f: A \to B$ and $g: B \to C$. We can define a new function $(g \circ f): A \to C$, where $(g \circ f)(a) = g(f(a))$. This is called \textit{composition}.

\problem{}
Suppose $f: A \to B$ and $g: B \to C$ are both one-to-one. Must $(g \circ f)$ be one-to-one? Provide a proof or a counterexample.

\vfill

\problem{}
Suppose $f: A \to B$ and $g: B \to C$ are both onto. Must $(g \circ f)$ be onto? Provide a proof or a counterexample.

\vfill
\pagebreak





\section{A Review of Modular Arithmetic}

\definition{}
$\mathbb{Z}_n$ is the set of integers mod $n$. For example, $\mathbb{Z}_5 = \{0, 1, 2, 3, 4\}$. \\
You should all be familiar with modular arithmetic.

\definition{}
The inverse of an element $a$ in $\mathbb{Z}_n$ is a $b$ so that $a \times b \equiv 1$. \\

Not all elements of $\mathbb{Z}_n$ have an inverse. Those that do are called \textit{units}. \\

\vspace{2mm}

The set of all units in $\mathbb{Z}_n$ is written $\mathbb{Z}_n^\times$ \\
Read this as \say{$\mathbb{Z}$ mod $n$ cross}

\problem{}
What are the elements of $\mathbb{Z}_5)^\times$?

\begin{solution}
	$\{1, 2, 3, 4\}$
\end{solution}

\vfill

\problem{}<modtables>
Create an addition table for $\mathbb{Z}_4$ and a multiplication table for $(\mathbb{Z}_5)^\times$

\begin{center}
\begin{tabular}{c | c c c c}
	+ & 0 & 1 & 2 & 3 \\
	\hline
	0 & ? & ? & ? & ? \\
	1 & ? & ? & ? & ? \\
	2 & ? & ? & ? & ? \\
	3 & ? & ? & ? & ? \\
\end{tabular}
\end{center}

\begin{solution}
	\begin{center}
	\begin{tabular}{c | c c c c}
		+ & 0 & 1 & 2 & 3 \\
		\hline
		0 & 0 & 1 & 2 & 3 \\
		1 & 1 & 2 & 3 & 0 \\
		2 & 2 & 3 & 0 & 1 \\
		3 & 3 & 0 & 1 & 2 \\
	\end{tabular}
	\hspace{1cm}
	\begin{tabular}{c | c c c c}
		\times & 1 & 2 & 3 & 4 \\
		\hline
		1 & 1 & 2 & 3 & 4 \\
		2 & 2 & 4 & 1 & 3 \\
		3 & 3 & 1 & 4 & 2 \\
		4 & 4 & 3 & 2 & 1 \\
	\end{tabular}
	\end{center}
\end{solution}



\vfill
\vfill
\pagebreak