Set Basics. P. Danziger

Similar documents
Relations. P. Danziger. We may represent a relation by a diagram in which a line is drawn between two elements if they are related.

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Reading 11 : Relations and Functions

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

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

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

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

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

Foundations of Mathematics

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

Notation Index. gcd(a, b) (greatest common divisor) NT-16

Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics Lecture notes in progress (27 March 2010)

Sets and Motivation for Boolean algebra

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Part IA Numbers and Sets

Chapter 1. Sets and Mappings

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

9 RELATIONS. 9.1 Reflexive, symmetric and transitive relations. MATH Foundations of Pure Mathematics

Chapter 1 : The language of mathematics.

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

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

0 Sets and Induction. Sets

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

Notes on ordinals and cardinals

Week 4-5: Binary Relations

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

Mathematics Course 111: Algebra I Part I: Algebraic Structures, Sets and Permutations

Chapter 1. Sets and Numbers

3. Abstract Boolean Algebras

Relations. We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples.

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

RED. Fall 2016 Student Submitted Sample Questions

Real Analysis. Joe Patten August 12, 2018

Cartesian Products and Relations

1. (B) The union of sets A and B is the set whose elements belong to at least one of A

MATH 433 Applied Algebra Lecture 14: Functions. Relations.

Week Some Warm-up Questions

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

EQUIVALENCE RELATIONS (NOTES FOR STUDENTS) 1. RELATIONS

1 Basic Combinatorics

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

MATH1240 Definitions and Theorems

Topology. Xiaolong Han. Department of Mathematics, California State University, Northridge, CA 91330, USA address:

Foundations of algebra

UNIVERSITY OF CALICUT SCHOOL OF DISTANCE EDUCATION B Sc (MATHEMATICS) I Semester Core Course. FOUNDATIONS OF MATHEMATICS (MODULE I & ii) QUESTION BANK

Theorem. For every positive integer n, the sum of the positive integers from 1 to n is n(n+1)

1 Predicates and Quantifiers

Sets, Logic, Relations, and Functions

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

Discrete Mathematics

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

MATH 220 (all sections) Homework #12 not to be turned in posted Friday, November 24, 2017

Part II. Logic and Set Theory. Year

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

Automata Theory and Formal Grammars: Lecture 1

CSC Discrete Math I, Spring Relations

Week 4-5: Binary Relations

Sets, Functions and Relations

Set theory. Math 304 Spring 2007

Introduction to Proofs

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

MAT 570 REAL ANALYSIS LECTURE NOTES. Contents. 1. Sets Functions Countability Axiom of choice Equivalence relations 9

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

Contribution of Problems

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

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

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

Foundations Revision Notes

Lecture Notes on Discrete Mathematics. October 15, 2018 DRAFT

Automata and Languages

Discrete Mathematics. (c) Marcin Sydow. Sets. Set operations. Sets. Set identities Number sets. Pair. Power Set. Venn diagrams

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

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

MA Discrete Mathematics

Relations Graphical View

Relations, Functions, and Sequences

Module 2: Language of Mathematics

586 Index. vertex, 369 disjoint, 236 pairwise, 272, 395 disjoint sets, 236 disjunction, 33, 36 distributive laws

A is a subset of (contained in) B A B iff x A = x B Socrates is a man. All men are mortal. A = B iff A B and B A. A B means A is a proper subset of B

Sets. Subsets. for any set A, A and A A vacuously true: if x then x A transitivity: A B, B C = A C N Z Q R C. C-N Math Massey, 72 / 125

Mathematical Reasoning & Proofs

FOUNDATIONS & PROOF LECTURE NOTES by Dr Lynne Walling

UMASS AMHERST MATH 300 SP 05, F. HAJIR HOMEWORK 8: (EQUIVALENCE) RELATIONS AND PARTITIONS

2.23 Theorem. Let A and B be sets in a metric space. If A B, then L(A) L(B).

MATH 363: Discrete Mathematics

Chapter 1. Logic and Proof

Lecture 5: Functions : Images, Compositions, Inverses

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

CSE 1400 Applied Discrete Mathematics Definitions

Sets. Alice E. Fischer. CSCI 1166 Discrete Mathematics for Computing Spring, Outline Sets An Algebra on Sets Summary

CS Discrete Mathematics Dr. D. Manivannan (Mani)

1.4 Equivalence Relations and Partitions

Background for Discrete Mathematics

Introduction. Foundations of Computing Science. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

Math 42, Discrete Mathematics

Mathematics Review for Business PhD Students Lecture Notes

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

Lecture 4: Constructing the Integers, Rationals and Reals

DEPARTMENT OF MATHEMATICS. MA1301 Discrete Mathematics

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

Transcription:

- 5 Set Basics P. Danziger 1 Set Basics Definition 1 (Cantor) A set is a collection into a whole of definite and separate objects of our intuition or thought. (Russell) Such that given an object x and a set S it is possible to state unequivocally that either x belongs to the set S, or x does not belong to S. The objects in a set, S, are called elements of S, or members of S. 2 Notation 1. If x is a member of a set S, we write x S. If x is not a member of a set S, we write x S. 2. We use curly braces to denote sets: Example 2 S = {a, b, c} means that S consists exactly of the elements a, b and c. Note that order is unimportant, thus {a, b, c} and {b, a, c} represent the same set. Also since a set is defined only by its members we ignore repitition. Thus the set {a, b, c} is the same as {a, a, b, b, b, c, c}. 3. We use ellipses (...) to indicate that a pattern continues. Example 3 {0, 1, 2, 3,...} = N. 4. We also use the notation T = {x S P (x)} to indicate the set of all those elements of S which satisfy the property P. T equals the set of x in S such that P (x). Example 4 (a) T = {x Z x is divisible by 2} The set of even numbers. (b) T = {x R 0 < x x < 2} All real numbers between 0 and 2. 5. In the case of intervals of real numbers we use a special notation: [a, b] = {x R a x b} - The set of all real numbers between a and b inclusive. (a, b) = {x R a < x < b} - The set of all real numbers between a and b exclusive. } (a, b] = {x R a < x b} - Half open intervals. [a, b) = {x R a x < b} 1

- 5 Set Basics P. Danziger 2.1 The Universal Set Often when we talk about sets we find it useful to define the set of all permissable objects - the universe, usually denoted U. We often restrict U to be a smaller set than the set of everything. Note that the notation {x U P (x)} naturally defines a universal set. 3 Some Useful Sets 3.0.1 The Empty Set (5.3) Definition 5 The empty set is the set with no elements, denoted by φ. 3.0.2 Number Sets N = {0, 1, 2, 3,...} - The natural numbers. N + = {x N x > 0} = {1, 2, 3,...} - The positive natural numbers. Z = {..., 3, 2, 1, 0, 1, 2, 3,...} - The integers. Z + = {x Z x > 0} = {1, 2, 3,...} - The positive integers. (= N + ) Z = {x Z x < 0} = {..., 3, 2, 1} - The negative integers. P = {p Z p is prime } - The prime numbers. Q = { x y x Z y N+ } - The rationals. Q + = { x y x Z+ y N + } - The positive rationals. Q = { x y x Z y N + } - The negative rationals. R = (, ) - The Real numbers. R + = (0, ) - The positive Real numbers. R = (, 0) - The negative Real numbers. I = R Q (all real numbers which are not rational) - The irrational numbers. C = {x + yi x, y R} - The Complex numbers. Note: There are many real numbers which are not rational, e.g. π, 2. 4 Set Comparisons Definition 6 Given two sets A and B: 1. A is called a subset of B, written A B, if and only if every element of A is also in B. We also say B contains A, or A is contained in B. Formally: A B for every x U, x A x B 2

- 5 Set Basics P. Danziger 2. A = B if and only if A and B have exactly the same elements. 3. A is a proper, or strict, subset of B, written A B if and only if A is a subset of B, but there is at least one element of B which is not in A. Notes A B (A B) (B A). A = B (A B) (B A). Example 7 Let A = {0, 1, 2, 3}, B = {1, 2}, C = {x N x < 4}. Then the following statements are true: C A, A C, C = A, B A, B A. We can also say: A B, C A. Note Sets may have other sets as elements, this is not the same as being a subset. Example 8 S = {0, 1, {2, 3}} {2, 3} S, {2, 3} S, {0, 1} S, {0, 1} S, 0 S. How many elements are in the set φ? How many elements are in the set {φ}? (Answer: 0 and 1 respectively) Theorem 9 1. φ is a subset of every other set, including itself. 2. Every set, including U, is a subset of the universal set U. Proof: 1. Must show that for any set S, x φ x S. But since there is no x such that x φ this is vacuously true. 2. For any set S, if x S x U, since everything is in U by definition. Theorem 10 The empty set is unique. (i.e. there is only one empty set) Proof: (By contradiction.) Suppose not, that is suppose that there are two distinct empty sets, φ 1 and φ 2. Now, φ 1 φ 2 (every set is a subset of the empty set). And φ 2 φ 1 (every set is a subset of the empty set). Thus φ 1 = φ 2 (Definition of = for sets). 3

- 5 Set Basics P. Danziger 5 Operations on Sets Definition 11 Let A and B be any subsets of a universal set U. 1. The union of A and B, denoted A B is the set of all elements of U which are in either A or B. i.e. A B = {x U x A x B}. 2. The intersection of A and B, denoted A B is the set of all elements of U which are in both A and B. i.e. A B = {x U x A x B}. 3. The difference of B minus A, denoted B A is the set of all elements of U which are in B but not in A. i.e. B A = {x U x B x A}. 4. The complement of A, denoted A c is the set of all elements of U which are not in A. i.e. A c = {x U x A}. Example 12 1) Let U = {a, b, c, d, e, f, g}, A = {a, c, e, g}, B = {d, e, f}. A B = {e}, A B = {a, c, d, e, f, g} = U {b}, A c = {b, d, f} B A = {d, f} = A c B. 2) Let U = R, A = ( 2, 0), B = [0, 2). A B = φ, A B = ( 2, 2), B A = [0, 2) = B, A c = (, 2] [0, ). Note that set difference is not a basic operation as it can be expressed in terms of union and intersection. Theorem 13 (Set Difference law) A B = A B c 5.1 Set Identities A, B, C are sets, φ is the empty set and U is the universal set. p, q, r are statements t is the tautology and c the contradiction. 4

- 5 Set Basics P. Danziger Law Set Identity (5.2.2) Logical Equivalence (1.1.1) Commutativity A B = B A p q q p A B = B A p q q p Associativity A (B C) = (A B) C p (q r) (p q) r A (B C) = (A B) C p (q r) (p q) r Distributivity A (B C) = (A B) (A C) p (q r) (p q) (p r) A (B C) = (A B) (A C) p (q r) (p q) (p r) Existence of A U = A p t = p Identity A φ = A p c = p Complement/ A A c = U p p = t Negation A A c = φ p p = c Double (A c ) c = A ( p) = p Complement Idempotent A A = A p p = p A A = A p p = p DeMorgans (A B) c = A c B c (p q) = p q (A B) c = A c B c (p q) = p q Universal A U = U p t = t bound A φ = φ p c = c Absorbtion A (A B) = A p (p q) = p A (A B) = A p (p q) = p Identity U c = φ t = c Relations φ c = U c = t Given a set with two binary operations and one unary operation defined on it, if it satisfies the first five of these properties (Commutativity, Associativity, Distributivity, Existence of Identities ), then it will satisfy the rest. Such a system is called a Boolean Algebra. In this case we have set of statements with, and. The set of all sets with, and c. Theorem 14 For any sets, A, B and C, the following always hold: 1 Inclusion of Intersection A B A A B B 2 Inclusion of Union A A B B A B 3 Transitivity of inclusion If A B and B C then A C Theorem 15 For any sets, A and B, if A B then A B = A and A B = B. 5

5.2 Sets - The Element Method P. Danziger 1 Proving Set Identities - The Element Method In order to prove the basic set set identities we use the so called element method. To do this we use the procedural definitions of the set identities: Definition 1 Given sets A and B in some universe U and some element x U: x A B x A x B. x A B x A x B. x A B x A x B. x A c x A. A B ( x A x B) To prove a set identity we consider an arbitrary element x U and use the properties above, valid forms theorem 1.1.1 to show the result. Theorem 2 For any sets A, B and C, A B = A B c Proof: ( ) We must show that for every x U, x A B x A B c. Let x A B (Assumption to prove implication) x A x B (Definition of setminus) x B (Specialization) x B c (Definition of B c ) x A (Specialization) x A x B c (Conjunction) x A B c (Definition of ) ( ) We must show that for every x U, x A B c x A B. Let x A B c (Assumption to prove implication) x A (Specialization) x B c (Specialization) x B (Definition of B c ) x A x B (Conjunction) x A B (Definition of A B) Now since A B A B c and A B c A B, we have A B = A B c. 1

5.2 Sets - The Element Method P. Danziger Theorem 3 For any sets A, B and C: 1. A B A and A B B. 2. A A B and B A B. 3. ((A B) (B C)) (A C). Proof: 1. To show A B A and A B B. Assume that some arbitrary element x satisfies x A B. x A x B (Definition of ). x A (Specialization). 2. We must show that if x A then x A B. Let x be an arbitrary, but specific element of A. i.e. x A. x A x B (Generalization). x A B (Definition of ). 3. We must show that if A B and B C then x A implies x C. Assume that A B and B C, and let x A. x B (Since A B). x C (Since B C). Theorem 4 For any set A in a universe U: 1. A φ = A (φ is an identity for ). 2. A φ = φ (φ is an absorbant for ). 3. A A c = φ and A A c = U. 4. U c = φ and φ c = U. Proof: 1. ( ) We must show that for every A U, (x A φ) (x A). Let x A φ (Assumption to prove implication) x A x φ (Definition of ) x φ (Definition of φ) x A (Elimination) ( ) We must show that for every A U, (x A) (x A φ). Let x A (Assumption to prove implication) x A x φ (Generalization) 2

5.2 Sets - The Element Method P. Danziger 2. ( ) We must show that for every A U, x A φ x φ. Note that the conclusion x φ is always false, for any x. So we must show that x A φ is false for any value of x. We use the rule of contradiction. Let x A φ (Assumption to prove implication) x A x φ (Definition of ) x φ (Specialization) c (Definition of φ) (x A φ) (Contradiction) ( ) We must show that for every A U, x φ x A φ. However, the assumption x φ is false for any value of x. Thus the implication is true. 3. To show A A c = φ Suppose x A A c Then x A x A c (Definition of ) So x A x A c (Definition of compliment) But there is no such x (Definition of set) So A A c = φ To Show A A c = U. ( ) If x A A c then x U, since everything is in U. ( ) We must show that for every A U, x A A c. Given any x U, either x A or x A (definition of set) So x A A c (definition of ). 4. U c = φ: By the definition of U, here is no element which is not in U. φ c = U ( ) We must show that for every x U, x φ x U. The statement x φ is true for every x U by the definition of φ, so both sides of the implication are always true. ( ) We must show that for every x, x U x φ. This is the contrapositive of definition of φ. 3

- 5.1 Partitions, Power Sets and Cartesion Products P. Danziger 1 Set Partitions Definition 1 Two sets are called disjoint if and only if they have no elements in common. Formaly A and B are disjoint A B = φ. A collection of sets A 1, A 2,..., A n are mutually disjoint or pairwise disjoint if and only if every pair of sets disjoint. More precisely, for all i, j = 1,..., n, Example 2 1. {1, 2} and {3,4} are mutually disjoint. A i A j = φ whenever i j. 2. {1, 2, 3} and {2,3,4} are not mutually disjoint, since they both contain 2 and 3. 3. Z + and Z are mutually disjoint 4. The intervals (, 4], [ 4, 0) are not mutually disjoint since they contain the common element 4. 5. The intervals (, 4], ( 4, 0), [0, 2], [4, 10) are pairwise disjoint. Theorem 3 For any sets A and B, A B and B are mutually disjoint. Proof: Let x be an element of A B, we must show that x B. Since x A B we know that x A and x B, by the definition of set difference. Thus x B (Conjunctive Simplification). Note Any set A is mutually disjoint from its complement, A c, since A A c = φ. Definition 4 A collection of nonempty sets {A 1, A 2,..., A n } is a partition of a set A if 1. A = A 1 A 2... A n ; 2. A 1, A 2,..., A n are mutually disjoint. 1

- 5.1 Partitions, Power Sets and Cartesion Products P. Danziger Example 5 1. Let A = {0, 1, 2, 3, 4, 5}, A 1 = {0, 1}, A 2 = {2, 3}, A 3 = {4, 5}. Is {A 1, A 2, A 3 } a partition of A? Yes. Since A = A 1 A 2 A 3 and A 1, A 2 and A 3 have no common elements. 2. Consider the sets: R 0 = {x Z x = 2k for some integer k} (even numbers). R 1 = {x Z x = 2k + 1 for some integer k} (odd numbers). Is {R 0, R 1 } a partition of Z? Yes. Since every number is either odd or even R 0 R 1 = Z. No number is both odd and even, so R 0 R 1 = φ. 3. Are the sets R 0 and R 1 above a partition of Z +? No. 2 R 0, so 2 R 0 R 1, but 2 Z +. So R 0 R 1 Z +. 2 Power Sets Definition 6 The power set of a set A, denoted P(A), is the set of all subsets of A. i.e. For any sets A and X X P(A) X A Example 7 1. Let A = {0, 1} P(A) = {φ, {0}, {1}, {0, 1}} 2. Let A = {a, b, c} P(A) = {φ, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}} Notes 1. X P(A) if and only if X A. 2. For any set A, φ P(A) and A P(A). Theorem 8 For any sets A and B, if A B then P(A) P(B). To Prove: sets A, B, A B P(A) P(B) Proof: Let A and B be sets with A B. We must show that every element of P(A) is in P(B). Let X P(A). Thus X A, by the definition of P(A). Thus X A B, so X B (5.2.1 3). But if X B then X P(B). Theorem 9 If a set A has n elements then P(A) has 2 n elements. S.W.P. (See p. 265) 2

- 5.1 Partitions, Power Sets and Cartesion Products P. Danziger 3 Cartesian Products Definition 10 Let n Z +, and let x 1, x 2,..., x n be n (not necessarily distinct) elements of some set. The ordered n-tuple (x 1, x 2,..., x n ) consists of x 1, x 2,..., x n together with the ordering. An ordered 2-tuple (x 1, x 2 ) is called an ordered pair. An ordered 3-tuple (x 1, x 2, x 3 ) is called an ordered triple. Two ordered n-tuples (x 1, x 2,..., x n ) and (y 1, y 2,..., y n ) are equal if and only if Thus (a, b) = (c, d) iff a = c and b = d. Definition 11 x 1 = y 1 x 2 = y 2... x n = y n 1. Given 2 sets A and B the Cartesian product of A and B, denoted A B (A cross B) is the set of ordered pairs (a, b) with a A and b B. i.e. A B = {(a, b) a A b B}. 2. Given sets A 1, A 2,..., A n the Cartesian product A 1 A 2... A n is the set of all ordered n-tuples (a 1, a 2,..., a n ). Example 12 i.e. A 1 A 2... A n = {(a 1, a 2,..., a n ) a 1 A 1 a 2 A 2... a n A n }. 1. A = {1, 2}, B = {3, 4, 5}, A B = {(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)} 2. R R = R 2 = {(x, y) x, y R}. 3. R n = R } R {{... R } = {(x 1, x 2,..., x n ) x 1, x 2,..., x n R}. n times 4. R N = {(x, a) x R a N}. 4 Alphabets and Strings See p. 736-737. Definition 13 1. An alphabet, Σ is a finite set. The elements of an alphabet are called symbols or characters. Example 14 (a) Σ E = {a, b,..., Y, Z} - The standard alphabet for English. 3

- 5.1 Partitions, Power Sets and Cartesion Products P. Danziger (b) Σ A = ASCII = Σ E {!, @,...,?} - Standard alphabet for computer I/O. (c) Σ 0 = {0, 1} - The natural alphabet of computers. 2. A string over an alphabet Σ is any ordered n-tuple of elements of Σ. We usually write strings with no commas or parantheses. We allow the empty string and denote it by the symbol ɛ. Generally, we use lowercase letters from the beginning of the alphabet a, b, c to denote single characters from an alphabet, and lowercase letters from the end of the alphabet u, v, w, x, y, z to denote strings of characters from an alphabet. Example 15 (a) If Σ = Σ 0 then ɛ, 0, 00, 01, 11, 01101100 are all strings over Σ. (b) If Σ = Σ E then ɛ, a, set, qwerty are all strings over Σ. 3. The length of a string is the number of characters which make it up. The empty string ɛ always has length 0. Example 16 (a) Σ = Σ 0, 0 and 1 have length 1. 00, 01 and 11 have length 2. 01101100 has length 8. (b) Σ = Σ E, a has length 1, set has length 3, qwerty has length 6. 4. Given an alphabet Σ Σ n denotes the set of all strings of length n over Σ. Σ denotes the set of all strings of any finite length (including 0) over Σ. Example 17 Σ = Σ 0. Σ 0 = {ɛ}, Σ 1 = Σ = {0, 1}, Σ 2 = {00, 01, 10, 11} etc. 5. Given any two strings x and y over an alphabet Σ, the concatenation of x and y is the string xy. Example 18 x = 01, y = 001, xy = 01001, yx = 00101. 4

- 10 Relations P. Danziger 1 Relations (10.1) Definition 1 1. A relation from a set A to a set B is a subset R of A B. 2. Given (x, y) R we say that x is related to y and write xry. 3. If (x, y) R we say that x is not related to y and write x Ry. 4. If A = B, we say that R is a binary relation on A. Note: Order matters. If xry this does not necessarily mean that yrx. Example 2 Let A = {0, 1, 2}, B = {3, 4, 5}. R = {(0, 3), (0, 4), (1, 3)}. So 0R3, 0R4, 1R3. But 3 R0, 4 R0, 3 R1. 0 is related to 2 different elements of B. There are 2 elements of A (0 and 1) which are related to 3 B. 2 A is related to no elements in B. There are no elements in A related to 5 B. We may represent a relation by a diagram in which a line is drawn between two elements if they are related. 0 1 2 3 3 4 5 If A = B, i.e. R is a binary relation on A, we need only draw A, we can then connect points of A to each other as needed. Example 3 A = {0, 1, 2}, R = {(0, 0), (0, 1), (1, 2)} 0 1 2 1

- 10 Relations P. Danziger Example 4 1. > on N, A = B = N, x, y N, xry x > y. So 1 > 0 1R0, but 0 R1 since 0 1. R = {(1, 0), (2, 0), (2, 1), (3, 0), (3, 1), (3, 2),...}. 2. Let P = {x x is a person }. Consider the relation Child of on P, given by x, y P, xry if and only if x is y s child. 3. = on Q. A = B = Q, x, y Q, xry x = y. We wil use the following definition of equality in Q : Given a b, c d Q, we say that a b = c if and only if d a gcd(a, b) = c gcd(c, d) and So, 1 2 = 1 2, 1 2 = 2 4, 2 4 = 1 2, 1 2 = 3 6, 2 4 = 3 6,... 4. Congruence modulo n ( n ). A = B = Z, x, y Z, xry x mod n = y mod n. We write x y (mod n). So, for example, if n = 6, b gcd(a, b) = d gcd(c, d). 1 1 (mod 6), 1 7 (mod 6), 1 13 (mod 6), 1 19 (mod 6),... 7 1 (mod 6), 7 7 (mod 6), 7 13 (mod 6), 7 19 (mod 6),... 2 2 (mod 6), 2 8 (mod 6), 2 14 (mod 6), 2 20 (mod 6),... 3 3 (mod 6), 3 9 (mod 6), 3 15 (mod 6), 3 21 (mod 6),... 4 4 (mod 6), 4 10 (mod 6), 4 16 (mod 6), 4 22 (mod 6),... 5 5 (mod 6), 5 11 (mod 6), 5 17 (mod 6), 5 23 (mod 6),... 0 0 (mod 6), 0 6 (mod 6), 0 12 (mod 6), 0 18 (mod 6),... Definition 5 Given a binary relation R from A to B the inverse relation, denoted R 1, is given by R 1 = {(b, a) B A (a, b) R}. Example 6 1. Let A = {0, 1, 2}, B = {3, 4, 5}. R = {(0, 3), (0, 4), (1, 3)}. Then R 1 = {(3, 0), (4, 0), (3, 1)}. 2

- 10 Relations P. Danziger 2. Inverse of > on N. a, b N, arb a > b b < a. So > 1 is <, i.e. (a, b) > (b, a) < 3. (Child of) 1. x, y P, x is the child of y if and only if y is the parent of x. So (Child of) 1 is (Parent of). 4. = 1 on Q. Note that by the definition of equality in Q for all x, y Q, x = y y = x. So = 1 is =. 5. Congruence modulo n ( n ). a b (mod n) a mod n = b mod n b mod n = a mod n b a (mod n). So 1 is The last two examples are self inverse. We showed that arb bra. Definition 7 Given n Z + and sets A 1, A 2,..., A n, an n-ary relation on A 1, A 2,..., A n is a subset R of A 1 A 2... A n. If n = 2 it is called a binary relation. If n = 3 it is called a ternary relation. If n = 4 it is called a quaternary relation. Example 8 1. Every subroutine (function) in a computer program is a relation between its inputs and its output(s). int f(int a, char *b, int c) { }. return (int) d; This is a quaternary relation, relating the inputs a, b and c with the output d. i.e. (a, b, c, d) R if and only if f returns d on the inputs a, b and c. If f returns a set of values (an array), rather than a single value, we say that (a, b, c, d) R for each d in the array. In this case A 1 = A 3 = A 4 = Z, and A 2 = Σ A, where Σ A is the ASCII character set. 3

- 10 Relations P. Danziger 2. Consider a database, each record of which contains 4 fields. Each record in the database looks like (x, y, z, w), where x A 1, y A 2, z A 3, w A 4, for some sets A 1, A 2, A 3, A 4. We define a quaternary relation R by (x, y, z, w) R if and only if (x, y, z, w) is a record in the database. This is called a relational database. 2 Equivalence Relations 2.1 Reflexive, Symmetric and Transitive Relations (10.2) There are three important properties which a relation may, or may not, have. Definition 9 Given a binary relation, R, on a set A: 1. R is called Reflexive if x A, xrx. 2. R is called Symmetric if x, y A, xry yrx. 3. R is called Transitive if x, y, z A, (xry yrz) xrz. 4. A relation which is reflexive, symmetric and transitive is called an equivalence relation. Example 10 1. A = {0, 1, 2}, R = {(0, 0), (1, 1), (1, 2), (2, 1), (0, 2), (2, 0)} 2 R2 so not reflexive. For each x, y A xry yrx (by exhaustion). So R is symmetric 1R2 and 2R0, but 1 R0, so R is not transitive. So R is not an equivalence relation (neither reflexive nor transitive). 2. A = {0, 1, 2}, R = {(0, 0), (1, 1), (2, 2), (1, 2), (2, 1)} For each x, y A, xrx, so R is reflexive. For each x, y A, xry yrx (by exhaustion), so R is symmetric. By reflexivity, x A, (xrx xrx) xrx. (1R1 1R2) 1R2, (1R2 2R1) 1R1, (1R2 2R2) 1R2, (2R1 1R1) 2R1. So by exhaustion R is transitive. Thus R is an equivalence relation. 3. > on N 0 0, so > is not reflexive. 1 > 0, but 0 1, so > is not symmetric. Let a, b, c N with a > b and b > c, then a > c, so > is transitive. Thus > is not an equivalence relation (not reflexive or symmetric). 4

- 10 Relations P. Danziger 4. (Child of) on P. No person is their own child, so not reflexive. If x is y s child, then y is not x s child, so not symmetric. If x is the child of y and y is the child of z, then x is not the child of z, so not transitive. So Child of is not an equivalence relation. 5. = on Q Reflexivity: Let a b Q, a b = a. So = is reflexive. b Symmetry: Let a b, c d Q, with a b = c d. By the definition of = in Q, c d = a. So = is symmetric. b Transitivity Let a b, c d, e f Q with a b = c d and c d = e f. c Then gcd(c, d) = a gcd(a, b) and c gcd(c, d) = e gcd(e, f), so d Also gcd(c, d) = b gcd(a, b) and d gcd(c, d) = f gcd(e, f), so Thus a b = e, and so = is transitive. f Thus = is an equivalence relation. 6. Congruence modulo n ( n ). e gcd(e, f) = b gcd(a, b) = Reflexivity: Let a Z, a mod n = a mod n, so a a (mod n). So n is reflexive. Symmetry: Let a, b Z, with a b (mod n). Thus a mod n = b mod n, so b a (mod n). So n is symmetric. Transitivity: Let a, b, c Z, with a b (mod n) and b c (mod n). Then a mod n = b mod n and b mod n = c mod n, so a mod n = c mod n, i.e. a c (mod n). So n is transitive. Thus n is an equivalence relation. 2.2 Transitive Closure a gcd(a, b). (Algebra) f gcd(e, f). (Algebra) Suppose we have a binary relation R on a set A which is not transitive. This means that there are triples of elements a, b, c A with arb and brc, but a Rc. Suppose that we create a new relation, R, by adding (a, c) to the relation for each such triple. The resulting relation, R, will be transitive. R is called the transitive closure of R. Definition 11 Given a set A and a binary relation R on A, the transitive closure of R is the relation R which satisfies the following properties: 5

- 10 Relations P. Danziger 1. R is transitive. 2. R R. 3. If S is any other transitive relation on A which contains R, then R S. Example 12 A = {0, 1, 2}, R = {(0, 0), (0, 1), (1, 2)} 0 R 1 2 3 Equivalence Classes 1 0 R 2 Definition 13 Given an equivalence relation R on a set A, for each a A we define the equivalence class of a, denoted [a], to be the set [a] = {x A xra}. Note R is reflexive so a A, ara, i.e. a [a]. Lemma 14 (10.3.2) Given an equivalence relation R on a set A, a, b A, arb [a] = [b]. S.W.P. (See Epp p. 563) Lemma 15 (10.3.3) Given an equivalence relation R on a set A, a, b A, a Rb [a] [b] = φ. S.W.P. (See Epp p. 564) Theorem 16 Given an equivalence relation R on a set A, the distinct equivalence classes of R are a partition of A. Examples 1. = on Q. Equivalence classes are a b, c d Q such that a b = c d. Thus [ ] { 1 1 = 2 2, 2 4, 3 6, 4 } 8,..., [ ] { 1 1 = 3 3, 2 6, 3 9, 4 } 12,..., [ ] { 2 2 = 3 3, 4 6, 6 9, 8 } 12,..., etc. [ ] [ ] [ ] [ ] [ ] [ ] 1 2 3 1 2 3 Note that = = =..., = = =..., etc. 2 4 6 3 6 9 6

- 10 Relations P. Danziger When we talk about a number in Q we usually don t care what form it is in, 1 2, 2 4, 3,..., we consider 6 these all equivalent. Thus our usual[ conception ] of Q is in fact an idea of the equivalence classes of 1 Q under =. We should really write rather than 1 2 2. This illustrates the usfuleness of equivalence classes, they take out extra information from the set, leaving us with only that information wich we consider useful for a particular purpose. 2. Congruence modulo n ( n ). The equivalence classes are a, b Z such that a mod n = b mod n. [0] = {a Z k Z such that a = kn} [1] = {a Z k Z such that a = kn + 1} [2] = {a Z k Z such that a = kn + 2}. [n 2] = {a Z k Z such that a = kn 2} [n 1] = {a Z k Z such that a = kn 1} Note that... = [ 2n] = [ n] = [0] = [n] = [2n] =...,... = [ 2n + 1] = [ n + 1] = [1] = [n + 1] = [2n + 1] =..., etc. 3. Consider the relation S on R 2, given by u, v R 2, usv a R + such that u = av. S is an equivalence relation (Exercise: prove this). The equivalence classes of S are all those vectors in R 2 which have the same direction. Each unit vector defines an equivalence class. Thus the equivalence classes take out information about magnitude. We may represent each equivalence class by a point on the unit circle. 4 Antisymmetry and Order Relations Definition 17 A relation R on a set A is called antisymmetric if and only if a, b A, arb bra a = b Notes 1. In general if a relation has any element which is related to a different element then if it is antisymmetric then it is not symmetric and visa versa. 2. Antisymmetry allows for the possibility that R is reflexive. Example 18 1. A = {0, 1, 2}, R = {(0, 0), (1, 1), (2, 2)} This relation is both symmetric and antisymmetric. It is also reflexive. 7

- 10 Relations P. Danziger 2. A = {0, 1, 2}, (a) R a = {(0, 0), (0, 1), (1, 2), (1, 0)}. This relation is not antisymmetric ((0, 1) R and (1, 0) R a ), nor reflexive ((2, 2) R a ), nor transitive ((0, 2) R a, but (0, 1) R and (1, 2) R). (b) R b = {(0, 0), (0, 1), (1, 2)}. This relation is antisymmetric, but neither reflexive ((2, 2) R b ), nor transitive ((0, 2) R b ). (c) R c = {(0, 0), (1, 1), (2, 2), (0, 1), (1, 2)}. This relation is antisymmetric and reflexive, but not transitive ((0, 2) R c ). (d) R d = {(0, 0), (1, 1), (2, 2), (0, 1), (1, 2), (0, 2)} This relation is antisymmetric, it is also transitive and reflexive, it is the transitive closure of R c above. 3. > on N. There are no a, b N such that a > b and b > a, so the predicate of the implication is always false so and this releation is antisymmetric. a, b N. 4. The Divides Relation on Z +. a, b Z +, arb a b is antisymmetric: a b and b a implies that a = b. It is also reflexive (a a for all a Z + ) and transitive (transitivity of divisibility). 5. The Subset relation. Let A be any set, consider the set of subsets of A, P(A). B, C P(A), BRC B C eg A = {0, 1, 2} {0} {0, 1}, so {0}R{0, 1}. {0, 1} {0, 1, 2}, so {0, 1}R{0, 1, 2} etc. But {2} {0, 1}, so {2} R {0, 1}. This relation is reflexive (definition of set equality) and transitive (transitivity of (5.2.1 #3)). Definition 19 Given a binary relation, R, on a set A it is called a partial order if it is reflexive, antisymmetric and transitive. The idea is that in an antisymmetric relation, given two unequal elements a, b A then either arb or bra, but not both. If arb then a b, but if bra then b a. We use the symbol to avoid confusion with. This defines an order on the elements of A. However, not all elements are necessarily related, hence the term partial order 8

- 10 Relations P. Danziger Definition 20 Given a partial order R on a set A. 1. For any pair of elements a, b A they are called comparable if either arb or bra; otherwise they are called noncomparable. 2. If R is a partial order and every pair of elemets are comparable, then R is called a total order. 3. A subset C A is a chain if every pair of elements of C are comparable. 4. The length of the chain is one less than the number of elements of the chain. The idea of a partial order is that if arb, then a b. Since it is antisymmetric there is no ambiguity. However, not all elements are comparable, hence the term partial order. The chains define lines of comparable elements. Notes A partial order restricted to a chain is a total order. In a total order the entire set A is a chain. Example 21 1. on N is a total ordering. 2. The Divides Relation on Z + is a partial ordering. It is not a total ordering. 2 4 8 16..., so powers of 2 form a chain. Note that 4 12, but 8 12, so 8 and 12 are not comparable and {4, 8, 12} is not a chain. Also 3 4 so 3 and 4 are not comparable. 3. The Subset relation on A = {0, 1, 2}. {{0}, {0, 1}, {0, 1, 2}} and {{1}, {0, 1}, {0, 1, 2}} are both chains, but {{0}, {1}, {0, 1}, {0, 1, 2}} is not, since {0} and {1} are not comparable. Definition 22 Given a partial order R on a set A. An element a A is called maximal if x A, either x a or x and a are not comparable. An element a A is called a greatest element (or a maximum) if x A, x a. An element a A is called minimal if x A, arx or x and a are not comparable. An element a A is called a least element (or minimum) if x A, x a. 9

18.312: Algebraic Combinatorics Lionel Levine Lecture date: Feb 24, 2011 Lecture 7 Notes by: Andrew Geng 1 Partially ordered sets 1.1 Definitions Definition 1 A partially ordered set ( poset for short) is a set P with a binary relation R P P satisfying all of the following conditions. 1. (reflexivity) (x, x) R for all x P 2. (antisymmetry) (x, y) R and (y, x) R x = y 3. (transitivity) (x, y) R and (y, z) R (x, z) R In analogy with the order on the integers by size, we will write (x, y) R as x y (or equivalently, y x). We will use x < y to mean that x y and x y. When there are multiple posets in play, we can disambiguate by using the name of the poset as a subscript, e.g. x P y. Remark 2 The word partial indicates that there s no guarantee that all elements can be compared to each other i.e. we don t know that for all x, y P, at least one of x y and x y holds. A poset in which this is guaranteed is called a totally ordered set. Partially ordered sets can be visualized via Hasse diagrams, which we now proceed to define. Definition 3 Given x, y in a poset P, the interval [x, y] is the poset {z P x z y} with the same order as P. Definition 4 y covers x means [x, y] = {x, y}. strictly between x and y (and x y). That is, no elements of the poset lie Definition 5 The Hasse diagram of a partially ordered set P is the (directed) graph whose vertices are the elements of P and whose edges are the pairs (x, y) for which y covers x. It is usually drawn so that elements are placed higher than the elements they cover. 7-1

1.2 Examples 1. n (handwritten as n) is the set [n] with the usual order on integers. 2. The Boolean algebra B n is the set of subsets of [n], ordered by inclusion. (S T means S T ). Figure 1: Hasse diagrams of B 2 and B 3 {1, 2, 3} {1, 2} {1} {2} {2, 3} {1, 3} {1, 2} {1} {2} {3} B 2 B 3 3. D n = {all divisors of n}, with d d d d. Figure 2: D 12 = {1, 2, 3, 4, 6, 12} 12 4 6 2 3 1 4. Π n = {partitions of [n]}, ordered by refinement. 1 5. Generalizing B n, any collection P of subsets of a fixed set X is a partially ordered set ordered by inclusion. For instance, if X is a vector space then we can take P to be the set of all linear subspaces. If X is a group, we can take P to be the set of all subgroups or the set of all normal subgroups. 1 A partition of a set X is a set of disjoint subsets of X whose union is X. We say that a partition σ refines another partition τ (so, in the example, σ τ) if every σ i σ is a subset of some τ j(i) τ. 7-2

2 Maps between partially ordered sets Definition 6 A function f : P Q between partially ordered sets is order-preserving if x P y f(x) Q f(y). Definition 7 Two partially ordered sets P and Q are isomorphic if there exists a bijective, order-preserving map between them whose inverse is also order-preserving. Remark 8 For those familiar with topology, this should look like the definition of homeomorphic spaces spaces linked by a continuous bijection whose inverse is also continuous. A continuous bijection can fail to have a continuous inverse if the topology of the domain has extra open sets; and an order-preserving bijection between posets can fail to have a continuous inverse if the codomain has extra order information. 2.1 Examples 1. D 8 4 2. D 6 B 2 Figure 3: Hasse diagrams of isomorphic posets 8 4 4 3 6 {1, 2} 2 2 2 3 {1} {2} 1 1 1 D 8 4 D 6 B 2 3 Operations on partially ordered sets Given two partially ordered sets P and Q, we can define new partially ordered sets in the following ways. 7-3

1. (Disjoint union) P + Q is the disjoint union set P Q, where x P +Q y if and only if one of the following conditions holds. x, y P and x P y x, y Q and x Q y The Hasse diagram of P + Q consists of the Hasse diagrams of P and Q, drawn together. 2. (Ordinal sum) P Q is the set P Q, where x P Q y if and only if one of the following conditions holds. x P +Q y x P and y Q Note that the ordinal sum operation is not commutative. In P Q, everything in P is less than everything in Q. 3. (Cartesian product) P Q is the Cartesian product set, {(x, y) x P, y Q}, where (x, y) P Q (x, y ) if and only if both x P x and y Q y. The Hasse diagram of P Q is the Cartesian product of the Hasse diagrams of P and Q. Example 9 B n 2 2 }{{} n times Proof: Define a candidate isomorphism f : 2 2 B n (b 1,, b n ) {i [n] b i = 2}. It s easy to show that f is bijective. To check that f and f 1 are order-preserving, just observe that each of the following conditions is equivalent to the ones that come before and after it. (b 1,, b n ) (b 1,, b n) b i b i for all i {i b i = 2} {i b i = 2} f((b 1,, b n )) f((b 1,, b n)) Example 10 If k = p 1 p n is a product of n distinct primes, then D k B n. 7-4

The proof of Example 10 is similarly easy, using the isomorphism f : D k B n defined by i S p i S. 4. P Q is the set of order-preserving maps from Q to P, where f P Q g means that f(x) P g(x) for all x Q. The notation P Q can be motivated by a basic example. Example 11 P = Q = P Q n {}}{ 1 + + 1 k {}}{ 1 + + 1 n k {}}{ 1 + + 1 Perhaps more importantly, the following properties hold (the proof is the 15th homework problem). P Q+R P Q P R ( P Q ) R P Q R Example 12 The partially ordered set 2 2 is isomorphic to 3. Proof: The order-preserving maps are specified by f 1 (1) = f 1 (2) = 1, f 2 = id, and f 3 (1) = f 3 (2) = 2; so f 1 f 2 f 3. 4 Graded posets Definition 13 A chain of a partially ordered set P is a totally ordered subset C P i.e. C = {x 0,, x l } with x 0 x l. The quantity l = C 1 is its length and is equal to the number of edges in its Hasse diagram. Definition 14 A chain is maximal if no other chain strictly contains it. Definition 15 The rank of P is the length of the longest chain in P. Definition 16 P is graded if all maximal chains have the same length. 7-5

Figure 4: Hasse diagram of a poset that is not graded Definition 17 A rank function on a poset P is a map r : P {0,, n} for some n, satisfying the following properties. 1. r(x) = 0 for all minimal x (i.e. there is no y < x). 2. r(x) = n for all maximal x. 3. r(y) = r(x) + 1 whenever y covers x. Lemma 18 P is graded of rank n there exists a rank function r : P {0,, n}. Example 19 B n is graded, and cardinality is a rank function on B n. Proof: : If P is graded of rank n, define r(x) = #{y C y < x} where C is a maximal chain containing x. To check that this is well-defined, we need to show that it is independent of C. So suppose C and C are maximal chains containing x. Write C = C 0 {x} C 1 C = C 0 {x} C 1 where C 0 = {y C y < x} and C 0 = {y C y < x}. If C 0 C 0, then assuming without loss of generality that C 0 > C 0, the chain C 0 x C 1 would have length greater than n. P being graded of rank n disallows this, so C 0 = C 0 = r(x). This establishes that r(x) is well-defined. It is easy to see by maximality of the chains involved that r is indeed a rank function. 7-6

: Given a rank function r : P {0,, n} and a maximal chain C = {x 0,, x l }, we observe that x 0 is minimal (otherwise C could be extended by anything less than x 0 ), x l is maximal (otherwise C could be extended by anything greater than x l ), and x i+1 covers x i (otherwise the element between them could be inserted into C). Then r(x 0 ) = 0, r(x l ) = n, and r(x i+1 ) = r(x i ) + 1 for i = 0, 1,..., l 1, so we see that l = n. Remark 20 If a rank function exists, it is in fact uniquely defined. Corollary 21 Any interval in a graded poset is graded. Proof: For [x, y] P, use the rank function r [x,y] (z) = r P (z) r P (x). 5 Lattices Definition 22 A poset L is a lattice if every pair of elements x, y has a least upper bound x y (a.k.a. join), and a greatest lower bound x y (a.k.a. meet); i.e. z x y z x and z y z x y z x and z y. Example 23 B n is a lattice. The meet and join can be explicitly specified as S T = S T S T = S T, and this can serve as a mnemonic for the symbols. 7-7

Figure 5: Hasse diagram of part of a lattice x y x y x y 7-8

- 7.1 Functions P. Danziger 1 Basic Definitions Definition 1 A binary relation from A to B is called a function if for every element a A there is a unique element b B such that arb. Given a function, f, from A to B, we write f : A B. Given x A we denote the unique element of B which x is mapped to by f(x). The definition of function says two things: 1. a A, b B such that arb. i.e. f(x) is defined for each x A 2. a A, b, c B, (arb arc) b = c. i.e. f(x) is unique. To prove that a relation is a function we must prove 1 and 2 above. To show that a relation is not a function we must find a counterexample to either 1 or 2 above. Example 2 For each of the following relations determine whether they are functions. Prove it. 1. A = B = Z, xry y = x + 3. 1) x + 3 is defined for all x Z. 2) Let a Z and let b, c Z be such that b = a + 3 and c = a + 3. b = c. So this is a function. 2. > on N. 2R0 and 2R1, so image of 2 is not unique. Thus > is not a function. We say that such a relation is one to many, since one element of A is taken to many (more than one)elements of B. 3. f : R R, f(x) = x 2. 1) x 2 is defined for all x R. 2) Let x R, and let y, z R be such that y = x 2 and z = x 2. y = z. 4. f : R R, f(x) = x. x is not defined for x < 0, so this is not a function. 1

- 7.1 Functions P. Danziger 5. f : R + R, f(x) = x. 1) x is defined for all x R +. 2) Let x R +, and let y, z R be such that y = x and z = x y = z. So this is a function. Note the symbol a always means the positive square root of a. 6. f : R + R, f(x) = x 1 2. Let x R +, and let y, z R be such that y = x 1 2 and z = x 1 2 y 2 = z 2 y = ±z. So this is not a function. { x if x 0 7. f : R R, f(x) = x = x if x < 0 1) x is defined for all x R. 2) Let x R and let y, z R be such that y = x and z = x. If x 0 then y = x and z = x, so y = z. If x < 0 then y = x and z = x, so y = z. So f is a function. Note If the graph of a relation satisfies the property that every vertical line cuts the graph exactly once then the relation is a function. We will now consider some of the properties of functions. Definition 3 Given a function f from A to B 1. The domain is all those values x A where f(x) is defined. dom(f) = {a A f(x) is defined }. 2. The co-domain of f is B. 3. The image or range of f is the set of values in y B for which there is an a A such that f(a) = b. im(f) = {y B x A such that y = f(x)}. 4. Two functions f and g are equivalent if dom(f) = dom(g) and x dom(f), f(x) = g(x). We write f = g, or f(x) g(x). Example 4 1. f : R R, f(x) = x + 1 dom(f) = R, im(f) = R 2. f : Z Q, f(x) = x + 1 2 dom(f) = Z, im(f) = {x Q x Z 2x Z} 3. f : R R, f(x) = 2 x. dom(f) = R, im(f) = R +. 2

- 7.1 Functions P. Danziger 4. f : R R, f(x) = x + 1, g : R R, g(x) = f and g are equivalent. 1.1 Inverse of a function We can also consider inverses of functions. 1. Find the inverse of f : R R, f(x) = x + 3. If x and y in R, with y = x + 3, then x = y 3. So f 1 : R R, f 1 (x) = x 3. 2. Find the inverse of f : R + R, f(x) = x. If x and y in R, with y = x, then x = y 2. So f 1 : R + R +, f 1 (x) = x 2. 3. Find the inverse of f : R R, f(x) = x { x 2 1 x 1 if x 1 2 if x = 1 Let x, y R, with y = x, then y = ±x. So f 1 consists of pairs of the form (x, x) and (x, x) for every x R. Note that though f is a function f 1 is not. 2 Useful Functions 2.1 The Logarithmic Function (see also section 9.4) Definition 5 Given a, x R +, y R, with a 1, and x = a y, we define the logarithmic function as log a x = y. i.e. logarithms are the inverse operation to exponentiation: log a : R + R, log a x = y x = a y. Theorem 6 For all a, x, y R +, z R, with a 1 1. a log a x = x 2. log a (a z ) = z 3. log a (x z ) = z log a x 4. log a x + log a y = log a (xy) 5. log a x log a y = log a ( x y ) Proof: Exercise Suppose we wish to store a number n N, how many bits will it take? We know that m bits can represent any number from 0 to 2 m 1. Thus n can be stored in m = log 2 n + 1 bits. Unfortunately most calculators do not do log 2, they do either log 10, or ln = log e. We can often estimate the result. For example How many bits are needed to store 346? 2 8 < 346 < 2 9, so 8 < log 2 346 < 9, thus log 2 346 = 8. So we will need 9 bits. 3

- 7.1 Functions P. Danziger Theorem 7 (Change of Base) Given a, b, x R +, with a, b 1, then log a x = log b x log b a. Proof: Let a, b, x N +, and let y N be such that y = log a x. Then x = a y. (Definition of log a ) Let n R be such that a = b n, i.e. n = log b a. So x = a y = (b n ) y, but (b n ) y = b ny = b n log a x. (Algebra) Thus, taking logarithms on both sides of x = b n log a x, we get log b x = n log a x. So log b x = log b x = log b x n log b a. All of these functions are arithmetic functions, we can have other kinds of functions as well. 2.2 The Identity Function For any set X, we can define the identity function on X, ı X : X X, ı(x) = x. 2.3 Projections Given sets A and B, we can define the projection from A B onto either A or B. p 1 : A B A, p 1 (a, b) = a p 2 : A B B, p 2 (a, b) = b In general given n, i N, with i n and sets A 1, A 2,..., A n, we can define the projection onto the i th coordinate by p i : (A 1 A 2... A n ) A i, p i (a 1, a 2,..., a n ) = a i 2.4 Functions on Languages Let Σ be an alphabet we can define functions on languages over Σ. For example, consider l : Σ Z, l(x) = the length of the string x. Genreally we use Σ = {0, 1}. Suppose we wish to encode a bit string x Σ. We use an encoding function f : Σ Σ. The decoding function is then the inverse function f 1 : Σ Σ. There are essentially 2 reasons to encode a message - error detection/correction and cryptography. 2.4.1 32 bit CRC Checksum Consider x Σ } 32. {{.. Σ 32 }, as a packet of n 32 bit words to be sent to a remote machine. n (We may padd x with zeros so that it is a multiple of 32 bits.) Consider the function C : Σ Σ 32, C(x) = p 1 (x) XOR p 2 (x) XOR... XOR p n (x), where p i (x) is the i th 32 bit word of x (a projection). When we are sending a packet of data we calculate the checksum C on the packet, and send this as the last word in the packet. The receiving machine also calculates the checksum on the packet as it comes in, it then checks its 4

- 7.1 Functions P. Danziger result against the checksum which has been sent, if they don t match there has been an error, and the receiving machine can request that the packet be resent. Note that this error detection protocol is not 100% accurate. Since f is not one to one, it is possible for two different packets to have the same checksum. However it is widely used. 2.4.2 Error correction We wish to send a message over a noisy line. Assume that we wish to send characters from the set {A, B, C, D, E, F, G}. We encode each character of the message to a three digit number using the following encoding function: f(a) = 013, f(b) = 124, f(c) = 235, f(d) = 346, f(e) = 450, f(f ) = 561, f(g) = 602. Note that any two digits uniquely determine the third in a set. If we assume that there is at most one error in each letter, then if we recieve, for example, 642, we can correct this to 602, or G. This is an example of an error correcting code, it can correct at most one error per character (A-G) sent. 2.4.3 Hamming distance function Given n N + H : Σ n Σ n N, H(x, y) = the number of positions in which the strings x and y differ. Example 8 Let n = 3 H(001, 101) = 1, since 001 and 101 differ in only one position. H(001, 100) = 2, H(001, 110) = 3. 2.4.4 Encryption/Decryption We wish to create a password for entry into a system. Given n N +, the number of characters in the password, consider the function f : N +n N +, f(x 1, x 2,..., x n ) = x 1 x 2... x n. Suppose that a given sequence x 1, x 2,..., x n satisfies f(x 1, x 2,..., x n ) = a, for some number a N. a is stored in the system, we enter the sequence of numbers x 1, x 2,..., x n, the computer calculates f(x 1, x 2,..., x n ). It then checks this against the stored answer, a, if they match we get access. The advantage of this system is that it does not require the password itself to be stored anywhere in the system, only the result of f on the password. Even if we could get to the stored answer, a we would have to factor it in order to find x 1, x 2,..., x n. 2.5 Boolean Functions A Boolean function is a function f : {0, 1} n {0, 1} Any truth table naturally defines a boolean function, with T = 1 and F = 0, n is the number of inputs to the boolean expression. 5

- 7.1 Functions P. Danziger 2.6 Hashing functions p q p q f 1 1 1 f(1, 1) = 1 1 0 0 f(1, 0) = 0 0 1 1 f(0, 1) = 1 0 0 1 f(0, 0) = 1 Suppose we have a large database which needs to be able to access a record quickly given an identifying number x. We could define a large array A so that A[x] is the record corresponding to x, however if x is large, or the array is sparse, this is an inefficient use of memory. An example of such a database is student records. The record for the student is accessed by typing in a 9 digit student number. However there are considerably less than 10 9 students, to define an array of this size is both impractical and wasteful. The solution is a hashing function. A hashing function h : N + N +, takes a large number and returns a smaller one. When looking for a space to put a record, x, we put it in h(x). If h(x) is already used (this is called a collision) we try h(x) + 1, if this is used we try h(x) + 2 and so on until we find a free space. When searching for a particular record, indexed by x, we look first in h(x), if the record we want is not there we try h(x) + 1, then h(x) + 2, and so on until we find our record. For example consider h(x) = x/100 mod 5, 000, this allows for 5,000 spaces. n A[n].. 1543 987-654-321 1544 986-543-763 1546 1547 1548 986-548-705. We first place 987-654-321, h(987-654-321) = 1543. Now we wish to place 986543763, h(986-543-763) = 1543, but since this is used we go to the next free slot, 1544. The operation x/100 removes the last two digits. In fact the first two digits contain information (the year in which the student first registered), and so tend to be similar. Thus a much better idea would be to remove the first two digits, rather than the last two. 3 One to One and Onto Functions Definition 9 Given a function f : A B 1. f is called one to one (1-1) or injective if x 1, x 2 A, f(x 1 ) = f(x 2 ) x 1 = x 2. 2. f is called onto or surjective if y B, x A such that f(x) = y. 6.

- 7.1 Functions P. Danziger 3. If f is both one to one and onto (injective and surjective) it is called a one to one correspondence or a bijection. To show that a function f : A B is 1-1 Let x 1, x 2 A, with f(x 1 ) = f(x 2 ) Show that this implies that x 1 = x 2 To show that a function f : A B is onto Let y B. Find an x A such that y = f(x). To show that a function f : A B is not 1-1 Find x 1, x 2 A such that f(x 1 ) = f(x 2 ). To show that a function f : A B is not onto Find y B such that x A with f(x) = y. Example 10 Decide whether the following functions are bijections, prove it. 1. f : Z Z, f(x) = x + 1. Let x 1, x 2 Z, with f(x 1 ) = f(x 2 ). Thus x 1 + 1 = x 2 + 1 x 1 = x 2. (Algebra) Thus f is injective. Let y Z, consider x Z such that y = x + 1, then x = y 1. So, given y Z, take x = y 1 Z to get f(x) = y. Thus f is surjective. So f is a bijection. 2. g : Z Z, g(n) = 3n. Let n 1, n 2 Z, with g(n 1 ) = g(n 2 ). Thus 3n 1 = 3n 2 n 1 = n 2. (Algebra) Thus g is 1-1. 1 is not a multiple of 3 for any integer n Z. (QRT) Thus g is not surjective. So g is not a bijection. 3. h : R R, h(n) = 3n Let x 1, x 2 R, with h(x 1 ) = h(x 2 ). Thus 3x 1 = 3x 2 x 1 = x 2. (Algebra) Thus h is 1-1. Let y R, consider x R such that y = 3x, then x = 1y. 3 So, given y R, take x = 1 y R to get h(x) = y. 3 Thus h is surjective. So h is a bijection. 7

- 7.1 Functions P. Danziger 4. f : R R, f(x) = x 2. ( 1) 2 = 1 2, so f is not 1-1. There is no x R such that x 2 = 1, so f is not onto. f is not a bijection. 5. g : R + R, g(x) = x 2 Let x 1, x 2 R +, with g(x 1 ) = g(x 2 ), i.e. x 2 1 = x 2 2. x 1 = ±x 2, but x 1 > 0, and x 2 > 0, so x 1 = x 2. Thus g is 1-1. There is no x R such that x 2 = 1, so g is not onto. So g is not a bijection. 6. h : R + R +, h(x) = x 2. h is 1-1 as for g above. Let y R +, consider x R + so that y = h(x). y = x 2 x = y. So h is onto. Thus h is a bijection. Theorem 11 If f : X Y is a bijection, then the inverse of f, f 1 : Y X is also a bijection. Proof: Let f : X Y be a bijection, and let f 1 : Y X be its inverse. i.e. y Y, x X, f 1 (y) = x y = f(x). We wish to show that f 1 (x) is a bijection (1-1 and onto) 1-1 Let y 1, y 2 Y, x X, with x = f 1 (y 1 ) = f 1 (y 2 ). Then f(x) = y 1 and f(x) = y 2, so since f is a function, y 1 = y 2. Onto Let x X. [We must find a y Y such that f 1 (y) = x.] Take y Y to be y = f(x). 4 Composition of Functions Definition 12 Given two functions f : X Y and g : Y Z such that im(f) Y, we may define a new function g f : X Z, (g f)(x) = g(f(x)). This is g composed with f. Example 13 f : Z Z, f(x) = x + 1, g : Z Z, g(x) = x 2 (f g)(x) = f(g(x)) = f(x 2 ) = x 2 + 1. (g f)(x) = g(f(x)) = g(x + 1) = (x + 1) 2. Theorem 14 For any function f : X Y, f ı X = ı Y f = f 8

- 7.1 Functions P. Danziger Proof: Let x X. Since for any x X, ı X (x) = x, (f ı X )(x) = f(ı X (x)) = f(x). Let y Y be such that y = f(x), then (ı Y f)(x) = ı Y (f(x)) = ı Y (y) = y = f(x). Thus ı X is the identity of the operation of composition Theorem 15 If f : X Y is a bijection with inverse f 1 : Y X then f f 1 = ı Y and f 1 f = ı X Example 16 Let f : Q Q, f(x) = 2x + 1 Exercise: Show that f is a bijection. f 1 (x) = 1 (x 1) 2 (f f 1 )(x) = f(f 1 (x)) = f( 1(x 1)) = 2 ( 1 (x 1)) + 1 = x. 2 2 (f 1 f)(x) = f 1 (f(x)) = f 1 (2x + 1) = 1 ((2x + 1) 1) = x. 2 Theorem 17 If f : X Y and g : Y Z are both 1-1 functions, then g f is also 1-1. Proof: Let f : X Y and g : Y Z both be 1-1 functions. Let x 1, x 2 X be such that (g f)(x 1 ) = (g f)(x 2 ) Thus g(f(x 1 )) = g(f(x 2 )), but g is 1-1, so f(x 1 ) = f(x 2 ), but f is 1-1 so x 1 = x 2. Example 18 f : R R, f(x) = 10 x, g : R R, g(x) = 3x. Note that both f and g are 1-1, though f is not onto. (f g)(x) = f(g(x)) = f(3x) = 10 3x. Let x 1, x 2 R, with (f g)(x 1 ) = (f g)(x 2 ), i.e. 10 3x 1 = 10 3x 2 x 1 = x 2 (Take logarithms on both sides.) Theorem 19 If f : X Y and g : Y Z are both onto functions, then g f is also onto. Proof: Let f : X Y and g : Y Z both be onto functions. Thus every z Z is the image of some y Y under g, and this y is the image of some x X under f. So every z Z is the image of x X under g f. 9

Functions: basic terms Functions are often identified with the formulas that define them. EG: f (x ) = x 2 This point of view does not suffice in Discrete Math. necessarily defined over the real numbers. In discrete math, functions are not EG: f (x ) = 1 if x is odd, and 0 if x is even. So in addition to specifying the formula one needs to define the set of elements which are acceptable as inputs, and the set of elements into which the function outputs. DEF: A function f : A B is given by a domain set A, a codomain set B, and a rule which for every element a of A, specifies a unique element f (a) in B. f (a) is called the image of a, while a is called the pre-image of f (a). The range (or image) of f is defined by f (A) = {f (a) a A }. EG: Let f : Z R be given by f (x ) = x 2 Q1: What are the domain and co-domain? Q2: What s the image of -3? Q3: What are the pre-images of 3, 4? Q4: What is the range f (Z)? Solution: f : Z R is given by f (x ) = x 2 A1: domain is Z, co-domain is R A2: image of -3 = f (-3) = 9 A3: pre-images of 3: none as 3 isn t an integer! pre-images of 4: -2 and 2 A4: range is the set of perfect squares f (Z) = {0,1,4,9,16,25, }

Functions: Sub-ranges. The effect of functions on subsets of the domain is often important. DEF: Given a function f : A B. The pre-image set (or inverse image) of b is defined by f -1 (b) = {a A f (a)=b }. Given subsets S A and T B, the image set of S is defined by f (S ) = {f(a ) a S } and the pre-image set (or inverse image) of T is defined by f -1 (T ) = {a A f (a) T }. NOTE: Even when f is not invertible, the inverse image is defined! EG: f : Z R with f (x ) = x 2 Q1: Calculate f 1 (3) Q2: Calculate f 1 (4) Q3: Calculate f ( {-9,-5,-3,0,1,2,3,4} ) Q4: Calculate f 1 ({-9,-5,-3,0,0.25,1,2,2.25,3,4}) EG: f : Z R with f (x ) = x 2 A1: f 1 (3) = A2: f 1 (4) = {-2, 2} A3: f ( {-9,-5,-3,0,1,2,3,4} ) = {81,25,9,0,1,4,16} A4: f 1 ({-9,-5,-3,0,0.25,1,2,2.25,3,4}) = {0,-1,1,-2,2}

One-to-One, Onto, Bijection. Intuitively. Bijection means that when arrows reversed, a function results. Equivalently, that both one-to-one ness and onto ness occur. BAD: not 1-to-1. Reverse over-determined: BAD: not onto. Reverse under-determined: GOOD: Bijection. Reverse is a function: L6 14