# 3.4.1: Formalizing the notion of functions

- Page ID
- 10893

In mathematics, of course, we need to work with functional relationships in the abstract. To do this, we introduce the idea of function. You should think of a function as a mathematical object that expresses a functional relationship between two sets. The notation *f** *: *A *→ *B *expresses the fact that *f *is a function from the set *A *to the set *B*. That is, *f*is a name for a mathematical object that expresses a functional relationship from the set *A** *to the set *B*. The notation *f *: *A *→ *B *is read as “ *f *is a function from *A *to *B*” or more simply as “ *f *maps *A *to *B*”.

Mathematical functions are different to functions in a programming language in Java. We’ll come back to this in the next section.

If *f *: *A *→ *B *and if *a *∈ *A*, the fact that *f *is a functional relationship from *A *to *B *means that *f *associates some element of *B *to *a*. That element is denoted *f *(*a*). That is, for each *a *∈ *A*, *f *(*a*) ∈ *B *and *f *(*a*) is the single, definite answer to the question “What element of *B *is associated to *a *by the function *f *?” The fact that *f *is a function from *A *to *B** *means that this question has a single, well-defined answer. Given *a *∈ *A*, *f *(*a*) is called the value of the function *f *at *a*.

For example, if *I *is the set of items for sale in a given store and *M *is the set of possible prices, then there is function *c *: *I *→ *M *which is defined by the fact that for each *x *∈ *I*, *c*(*x*) is the price of the item *x*. Similarly, if *P *is the set of people, then there is a function *m*: *P *→ *P *such that for each person *p*, *m*(*p*)is the mother of *p*. And if \(\mathbb{N}\) is the set of natural numbers, then the formula

*\(s(n)=n^{2}\)* specifies a function *s*: \(\mathbb{N} \rightarrow \mathbb{N}\).

It is in the form of formulas such as \(s(n)=n^{2}\) or \(f(x)=x^{3}-3 x+7\) that most people first encounter functions. But you should note that a formula by itself is not a function, although it might well specify a function between two given sets of numbers. Functions are much more general than formulas, and they apply to all kinds of sets, not just to sets of numbers.