Chapter12. Relations, Functions, and Induction

Similar documents
Week 4-5: Binary Relations

Chapter 1. Sets and Numbers

MI 4 Mathematical Induction Name. Mathematical Induction

Relations, Functions, and Sequences

Week 4-5: Binary Relations

Reading 11 : Relations and Functions

MATH 215 Sets (S) Definition 1 A set is a collection of objects. The objects in a set X are called elements of X.

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

HL Topic. Sets, relations and groups. (Further Mathematics SL Topic 3) Sets Ordered pairs Functions Binary operations Groups Further groups

Review Problems for Midterm Exam II MTH 299 Spring n(n + 1) 2. = 1. So assume there is some k 1 for which

Chapter 8: Recursion. March 10, 2008

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Notes on ordinals and cardinals

1 Sequences and Summation

Final Exam Review. 2. Let A = {, { }}. What is the cardinality of A? Is

LESSON RELATIONS & FUNCTION THEORY

Binomial Coefficient Identities/Complements

ASSIGNMENT 1 SOLUTIONS

Relations. Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations. Reading (Epp s textbook)

Math 300: Final Exam Practice Solutions

Chapter 1. Sets and Mappings

Advanced Counting Techniques

Relations, Functions & Binary Operations

Part IA Numbers and Sets

Recurrence Relations

MATH 13 SAMPLE FINAL EXAM SOLUTIONS

Cartesian Products and Relations

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

1 Basic Combinatorics

Automata and Languages

Lecture Notes on Discrete Mathematics. October 15, 2018 DRAFT

1. Decide for each of the following expressions: Is it a function? If so, f is a function. (i) Domain: R. Codomain: R. Range: R. (iii) Yes surjective.

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS.

Advanced Counting Techniques. Chapter 8

Discussion Summary 10/16/2018

Sets and Functions. MATH 464/506, Real Analysis. J. Robert Buchanan. Summer Department of Mathematics. J. Robert Buchanan Sets and Functions

Section 0. Sets and Relations

Chapter 5: Sequences, Mathematic Induction, and Recursion

Chapter Summary. Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Computability

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland

2.1 Sets. Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R.

Chapter VI. Relations. Assumptions are the termites of relationships. Henry Winkler

RED. Fall 2016 Student Submitted Sample Questions

Chapter Summary. Sets (2.1) Set Operations (2.2) Functions (2.3) Sequences and Summations (2.4) Cardinality of Sets (2.5) Matrices (2.

Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr.

Chapter 2 - Basics Structures MATH 213. Chapter 2: Basic Structures. Dr. Eric Bancroft. Fall Dr. Eric Bancroft MATH 213 Fall / 60

0 Sets and Induction. Sets

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth

MATH 61-02: PRACTICE PROBLEMS FOR FINAL EXAM

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions

Mathematical Fundamentals

Functions. Given a function f: A B:

Finite and Infinite Sets

CHAPTER 4 SOME METHODS OF PROOF

RED. Name: Math 290 Fall 2016 Sample Exam 3

Sets and Functions. (As we will see, in describing a set the order in which elements are listed is irrelevant).

Math Circle: Recursion and Induction

Economics 204 Summer/Fall 2017 Lecture 1 Monday July 17, 2017

Induction and Recursion

Chapter 2 - Basics Structures

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

RED. Name: Instructor: Pace Nielsen Math 290 Section 1: Winter 2014 Final Exam

Relations. Definition 1 Let A and B be sets. A binary relation R from A to B is any subset of A B.

MATH 433 Applied Algebra Lecture 14: Functions. Relations.

Section Summary. Definition of a Function.

CSC Discrete Math I, Spring Relations

Module 2: Language of Mathematics

Functions as Relations

Exam Practice Problems

A n = A N = [ N, N] A n = A 1 = [ 1, 1]. n=1

Introduction to Functions

MATH 102 INTRODUCTION TO MATHEMATICAL ANALYSIS. 1. Some Fundamentals

14 Equivalence Relations

Copyright c 2007 Jason Underdown Some rights reserved. statement. sentential connectives. negation. conjunction. disjunction

Sets, Functions and Relations

MAT115A-21 COMPLETE LECTURE NOTES

With Question/Answer Animations

1.4 Equivalence Relations and Partitions

Math 127 Homework. Mary Radcliffe. Due 29 March Complete the following problems. Fully justify each response.

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

In N we can do addition, but in order to do subtraction we need to extend N to the integers

Propositional Logic, Predicates, and Equivalence

Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries

Section Summary. Relations and Functions Properties of Relations. Combining Relations

(1) Which of the following are propositions? If it is a proposition, determine its truth value: A propositional function, but not a proposition.

International Mathematical Olympiad. Preliminary Selection Contest 2013 Hong Kong. Outline of Solutions

Func%ons. function f to the element a of A. Functions are sometimes called mappings or transformations.

Discrete Mathematics. Benny George K. September 22, 2011

Contribution of Problems

MATH 2200 Final Review

REVIEW FOR THIRD 3200 MIDTERM

EQUIVALENCE RELATIONS (NOTES FOR STUDENTS) 1. RELATIONS

BADHAN ACADEMY OF MATHS CONTACT FOR HOMETUTOR, FOR 11 th 12 th B.B.A, B.C.A, DIPLOMA,SAT,CAT SSC 1.2 RELATIONS CHAPTER AT GLANCE

Math 3450 Homework Solutions

MAS114: Exercises. October 26, 2018

Discrete Mathematics: Lectures 6 and 7 Sets, Relations, Functions and Counting Instructor: Arijit Bishnu Date: August 4 and 6, 2009

CSE 20 DISCRETE MATH. Fall

CHAPTER 1. Basic Ideas

Transcription:

. Relations. Functions. Seuences.4 Mathematical Induction.5 Recurrence Relations Chapter Review Chapter Relations, Functions, and Induction In this chapter we introduce the concepts of a relation and a function, which are fundamental in mathematics and applications. These concepts form the basis for the study of graphs and trees as introduced in Chapter.. RELTIONS 58 The word relation is a common term used in mathematics to indicate a relationship between two objects. Relationships occur everywhere. Two people belonging to the same family may be related as father-and-son, mother-and-son, brother-and-sister, husband-and-wife, and so forth. In mathematics two numbers may be related by being eual, or by one being greater than the other. Two sets may be related as one being a subset of the other, etc. These are only a few examples of relations. Later in this section, and in the exercises, we present more examples. First we start with a formal definition.

. Relations 59 Definition of Relation Relation Let and be two nonempty sets. relation R from to is a set R of ordered pairs (a, b) where a and b. For every such ordered pair we write arb, read a is related to b by R. If the relation R is from the set to itself, we say R is a relation on.* EXMPLE Studying Relations etween Two Sets Let {,, 7} and {, 5}. List the elements of each relation R defined below. (a) a is related to b, that is, arb if, and only if, a b. (b) a is related to b, that is, arb if, and only if, a and b are both odd numbers. (c) a is related to b, that is, arb if, and only if, (a b) is an even number. SOLUTION (a) Since is less than, then R. Similarly R5 and R5. Therefore, R {(, ), (, 5), (, 5)} Note that 7 is not related to 5 since 7 is not less than 5. (b) Since and 5 are both odd, then R5. Similarly, 7R5. Therefore, R {(, 5), (7, 5)} Note that is not related to 5 since is not odd. (c) Here, is related to 5 since 5 6 is even. Therefore, R5. Similarly, R and 7R5. Therefore, R {(, 5), (, ), (7, 5)} Note that is not even; thus, is not related to. EXMPLE Now Work Problem Studying Relations etween Two Sets Let be the set of all integers. We define a relation R on as follows: arb if, and only if, a and b have the same remainder when divided by. Is 5R? Is R? Is 7R4? SOLUTION Since both 5 and give as a remainder, then 5R. Since and 0, we conclude that both and give as a remainder; therefore, R. Since 7 gives as a remainder and 4 gives 0 as a remainder, 7 is not related to 4. * R is sometimes called a binary relation R from to since the elements of the set R are ordered pairs. This relation is called the congruence modulo relation and may be denoted by a b (mod ).

540 Chapter Relations, Functions, and Induction pplications to Computer Science In computer science the binary digits 0 and are called bits. n ordered collection of consecutive bits is called a binary word. Since computers store information in the form of binary words, they are important in the field of computer science. Of special importance are binary words of length 7, called bytes,* because a byte is the smallest addressable memory area in the computer, that is, the smallest unit that can be located in memory. The sets S and S* defined below are referred to in the exercises and in later sections of this chapter. Let S {0, }. We use 0 and to form binary words. Some binary words are 0, 00, 0,, 0, 000, 00, 00, 00, 0, 0, 00, and 0000. Now let S* denote the set of all binary words. S*, clearly, contains an infinite number of elements and hence makes its listing impractical. Next, for every word a in S* let Length (a) The number of bits in a For example, if a 00, then length (a) 6. With this in mind we can define a relation R on S* by considering the number of bits in each element in S* as follows: For a and b in S*, arb if, and only if, length (a) length (b). Thus, for instance, (000) R () since length (000) length () ; and (00) R (00) since both 00 and 00 have length eual to 4. EXMPLE Studying the Length of inary Words Let the set S* and the relation R be the ones defined above. Let 0 be in S*. List all elements in S* that are related to 0 under R. SOLUTION 0 is of length. The binary words in S* related to 0 under R are also of length. The list of all such words is 00, 0, 0,. Properties of Relations relation R on a set often satisfies certain properties. Three of these properties, reflexivity, symmetry, and transitivity, are defined as follows:. R is reflexive if, for each element a, we have ara.. R is symmetric if, for a, b, whenever arb, we have bra.. R is transitive if, for a, b, c, whenever arb and brc, we have arc. EXMPLE 4 Studying Properties of a Relation Let R be a relation defined on the set {a, b, c}. For each definition of R given below determine whether R is reflexive, symmetric, or transitive. * On some computers, such as the IM computers, a byte is 8 bits long.

. Relations 54 (a) R {(a, a), (a, b), (b, b), (c, c), (b, c)}. (b) R {(c, a), (a, c), (c, c), (c, b), (b, c)}. (c) R {(a, b), (b, a), (a, c), (c, a), (b, c), (c, b), (a, a), (b, b), (c, c)}. SOLUTION Now Work Problem (a) Since (a, a), (b, b), and (c, c) R, then R is reflexive. ecause (a, b) R, but (b, a) R, then R is not symmetric. nd because (a, b) and (b, c) R, but (a, c) R, then R is not transitive. (b) This relation is not reflexive because (a, a) R. It is not transitive because (a, c) and (c, a) are in R, but (a, a) is not. However, it is symmetric. (Why?) (c) R is reflexive, symmetric, and transitive. (Why?) EXMPLE 5 Studying Properties of a Relation Let {,, } and let R be a relation defined on. Suppose further that the ordered pairs (, ), (, ), and (, ) belong to R. What ordered pairs, besides the ones given above, must belong to R in order to make R (a) Reflexive? (b) Symmetric? (c) Transitive? SOLUTION (a) R will be reflexive if every element in is related to itself. The ordered pairs (, ) and (, ) must also belong to R to make it reflexive. (b) R will be symmetric if, whenever (a, b) isinr, sois(b, a). Obviously, (, ) satisfies this condition. Now since (, ) R, then, for R to be symmetric, (, ) must also belong to R. Similarly, since (, ) R, then, for R to be symmetric, (, ) must also belong to R. (c) R will be transitive if, whenever (a, b) and (b, c) are in R, sois(a, c). Now (, ) and (, ) R implies that, for R to be transitive, (, ) must also belong to R. EXERCISE. nswers to odd-numbered problems begin on page N-47.. Let {x, y, z}, {,, 5}. relation R from to is defined as nswer true or false: R {(x, 5), (y, ), (z, )} xr5, yr, zr, zr, yr, xr, xr, yr5, zr5. Let {,, }, {a, b, c, d}. relation R from to is defined as R {(, a), (, c), (, b), (, a), (, c)} nswer true or false: Ra, Rb, Rc, Ra, Rb, Rc, Ra, Rb, Rc. Let {,, 5}, {, 4, 6, 0}. relation R from to is given as follows: R, R4, R6, R0, R6, 5R0 Write R as a set of ordered pairs. 4. Let C {pple, TRS, IM, tari}, M {000, 60, 70, 800, II}. Let R, the relation from C to M, be given as follows: (pple) R (II), (TRS) R (000), (IM) R (70), (tari) R (800) Write R as a set of ordered pairs.

54 Chapter Relations, Functions, and Induction 5. Let D {,,, 4, 5} and C {, 4, 9, 6, 5, 6, 49, 64, 8}. The relation R from D to C is defined as follows: xry means y x Replace the? by the appropriate value: R?, R?, R?, 4R?, 5R?,?R4,?R5 6. Let F {, 0,, 0,, }. The relation R on F is defined as follows: nswer true or false: arb means a b R, R, R, R0, 0R0, R, R 7. The Cartesian product of two nonempty sets and, denoted by, is the set consisting of all ordered pairs (a, b) with a and b. That is, {(a, b) a, b } Let {,, 5} and {, 4, 7}. (a) Find the Cartesian product. (b) Define the relation less than, call it R, from the set to the set. Write R as a set of ordered pairs. (c) What can you say about the set R and? 8. Repeat Parts (b) and (c) of Problem 7, but now let R be the relation greater than or eual to. 9. Let S {a, b} and S set of all words on S of length. (a) List all elements of S. (b) The relation L on S is defined this way: vlw means that the first letter in v is the same as the first letter in w where v and w are in S. Write L as a set of ordered pairs. 0. Repeat Problem 9(b) for L defined as follows: vlw means the first letter of v is not the same as the first letter of w. In Problems 8 write the set of ordered pairs in the relation R.. Let {,, }, {, 4, 6, 8}. Define R to be the relation from the set to the set where arb means a is a factor of b.. Let {,,, 4, 5, 6}. Let R be a relation on where arb means a b (mod )(see footnote page 59).. Let {,,, 4, 5, 6, 7, 8, 9, 0}; R is a relation on where arb means a and b are either both even or both odd. 4. Let {,,, 4, 5}; R is a relation on where arb means ab is even. 5. Let {0,,, } and R on be defined as follows: arb means a b. 6. Let {,,, 4, 5, 9} and R on be defined as follows: arb means b a. 7. Let D {0,,,, 4, 5, 9, 5, 6} and R on D be defined as follows: xry means x. py 8. Let I {4,,, 0,,, 4} and R on I be defined as: xry means x y. For a relation R from the set to the set, the inverse relation of R, denoted R,is a relation from to defined as follows: For Problems 9 find R. br a means arb 9. R {(, ), (, ), (, 5), (, 7)}. 0. R {(a, a), (a, b), (b, a), (b, c)}.. R {(*, 4), (H, 7), (/, 47), (x, 88)}.. R is the relation on integers. In Problems 0 determine whether the given relation R on the set is reflexive, symmetric, or transitive.. Let R on a set of real numbers be defined as arb means a b. 4. Let R on the set of real numbers be defined as arb means a b.

. Functions 54 5. Let R be the relation of congruence modulo on the set of integers (see Example ). 6. Let be the set of integers and R a relation on be defined as arb means a divides b (or a is a factor of b). 7. Let be the set of all lines in the plane and R be defined by l Rl means l is a line parallel to l. 8. R is defined as follows: if an arrow connects a point to another, then the two points are related. (See the figure.) That is, R {(a, a), (a, b), (b, b), (b, a)} a 9. R is defined as follows: if an arrow connects a point to another, then the two points are related. (See the figure.) b That is, R {(, ), (, ), (, ), (, ), (, C), (C, ), (C, C), (, C)} 0. Let {,, } and R {(, )}. C. Consider the set {t, u, v, w} and the relation R on defined as R. (That is, R is the empty relation. In other words, no relation exists between any pair of elements of.) Show that R is symmetric and transitive but not reflexive.. FUNCTIONS In this section we discuss one of the most important concepts in mathematics and its applications: the concept of a function. s we will see, a function is a special type of a relation. Definition of a Function Function Let and be two nonempty sets. function f from into is a relation from to that relates every element in to only one element in. The set is called the domain of the function. For each element a in, the corresponding element b in, related to a by f, is called the image of a. The set of all images of the elements of the domain is called the range of the function. Since there may be elements in that are the image of no a in, it follows that the range of a function is often a proper subset of. Functions are often denoted by letters such as f, F, g, and G. Iff is a function from into, then for each element a in the corresponding image in the set is denoted by the symbol f(a) and is read f of a. (Note that f(a) does not mean f times a.) We can think of a function f as associating elements in to elements in and visualize f by means of a simple diagram as we do in Figure. Figure f a f(a)

544 Chapter Relations, Functions, and Induction EXMPLE Determining the Values of a Given Function Let {,, 5} and {, 4}. Define the function f from into, as shown in Figure. Find f(), f(), f(5), and the range of f. Figure f 5 4 SOLUTION Following the arrows, we have f() f() 4 f(5) Range of f {, 4} EXMPLE Determining the Values of a Given Function Let {,, } and {a, b, c, d, e}. Define the function f from into, as shown in Figure. Find f(), f(), f(), and the range of f. Figure f a b c d e SOLUTION Following the arrows in Figure, we find f() d f() b f() b Range of f {b, d} Now Work Problem ecause b and d are the only elements in that are assigned to elements in, we observe that the range of f is a proper subset of. EXMPLE Determining When a Relation Is a Function The diagrams in Figure 4 show a correspondence by which elements of {,, } are associated to elements in {w, x, y, z}. Which of these diagrams define a function from into? Figure 4 w x y z w x y z w x y z (a) (b) (c)

. Functions 545 SOLUTION In Figure 4(a) not all elements in are associated with elements in. For example, the element in has no image in. This is indicated by the absence of an arrow going from in to an element in. Thus Figure 4(a) does not define a function from into. In Figure 4(b) every element in is associated with a uniue element in. Thus Figure 4(b) defines a function. In Figure 4(c) the uniueness of images is violated. For example, the element has two images. This is shown by the two arrows emanating from to w and to z. Thus, Figure 4(c) does not define a function. When the sets and are infinite, a complete arrow diagram of a function f cannot be drawn. In such cases functions are sometimes defined by a formula, and the images of f can then be found from the formula defining f. EXMPLE 4 Determining Values Of a Function From a Formula Let f be a function from the set of real numbers to itself defined by the formula f(x) x Find f(0), f(0.5), f( ), f(), f( 0), f(00). SOLUTION f(0) is obtained from substituting 0 for x in x. That is, f(0) (0) Similarly, Now Work Problem f(0.5) (0.5) 0 f( ) ( ) f() () f( 0) ( 0) f(00) (00) 99 EXMPLE 5 Hamming Distance Function In a branch of computer science, called coding theory, a function called the Hamming distance function is of importance. Refer to Section 8.. This function gives a measure of the difference between two binary words that have the same length. We define the Hamming distance function H as follows: Let (u, v) be a pair of binary words of the same length. We compare u and v position by position and define For example, H(u, v) the number of positions in which u and v have different bits H(00, 00) 4 because 00 and 00 differ in all four positions. On the other hand, H(0, 00)

546 Chapter Relations, Functions, and Induction because 0 and 00 differ in only one position, namely, the second position. Special Types of Functions In Example we notice that the two elements and 5 in the domain are assigned the same element in the range. nd in Example we notice that the range of f is not the entire set. This shows that functions can be of different types. In the remainder of this section we introduce functions that have special properties. These functions are important in mathematics and its applications. One-to-One Function; Injective function f from into is one-to-one, or injective, if for all elements a, b in such that a b we have f(a) f(b). That is, if no two elements of are assigned to the same element in, or, euivalently, if each element of the range corresponds to exactly one element of the domain, then f is one-to-one. EXMPLE 6 Checking Whether a Function Is One-to-One Let {,, }, {a, b, c, d}, and let f() a, f() d, f() c. Isf one-to-one? SOLUTION Yes, because the different elements,,, in are assigned to the different elements a, d, c, respectively, in. EXMPLE 7 Checking Whether a Function Is One-to-One Figure 5 defines a function f from the set {a, b} into the set {x, y}. Is f oneto-one? Figure 5 a b x y SOLUTION Yes, because the two arrows show that a is assigned to y and that b, which is different from a, is assigned to x, which is different from y.

. Functions 547 EXMPLE 8 Checking Whether a Function Is One-to-One Let f(x) x, x any real number. Show that f is not one-to-one. SOLUTION We need only show that two distinct numbers are assigned to the same number under f. Choose the distinct values x and x. Now f(x ) f() () f(x ) f( ) ( ) Thus, we see that f() f( ). Therefore, f is not one-to-one. Onto Function; Surjective function f from into is onto, or surjective, if every element of is the image of some element in, that is, if range of f. EXMPLE 9 Checking Whether a Function Is Onto The diagrams in Figure 6 define the functions f and g from the set {,,, 4} into the set {a, b, c, d}. Which of these functions is onto? Figure 6 f g 4 a b c d 4 a b c d SOLUTION Under f, c is not the image of any element in. Thus, f is not onto. Under g, every element in is an image. Therefore, g is onto. EXMPLE 0 Checking Whether a Function Is Onto Let f(x) x, x any real number. Show that f is not onto. SOLUTION Since we cannot find a real number whose suare is negative, then the set of negative real numbers is not in the range. Thus f is not onto. ijective Function If a function f from into is both one-to-one and onto we say that f is bijective.

548 Chapter Relations, Functions, and Induction If a function f is bijective, then there will be another function g that will undo what f did. In a way, g will be the opposite of f as the following definition shows: Inverse Function Let f be a function from into. The function g from to is called the inverse of f if g(b) a, whenever f(a) b. The function g is usually denoted by f, read f inverse. Note that if f is one-to-one and onto, then the inverse g of f exists. lso, the range of f is the domain of g, and the range of g is the domain of f. EXMPLE Now Work Problem 5 Finding the Inverse of a Function Let {,, }, {a, b, c}. Define f from into as f() a, f() b, f() c Since f is both one-to-one and onto, it has an inverse. The inverse f from into is f (a), f (b), f (c) EXERCISE. nswers to odd-numbered problems begin on page N-48.. Let {a, b, c} and {,,, 4}. Let f be a function from into, as shown in the figure below. Find f(a), f(b), f(c). lso find the range of f. a b c f. Let {0,, } and {, 0, 00}. Let f be a function from into, as shown in the figure below. Find f(0), f(), f(). lso find the range of f. 4. Let f be a function from the set of real numbers into itself defined by f(x) 5 x Find f(0), f(5), f(5), f(0), f(0). 4. Let f be a function defined by f(x) x where x is any real number and x. Find f(), f(), f(0), f(). f 0 0 00

. Functions 549 In Problems 5 8, f assigns elements of {x, y, z} into elements of {,,, 4}. State whether f defines a function. If it doesn t, explain why. 5. f(x), f(x), f(z) 4. 6. f(x), f(y), f(z). 7. f(x) 4, f(y), f(z) 4. 8. f(y), f(y), f(z). In Problems 9, {0,, } and {,,, 4}. Use the correspondence pictures in the accompanying figures to determine whether f is a function. 9. f 0. f 0 4 0 4. f. f 0 4 0 4. Let l be a relation from the set of all binary words into the set M {0,,,,...},defined by l(w) Length of w (see Section.). Is l a function? 4. Let f be a relation that sends binary words into the set {0, } defined by, if w contains an odd number of 0s f(w) 0, if w contains an odd number of s 5. Let f be a relation that sends binary words into the set M {0,,,,...}defined by Is f a function? f(w) Number of 0s in w 6. Let H be the Hamming distance function. (See Example 5.) Find H(000, 000), H(0, 0), H(0, 0), H(0, 00), H(000, 00). Is f a function? In Problems 7 0, f is a function from into pictured in the accompanying figures. State whether f is one-to-one, onto, or bijective. 7. f 8. f a b c x y z w 0 9. f 0. f a b c 4 a b c d 0 0 0 40

550 Chapter Relations, Functions, and Induction. Show that the Hamming distance function on the set of all pairs of binary words of length n is not one-to-one.. Show that the Hamming distance function on the set of all pairs of binary words of length n is not onto. [Hint: Can you find binary words u and v of length n such that H(u, v) n?]. Let f be a function from the set of integers into the set of integers given by the formula f(n) n. Isf onto? 5. Refer to the figure of Problem 4. Find f (a), f (b), f (c). 6. Let f be a bijective function defined by Find f(), f() 4, f() 9, f(4) 6 f (), f (4), f (9), f (6) 4. Let f be the function from the set into the set given in the figure below. (a) Find f(), f(), f(). (b) Show that f is bijective. f a b c Let f be a function from into and let g be a function from into C. The composition of f and g, denoted by g f, read g of f, results in a new function from into C and is given by (g f )(a) g( f(a)) where a is in. That is, the function g f associates a in to f(a) in first and then associates the element f(a) in to the element g( f(a)) in C. See the figure below. C a f f(a) g g(f(a)) = (g f ) (a) g f 7. Use the figure below to find (g f )(), (g f )(), (g f )() f a b c g x y z C 8. If f is a bijective function from into, then f has an inverse f from into. This means that f f is a function from into. Such a function has the property ( f f )(a) a and ( f f )(a) a We call this the identity function. Let f(x) x bea function from the set of real numbers to the set of real numbers. If f (x) x, show that ( f f )(x) x and ( f f )(x) x.. SEQUENCES In this section we present a special type of function one whose domain is the set of numbers {0,,,,...}. These functions are called seuences. Seuences are useful in both mathematics and computer science.

. Seuences 55 Seuence Let S be a set. seuence is a function s from the set {0,,,,...}into S. If S is the set of real numbers, then s is called a seuence of reals. For every number n intheset{0,,,,...},s(n) will be the value assigned to n by the function s. We call s(n) the nth term of the seuence and denote it by s n [instead of s(n)]. We will also use the symbol (s n ) to denote the seuence itself. EXMPLE Listing Terms of a Seuence Let the seuence (s n ) be given by List the first four terms of (s n ). s n n SOLUTION s0 0 0 s s 4 s 9 EXMPLE Listing Terms of a Seuence Now Work Problem Let s n ( ) n. Write out the first four terms of (s n ). SOLUTION Note that the range of s is {, }. 0 s0 ( ) s ( ) s ( ) s ( ) EXMPLE Listing Terms of a Seuence Let (s n ) be a seuence given by s n a. List s 0, s, s, s, etc. SOLUTION s 0 a, s a, s a, s a, etc. Such a seuence is called a constant seuence.

55 Chapter Relations, Functions, and Induction EXMPLE 4 Listing Terms of a Seuence For (s n ) n, n 0, write out the first four terms of s n. SOLUTION s, s, s, s 4 4 Sometimes values of a seuence may be matrices as the following example shows. EXMPLE 5 Listing Terms of a Seuence Let the matrix-values seuence (M n ) be given by n n M n 0 ( ) n Write out the terms M 0, M, and M. Now Work Problem 9 SOLUTION 0 0 0 M0 0 ( ) 0 0 M 0 ( ) 0 M 0 ( ) 0 EXERCISE. nswers to odd-numbered problems begin on page N-48.. Suppose a seuence (s n ) is defined by s n () n /n, n 0. Write out s, s, s, s 4, s 00.. nswer the uestion in Problem for s n () n /n.. Consider a seuence (b n ) given by b n n/(n ) (a) List b 0, b, b, b, b 4, b 5. (b) Find b n b n, for n 0,,. n 8. Let M n. Find M 0, M, M, and M. n n n n. n 0 9. Let M n Find M 0, M, M, 0 n n and M. 4. nswer the uestion in Problem for b n n/(n ). 5. Find the first 8 terms of the seuence a k k. 6. nswer the uestion in Problem 5 for a k k. 7. List the first 7 terms of the seuence s n n!. n n 0 0 0. Let M n where stands for 0 0 0 multiplied by itself n times. Find M, M, M, 0 and M 0.

.4 Mathematical Induction 55 In Problems 6, write a formula for the nth term..,,,,....,0,,0,,0,....,,5,7,9,... 4. 0,5,5,5,... 5.,,, 4, 5,... 6.,, 9, 7,... 7. Towers of Hanoi* The number of moves reuired in solving the puzzle of the Towers of Hanoi for n disks is given by (s n ) n Find s 0, s, s, s, s 4, s 5, s 6, s 7, and s 8. 8. Suppose we have a set of straight lines where no two of the lines are parallel and no three of the lines go through the same point. The number of distinct regions that such a set of n lines divides the plane into is given by the nth term of the seuence Find s, s, s, and s 4. n (s n), n 9. The Fibonacci seuence is given by n n p5 p5 (s n) p5 Find s 0, s, s, s, s 4, s 5, s 6, s 7, and s 8..4 MTHEMTICL INDUCTION Mathematical induction is used to establish that mathematical statements involving positive integers are true for all positive integers. For example, we can use mathematical induction to prove that the following statement: n(n ) n () holds for all positive integers n. efore describing the method of mathematical induction, let us try to realize its power. To do this, we use Euation () and substitute the various possible values of n,,,...toconstruct the following table: Value of n Left-Hand Side of Euation () Right-Hand Side of Euation () Formula in Euation () 6 4 4 0 etc. ( ) ( ) ( ) 6 4(4 ) 0 Holds Holds Holds Holds * See Example, Section.5. See Example, Section.5.

554 Chapter Relations, Functions, and Induction We make two observations about this table:. It is impossible to substitute all possible values of n because there is an infinite number of them (as many as the number of positive integers). This means that our table can never be complete, and so Euation () can never be proven by substituting all the various values of n.. lthough the pattern of the rightmost column suggests that n(n )/ is valid, we can never be sure that Euation () does not fail for some untried value of n. y mathematical induction, however, we will prove that Euation () holds for all positive integers n. We will show this in Example. EXMPLE Finding Values of a Statement Let S(n) be the statement n(n ) n (a) Write S(). Is S() true? (b) Write S(). Is S() true? (c) Write S(k). (k is a positive integer.) (d) Write S(k ). SOLUTION It is clear that S(n) is the statement about the sum of the first n positive integers. (a) S() is the statement about the sum of the first positive integer. y Formula (), S() is the statement ( ) which is true. (b) S() is the statement about the sum of the first two positive integers. y Formula (), S() is the statement ( ) which is also true. (c) S(k) is the statement about the sum of the first k positive integers. y Formula (), S(k) is the statement k(k ) k (d) S(k ) is the statement about the sum of the first (k ) positive integers. This is obtained by substituting k for n in Euation (), to get (k )[(k ) ] k (k ) ()

.4 Mathematical Induction 555 We are now ready to state the principle of mathematical induction. Principle of Mathematical Induction Let S(n) be a statement that involves positive integers n,,,...ifwe can show that the following two conditions are satisfied: Condition I The statement S() is true. Condition II Let k be any positive integer. If assuming S(k) is true implies that S(k ) is also true, then S(n) must be true for all positive integers. Notice that from Condition I, S() is true. y Condition II, S() is true. gain using Condition II, S() is true, and so on, for all natural numbers. EXMPLE Using Mathematical Induction To Prove Formula () Show that n(n ) n () is true for all positive integers n. SOLUTION We need to show first that S() is true. ecause ( )/, Condition I is satisfied. To show that Condition II is true, we assume that Formula () holds for some positive integer k. That is, we assume S(k) is true for some positive integer k and, based on this assumption, we must show that S(k ) is true. We look at the sum of the first k positive integers: k (k ) [ k] (k ) Now Work Problem 7 k(k ) (k ) y our assumption that S(k) is true k(k ) (k ) (k )[k ] Take (k ) as a common factor. (k )[(k ) ] which is S(k ). [See Formula ().] Thus, Condition II is also satisfied. nd by the principle of mathematical induction, Euation () is true for all positive integers n.

556 Chapter Relations, Functions, and Induction EXMPLE Using Mathematical Induction Let S(n) be the following statement describing the sum of the first n positive odd integers: 5 (n ) n (4) (a) Write S() and show it is true. (b) Write S() and show it is true. (c) Write S(k). (d) Write S(k ). (e) Show, using mathematical induction, that S(n) is true for all positive integers n. SOLUTION (a) S() describes the sum of the first positive odd integer; Euation (4) gives. This is true; therefore, S() is true. (b) S() describes the sum of the first two positive odd integers; Euation (4) gives. ecause both sides are eual to 4, S() is true. (c) S(k) describes the sum of the first k positive odd integers. Euation (4) gives 5 (k ) k. (d) S(k ) describes the sum of the first k positive odd integers. Euation (4) gives 5 (k ) (k ) (k ) (e) Since, from (a) above, S() is true, Condition I is satisfied. To show that Condition II is satisfied, we assume that S(k) is true [see (c) above] and we show that this implies S(k ) [see (d) above] is true. So we consider the sum of the first (k ) positive odd integers: 5 (k ) (k ) [ 5 (k )] (k ) k k (k ) k since we assumed S(k) holds Thus, S(k ) holds and so Condition II is satisfied, and Formula (4) is true for all positive integers. EXMPLE 4 Using Mathematical Induction to Prove an Ineuality n Prove by mathematical induction that 5 n for all positive integers n.

.4 Mathematical Induction 557 SOLUTION We need to show that our statement is true for n. ecause 5, Condition I is satisfied. To show that Condition II is satisfied, we assume that k 5 k for some positive integer k and, based on this assumption, we must show that k 5 (k ). 5k 5(5 k) 5k y our assumption that 5 k k k k k We want to compare 5k to (k ) k k. k k Since k is an integer, k k and k. (k ) k Thus, 5 (k ), and Condition II is also satisfied. y the principle of mathe- matical induction, we have also proved n 5 n for all positive integers n. EXERCISE.4 nswers to odd-numbered problems begin on page N-48.. Let S(n) be the statement n n n is a positive integer (a) Write S(). Is S() true? (b) Write S(). Is S() true? (c) Write S(k). (d) Write S(k ).. Let S(n) be the statement 4 n (n ) n(n )(n ) (a) Write S(). Is S() true? (b) Write S(). Is S() true? (c) Write S(k). (d) Write S(k ).. Let S(n) be the statement n(n )(n ) n 6 (a) Write S(). Is S() true? (b) Write S(5). Is S(5) true? (c) Write S(k). (d) Write S(k ). 4. Let S(n) be the statement n 4 n(n ) n (a) Write S(). Is S() true? (b) Write S(). Is S() true? (c) Write S(k). (d) Write S(k ). 5. Let S(n) be the statement n n (a) Write S(). Is S() true? (b) Write S(5). Is S(5) true? (c) Write S(k). (d) Write S(k ). 6. Let S(n) be the statement n () (a) Write S(). Is S() true? (b) Write S(). Is S() true? (c) Write S(00). Is S(00) true? (d) Write S(k). (e) Write S(k ). n ()

558 Chapter Relations, Functions, and Induction In Problems 7 8 prove by mathematical induction that the statement is true for all positive integers n. n(n )(n ) n(n )(n ) 7. 4 n (n ) 8. n 6 n 9. 0. 4 6 n n (n ) 4 n (n ) n n(n ). 5 8 (n ). n n. 4 6 n n(n ) 4. 5 9 (4n ) (n )(n ) 5. 9. n n 4 5 () n () n(n ) n 6. 5 5 7 (n ) (n ) n n(n ) 8. n n(n ) 4 4 5 n (n ) (n ) 4(n )(n ) 7. n 4 4 7 7 0 (n ) (n ) n 0. n n (n ) n. n ( n ). 0 7 (7n 4) n(7n ). n n 5 n 4.... 5. 4 6 n pn n roots 6. is a factor of 4 n 7. is a factor of n n 8. 57 is a factor of 7 n 8 n.5 RECURRENCE RELTIONS Thus far we have defined a seuence by giving a general formula for its nth term or by writing a few of its terms. Often this approach is not possible. n alternative is to write the seuence by finding a relationship among its terms. Such a relationship is called a recurrence relation. Seuences defined this way normally arise when each term of the seuence depends upon the previous terms of the seuence. Defining a seuence recursively reuires both giving the recurrence relation and specifying the first few terms of the seuence. Specifying the first few terms of the seuence is called setting initial conditions. n example will help clarify these concepts. EXMPLE Computing Terms of a Seuence Compute the first six terms of the seuence defined by the following recurrence relation and initial conditions: (a) Recurrence relation: s n s n for all integers n Initial condition: s 0 (b) Recurrence relation: s n s n s n for all integers n Initial conditions: s 0, s

.5 Recurrence Relations 559 (c) Recurrence relation: s n s ns s for all integers n n n n Initial conditions: s 0, s, s s n (d) if s n is even Recurrence relation: s n s n if sn is odd Initial condition: s 0 6 SOLUTION (a) Here the initial condition is given as s0. Therefore, we need to compute s, s, s, s 4, and s 5. Substituting n in the recurrence relation gives s s s0 () s0 Similarly, and s s s () 7 s s s s (7) 5 s 7 s4 s4 s (5) s 5 s s s () 6 5 5 4 s 4 Thus, the first six terms of this seuence are,, 7, 5,, 6. (b) Here, the initial conditions are given as s0 and s ; therefore, we need to compute s, s, s 4, and s 5. Substituting n in the recurrence relation gives s s s s s0 s0 ands Similarly, and s s s s s 5 s ands s4 s4 s4 s s 5 8 s ands 5 s s s s s 8 5 5 5 5 4 s 5ands 8 4 Thus, the first six terms of this seuence are,,, 5, 8,.

560 Chapter Relations, Functions, and Induction Now Work Problem (c) Here, the initial conditions are given as s0, s, and s ; therefore, we need to compute s, s 4, and s 5. Substituting n in the recurrence relation gives s s s s s s s0 ( ) () 6 8 s0, s, and s Similarly, and s4 s4 4s4 s4 s 4s s 8 4( ) 64 4 6, s, s, and s 8 s5 s5 5s5 s5 s4 5s s (6) 5(8) s, s 8, and s 6 4 844 40 88 Thus, the first six terms of this seuence are,,, 8, 6, 88. (d) Here, the initial condition is s0 6; therefore, we need to compute s, s, s, s 4, s 5. Since s 0 is even, s0 6 s 6 Since s is odd, s s (6) 90 Similarly, s 90 s 95 s4 s (95) 86 s4 86 s5 4 Thus, the first six terms of this seuence are 6, 6, 90, 95, 86, 4. These examples lead us to the following definition. Recurrence Relation recurrence relation for the seuence s 0, s, s, s,...isaformula that relates each term s n to previous terms of the seuence. The initial condition for a recurrence relation is a set of values of the first few terms of the seuence. The next two examples are two well-known seuences that are defined recursively.

.5 Recurrence Relations 56 EXMPLE Finding How Fast Rabbits Multiply In 0.D., a European mathematician named Leonardo Fibonacci posed the following problem: ssume we start with a single pair of newborn rabbits and that each pair does not reproduce during its first month of life, but after its first month, it produces one new pair (a male and a female) at the end of every month. If we further assume that no rabbits die, how many pairs of rabbits will there be at the end of n months? SOLUTION Let r n denote the number of rabbit pairs at the end of the nth month. Since we started with one pair, then we have r0. nd, since this pair is not fertile during its first month, then at the end of the first month we will still have (this) one pair, that is, r. t the end of the second month this pair will produce another pair and so there will be two pairs, that is, r r0 r. t the end of the third month the one-month-old pair does not produce but the old pair does, the one we started with; thus there will be one newborn pair in addition to the previous two pairs, that is, r r r t the end of the fourth month there will be two pairs that are reproductive (as many as there was at the end of the second month, which is ), which will produce two pairs, and the one-month-old pair that cannot produce. Thus, r r r 5 4 Continuing in this manner, we find that at the end of the nth month there will be r n new pairs born plus r n pairs (those include the one-month-olds). That is, Now Work Problem 5 Recurrence relation: r r r n n n Initial condition: r, r 0 Fibonacci numbers occur in many applications. For example, the number of binary words that do not contain the pattern 00, follows a Fibonacci seuence. EXMPLE The Towers of Hanoi This is a puzzle about three poles and n disks of increasing sizes called the Towers of Hanoi puzzle. Initially, all of the disks (all have holes at their centers) are placed on the first pole, as shown in Figure 7(a). We want to transfer all the disks from the first pole to the third, so that they appear as in Figure 7(b). If we can move only one disk at a time and if we are not allowed to place a larger disk on top of a smaller one, what

56 Chapter Relations, Functions, and Induction is the minimum number of moves reuired to transfer a tower of n disks from the first pole to the third pole? Figure 7 (a) (b) SOLUTION We begin by letting m n be the minimum number of moves reuired to move the n disks from the first pole to the third. Obviously, m0 0. m because we can move one disk from the first pole to the third in one move. Notice that this is the minimum number of moves reuired to transfer one disk from the first pole to the third. To find m, we proceed as follows: First, we move the smaller disk from the first pole to the second, leaving the larger one on the first pole [Figures 8(a) 8(b)]. Second, we move the larger disk from the first pole to the third [Figures 8(b) (c)]. Third, and last, we move the smaller disk from the second pole to the third [Figures 8(c) (d)]. Figure 8 First move Second move Third move (a) (b) (c) (d) Figure 9 Thus, a minimum of three moves is needed to transfer two disks from the first pole to the third. This is the minimum number of moves because if we follow a different set of moves to transfer the two disks from the first pole to the third without violating the rules of the puzzle, we end up with more than three moves (Try it!). Thus, m reuires the following: m moves from the first pole to the second (moves for transferring the smaller disk from the first pole to the second), one move of the larger disk from the first pole to the third, and another m moves from the second pole to the third (moves for transferring the smaller disk from the second pole to the third). Thus, m m For a tower of three disks the minimum number of moves m reuired to transfer the three disks from the first pole to the third is computed as follows: m moves are reuired to transfer the top two disks from the first pole to the second [Figures 9(a), 9(b)], one move of the large disk from the first pole to the third [Figure 9(c)], and another m moves of the smaller two disks from the second pole to the third [Figure 9(d)]. Thus, m m 7 (a) (b) (c) (d)

.5 Recurrence Relations 56 Continuing our reasoning* in this way, it can be shown that Recurrence relation: mn mn for all integers n Initial condition: m0 0, m More examples on recursively defined seuences are found in the exercises. EXERCISE.5 nswers to odd-numbered problems begin on page N-5. In Problems 4 a recurrence relation and an initial condition are given that define a seuence (s n ). Find the first six terms of (s n ).. s n s n for all integers n s 0. s n s n n for all integers n s 0. s n ns n for all integers n s 0 4. s n s n n for all integers n s 0 5. s n (n )s n for all integers n s 0 6. s n s n n for all integers n s 0 n 7. s n s n s n for all integers n s 0, s 8. s s s n n n for all integers n s 0, s 9. s n s n s n for all integers n s 0, s 0. s n (s n s n ) / for all integers n s 0, s 6. s n s n s n s n for all integers n s 0, s, s. s n s n s n s n for all integers n s 0, s, s. s n ns n s n s n for all integers n s 0, s, s 4. s n n () sn nsn nsn for all integers n s 0, s, s 5. Use the recurrence relation and initial condition for the Fibonacci number seuence r 0, r, r, r,...defined in Example to compute r 0, r, r, r, and r 4. 6. Use the recurrence relation and initial condition for the Towers of Hanoi seuence m 0, m, m, m,...defined in Example to compute m 6, m 7, m 8, and m 9. 7. (a) Write all binary words of lengths 0,,,, and 4 that do not contain the bit pattern 00. (b) For all integers n, let sn the number of binary words of length n that do not contain the pattern 00. Find a recurrence relation relating s n to s n and s n. 8. Repeat Problem 7 for the binary words that do not contain the bit pattern. 9. Suppose $000 is invested in an account paying 0% interest compounded annually. ssume that no withdrawals are made, and let n be the amount in the account after n years. (a) Compute 0,,,, and 4. (b) Find a recurrence relation relating n to n for all integers n. 0. Repeat Problem 9 for $000 with annually compounded interest of 5.5%. * proof of this reuires mathematical induction.

564 Chapter Relations, Functions, and Induction. Consider a set of n lines in a plane no two of which are parallel and no three of which intersect at the same point. Let p n denote the number of distinct regions formed by these lines. See the figure. Region Region Region Region Region Region Region Region 4 Region 7 Region Region 4 Region 5 Region 6 (a) Find p, p, p, and p 4. (b) Find a recurrence relation relating p n to p n for all integers n. CHPTER REVIEW IMPORTNT TERMS ND CONCEPTS relation 59 bit 540 binary word 540 byte 540 reflexive 540 symmetric 540 transitive 540 Cartesian product 54 inverse relation 54 function 54 domain 54 image 54 range 54 one-to-one 546 injective 546 onto 547 surjective 547 bijective 547 inverse function 548 composition of functions 550 identity function 550 seuence 55 constant seuence 55 mathematical induction 55 recurrence relation 558 initial condition 558 TRUE FLSE ITEMS nswers are on page N-5. T F. For all relations R from to and all a, b if arb, then bra. T F. The range and the domain of all functions are the same. T F. bijective function is both one-to-one and onto. T F 4. One way to define a seuence is to give a formula for its nth term. T F 5. Condition II of the principle of mathematical induction states that if the statement S(k) is true for some positive integer k, then so is S(k ). T F 6. Every recurrence relation must have some initial condition. FILL IN THE LNKS nswers are on page N-5.. relation R from to is the set R of where a b.. from the set X into the set Y is a relation that associates with each element of X exactly one element of Y.. one-to-one and onto function is called.

Chapter Review 565 4. seuence is a function whose domain is the set of 5. is used to prove that a statement S(n), which involves natural numbers, is true for all n.. 6. formula that relates each term of a seuence of previous terms is called a. Specifying the first few terms is giving the. REVIEW EXERCISES nswers to odd-numbered problems begin on page N-5.. Let {,,, 8, 9, 7} and R be a relation on defined by arb if, and only if, a is the cube of b. Write R as a set of ordered pairs.. State the inverse relation R of the relation R of Problem. Write R as a set of ordered pairs.. Which of the following relations defines a function from {0,, } to {0,,, }? (a) f(0) 0, f(), f() (b) g(0), g(), g() (c) h(0), h() (d) F(0), F(), F(0), F() 4. Suppose S(n) is the statement n n ( ). Find S(), S(), S(). Use mathematical induction to prove that S(n) is true for all n. 5. Find the first 0 terms of each seuence (a) a k () k k (b) a k () k k 6. Find the first 5 terms of the seuence defined by the following recurrence relation and initial conditions: s (n )s s n n n n s, s 0 0 7. Find the first 7 terms of the seuence defined by the following recurrence relation and initial conditions: s s (s s ) n n n n n s, s, s 0 8. Suppose that you start with a single pair of newborn rabbits and that each pair reproduces a new pair (a male and a female) every two months except the first two months of its life. If no rabbits die, how many rabbits will there be at the end of the (a) Fourth month? (b) Sixth month? (c) Tenth month?