# A big list of non-trivial examples of functions from outside mathematics

I will be teaching my students about functions, and want to stress that functions are not only the usual mathematical ones (linear, logs, exponential, ...), but that function is fundamentally a logical concept, and so that functions abounds not only in mathematics and nearby fields such as computer science, but can be found everywhere. I have some specific examples in mind, but will give them as answers, after waiting some hours to see what else people can come up with. I want a really big list, functions are everywhere, really!

Also, I want more than functions. We use functions to represent/model some very specific kind of relation between things of varied kinds, so I also want examples of relations from outside mathematics, with explications of why they cannot (or can) be modelled as functions.

I will start out with the process of solving equations. Let us start with what we everybody learns in elementary school, to solve linear equations like $$5x-3=6$$ We are told (I jump over the explications here...) that we can move the 3 over to the other side of the equals sign, but we must then remember to change its sign: $$5x = 6+3$$ and then we can "move the factor 5 over", but we must then remember to divide, not multiply.

Later, maybe much later, we understand that the process is really to "do the same thing/operations on both sides of the equals sign", and then the equality will be preserved. Now, being much more advanced, we think that the "operation" we are applying on each side is the application of a function, and might be satisfied with that.

But this is too simple! it is easy to do the same on both sides, and then finding that it was not really a function at all!

So let us be systematic. Write our equation symbolically as $$\tag{1} x = a$$ Denote "what we do on both sides as $R$ (think Relation or Rule): $$\tag{2} R(x) = R(a)$$ We want to be sure that the solution set of (1) is the same as the solution set of (2). To be sure that a solution of (1) also is a solution of (2), $R$ must preserve equality, that is, $R$ must be a function. Thats the basic requirement in the definition of a function. We call that "the principle of preservation of equality". The other way, to be sure a solution of (2) also is a solution of (1), $R$ must be injective (but it does not need to be a function, the definition of injective makes perfect sense for relations too). This is "the principle of preservation of inequality". An example of a non-function relation that is injective is the relation consisting of all the pairs $(x, \sqrt{x}), (x, -\sqrt{x})$ where $x$ ranges over non-negative numbers. An example where one can stumble upon "doing an operation" which turns out not to be a function is when trying to solve a congruence equation (incorrectly): $$2\cdot 7 x \equiv 2\cdot 9 \pmod{12}$$ and just cancelling the factor 2 on both sides. That is incorrect, because 2 is a nulldivisor $\pmod{12}$. So that process do not define a function, but it does define a relation.

So, I am also interested in relations from everywhere, since in discussing equation solving one cannot really avoid them. And, a last question: where can I find (published) a discussion of equation solving, in general terms, along the lines above?

• Please, can someone mark this as community wiki? – kjetil b halvorsen Sep 11 '14 at 8:38
• Could you please explain the downvote? I sincerely do not understand! – kjetil b halvorsen Sep 29 '14 at 14:14

Here are some things that I use as function examples for a general set of functions:

(1) Letter counting function, $L$. Domain: Set of words. Letter counting function outputs number of letters: E.g., $L($dog$)=3$.

(2) Initials function, $I$. Domain: Set of students in class. Initials function outputs first and last name initials: E.g., $I($Mary Jones$)=$MJ.

(3) Full sibling (two bio parents in common) relation, $S$: For people $a, b$ we have $a S b$ if and only if $a$ and $b$ have both bio parents in common. (Variants are possible: at least one bio parent in common; exactly one bio parent in common; etc.)

I'm sure others can add many other ideas to this list.

I think a nice example of this comes from AI, e.g. from image recognition.

Consider the task of categorizing an image to one of $k$ classes. We can think of this as constructing a function that maps from the set of images ${\mathcal{I}}$ to the set of labels $\widetilde{\mathcal{L}} = \{1,\ldots,k\}\subset\mathbb{Z}$, i.e. $$\widetilde{f~}:\mathcal{I}\rightarrow \widetilde{\mathcal{L}}$$ This is made easier by noticing that an image is a matrix of pixels (with $n$ rows and $m$ columns), each pixel being a vector of length 3 for a color image. So $\mathcal{I}\equiv \mathbb{R}^{n\times m\times 3}$. Also, we can predict probabilities of each class instead of discrete labels, so we can instead use $\mathcal{L}\equiv\mathbb{R}^{k}$, so that $$f:\mathcal{I}\rightarrow\mathcal{L} \;\;\;\;\&\;\;\;\; f: \mathbb{R}^{n\times m\times 3}\rightarrow \mathbb{R}^{k}$$ essentially computes the same thing.

The job of the AI agent is then to find the function $f$, so that when it is given an input image $I\in\mathcal{I}$, it can tell you from which category it came, i.e. using $\widehat{L}=f(I)\in\mathcal{L}$, e.g. via $k^* = \arg\max_k \widehat{L}_k$.

Here is one example I thought of (this is from a computer science book: Richard Bird & Oege de Moor: "The Algebra of Programming") The example is from grammar:

Adjectives are functions from nounphrases into nounphrases, for example, blue is a function:

 blue( a car ) = a blue car
blue( an old car ) = a blue old car
blue( a green car ) = a blue green car


and so on. You can find other examples of functions from grammar!

This is the kind of example I want most in the list, examples where concepts from other diciplines really are functions.

Here is another example, now from the world of taxes.

Income tax for persons only with wage income is usually highly automated. In many (most?) countries the tax is taken from the paycheck and paid directly to the tax authorities before you even see your paycheck (that system was proposed by Milton Friedman, a move he has since regretted, see: http://www.investopedia.com/articles/tax/10/understanding-tax-withholding-system.asp)

So the usual wage earner can do pretty little to influence his taxes, they are determined by his income (and maybe a few other variables). In short, personal income tax is a function of income.

Not so for company taxes. Company taxes are regulated by immensely complicated laws, and many companies have a (big) degree of freedom in how they do their bookkeeping. They can influence their taxes by this bookkeeping choices (and I am not talking about fraude here, there is a big room for manoeuvring inside the law). This explains in part why bookkeepers can take out big wages! This art is called creative bookkeeping.

In short, company taxes in not a function of the companys income and expenses. The companys freedom of choice make the tax only a relation, and, this fact explains the existence of creative bookkeeping.