# 4.4.B Operations on functions

Suppose that → and g→ are functions. Given ∈ A, there is an associated element (a) ∈ B. Since is a function from to C, and since (a) ∈ Bassociates some element of to (a). That element is g(a)). Starting with an element of A, we have produced an associated element g(a)) of C. This means that we have defined a new function from the set to the set C. This function is called the composition of with , and it is denoted by ◦ . That is, if → and → are functions, then g ◦ f→ is the function which is defined by

$$(g \circ f)(a)=g(f(a))$$

for each ∈ A. For example, suppose that is the function that associates to each item in a store the price of the item, and suppose that is a function that associates the amount of tax on a price to each possible price. The composition, ◦ p, is the function that associates to each item the amount of tax on that item. Or suppose that : N → N and r: N → N are the functions defined by the formulas s(n) = n2 and r(n) = 3+ 1, for each n ∈ N. Then ◦ is a function from N to N, and for n ∈ N,(rs)(n) = $$r(s(n))=r\left(n^{2}\right)=3 n^{2}+1 .$$ In this case, we also have the function $$s \circ r,$$ which satisfies $$(s \circ r)(n)=s(r(n))=s(3 n+1)=(3 n+1)^{2}=9 n^{2}+6 n+1 .$$ Note in particular that $$r \circ s$$  and ◦ are not the same function. The operation ◦ is not commutative. If is a set and → A, then ◦ , the composition of with itself, is defined. For example, using the function from the preceding example, ◦ is the function from $$\mathbb{N}$$ to $$\mathbb{N}$$ given by the formula $$(s \circ s)(n)=s(s(n))=s\left(n^{2}\right)^{2}=n^{4} .$$ If $$m$$ is the function from the set of people to itself which associates to each person that person’s mother, then ◦ is the function that associates to each person that person’s maternal grandmother.

If and are entities, then (ab) denotes the ordered pair containing and b. The ordered pair (ab) differs from the set {ab} because a set is not ordered. That is, {ab} and $$\{b, a\}$$ denote the same set, but if $$a \neq b,$$ then $$(a, b)$$ and $$(b, a)$$ are different ordered pairs. More generally, two ordered pairs (ab) and (cd) are equal if and only if both and d. If (ab) is an ordered pair, then and are referred to as the coordinates of the ordered pair. In particular, is the first coordinate and is the second coordinate.

In high school you would also have to write (x,y)-coordinates using this ordered pair notation. For instance you would say that the line ax b intersects the y-axis at $$(0, b)$$ and the $$x$$ -axis at $$\left(-\frac{b}{a}, 0\right)$$

If and are sets, then we can form the set × which is defined by

× = {(ab) | ∈ and ∈ B}.

This set is called the cross product or Cartesian product of the sets and B. The set A × contains every ordered pair whose first coordinate is an element of and whose second coordinate is an element of B. For example, if = {cd} and = {1, 2, 3}, then X × = {(c, 1), (c, 2), (c, 3), (d, 1), (d, 2), (d, 3)}. It is possible to extend this idea to the cross product of more than two sets. The cross product of the three sets AB, and is denoted × × C. It consists of all ordered triples (abc) where ∈ A∈ B, and c ∈ C. The definition for four or more sets is similar. The general term for a member of a cross product is tuple (recall page 42) or, more specifically, ordered n-tuple. For example,(abcde) is an ordered 5-tuple.

Given a function f→ B, consider the set{(a,b) ∈ A×B|∈ and b f(a)}. This set of ordered pairs consists of all pairs (ab) such that ∈ and is the element of B that is associated to by the function . The set {(ab) ∈ × ∈ and (a)}is called the graph of the function . Since is a function, each element ∈ occurs once and only once as a first coordinate among the ordered pairs in the graph of . Given a ∈ A, we can determine (a) by finding that ordered pair and looking at the second coordinate. In fact, it is convenient to consider the function and its graph to be the same thing, and to use this as our official mathematical definition. (a) Graph for the formula $$f(n)=n^{2}$$ for $$-10 \leq$$ $$n \leq 10$$ (b) Graph for the function → with A = {a,b,c} and = {1,2,3}, such that g = {(a, 2), (b, 3), (c, 1)}.

Figure 4.7: Two different graphs representing functions.

You are already familiar with the process of graphing numerical functions from high school (for instance you can graph the formula $$f(n)=n^{2}$$ as depicted in Figure 4.7a), but we can also graph non-numerical functions as indicated in Figure 4.7b. To do so, we draw all elements from the set and connect them to the elements of they map to.

Definition4.2.

Let and be sets. A function from to is a subset of A×which has the property that for each ∈ A, the set contains one and only one ordered pair whose first coordinate is a. If (ab) is that ordered pair, then is called the value of the function at and is denoted (a). If (a), then we also say that the function maps a to b. The fact that is a function from to is indicated by the notation → B.

For example, if = {a,b} and = {1,2,3}, then the set {(a,2),(b,1)} is a function from to Y, and {(1, a), (2, a), (3, b)} is a function from to X. On the other hand, {(1, a), (2, b)} is not a function from to X, since it does not specify any value for 3. And {(a, 1), (a, 2), (b, 3)} is not a function from to Y because it specifies two different values, 1 and 2, associated with the same element, a, of X.

Even though the technical definition of a function is a set of ordered pairs, it’s usually better to think of a function from to as something that associates some element of to every element of A. The set of ordered pairs is one way of expressing this association. If the association is expressed in some other way, it’s easy to write down the set of ordered pairs. For example, the function $$s : \mathbb{N} \rightarrow \mathbb{N}$$ which is specified by the formula $$s(n)=n^{2}$$ can be written as the set of ordered pairs $$\left\{\left(n, n^{2}\right) | n \in \mathbb{N}\right\}$$