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

Similar documents
SETS AND FUNCTIONS JOSHUA BALLEW

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Exercises for Unit VI (Infinite constructions in set theory)

5 Set Operations, Functions, and Counting

MATH 3300 Test 1. Name: Student Id:

Lecture Notes on Discrete Mathematics. October 15, 2018 DRAFT

1.4 Cardinality. Tom Lewis. Fall Term Tom Lewis () 1.4 Cardinality Fall Term / 9

Introduction to Proofs

Chapter 1 : The language of mathematics.

Math 4603: Advanced Calculus I, Summer 2016 University of Minnesota Notes on Cardinality of Sets

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.

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

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

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

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

0 Logical Background. 0.1 Sets

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

Math 105A HW 1 Solutions

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

CITS2211 Discrete Structures (2017) Cardinality and Countability

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

FOUNDATIONS & PROOF LECTURE NOTES by Dr Lynne Walling

Reading 11 : Relations and Functions

Section 0. Sets and Relations

Math 300: Final Exam Practice Solutions

Prof. Ila Varma HW 8 Solutions MATH 109. A B, h(i) := g(i n) if i > n. h : Z + f((i + 1)/2) if i is odd, g(i/2) if i is even.

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

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 27

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

With Question/Answer Animations. Chapter 2

Set theory. Math 304 Spring 2007

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

POL502: Foundations. Kosuke Imai Department of Politics, Princeton University. October 10, 2005

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

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

Infinite constructions in set theory

Week Some Warm-up Questions

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

Foundations of Mathematics

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

Handout 2 (Correction of Handout 1 plus continued discussion/hw) Comments and Homework in Chapter 1

Principles of Real Analysis I Fall I. The Real Number System

Math Fall 2014 Final Exam Solutions

One-to-one functions and onto functions

MAT115A-21 COMPLETE LECTURE NOTES

Mathematics 220 Workshop Cardinality. Some harder problems on cardinality.

Chapter 1. Sets and Mappings

A Logician s Toolbox

2. Prime and Maximal Ideals

Finite and Infinite Sets

DO FIVE OUT OF SIX ON EACH SET PROBLEM SET

MATH 102 INTRODUCTION TO MATHEMATICAL ANALYSIS. 1. Some Fundamentals

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS

0 Sets and Induction. Sets

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

Foundations Revision Notes


Automata Theory and Formal Grammars: Lecture 1

Part II. Logic and Set Theory. Year

Discrete Mathematics

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch]

Notes. Relations. Introduction. Notes. Relations. Notes. Definition. Example. Slides by Christopher M. Bourke Instructor: Berthe Y.

Math 455 Some notes on Cardinality and Transfinite Induction

Lecture 10: Everything Else

Notes on ordinals and cardinals

Sets, Functions and Relations

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

Functions and cardinality (solutions) sections A and F TA: Clive Newstead 6 th May 2014

Theorems. Theorem 1.11: Greatest-Lower-Bound Property. Theorem 1.20: The Archimedean property of. Theorem 1.21: -th Root of Real Numbers

Lecture 3: Sizes of Infinity

Relations, Functions, and Sequences

CA320 - Computability & Complexity

Equational Logic. Chapter Syntax Terms and Term Algebras

Sets, Structures, Numbers

Part IA Numbers and Sets

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

Countability. 1 Motivation. 2 Counting

1.A Sets, Relations, Graphs, and Functions 1.A.1 Set a collection of objects(element) Let A be a set and a be an elements in A, then we write a A.

Automata and Languages

Theory of Computation

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

An Introduction to University Level Mathematics

CSE 20 DISCRETE MATH. Fall

MATH31011/MATH41011/MATH61011: FOURIER ANALYSIS AND LEBESGUE INTEGRATION. Chapter 2: Countability and Cantor Sets

Set Theory. CSE 215, Foundations of Computer Science Stony Brook University

Chapter 2 Sets, Relations and Functions

ACS2: Decidability Decidability

Section 7.5: Cardinality

Discrete Mathematics 2007: Lecture 5 Infinite sets

Relations Graphical View

Economics 204 Summer/Fall 2011 Lecture 2 Tuesday July 26, 2011 N Now, on the main diagonal, change all the 0s to 1s and vice versa:

Harvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability

MATH 13 SAMPLE FINAL EXAM SOLUTIONS

ABOUT THE CLASS AND NOTES ON SET THEORY

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

Some Basic Notations Of Set Theory

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

CHAPTER 8: EXPLORING R

6 CARDINALITY OF SETS

Chapter One. The Real Number System

Transcription:

Discrete Mathematics: Lectures 6 and 7 Sets, Relations, Functions and Counting Instructor: Arijit Bishnu Date: August 4 and 6, 2009 Our main goal is here is to do counting using functions. For that, we need to have some basic understanding of sets, relations and functions. This notes is mainly based on [1, 2, 3, 4]. 1 Sets A set, as we all know by now, is a collection of elements. We are also familiar with the ways of writing or representing a set. For example, N = {1, 2,...} denotes the set of natural numbers. We would use N to denote natural numbers, Z to denote the set of integers, Q to denote the set of rational numbers, R to denote the set of real numbers and C to denote the set of complex numbers. N n denotes the set of natural numbers 1, 2,..., n. The cardinality of a set A will be denoted by A. A set A is said to be a finite set if A is finite, i.e. A <. A set A is said to be a subset of B denoted as A B if every element of A is an element of B. The power set of A, denoted as P (A), is the collection of all subsets of A. If A = n, P (A) = 2 n (why?). Funny things happen with sizes of infinite sets. Two sets are said to be equinumerous, if they have the same cardinality. Two infinite sets can also be equinumerous. Consider the sets N, Z, Q and R. All these four are examples of infinite sets. We can also see the following: N Z Q R. So, one should expect that N < Z < Q < R. But, strangely it so happens that Q and Z are equinumerous with N. We would come back to the technique of proving two sets to be equinumerous after studying functions. Countability of sets is very crucial to the study of computer science. This notion of countability (or its opposite, uncountability!) leads to the fact that computers cannot solve all problems. Just try solving the following decision problem: Given a particular input to a particular computer program, the problem is to determine whether the program will terminate after a finite number of steps on the given input. This problem is known as the halting problem and is undecidable. One might observe that we have not defined sets very formally and have relied on an intuitionistic notion. This might give rise to paradoxes like the famous Russell s paradox. To get rid of such paradoxes, set theory has been recast in formal terms where all properties of sets are built from some axioms. But, for the sets that we will be considering in this course, no such paradoxes will arise. So, we work with this intuitionistic notion of sets. 1

2 Cartesian product and relations 2.1 Ordered and unordered pairs Let us first look at unordered pairs and ordered pairs. The symbol {a, b} denotes the set that contains just the elements a and b. Also, {a, b} = {b, a}, i.e. the elements of the set {a, b} can appear in any order. We call {a, b} to be an unordered pair of a and b. In contrast, for ordered pairs, the order of the elements matters. We denote an ordered pair involving a and b as (a, b); (a, b) (b, a). (a, b) = (c, d) if and only if a = c and b = d. We can similarly have an ordered n-tuple involving a 1, a 2,..., a n, which is denoted as (a 1, a 2,..., a n ). Definition 1 The Cartesian product A B of two sets A and B is the set of all ordered pairs (a, b), where a A and b B. In set-theoretic notations, A B = {(a, b) a A, b B}. If A and B are finite sets, the cardinality of A B is A B. Is A B = B A? No, as the operation is not commutative. 2.2 Relation Definition 2 A Relation is a set of ordered pairs. Given two sets A and B, any subset of the Cartesian product A B is called a relation between A and B. We denote a relation R from A to B as R : A B. If an ordered pair (a, b) belongs to a relation R, i.e. (a, b) R, we say that a and b are related by R. We also denote it as arb. If A = B, then R : A A is a relation from A to itself. Example 1 Let us consider equality (=). We can define equality as a relation R : N N. R contains {(1, 1), (2, 2), (3, 3),...}. Similarly, we can define less than equal to ( ) as a relation, the set being {(2, 1), (3, 2), (3, 1), (4, 3), (4, 2), (4, 1),...}. How many possible relations can there be? Any subset of a Cartesian product is a relation. Hence, the possible number of relations is 2 A B. Let A, B, C be sets with the following relations: R : A B, S : B C. The composition of relations R and S, denoted as R S, is the relation T : A C defined as follows: for given a A and c C, at c holds if and only if there exists some b B such that arb and bsc. A relation can satifsy some conditions and based on that we can have special types of relations. Definition 3 We say that a relation R on a set A is reflexive if (a, a) R, a A, 2

symmetric if (a, b) R implies (b, a) R, a, b A, transitive if (a, b) R and (b, c) R imply (a, c) R, a, b, c A. antisymmetric if (a, b) R and (b, a) R imply a = b, a, b A. 2.2.1 Equivalences A special type of relation is known as equivalence. Definition 4 We say that a relation R on A is an equivalence on A if its reflexive, symmetric and transitive. Example 2 Let T be the set of all triangles in the plane. We say that two triangles t 1, t 2 T are related, i.e. (t 1, t 2 ) R if and only if they are congruent. Two triangles are congruent if one can be transformed into the other by translation and rotation. Clearly, R is an equivalence relation. Example 3 Let T = {(a, b) a, b N, and a = b}. Clearly, T is an equivalence relation. Exercise 1 Consider the following statement: Suppose R is a relation on X. If R is symmetric and transitive, then R is reflexive. As a proof of the above statement, consider the following. Let x be an arbitrary element in X. Let y X such that (x, y) R. Since, R is symmetric, (y, x) R. Now, since (x, y) R and (y, x) R, by transitivity, (x, x) R. If what has been proved is correct, then for equivalences, the reflexivity condition is redundant. Solution: There is a fallacy in the argument. The basic fallacy is to assume that such a y exists. It is possible that there is an x X, that is not related to anything else by R. No such R will be reflexive. Consider the empty relation on any non-empty set X. It is symmetric and transitive but not reflexive. Consider also an example. Let R = {(a, a), (a, b), (b, a), (b, b)} on X = {a, b, c}. R is symmetric and transitive but (c, c) R, so R is not reflexive. The notion of equivalence class is related to equivalence. The equivalence classes form a partition of the set A. A partition of A is a collection of non-empty disjoint subsets of A whose union equals A. Let R be an equivalence on a set A and let a A. Now, R[a] = {b b A and (a, b) R}. R[a] denotes the equivalence class of R determined by a. Exercise 2 For any equivalence R on A, prove the following: (i) R[a] is non-empty a A. (ii) For any two elements a, b A, either R[a] = R[b] or R[a] R[b] =. 3

(ii) The equivalence classes determine the relation R uniquely, i.e. if R 1 and R 2 are two equivalences on A and if the equality R 1 [a] = R 2 [a] holds for a A, then R 1 = R 2. Equivalence class induces a pairwise disjoint partition of A whose union is A. Conversely, any partition of A determines exactly one equivalence on A. That is, there exists a bijective mapping of the set of all equivalences on A onto the set of all partitions of A. 2.2.2 Ordered sets Definition 5 A partial order R on A is a reflexive, antisymmetric and transitive relation on A. An ordered set is a pair (A, R), where A is a set and R is an ordering on A. This is also refered to as partially ordered sets or posets. Examples of ordered sets are (R, ) and (N, ). If for any two distinct elements a, b A, either a b or b a holds, then A is said to have a linear ordering or a total ordering. The sets R and N admit a linear ordering. Consider the following relation R on N: R = {(a, b) a, b N and a c N, such that b = ac}. Exercise 3 Verify whether R is both a partial ordering and linear ordering on N. Exercise 4 Let A be a set and 2 A denotes the system of all subsets of the set A. Does the relation define a partial ordering on 2 A? 9 8 7 6 5 4 3 2 (a) Hasse diagram for ({2, 3, 4, 5, 6, 7, 8, 9}, ). 8 4 2 10 6 3 9 (b) Hasse diagram for N 10 ordered by divisibility. Figure 1: Examples of Hasse diagram. Hasse diagram: Partially ordered sets can be pictorially represented by Hasse diagram. Here the conditions can be represented by arrows. But, not all arrows are 4 1 5 7

to be drawn. If R is a partial order and (a, b) R is represented as an arrow from a to b and (b, c) R is also represented as an arrow b to c, then we may omit the arrow from a to c and take it as implicit. Similarly, we can forget about loops as we can assume they are always there. Also, if we always draw the ordering relation from top to bottom, we can get rid of the arrows and represent the relations using line segments. It can be proved that for finite posets, all the information is captured by the relation of immediate predecessor. The ordering can be reconstructed from the immediate predecessor relation. We omit the proof. One can go through [1] for the proof. The relation of immediate predecessor is the basis of drawing the Hasse diagram. 3 Function We look at functions and its use in counting. Let us first define a function. Definition 6 A function f from the set A to B is a relation from A to B satisfying the following condition: - for each a A, there exists a unique b B with (a, b) f. The set A is the domain of f and B is the codomain or range of f. A function f from A to B is denotes as f : A B. If A =, then the only function from A to B is the empty set. On the other hand, if A and B =, then there are no functions. If both A and B are non-empty, then there are B choices for each element of A. So, the total number of functions possible is B A. Look at the following algebraic inequality. Is it true that y x 2 xy for all positive integers x and y? Set A = x and B = y and use the fact that the number of functions has to be less than equal to the number of relations as function is a special type of relation. Now, for some special types of functions. Definition 7 Let A and B be two non-empty sets. The function f : A B is a one-to-one or injective function if no two elements of A are mapped to the same element of B, i.e. for a, b A and f(a), f(b) B, a b implies f(a) f(b). a onto function or surjective function if for every b B there exists a A satisfying f(a) = b. a bijective function if f is both one-to-one and onto. If f is a bijection, then its converse denoted as f 1 is called the inverse of f. The bijections are the only functions for which the converse relation is also a function. Note that, if f is a bijection, then f(a) = b if and only if f 1 (b) = a. 5

Exercise 5 Let f : A B and g : B C be two functions. Prove the following: (i) if f and g are one-to-one functions, then g f is also a one-to-one function. (ii) if f and g are onto functions, then g f is also a function onto. (iii) if f and g are bijective functions, then g f is also a bijective function. (iv) Show that any function can be written as a composition of a one-to-one function and an onto function. 3.1 Functions and counting We now look at the relations between the cardinalities of the sets satisfying a functional mapping and then explore what we promised at the very beginning: counting is possible by transforming the problem to functions. Observation 1 Let A and B be two sets such that f : A B where f is a one-toone function. Then, A B. Observation 2 Let A and B be two sets such that f : A B where f is a function onto. Then, A B. These two observations intuitively points to some relation about the cardinality of two sets having a bijection. In effect, there exists a theorem that says two sets are equinumerous if and only if there is a bijection between them. We state it without the proof. Interested students might look at [4]. Theorem 1 (Cantor-Schröder-Bernstein theorem) Two sets A, B are equinumerous if and only if there exists a bijection f : A B between them. Let us look at the following two problems that is already known to you from your high school days. Problem 1 How many 4-letter words can be formed using smaller case English alphabets? Problem 2 How many 4-letter words can be formed using smaller case English alphabets where all letters are distinct? Well, you all know. The solution to Problem 1 is 26 4 as all four places can be filled up in 26 ways. The solution to Problem 2 is 26 25 24 23. Let us recast these problems in terms of functions. Let A = {w 1, w 2, w 3, w 4 } and B = {a, b,..., z}. Here, B = 26 and A = 4. The solution to Problem 1 is nothing but counting the number of possible mappings of the function f : A B which we know to be B A. What about a formal proof? 6

Proposition 1 Let A and B be two sets with B 1. Then, the number of all possible mappings f : A B is B A. Proof: As the basis of induction, we have the function f : B. Here, f will be the empty set as no ordered pairs are there. So, we have exactly 1 mapping. Under the assumption that A and B are non-empty sets, we could have proved the basis of the induction with A = 1 also. Then also there is only 1 mapping. The rest of the proof is left as an exercise. Sketch of the proof was discussed in the class. Exercise 6 How many boolean functions are possible with n boolean variables? Exercise 7 How many subsets does a set A with A have? Prove using the concept of functions. Solution: Consider any arbitrary set A A. Define a mapping f A : A {0, 1} as follows. For, an element a A, we have { 1 if a A; f A (a) = 0 if a A. Distinct sets A have distinct mappings f A. Conversely, any given mapping f : A {0, 1} determines a subset A A with f = f A. So, the number of mappings, which is 2 A, is the same as all possible subsets of A. What about the solution to Problem 2? Again, let A = {w 1, w 2, w 3, w 4 } and B = {a, b,..., z}. The solution to Problem 2 is nothing but counting the number of possible injective mappings f : A B. Let us now count the number of possible injective maps from a set A, with cardinality A, to a set B, with cardinality B. Proposition 2 Let A and B be two non-empty sets with A, B > 0. Then, the number of all possible one-to-one or injective maps f : A B is B ( B 1) ( B A + 1) = A 1 ( B i). i=0 Proof: We proceed by induction on A. First notice that, with A > B, there exists no (i.e. 0) injective map. The formula tallies with that. For the basis of the induction, with A = 1, there are B choices for an element a A to be mapped to an element in B. This also tallies with the formula. Let, now A 1 and B A. The proof sketch is as follows. Fix a A and choose f(a) B arbitrarily in one of B possible ways. To complete the injective function, next we need to find an injective map from A\a to B \f(a). The number of such inductive maps, by the induction hypothesis, is ( B 1)( B 2) (( B 1) ( A 1)+1). Thus, the final result is the product of ( B 1)( B 2) ( B A +1) and B, i.e. A 1 i=0 ( B i). Next, we introduce counting using bijections. 7

Example 4 Let A be a set with cardinality A = n 1. Show that A has exactly 2 n 1 subsets of an odd size and exactly 2 n 1 subsets of an even size. Solution: Fix an element a A. We know from Exercise 7, that the number of subsets of an n-element set is 2 n. So, the number of subsets of the set A \ {a} will be 2 (n 1). Our idea is to set up a bijection between all subsets of A \ {a} AND all odd-sized subsets of A. Any subset A A \ {a} can be extended to another subset A A, such that A is odd-sized, as follows: 1. if A is odd, set A = A ; 2. if A is even, set A = A {a}. One can easily verify that the above rule is a bijection between all subsets of A \ {a} AND all odd-sized subsets of A. Hence, the result. Exercise 8 How many 8-digit sequences consisting of digits 0 to 9 are there? How many of them contain an even number of odd digits? References [1] J. Matoušek and J. Nešetřil, Invitation to Discrete Mathematics, Oxford University Press, New York, 1998. [2] C. L. Liu, Elements of Discrete Mathematics, Tata McGraw Hill, New Delhi, 2000. [3] Martin J. Erickson, Introduction to Combinatorics, Wiley-Interscience Publication, John Wiley & Sons. [4] Abhijit Das, Sizes of sets, Personal communication. 8