Skip to main content
Mathematics LibreTexts

10.1: Basics

  • Page ID
    83451
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    10.1.1: Terminology and basic concepts

    Definition: Function(working definition)

    a rule which assigns to each input element from a set \(A\) a single output element from a set \(B\)

    Definition: Domain

    the set of all possible input elements for a function

    Definition: Codomain

    a set containing all possible output elements for a function

    Definition: \(f: A \rightarrow B\)

    \(f\) is a function with domain \(A\) and codomain \(B\)

    Definition: Input-output Rule

    the process/algorithm/rule/formula that describes how each input element from the domain will be transformed into an output element in the codomain

    Definition: \(f(a) = b\)

    function \(f: A \rightarrow B\) associates the codomain element \(b\in B\) to the domain element \(a\in A\)

    Definition: \(a \mapsto b\)

    alternative notation for \(f(a) = b\)

    Definition: Image (of an domain element)

    when \(f(a) = b\) we say that \(b\) is the image of \(a\) under \(f\text{,}\) or that \(f\) maps \(a\) to \(b\)

    clipboard_efea3fd10f5d000407195cde500cfd833.png
    Figure \(\PageIndex{1}\): A Venn diagram of a function transforming a domain element into a codomain element.
    Warning \(\PageIndex{1}\): Domain elements are necessarily inputs, but codomain elements are not necessarily outputs.

    When we define a function, the domain should either be implicitly clear from the input-output rule, or explicitly stated so that the precise collection of allowable input elements is known.

    However, it would be too onerous to do the same for the precise collection of output elements — often when we create a function we won't initially know exactly what outputs it will produce. The purpose of stating a codomain is so that it is at least clear what type of output element is produced.

    10.1.2: Defining functions

    Defining a function is a two-step process, in which we need to specify three pieces of information:

    1. the domain,
    2. the codomain, and
    3. the input-output rule.

    The first two pieces of information are specified in one step, when we write

    \begin{equation*} f: A \rightarrow B \text{.} \end{equation*}

    This notation indicates that \(A\) will be the domain and \(B\) will be the codomain for the function named \(f\text{.}\) Of course, the name of the function is an additional piece of information being specified with this notation, but naming a function is optional (though highly recommended!).

    Specifying the input-output rule may be done in many different ways, e.g. by a formula, table of values, a description of a step-by-step process or algorithm to determine or compute an output given an arbitrary input, etc.

    Example \(\PageIndex{1}\): Defining a function by an input-output formula.

    An input-output formula like \(f(x) = \sqrt{x}\) defines a function, but we here need to be careful about the domain. The domain and codomain for this function could be specified as \(f: \mathbb{R}_{\geq 0} \rightarrow \mathbb{R} \text{,}\) where \(\mathbb{R}_{\geq 0}\) represents the set of nonnegative real numbers.

    Example \(\PageIndex{2}\): Correctly stating a domain and codomain.

    In the function definition

    \begin{align*} f\colon \mathbb{R} & \to \mathbb{R}, \\ x & \mapsto \dfrac{1}{x^2}, \end{align*}
    the first line of the definition tells us the domain (\(\mathbb{R}\)), codomain (again \(\mathbb{R}\)), and a name for the function (\(f\)). The second line tells us the input-output rule, so that

    \begin{equation*} f(x) = \dfrac{1}{x^2} \text{.} \end{equation*}
    However, on closer inspection we discover that the domain has been incorrectly specified, as \(x=0\) is not a permissible input for the input-output rule. Instead, we should write

    \begin{equation*} f: \mathbb{R} \setminus \{0\}\rightarrow \mathbb{R} \text{.} \end{equation*}
    Even though this function will only ever produce positive real numbers as outputs, the codomain is acceptable as stated. It would be more precise to write

    \begin{equation*} f: \mathbb{R} \setminus \{0\} \rightarrow \mathbb{R}_{>0}, \end{equation*}
    where \(\mathbb{R}_{>0}\) represents the set of positive real numbers, but it is not necessary to do so.

    Example \(\PageIndex{3}\): Defining a function by an input-output algorithm.

    Consider the function \(\mathscr{P}(\mathbb{Z}) \to \mathbb{N}\) where outputs are computed according to the following algorithm.

    Given an input element \(X \in \mathscr{P}(\mathbb{Z})\) (which, by definition, is a set of integers), carry out the following.

    1. Compute the absolute value of each element in \(X\text{.}\) (If \(X\) is empty, skip this step.)
    2. Determine the minimum result of the absolute value computations in the previous step. (If \(X\) is empty, there will not be any absolute value computation results to compare, so take \(0\) as the “mininum” instead.)
    3. Multiply the minimum value found in the previous step by \(2\) and add \(1\text{.}\) Output this final result.

    However, with the right notation, an algorithm like the above can often be converted into an input-output formula — see Example 10.4.4.

    Example \(\PageIndex{4}\): Defining a function by listing input-ouput pairs.

    For \(\mathscr{N} = \{1,2,3\}\) and \(\mathscr{A} = \{a,b,c,d\}\text{,}\) one way to define a function \(f: \mathscr{N}\rightarrow \mathscr{A}\) is

    \begin{align*} f(1) & = d, & f(2) & = a, & f(3) & = d. \end{align*}

    Example \(\PageIndex{5}\): Multi-variable functions.

    In a first course in calculus a student typically studies only single-variable functions, i.e. functions with a single input variable and a single output variable. In subsequent calculus courses a student may study multi-variable functions with multiple input variables, such as

    \begin{equation*} f(x,y) = x^2 + y^2 \text{.} \end{equation*}
    Technically, we should write

    \begin{equation*} f((x,y)) = x^2 + y^2 \text{,} \end{equation*}
    as the proper definition of \(f\) is \(f: \mathbb{R}^2 \rightarrow \mathbb{R}\text{,}\) but the extra brackets convey no additional information and only clutter things up.

    Functions with multiple real output variables are often called vector functions. For example, \(g: \mathbb{R}\rightarrow\mathbb{R}^2\) defined by

    \begin{equation*} g(t) = (t,t^2) \end{equation*}
    can be considered as a vector parametrization of a parabola in the plane.

    And of course we could consider multi-variable vector functions as well. A function \(\varphi: \mathbb{R}^2 \rightarrow \mathbb{R}^2 \) like

    \begin{equation*} \varphi(s,t) = (s-t,s+t) \end{equation*}
    could be considered as a change of variables

    \begin{align*} x & = s - t, & y & = s + t. \end{align*}

    Example \(\PageIndex{6}\): Logical statements as functions.

    A logical statement \(S\) involving statement variables \(p_1, p_2, \ldots , p_m\) is essentially a multi-variable function

    \begin{equation*} S: \Lambda^m \rightarrow \Lambda \text{,} \end{equation*}
    where \(\Lambda = \{ T,\, F \}\text{.}\) For example, the statement

    \begin{equation*} S(p_1,p_2) = (p_1 \rightarrow p_2) \end{equation*}
    is a function \(S: \Lambda \times \Lambda \rightarrow \Lambda \text{,}\) where

    \begin{align*} S(T,T) & = T, & S(T,F) & = F, & S(F,T) & = T, & S(F,F) & = T. \end{align*}

    10.1.3: Graph of a function

    Definition: Graph (of a function)

    the set of all input-output pairs for the function

    Definition: \(\Delta (f)\)

    the graph of function \(f: A \rightarrow B\text{,}\) so that

    \begin{equation*} \Delta (f) = \{(a,f(a)) \vert a \in A\} \subseteq A \times B \end{equation*}

    Example \(\PageIndex{7}\): Graph of a function defined by a list.

    To describe the graph of the function \(f: \mathscr{N} \rightarrow \mathscr{A}\) defined in Example \(\PageIndex{4}\), we just need to collect the defined input-output pairs into Cartesian product elements:

    \begin{equation*} \Delta (f) = \{ (1,d), (2,a), (3,d) \} \text{.} \end{equation*}

    This graph can most simply be represented by a table:

    \(x\) \(1\) \(2\) \(3\)
    \(f(x)\) \(d\) \(a\) \(d\)
    Example \(\PageIndex{8}\): Graph of a single-variable, real-valued function.

    The graph of a function \(f: \mathbb{R} \rightarrow \mathbb{R}\) is a subset of \(\mathbb{R} \times \mathbb{R} = \mathbb{R}^2\text{.}\) We usually represent \(\mathbb{R}^2\) visually as the \(xy\)-plane and the graph \(\Delta (f) \subseteq \mathbb{R}^2\) as a curve in the plane.

    clipboard_e7bd33514c11bb11059bb60c5df0758be.png
    Figure \(\PageIndex{2}\): The graph \(\Delta (x \mapsto x^2)\) represented as a curve in the Cartesian plane.

    In the graph of \(f(x) = x^2\) above, each point on the curve represents an element of \(\mathbb{R}^2\) which is in the subset \(\Delta (f)\text{.}\) For example, \((-1,1) \in \Delta (f)\) but \((-1,\pi) \notin \Delta (f)\text{.}\)

    Example \(\PageIndex{9}\): Graph of a multi-variable, real-valued function.

    The graph of a function \(f: \mathbb{R}^2 \rightarrow \mathbb{R}\) is technically a subset of \(\mathbb{R}^2 \times \mathbb{R}\text{,}\) but usually we just think of this as \(\mathbb{R}^3\text{,}\) or \(3\)-space. Instead of a curve, such a graph defines a surface in \(\mathbb{R}^3\text{.}\) For example, the graph of the function \(f(x,y) = x^2 + y^2\) from Example \(\PageIndex{5}\) is a parabolic cone, i.e. a (non-solid) cone-like surface with parabolic sides.

    Example \(\PageIndex{10}\): Graph of a logical statement.

    We've already encountered the graph of a logical statement: it is usually represented as a truth table. For example, the graph \(\Delta (S)\) of the logical statement

    \begin{align*} S \colon \Lambda \times \Lambda & \to \Lambda, & S(p_1,p_2) & = p_1 \rightarrow p_2, \end{align*}

    where \(\Lambda = \{ T, F \}\) as usual, can be represented as below.

    clipboard_e534d6a7d2de31a717605d0f31c321980.png
    Figure \(\PageIndex{3}\): The graph \(\Delta (S)\) of the logical statement \(S(p_1,p_2) = p_1 \rightarrow p_2\text{.}\)

    Unfortunately, our working definition for function is lacking: what is a “rule”? Rather than chasing some circle of definitions, we can come up with a better definition by noticing that the graph of a function contains all the necessary information about the function.

    Definition: Function (formal definition)

    a subset \(F \subseteq A \times B\) such that for every \(x\in A\) there is exactly one element \((a,b)\in F\) with \(a=x\)

    In this formal definition, we are defining a function to be what we previously would have called its graph.

    Example \(\PageIndex{11}\): Formal definition for a single-variable, real-valued function.

    We are now defining a function \(f: \mathbb{R} \rightarrow \mathbb{R}\) to be the subset of the Cartesian plane \(\mathbb{R}^2\) consisting of the graph of the function. In this case, you can think of the “exactly one” requirement as equivalent to the vertical line test: an input value may not produce more than one output value. (Though the “one” part of “exactly one” captures our requirement that a function be defined on every domain element.)

    10.1.4: Undefined and well-defined

    We have to be careful defining functions; sometimes what we think is a function turns out to not be a function.

    Example \(\PageIndex{12}\): A function must be defined on the whole domain.

    Again write \(\mathscr{N} = \{1,2,3\}\) and \(\mathscr{A} = \{a,b,c,d\}\text{,}\) and consider

    \begin{equation*} F = \{ (1,a), (3,d) \} \subseteq \mathscr{N} \times \mathscr{A} \text{.} \end{equation*}
    Does this subset define a function with domain \(\mathscr{N}\) and codomain \(\mathscr{A}\text{?}\) That is, does there exist a function \(f: \mathscr{N} \rightarrow \mathscr{A}\) such that \(F = \Delta (f)\text{?}\) The answer is no, because there is no input-output pair in \(F\) with domain element \(2\text{.}\) If we attempt to consider a function \(f\) with graph \(\Delta (f) = F\text{,}\) we have no way to tell what result \(f(2)\) should return. In other words, such an \(f\) will have been left undefined on element \(2\text{,}\) which is supposed to be part of the domain.

    The set \(F\) does define a function, just not one with domain \(\mathscr{N}\text{.}\) If we consider the smaller set \(\mathscr{N}' = \{1,3\}\text{,}\) then there is a function \(f: \mathscr{N}' \rightarrow \mathscr{A}\) with \(F = \Delta (f)\text{.}\)

    Example \(\PageIndex{13}\): A function must be well-defined.

    Again write \(\mathscr{N} = \{1,2,3\}\) and \(\mathscr{A} = \{a,b,c,d\}\text{,}\) and consider

    \begin{equation*} F = \{ (1,a), (3,a), (3,d) \} \subseteq \mathscr{N} \times \mathscr{A} \text{.} \end{equation*}
    Does this subset define a function with domain \(\mathscr{N}\) and codomain \(\mathscr{A}\text{?}\) That is, does there exist a function \(f: \mathscr{N} \rightarrow \mathscr{A}\) such that \(F = \Delta (f)\text{?}\) The answer is no, because there are more than one input-output pairs with domain element \(3\text{.}\) In other words, a function \(f\) with graph \(\Delta (f) = F\) is not well-defined, because we have no way to tell whether \(f(3)\) should be \(a\) or \(d\text{.}\)

    Example \(\PageIndex{14}\): An input-output rule does not necessarily define a function.

    Recall that

    \begin{equation*} \mathbb{Q} = \{\dfrac{m}{n}\vert m,n\in \mathbb{Z},\, n\ne 0\}\text{.} \end{equation*}
    Suppose we attempt to define \(f: \mathbb{Q} \rightarrow \mathbb{Z}\) by \(f(\dfrac{m}{n}) = m+n\text{.}\) This seems like a valid way to define a function, until we realize that, for example,

    \begin{align*} f\left(\dfrac{1}{2}\right) & = 1 + 2 = 3, & f\left(\dfrac{2}{4}\right) & = 2 + 4 = 6. \end{align*}
    This is nonsense, because \(\dfrac{1}{2}\) and \(\dfrac{2}{4}\) represent the same element of \(\mathbb{Q}\text{.}\) Thus, rule \(f\) is not well-defined as a function, since to each element of the domain \(\mathbb{Q}\) it associates more than one element of the codomain \(\mathbb{Z}\text{.}\)

    10.1.5: Equality of functions

    Definition: Equality of Functions

    for \(f: A \rightarrow B\) and \(g: A\rightarrow B \text{,}\) write \(f = g\) if \(f(a) = g(a)\) for all \(a\in A\)

    Example \(\PageIndex{15}\): Seemingly different input-output rules can define the same function.

    The functions \(f: \mathbb{R}\rightarrow \mathbb{R}\text{,}\) \(f(x) = \vert x \vert\text{,}\) and \(g: \mathbb{R}\rightarrow \mathbb{R}\text{,}\) \(g(x) = \sqrt{x^2}\text{,}\) are equal.

    10.1.6: Image of a function

    Definition: Image of a Function

    the set of all possible outputs of the function

    Definition: \(f(A)\)

    the image of function \(f: A \rightarrow B\text{,}\) so that

    \begin{equation*} f(A) = \{f(a) \vert a \in A\} \subseteq B \end{equation*}

    clipboard_e30b843596d9736c02e1441222ce51c13.png
    Figure \(\PageIndex{4}\): A Venn diagram of the image of a function.
    Warning \(\PageIndex{1}\): Codomain elements are not necessarily image elements.

    We have stated before that a codomain in a function definition may be “larger” than necessary because we do not always know precisely what output elements a given input-output rule will produce. Our idea of codomain is that it should at least tell us what “type” of outputs will be produced, but not necessarily exactly what outputs will be produced.

    With our new concept of function image, we can now repeat this more technically: a function image is always a subset of the codomain, but it might be a proper subset.

    How do we know if a codomain element is an image element?

    For function \(f: A \rightarrow B\) and codomain element \(b\in B\text{,}\) we have \(b \in f(A)\) if and only if there exists \(a\in A\) such that \(b = f(a)\text{.}\)

    Example \(\PageIndex{16}\): Verifying a function image description.

    Consider \(f: \mathbb{R} \rightarrow \mathbb{R}\text{,}\) \(f(x) = x^2\text{.}\) Prove \(f(\mathbb{R}) = \mathbb{R}_{\geq 0}\text{,}\) where \(\mathbb{R}_{\geq 0}\) is the set of nonnegative real numbers.

    Solution

    Following the Test for Set Equality, we need to show both

    \begin{align*} f(\mathbb{R}) & \subseteq \mathbb{R}_{\geq 0}, & f(\mathbb{R}) & \supseteq \mathbb{R}_{\geq 0} \text{.} \end{align*}
    To be more explicit about the second set \(\mathbb{R}_{\geq 0}\text{,}\) we can write

    \begin{equation*} \mathbb{R}_{\geq 0} = \{x\in \mathbb{R} \vert x \ge 0 \} \text{.} \end{equation*}

    Show \(f(\mathbb{R}) \subseteq \mathbb{R}_{\geq 0}\).

    Let \(y\) represent an arbitrary element of \(f(\mathbb{R})\text{.}\) As an element of the image of \(f\text{,}\) \(y\) is an output corresponding to some input. That is, there exists some \(x \in \mathbb{R}\) such that

    \begin{equation*} y = f(x) = x^2 \text{.} \end{equation*}

    Therefore, since square numbers are always positive, we have \(y \ge 0\text{,}\) and hence \(y \in \mathbb{R}_{\geq 0}\text{.}\)

    Show \(f(\mathbb{R}) \supseteq \mathbb{R}_{\geq 0}\).

    Let \(y\) represent an arbitrary element of \(\mathbb{R}_{\geq 0}\text{.}\) To show \(y \in f(\mathbb{R})\text{,}\) we need to find \(x \in \mathbb{R}\) such that \(f(x) = y\text{.}\) Let \(x = \sqrt{y}\text{,}\) which is defined since \(y \in \mathbb{R}_{\geq 0}\) implies \(y\ge 0\text{.}\) Then

    \begin{equation*} f(x) = x^2 = (\sqrt{y})^2 = y \text{,} \end{equation*}

    as desired.

    Definition: Image of a Function on a Subset

    the set of all outputs of a function when only fed inputs from a given subset

    Definition: \(f(A')\)

    the image of the subset \(A' \subseteq A\) under a function \(f: A \rightarrow B\text{,}\) so that

    \begin{equation*} f(A') = \{f(a) \vert a \in A' \} \subseteq B \end{equation*}

    Example \(\PageIndex{17}\)

    We saw in Worked Example \(\PageIndex{16}\) that for \(f: \mathbb{R}\rightarrow \mathbb{R} \text{,}\) \(f(x) = x^2\text{,}\) we have \(f(\mathbb{R}) = \mathbb{R}_{\geq 0}\text{.}\) Now, the set of integers \(\mathbb{Z}\) is a subset of the domain \(\mathbb{R}\text{,}\) so we can compute

    \begin{equation*} f(\mathbb{Z}) = \{0,1,4,9,16,\ldots ,n^2,\ldots \} \subseteq \mathbb{R}_{\geq 0} \text{.} \end{equation*}


    This page titled 10.1: Basics is shared under a GNU Free Documentation License 1.3 license and was authored, remixed, and/or curated by Jeremy Sylvestre via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.