The set of integers. The set of real numbers.
Suppose that y is a differentiable function of t and t is a differentiable function of x. Then y is a composite function of x and dy/dx = dy/dt dt/dx.. That is the derivative of y with respect to x is the derivative of y with respect to t times the derivative of t with respect to x.

### Functions

Almost as basic to modern mathematics as the concept of a set is the idea of a function. If A and B are sets, a function f from A to B is any correspondence (or rule) which associates to each element x of A an element f(x) of B. If f is a function from A to B, we write f:AB. If x A, then f(x) is called the image of x under f. As was the case with sets, functions appeared in mathematics long before the general concept was formulated. Prior to the eighteenth century, a function was thought of as a "formula" which allowed computation of one numerical quantity in terms of others. Thus typical functions were f1(x) = x2, f2(x) = x2, f3(x) = 1/x, and f4(x) = sin(ex). With the development of calculus of functions of a complex variable or of several real variables, the concept of a function was somewhat enlarged. Mathematicians began to consider functions which associated every point (x,y) of the plane a point (f(x,y),g(x,y)) of the plane, where f(x,y) and g(x,y) were given by "formulas." As (x,y) traces out a curve C into the plane, the point (f(x,y),g(x,y)) traces out a curve C'. Thus, mathematicians began to think of functions as "transforming" C into C'. These functions were often called transformations or mappings. This terminology persisted and today the terms "transformation" and "mapping" are synonymous with "function."

If f:AB, and x A, then we often say that f maps x into f(x) and we often suggestively write xf(x) [read: x is mapped into f(x)].

Mathematicians also thought of a function f as "operating" on x in order to produce f(x). This terminology arose in the situation where A and B are sets of functions and f "operates" on a function x in A to yield a function f(x) in B. For example if A=B=the set of all functions which are differentiable arbitrarily often at every point of the real line, then the function f which maps the function x in A onto its derivative x' is a typical example of such an operator. Even today, functions are sometimes referred to as "operators." During the eighteenth and nineteenth centuries it was realized that not every function which mathematicians wished to study could be defined as a formula. For example, if P denotes the set of positive integers, let the function f:PP be defined by f(n) = the number of positive divisors of n. Then there is no simple formula expressing f(n) in terms of n. Thus, mathematicians were led to extend the notion of a function to include any rule or correspondence, not just those given by formulas.

Let us give a few examples of functions which occur rather frequently.

Example 1: Let A and B be any non-empty sets and let b0 B. The function f:AB defined by f(a) = b0 for all a A is called a constant function.

Example 2: Let A be any non-empty set. The function f:AA defined by f(a)=a for all a A is called the identity function and will be denoted iA.

If f:AB is a function, the set A is called the domain of f, and the set B is called the range of f. A function is defined by specifying its value for each element belonging to the domain. Two functions f,g from A to B are said to be equal if f(x) = g(x) for all x A.

Suppose that g:AB, f:BC are functions. If x A, then we may define a function from A into C by first mapping x into g(x) and then mapping g(x) into f(g(x)). This function is called the composite of f and g and will be denoted fg. According to our definition

(fg)(x) = f(g(x)) (x A).

The reader is probably well acquainted with the notion of the composite of two functions from the study of the chain rule in calculus.

Suppose that h:AB, g:BC, and f:CD are functions. Then we have the following associative law:

(1)
(fg)h = f(gh).

In order to prove (1), we must show that the functions on each side of (1) have the same value for all x A. But f(gh)(x) = f(gh(x)) = f(g(h(x))), and (fg)h(x) = (fg)(h(x)) = f(g(h(x))). Therefore (1) holds.

Let f:AB be a function. Then f is said to be injective (or one to one) if, whenever f(x) = f(y), we have x = y. Thus, for example, if f : RR is the function f(x) = 3x, then f is injective, since 3x = 3y implies that x = y. The function g(x) = x2 is not injective since g(4) = g(-4).

A function f : AB is said to be surjective (or onto) if for every y B there exists x A such that f(x) = y. Thus, for example, f(x) = 3x is surjective since for every y R, we have f(y/3) = y. However, f(x) = sin(x) is not surjective, since there does not exist an x R such that f(x) = 17 [since -1 < sin(x) < 1 for all x R].

A function f:AB which is both injective and surjective is said to be bijective. If f:AB is a bijection, then for any b B, there is exactly one aA such that f(a) = b. Therefore, we may define the function f -1:BA by f -1(b) = a. The function f -1 is called the inverse of f. We clearly have

ff -1 = iB, f -1f = iA.

A few words of caution about inverse functions. First, in order for us to be able to define an inverse function, f must be a bijection. Second, if f -1(x) is a real number, then it is not usually true that f -1(x) = 1/f(x). For example let f : RR be defined by f(x) = 3x. then f is a bijection and f -1(x) = x/3. Thus, f -1(2)1/f(2).

Let f:AB be a function and let CA. Let us define the image f(C) of C under f by

f(C) = {y B | y = f(x) for some x C}.

If DB, let us define the inverse image f -1(D) of D under f by

f -1(D) = {x A | f(x) D}.

Let A be a set. Then a function f:A × AA is called a binary operation on A. We may think of a binary operation as defining an operation of multiplication, denoted · , among the elements of A. Namely if a,b A then we define the "product" of a · b to be f((a,b)). Examples of binary operations come from elementary arithmetic. For example, addition and multiplication of real numbers are examples of binary operations on the set of real numbers. We will meet many more examples of binary operations later.

Let · be a binary operation on a set A. Then we say that · is associative if a · (b · c)=(a · b) · c for all a,b,c A. We say that · is commutative if a · b = b · a for all a,b A. Finally, we say that i A is an identity with respect to · if i · a = a · i = a for all a A.

Example 3: Let Z = {...,-3,-2,-1,0,1,2,3,...} be the set of integers, and let us consider the binary operation + of addition on Z. Then + is associative since (a + b) + c = a + (b + c) for all integers a,b,c. Moreover, + is commutative since a + b = b + c for all integers a and b. Also, 0 is an identity for + since a + 0 = 0 + a = a for all a Z.

Example 4: Again, let Z denote the set of integers, but now consider the binary operation · of multiplication on Z. Then · is associative since a · (b · c) = (a · b) · c for all integers a,b,c. Moreover, · is commutative since a · b=b · a for all integers a,b. Finally, 1 is an identity for · since 1 · a = a · 1 = a for all a Z.

Example 5: Again let Z denote the set of all integers. This time, however, let us consider the binary operation * on Z defined by a * b =ab2. Then * is not associative, since, for example, (1*2)*3 = 36, while 1*(2*3) = 324. Moreover, * is not commutative, since, for example 2*3 = 18, whereas 3*2 = 12.