Chapter VII Functions
Total Page:16
File Type:pdf, Size:1020Kb
Chapter VII Functions Greatness is not a function of circumstance. Greatness, it turns out, is largely a matter of conscious choice, and discipline. James C. Collins Functions play an important role in mathematical applications to physics, engi- neering, biology, economics, etc. If you have taken algebra and calculus, then you evaluated functions, graphed functions, and determined derivatives and integrals of functions. However, the precise definition of what a function is may have been some- what vague. In this chapter we will make precise exactly what modern mathematicians mean by a function. The definition will allow us to study functions on sets much more general than real numbers. We will see examples of functions defined on the real numbers, the integers, the natural numbers, congruence classes, power sets, and other sets. We will also discuss various properties of functions. The properties that we study have been chosen for their usefulness; they show up throughout higher mathematics. As you progress in mathematics, you will find that an important tool in studying any class of mathematical objects is the study of functions between the objects. The definitions and techniques that we learn in this chapter will prepare you for this study. 175 176 CHAPTER VII. FUNCTIONS 24 Defining functions The main purpose of this section is to formally define what we mean by a function. We will also give examples. 24.A What is a function? Recall that we have defined a relation from a set A to a set B to be a subset of A B. We now define a function from A to B as a relation that satisfies certain conditions.× Definition 24.1. Let A and B be sets. A function from A to B is a relation f from A to B (i.e., a subset of A B), such that each a A is a first coordinate of exactly one element of f. In other× words ∈ a A, ! b B, (a, b ) f. ∀ ∈ ∃ ∈ ∈ We call A the domain of f, and we call B the codomain of f. To specify that f is a function from A to B, we may write “Let f : A B be a function.” → Example 24.2. Let A = 1, 2, 3, 4 and B = 1, 2, 3, 4, 5 . Define a relation f by { } { } f = (1 , 2) , (2 , 2) , (3 , 4) , (4 , 1) . { } We see that f is a function, because each of the four elements of A is a first coordinate of exactly one ordered pair in f. It is sometimes useful to visualize a function via a diagram. For instance, the function f described above could be visualized in the following diagram. 1 1 2 2 3 3 4 4 5 A B Here, we draw an arrow from a A to b B if ( a, b ) f. So there is an arrow from 1 A to 2 B, since (1 , 2) f.∈ ∈ ∈ ∈ ∈ ∈ Note that since f is a function, we have exactly one arrow emanating from each element of the domain. There is no such restriction on the codomain; some elements of the codomain may have multiple arrows pointing at them and others may have no arrows pointing at them. △ 24. DEFINING FUNCTIONS 177 Example 24.3. Let A = a, b, c, d, e and B = 1, 2, 3 . Define a relation f by { } { } f = (a, 1) , (b, 1) , (c, 3) , (d, 3) , (a, 2) . { } This relation f fails to be a function for two reasons: First, the element a A is the first coordinate of two different ordered pairs, namely ( a, 1) and ( a, 2). Second,∈ the element e A is not the first coordinate of any ordered pair in f. We can∈ see these failures if we draw a diagram of the relation f. a b 1 c 2 d 3 e B A The element a has two arrows emanating from it; the element e has none. △ Since a function f from A to B is a relation from A to B, for a A and b B such that ( a, b ) f we could write a f b . However, for functions we∈ typically use∈ a different notation.∈ Definition 24.4. Let f : A B be a function. We write → f(a) = b to mean that ( a, b ) f. In other words, f(a) is the second coordinate of the unique ordered pair∈ having a as its first coordinate. When f(a) = b, we say that b is the image of a under the function f. Example 24.5. Let A = 1, 2, 3, 4 and B = 5, 6, 7, 8 . Let f : A B be the function { } { } → f = (1 , 5) , (2 , 6) , (3 , 7) , (4 , 8) . { } Then we may write f(1) = 5, f(2) = 6, f(3) = 7, and f(4) = 8. We say that the image of 4 under f is 8. If it is understood that f is the only function under consideration, we could just say that the image of 4 is 8 (since there is no possibility of confusion about which function we mean). △ In many cases that we encounter, we will be able to define a function f : A B by some kind of mathematical formula. If we wish to do this, we would want to→ give a rule that would tell us the value of f(a) for any given element a A. ∈ Example 24.6. Let f : A B be the function defined in Example 24.5 . Rather than defining f by listing all→ of its ordered pairs, we might define f as follows: For each a A, we have f(a) = a + 4. ∈ 178 CHAPTER VII. FUNCTIONS This tells us that f(1) = 1+4 = 5, so (1 , 5) f. Also f(2) = 2+4 = 6, so (2 , 6) f, and f(3) = 3+4 = 7, so (3 , 7) f. Finally, ∈f(4) = 4+4 = 8, so (4 , 8) f. ∈ Another way to describe this∈ function by a formula would be to say∈ that f = (a, a +4) : a A . { ∈ } △ Example 24.7. Define a function f : R R by f(x) = x2 for each x R. We may find the images of various real numbers→ under this function; f(2) = 4,∈ f(√3) = 3, and so on. Note that for any real number x, the output x2 is also a real number, so the function does in fact go from R to R. Note that as a set f = (x, x 2) : x R , { ∈ } and we graph this set below; the graph is called the graph of the function . y 3 2 1 x 2 1 1 2 − − △ Warning 24.8. When defining a function f : A B by a formula, as above, it is very important to verify that for each element→ of A, the output of the formula is actually an element of B. If even one of the values is not an element of B, then f is not a function from A to B. Example 24.9. Suppose we try to define a function f : R Z by the formula f(x) = x2 for all x R. We have exactly the same rule as in the→ previous example, but now, for many real∈ numbers x, the image of x under f is not in Z. For instance, f(0 .5) = 0 .25 / Z. Hence, f is not a function from R to Z. ∈ △ Sometimes we will wish to determine if two functions are equal. For this, we will use the following definition. Definition 24.10. Two functions f and g are equal if they have the same domain, the same codomain, and they are equal as sets of ordered pairs. Example 24.11. If we define f : Z Z by f(x) = 2 x, and we define g : Z R by g(x) = 2 x, then f and g consist→ of the same set of ordered pairs (namely,→ the set (x, 2x) : x Z ), but they have different codomains, so they are not the same function.{ ∈ } △ 24. DEFINING FUNCTIONS 179 Example 24.12. If we define f : Z Z by f(x) = 2 x + 2, and we define g : Z Z by g(x) = 2( x + 1), then is it the case→ that these functions are equal? Yes. Fir→st, they have the same domain, Z. Second, they have the same codomain, Z. Third, they have the same ordered pairs, since f(x) = 2 x +2 = 2( x + 1) = g(x) for each x Z. ∈ △ 24.B Piecewise defined functions The rule or formula defining a function need not be a simple one-line mathematical formula. Sometimes we will wish to define a function f : A B by one formula on one part of A and by another formula on another part of A. For→ instance, the absolute value function is defined on R as x if x 0, x = ≥ | | x if x < 0. (− This is a piecewise defined function . We will make this precise in the following theorem, and give other examples af- terward. Theorem 24.13. Let A and B be sets, and suppose that P, Q is a partition of A with two parts. If we are given a function g : P { B and} a function h: Q B, then f = g h defines a function f : A B. → → ∪ → Remark 24.14. The rule for f is g(a) if a P , f(a) = ∈ h(a) if a Q. ( ∈ See Exercise 24.7 for a more general version of this theorem. N Proof. We may consider g as a subset of P B, which is a subset of A B, and h as a subset of Q B, which is a subset of A ×B.