The way it functions (Part 2)

  • Post category:Advanced

Last time, we had an introductory discussion of the concept of functions in a more or less informal setting. In particular, we described functions using arrow diagrams. While they are mostly self-explanatory, it’s sometimes physically impossible to construct one such diagram when, for instance, the domain has infinitely many inputs to be assigned.

We therefore need a more powerful and systematic approach to describe functions. Hence, we will do things more formally in this article by employing some notation as well as revising some terminologies and concepts. Also, it will be beneficial to familiarize yourself with set notation as we will need it later.

Function notation

Say we have a function whose domain and codomain are specified. Henceforth, let the function be denoted by the letter “f”, domain by the letter “A”, and codomain by the letter “B”. Then, we use the following expression to mean a function f mapping from A to B:

\displaystyle f:A\longrightarrow B

If x is an input of f, then we write f(x) to mean the output, also known as the value of the function (or function value). This relationship is usually represented by the following expression:

\displaystyle x\longmapsto f(x)

Let’s now revisit Examples 9.1 to 9.3 from Part 1 and rewrite each of them using the function notation stated above.

Revisiting Example 9.1

\displaystyle A=\left\{\text{Button A, Button B, Button C} \right\}\\\\B=\left\{\text{Coke, Pepsi, 7 Up} \right\}

\displaystyle f:A\longrightarrow B

\begin{aligned} &f(\text{Button A}) = \text{Coke}\\&f(\text{Button B}) = \text{Pepsi}\\&f(\text{Button C}) = \text{7 Up}\end{aligned}

Revisiting Example 9.2

\displaystyle A=\left\{\text{all library members} \right\}\\\\B=\left\{\text{all 4-digit ID numbers from 0001 to 9999} \right\}

\displaystyle f:A\longrightarrow B

\begin{aligned} &f(\text{Isaac}) &= 0001\\&f(\text{Garet}) &= 0002\\&f(\text{Ivan}) &= 0003\\&f(\text{Mia}) &= 0004\end{aligned}

Revisiting Example 9.3

\displaystyle A=\left\{\text{all integer points from 0 to 5} \right\}\\\\B=\left\{\text{Fail, Pass} \right\}

\displaystyle f:A\longrightarrow B

\begin{aligned} &f(0) = \text{Fail}\\&f(1) = \text{Fail}\\&f(2) = \text{Fail}\\&f(3) = \text{Pass}\\&f(4) = \text{Pass}\\&f(5) = \text{Pass}\end{aligned}

Specifying function values

While using symbols keeps us away from the hassle of drawing diagrams, so far we are still listing out explicitly the output values for all the inputs. Moreover, this approach is bound to fail when, again, there are infinitely many inputs and outputs to list. If we wish to handle functions with domains of infinite size, we ought to take a different route – the algorithmic approach.

Metaphorically speaking, instead of making a complete cake for someone, we are giving them just the recipe for the cake (not the best way to impress others for sure). This notion of specifying a set of instructions is hardly uncommon. Just think of how a calculator works; what it stores are not the exact answers to 34 + 279 and 943.21 + 23.5, but a program that computes the sum of any two numbers.

A typical example of defining function values algorithmically can be found in Worked Problem 1, where we have

\displaystyle f(x)=30+0.40x

as the recipe to generate the output f(x) for each input x.

Note that it’s not necessary to define the function values by just a single formula. To illustrate, consider Example 9.3 again. We can exploit the fact that the inputs are bona fide numbers to express f(x) in the following way:

\displaystyle A=\left\{\text{all integer points from 0 to 5} \right\}\\\\B=\left\{\text{Fail, Pass} \right\}

\displaystyle f:A\longrightarrow B

\displaystyle f(x)=\begin{cases} \text{Fail} & \text{if  }0\leq x \leq 2, \\ \text{Pass} & \text{if } 3\leq x \leq 5. \end{cases}

Functions whose function values are expressed by cases like this are called piecewise functions, and they play significant roles in the fields of applied math and sciences.

Equality of functions

A recurrent theme in mathematics whenever we devise a new type of objects is to answer the following two questions:

[Q1] How are two objects comparable?
[Q2] How do we define meaningful operations on these objects?

Take for example the rational numbers. We don’t just define what rational numbers are, do we? We also decree

[Q1] when two rational numbers are equal, as well as
[Q2] how to add, subtract, multiply, and divide any two rational numbers.

We’d now like to do the same for this type of objects that we call functions. In this case, the answer to [Q1] is easy, which we will see in a second. The answer to [Q2], however, is more demanding on the technical end, and we shall save it for a future article.

So, how do we decide when two functions are equal? Well, recall that a function has three ingredients: domain, codomain, and function values. It seems like the most natural way for two functions to be equal is when they share the same three ingredients, and this is exactly how it works!

More precisely, given two functions f and g such that

\displaystyle f:A\longrightarrow B\qquad\qquad g:A\longrightarrow B

we say that f = g if and only if

\displaystyle f(x)=g(x)

for every input x in A.

To grasp this idea more concretely, consider the three examples below.

Example 10.1

\displaystyle f:\left\{1,2,3\right\}\longrightarrow \mathbb{Z}

\displaystyle f(x) = x+10

Example 10.2

\displaystyle g:\left\{1,3\right\}\longrightarrow \mathbb{Z}

\displaystyle g(x) = \frac{(x+10)(x-2)}{x-2}

Example 10.3

\displaystyle h:\left\{1,2, 3\right\}\longrightarrow \mathbb{Z}

\displaystyle h(x) = \begin{cases} \dfrac{(x+10)(x-2)}{x-2} & \text{if  }x \neq 2, \\\\ 12 & \text{if } x = 2. \end{cases}

First, we see that all three examples share the same codomain \mathbb{Z}, i.e. the set of all integers. Next, if we look at the formula of g(x), it’s very tempting to cancel out the factor (x – 2) from both the numerator and denominator. This step simplifies the expression to x + 10, which looks the same as f(x)! So can we claim that f = g? The answer is no, simply because f and g act on different domains (in particular, 2 is not in the domain of g), and hence they are not equal as functions by definition.

On the other hand, functions f and h do share the same domain {1, 2, 3}. Moreover,

\begin{aligned} &f(1) = h(1) =11\\&f(2) = h(2) = 12\\&f(3) = h(3) = 13\end{aligned}

and therefore f = h by definition, even if the function values f(x) and h(x) are defined quite differently!

We are beginning to see that the topic of function is full of subtleties, and it’s only going to get more intriguing down the road. Next time, we will take a closer look at two very important classes of functions, i.e. the injective (one-to-one) and surjective (onto) functions (see Remark 9.1). Until then, stay acute, stay safe. See you!


Remark 10.1

Recall that not every element of the codomain needs to be an output of some input (see Remark 9.1). The collection of all outputs of a function f therefore deserves its own name; it is called the image (or range) of f, denoted by f(A) where A is the domain of f.

Examples 9.1 and 9.3 are instances where the image is the same as the codomain, i.e f(A) = B. This also means that they are both surjective functions.

The image of Example 9.2, however, is just {0001, 0002, 0003, 0004}, which is a strictly “smaller” set than the codomain. In set theoretical language, we say that f(A) is a proper subset of B, denoted by f(A)B.

So here comes a question: Why don’t we always choose our codomain B in the minimum possible way such that every element in B is hit by at least one input from the domain A? In that case, there’s no need to introduce extra terminologies or concepts like the image of function and surjectivity.

The above question can be tackled from various points of view. One quick answer is that the surjective property does play a crucial role in higher level mathematics (more on this next time). Here, we will just present another reason from a practical standpoint: it is sometimes very hard or tedious to find the actual image of a function.

Consider this simple-looking polynomial function

\displaystyle p:\mathbb{R}\longrightarrow \mathbb{R}

\displaystyle p(x) = 3x^4-16x^3-6x^2

where \displaystyle \mathbb{R} is the standard notation of the set of all real numbers. Do you wanna guess what its image is? It is the set of all real numbers greater than or equal to -179 - 80\sqrt{5} (or approx. –357.885), which is denoted by the interval notation

\displaystyle \left[-179 - 80\sqrt{5},+\infty\right)

Mind you, p is a contrived example I come up with whose image has a lower boundary that can be written in exact form. Don’t expect this to happen in general!

So, in order to prevent us from getting bogged down in unnecessary technicalities like this, we allow some flexibility in defining the codomain, expanding or shrinking it according to our needs, as long as it contains the entire image of the function.

I guess you could say that it is not reasonable to be economical at all times: sometimes you just have to pay the price for convenience! 

This Post Has One Comment

Comments are closed.