Up Main

Functions in general

You might have learned from a previous course that a function that accepts a real number as input and returns another real number is called a real-valued single-variable function. For example, the function \(f\) given by \(f(x) = x^2+1\) is such a function: it accepts a real value \(x\) as input and returns the value \(x^2 + 1\) as output.

We will look at functions in more general terms. In particular, we do not restrict the inputs and outputs to real numbers. Before we do so, we first learn the notation for specifying sets of \(n\)-tuples.

Sets of \(n\)-tuples

There is a convenient notation for specifying sets of \(n\)-tuples whose entries are from the same set.

Let \(A\) be a set. Let \(n\) be a positive integer. Then, the set of \(n\)-tuples whose entries are elements of \(A\) is denoted by \(A^n\).

For example, \(\mathbb{Z}^3\) is the set of all \(3\)-tuples whose entries are integers. In other words, \(\mathbb{Z}^3 = \left \{ \begin{bmatrix} a\\ b\\ c\end{bmatrix} : a, b, c \in \mathbb{Z}\right\}\). The set of \(n\)-tuples whose entries are real numbers is denoted by \(\mathbb{R}^n\).

Definitions

Let \(X\) and \(Y\) be sets. We say that \(f\) is a function (or mapping) with domain \(X\) and codomain \(Y\), denoted by \(f: X \rightarrow Y\), if for each element \(u \in X\), \(f(u)\) is an element in \(Y\).

Loosely speaking, the domain \(X\) is the set of all possible inputs to \(f\) and \(Y\) is the set to which every possible output of \(f\) belongs. Note that \(Y\) is not required to contain just the possible outputs. The set of all possible outputs is called the range of \(f\). If the range of \(f\) is equal to \(Y\), we say that \(f\) is a surjective (onto) function.

Examples

  1. The function \(f:\mathbb{R}\rightarrow \mathbb{R}\) given by \(f(x) = x^2 + 1\) is a function whose range is the set of all real numbers at least 1 and therefore is not an onto function. To see this, note that \(x^2\), being the square of the real number \(x\), is never negative. So \(x^2 + 1 \geq 1\). Now, for any real number \(y\) at least \(1\), \(\sqrt{y-1}\) is a real number. Setting \(x = \sqrt{y-1}\) gives \(f(x) = y\). Thus, the range of \(f\) is the set of all real numbers at least \(1\).

  2. The function \(f:\mathbb{Z}\rightarrow \mathbb{Q}\) given by \(f(x) = \frac{x}{2}\) is not an onto function. Note that the codomain is \(\mathbb{Q}\), the set of rational numbers. As the domain is \(\mathbb{Z}\), the set of integers, the output is always half of an integer. Thus, a number such as \(\frac{1}{3}\) cannot be in the range of \(f\). Hence, the range of \(f\) does not contain all rational numbers and so \(f\) is not onto.

  3. Consider the function \(f:\mathbb{R}^2 \rightarrow \mathbb{R}\) given by \[f\left(\begin{bmatrix} a \\ b\end{bmatrix}\right) = 2a -b.\] Before we determine the range of \(f\), let us look at the the outputs of \(f\) for a couple of inputs.

    For example, what is \(f\left(\begin{bmatrix} -1 \\ 2\end{bmatrix}\right)\)? According to how \(f\) is defined, to obtain the output from the input, we need to take twice the first entry minus the second entry. Thus, \(f\left(\begin{bmatrix} -1 \\ 2\end{bmatrix}\right) = 2(-1) - 2 = -2 -2 = -4\).

    What about \(f\left(\begin{bmatrix} 3 \\ 7\end{bmatrix}\right)\)? We apply the same logic as above: \[f\left(\begin{bmatrix} 3 \\ 7\end{bmatrix}\right) = 2(3) - 7 = 6 -7 = -1.\]

    So what is the range of \(f\)? Is there any real number that cannot be the output?

    To answer this question, we need to determine for what values \(y\) do there exist real numbers \(a\) and \(b\) such that \(2a - b = y\). Note that no matter what \(y\) is, we can set \(a = \frac{y}{2}\) and \(b = 0\). Then, \[f~\left(\begin{bmatrix} \frac{y}{2} \\ 0\end{bmatrix}\right) = 2\left(\frac{y}{2}\right) - 0 = y.\] Hence, the range of \(f\) is all of \(Y\) and so \(f\) is an onto function.

    Remark. We could have also made the observation that \[f\left(\begin{bmatrix} 0 \\ -y \end{bmatrix}\right) = 2(0)-(-y) = y.\]

  4. Let \(X\) denote the set of polynomials in \(x\) with real coefficients having degree at most two. That is, \(X = \{ ax^2 + bx + c : a,b,c \in \mathbb{R}\}\). Consider the function \(f:X \rightarrow \mathbb{R}\) given by \[ f(ax^2+bx+c) = (a+2b)^2 -c\] for all \(a,b,c \in \mathbb{R}\). What is \(f(x - 2)\)?

    To determine \(f(x-2)\), we first write \(x-2\) in the form \(ax^2 + bx + c\). Note that \[x-2 = x + (-2) = 0 \cdot x^2 + 1\cdot x + (-2).\] Hence, \begin{eqnarray*} f(x-2) & = & f (0 \cdot x^2 + 1\cdot x + (-2)) \\ & = & (0 + 2(1))^2 - (-2) \\ & = & 2^2 + 2 \\ & = & 4 + 2 = 6. \end{eqnarray*}

Quick Quiz

Exercises

  1. What is the range of the function \(f:\mathbb{R} \rightarrow \mathbb{R}\) given by \(f(x) = 2^{-x}\)?  

  2. Consider the function \(f:\mathbb{Z} \rightarrow \mathbb{R}\) given by \(f(x) = \sin \left(\frac{\pi}{2}x\right)\).

    1. Determine all values \(x\) satisfying \(f(x) = 0\).  

    2. What is the range of \(f\)?  

  3. Consider the function \(f:\mathbb{R}^3\rightarrow \mathbb{R}\) given by \[f~\left(\begin{bmatrix} a \\ b \\c \end{bmatrix}\right) = a b - c^2.\]

    1. What is \(f~\left( \begin{bmatrix} 1 \\ -1 \\ 2 \end{bmatrix} \right)\)?  

    2. Is \(f\) surjective?