The concept of function

The first functions that the children explicitly meet are, at the beginning of elementary school, the four operations (with two inputs), the unit increases and decreases and the change of sign (with one input).  But in elementary school they also encounter functions with any quantity of input, such as the maximum and minimum of a set of data,  and functions to which a calculation procedure does not correspond  (for example the height or weight of a person, or the population of a city, as the time passes, or tariffs of various kinds, in which the monetary value is expressed as a function of various quantities).  Pupils also encounter multi-output functions (division with remainder, for example, is a two-input and two-output function). Many of these functions can be performed using the function keys of a pocket calculator.

The cross histograms are also functions, which can be addressed even before primary school, in kindergarten:  each method of getting to school is associated with the number (represented by a column of crosses) of the pupils who use it,  each type of holiday resort is associated with the number of pupils who spent it that way,  each weather condition is associated with the number of days of the month in which the weather was such, ...

And, if one uses a computer and software, a function is a procedure that associates one or more inputs with one or more outputs, of various types, also graphical:  a sequence of data can be associated with their sum or with the ordered sequence of the themselves,  a sentence can be associated with its length,  an interval and a real function of a real variable can be associated with the corresponding graph,  a formula with its truth value,  an image with the "inverted" color image, …

It is evident that these concepts have little to do with the definitions with which they are introduced in many textbooks (and in many websites):  a function is a set of ordered pairs such that ...; the authors of these books smatter definitions like this that are done in university algebra courses, without realizing that to master them you need to have techniques, not simple, to represent an input sequence and an output sequence with a suitable pair of mathematical objects  (for example the "sum" function, with 2 inputs and 1 output, would be a set of ordered pairs whose first element is in turn an ordered pair).  In many books (and sites) it is also found that in order to define a function it is first necessary to precisely describe its domain or, alternatively, that it is possible to determine the domain of each real function of a real variable.  But it is not possible to find the domain of whatever function:

• let F be the function which associates with x 1 if x is rational and 0 otherwise;  the domain of the function which associates with x  1 / (F(π+e) x)  cannot be determined since it is not known whether π + e  is irrational or not;

• or, more simply, if t(x) is a term containing the variable x such that we cannot solve the equation t(x)=0, why couldn't we consider the function x → 1/f(x)?

• on the other hand, it cannot be established a priori (with a suitable program),  in any way we take a program P and an input string v,  if P with input v converges or P with input v diverges  (this was demonstrated by Turing in the 1936: see here).

Recall that the name "operation" is an "appellative" which is often used to indicate certain functions  (for example, the functions which associate with a couple of numbers the sum, the product, the quotient, the ratio, the difference, the exponentiation;  the functions which associate with a pair of sets their union or their intersection;  the functions which associate with a number its opposite or its square root;  the functions which associate with a finite set of numbers their maximum or their minimum;  the functions which associate with a pair of vector the sum or the scalar product; ...),  without a precise definition.

In some university mathematical analysis handbook it is written that a function is a rule that uniquely associates with a set of real numbers other real numbers.  This definition is wrong:  considering "rules" it can capture only a (small) "part" of the functions, and, moreover, it would take away the sense of any application of the concept of function to model real situations.  For an example, think of the functions represented graphically below, which associate to the various months of the year the millimeters of rain that fell on average during them, between 1971 and 2000, in the cities of Palermo, Genoa, Milan and Bolzano.  What are the "rules" that determine them?

It should be remembered, incidentally, that, generally, before it is necessary to start building the meaning of a new mathematical concept and, only after, pose the problem of limiting it with a definition, in order to make it usable in any mathematical proposition referred to any context.  And it is appropriate to remember that of some concepts (such as that of "set") one cannot tackle a definition except in advanced university studies,  and that of others (such as the concept of "probability") one can do nothing but give, from the earliest forms of education, a description that focuses its properties (description that, towards the end of the school path, can be called "axiomatic").