Skip to main content
\(\require{cancel}\newcommand{\half}{ \frac{1}{2} } \newcommand{\ds}{\displaystyle} \newcommand{\ts}{\textstyle} \newcommand{\es}{ {\varnothing}} \newcommand{\st}{ {\mbox{ s.t. }} } \newcommand{\pow}[1]{ \mathcal{P}\left(#1\right) } \newcommand{\set}[1]{ \left\{#1\right\} } \newcommand{\lin}{{\text{LIN}}} \newcommand{\quot}{{\text{QR}}} \newcommand{\simp}{{\text{SMP}}} \newcommand{\diff}[2]{ \frac{\mathrm{d}#1}{\mathrm{d}#2}} \newcommand{\bdiff}[2]{ \frac{\mathrm{d}}{\mathrm{d}#2} \left( #1 \right)} \newcommand{\ddiff}[3]{ \frac{\mathrm{d}^#1#2}{\mathrm{d}{#3}^#1}} \renewcommand{\neg}{ {\sim} } \newcommand{\limp}{ {\;\Rightarrow\;} } \newcommand{\nimp}{ {\;\not\Rightarrow\;} } \newcommand{\liff}{ {\;\Leftrightarrow\;} } \newcommand{\niff}{ {\;\not\Leftrightarrow\;} } \newcommand{\De}{\Delta} \newcommand{\bbbr}{\mathbb{R}} \newcommand{\arccsc}{\mathop{\mathrm{arccsc}}} \newcommand{\arcsec}{\mathop{\mathrm{arcsec}}} \newcommand{\arccot}{\mathop{\mathrm{arccot}}} \newcommand{\erf}{\mathop{\mathrm{erf}}} \newcommand{\smsum}{\mathop{{\ts \sum}}} \newcommand{\atp}[2]{ \genfrac{}{}{0in}{}{#1}{#2} } \newcommand{\YEaxis}[2]{\draw[help lines] (-#1,0)--(#1,0) node[right]{$x$};\draw[help lines] (0,-#2)--(0,#2) node[above]{$y$};} \newcommand{\YEaaxis}[4]{\draw[help lines] (-#1,0)--(#2,0) node[right]{$x$};\draw[help lines] (0,-#3)--(0,#4) node[above]{$y$};} \newcommand{\YEtaxis}[4]{\draw[help lines] (-#1,0)--(#2,0) node[right]{$t$};\draw[help lines] (0,-#3)--(0,#4) node[above]{$y$};} \newcommand{\YExcoord}[2]{\draw (#1,.2)--(#1,-.2) node[below]{$#2$};} \newcommand{\YEycoord}[2]{\draw (.2,#1)--(-.2,#1) node[left]{$#2$};} \renewcommand{\textcolor}[2]{\color{#1}{#2}} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

Section0.4Functions

Now that we have reviewed basic ideas about sets we can start doing more interesting things with them — functions.

When we are introduced to functions in mathematics, it is almost always as formulas. We take a number \(x\) and do some things to it to get a new number \(y\text{.}\) For example,

\begin{align*} y = f(x) &= 3x-7 \end{align*}

Here, we take a number \(x\text{,}\) multiply it by 3 and then subtract seven to get the result.

This view of functions — a function is a formula — was how mathematicians defined them up until the 19th century. As basic ideas of sets became better defined, people revised ideas surrounding functions. The more modern definition of a function between two sets is that it is a rule which assigns to each element of the first set a unique element of the second set.

Consider the set of days of the week, and the set containing the alphabet

\begin{align*} A &= \set{\text{Sunday, Monday}, \text{Tuesday, Wednesday}, \text{Thursday, Friday}, \text{Saturday}, \text{Sunday}}\\ B &= \set{\text{a,b,c,d,e}, \dots,\text{x,y,z}} \end{align*}

We can define a function \(f\) that takes a day (that is, an element of \(A\)) and turns it into the first letter of that day (that is, an element of \(B\)). This is a valid function, though there is no formula. We can draw a picture of the function as

<<SVG image is unavailable, or your browser cannot render it>>

Clearly such pictures will work for small sets, but will get very messy for big ones. When we shift back to talking about functions on real numbers, then we will switch to using graphs of functions on the Cartesian plane.

This example is pretty simple, but this serves to illustrate some important points. If our function gives us a rule for taking elements in \(A\) and turning them into elements from \(B\) then

  • the function must be defined for all elements of \(A\) — that is, no matter which element of \(A\) we choose, the function must be able to give us an answer. Every function must have this property.
  • on the other hand, we don't have to “hit” every element from \(B\text{.}\) In the above example, we miss almost all the letters in \(B\text{.}\) A function that does reach every element of \(B\) is said to be “surjective” or “onto”.
  • a given element of \(B\) may be reached by more than one element of \(A\text{.}\) In the above example, the days “Tuesday” and “Thursday” both map to the letter \(T\) and similarly the letters \(S\) is mapped to by both “Sunday” and “Saturday”. A function which does not do this, that is, every element in \(A\) maps to a different element in \(B\) is called “injective” or “one-to-one” — again we will come back to this later when we discuss inverse function in Section 0.6.

Summarising this more formally, we have

Definition0.4.1

Let \(A, B\) be non-empty sets. A function \(f\) from \(A\) to \(B\text{,}\) is a rule or formula that takes elements of \(A\) as inputs and returns elements of \(B\) as outputs. We write this as

\begin{gather*} f: A \to B \end{gather*}

and if \(f\) takes \(a \in A\) as an input and returns \(b\in B\) then we write this as \(f(a) = b\text{.}\) Every function must satisfy the following two conditions

  • The function must be defined on every possible input from the set \(A\text{.}\) That is, no matter which element \(a \in A\) we choose, the function must return an element \(b \in B\) so that \(f(a)=b\text{.}\)
  • The function is only allowed to return one result for each input  1 . So if we find that \(f(a)=b_1\) and \(f(a)=b_2\) then the only way that \(f\) can be a function is if \(b_1\) is exactly the same as \(b_2\text{.}\)

We must include the input and output sets \(A\) and \(B\) in the definition of the function. This is one of the reasons that we should not think of functions as just formulas. The input and output sets have proper mathematical names, which we give below:

Definition0.4.2

Let \(f:A \to B\) be a function. Then

  • the set \(A\) of inputs to our function is the “domain” of \(f\text{,}\)
  • the set \(B\) which contains all the results is called the codomain,
  • We read “\(f(a) = b\)” as “\(f\) of \(a\) is \(b\)”, but sometimes we might say “\(f\) maps \(a\) to \(b\)” or “\(b\) is the image of \(a\)”.
  • The codomain must contain all the possible results of the function, but it might also contain a few other elements. The subset of \(B\) that is exactly the outputs of \(A\) is called the “range” of \(f\text{.}\) We define it more formally by \begin{align*} \text{range of } f &= \set{b \in B \;|\; \text{there is some } a \in A \text{ so that } f(a) = b} \\ &= \set{f(a) \in B \;|\; a \in A} \end{align*} The only elements allowed in that set are those elements of \(B\) that are the images of elements in \(A\text{.}\)

Almost all the functions we look at from here on will be formulas. However it is important to note, that we have to include the domain and codomain when we describe the function. If the domain and codomain are not stated explicitly then we should assume that both are \(\mathbb{R}\text{.}\)