Notes. Sets. Notes. Introduction II. Notes. Definition. Definition. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry.

Similar documents
Discrete Mathematics

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Recursive Algorithms. Recursion. Motivating Example Factorial Recall the factorial function. { 1 if n = 1 n! = n (n 1)! if n > 1

Lecture 1. Basic Concepts of Set Theory, Functions and Relations

3. Mathematical Induction

CS 3719 (Theory of Computation and Algorithms) Lecture 4

Lecture 16 : Relations and Functions DRAFT

Mathematics Review for MS Finance Students

A Little Set Theory (Never Hurt Anybody)

Handout #1: Mathematical Reasoning

Automata and Formal Languages

Basics of Counting. The product rule. Product rule example. 22C:19, Chapter 6 Hantao Zhang. Sample question. Total is 18 * 325 = 5850

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

INTRODUCTORY SET THEORY

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

Lecture 17 : Equivalence and Order Relations DRAFT

THE LANGUAGE OF SETS AND SET NOTATION

Mathematical Induction

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

Lecture Note 1 Set and Probability Theory. MIT Spring 2006 Herman Bennett

Math/Stats 425 Introduction to Probability. 1. Uncertainty and the axioms of probability

Logic in Computer Science: Logic Gates

LEARNING OBJECTIVES FOR THIS CHAPTER

Regular Languages and Finite Automata

Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi

Reading 13 : Finite State Automata and Regular Expressions

The Set Data Model CHAPTER What This Chapter Is About

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

Basic Probability Concepts

Follow links for Class Use and other Permissions. For more information send to:

SOLUTIONS TO ASSIGNMENT 1 MATH 576

Basic Concepts of Point Set Topology Notes for OU course Math 4853 Spring 2011

Elements of probability theory

This asserts two sets are equal iff they have the same elements, that is, a set is determined by its elements.

Basic Concepts of Set Theory, Functions and Relations

Quotient Rings and Field Extensions

Probability: Terminology and Examples Class 2, 18.05, Spring 2014 Jeremy Orloff and Jonathan Bloom

Cartesian Products and Relations

Regular Languages and Finite State Machines

You know from calculus that functions play a fundamental role in mathematics.

MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.436J/15.085J Fall 2008 Lecture 5 9/17/2008 RANDOM VARIABLES

Set Theory Basic Concepts and Definitions

The Graphical Method: An Example

1 Sets and Set Notation.

6.3 Conditional Probability and Independence

Continued Fractions and the Euclidean Algorithm

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

1 if 1 x 0 1 if 0 x 1


MA651 Topology. Lecture 6. Separation Axioms.

CHAPTER 3. Methods of Proofs. 1. Logical Arguments and Formal Proofs

Mathematics Course 111: Algebra I Part IV: Vector Spaces

Course Syllabus. MATH 1350-Mathematics for Teachers I. Revision Date: 8/15/2016

DIVISIBILITY AND GREATEST COMMON DIVISORS

Linear Algebra. A vector space (over R) is an ordered quadruple. such that V is a set; 0 V ; and the following eight axioms hold:

Examples of Functions

k, then n = p2α 1 1 pα k

Lecture 1 Introduction Properties of Probability Methods of Enumeration Asrat Temesgen Stockholm University

GROUPS ACTING ON A SET

ALMOST COMMON PRIORS 1. INTRODUCTION

MATH10040 Chapter 2: Prime and relatively prime numbers

Math 4310 Handout - Quotient Vector Spaces

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

DETERMINANTS IN THE KRONECKER PRODUCT OF MATRICES: THE INCIDENCE MATRIX OF A COMPLETE GRAPH

Student Outcomes. Lesson Notes. Classwork. Discussion (10 minutes)

Collinear Points in Permutations

COMBINATORIAL PROPERTIES OF THE HIGMAN-SIMS GRAPH. 1. Introduction

INCIDENCE-BETWEENNESS GEOMETRY

This chapter is all about cardinality of sets. At first this looks like a

Factorizations: Searching for Factor Strings

8 Divisibility and prime numbers

CMPSCI 250: Introduction to Computation. Lecture #19: Regular Expressions and Their Languages David Mix Barrington 11 April 2013

Set Theory: Shading Venn Diagrams

WOLLONGONG COLLEGE AUSTRALIA. Diploma in Information Technology

THE DIMENSION OF A VECTOR SPACE

Matrix Representations of Linear Transformations and Changes of Coordinates

Just the Factors, Ma am

Session 6 Number Theory

6.207/14.15: Networks Lecture 15: Repeated Games and Cooperation

INTRODUCTION TO TOPOLOGY

Georg Cantor ( ):

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 2. x n. a 11 a 12 a 1n b 1 a 21 a 22 a 2n b 2 a 31 a 32 a 3n b 3. a m1 a m2 a mn b m

Relational Databases

SCORE SETS IN ORIENTED GRAPHS

Chapter 3. Distribution Problems. 3.1 The idea of a distribution The twenty-fold way

Lecture Notes on Topology for MAT3500/4500 following J. R. Munkres textbook. John Rognes

Practical Guide to the Simplex Method of Linear Programming

On Lexicographic (Dictionary) Preference

Pigeonhole Principle Solutions

3515ICT Theory of Computation Turing Machines

Prime Numbers and Irreducible Polynomials

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 10

Mathematical Induction

How To Find Out What A Key Is In A Database Engine

Sudoku puzzles and how to solve them

def: An axiom is a statement that is assumed to be true, or in the case of a mathematical system, is used to specify the system.

6.080/6.089 GITCS Feb 12, Lecture 3

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1.

Discrete Maths. Philippa Gardner. These lecture notes are based on previous notes by Iain Phillips.

Transcription:

Sets Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Spring 2006 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 1.6 1.7 of Rosen cse235@cse.unl.edu Introduction I We ve already implicitly dealt with sets (integers, Z; rationals (Q) etc.) but here we will develop more fully the definitions, properties and operations of sets. set is an unordered collection of (unique) objects. Sets are fundamental discrete structures that form the basis of more complex discrete structures like graphs. Contrast this definition with the one in the book (compare bag, multi-set, tuples, etc). Introduction II The objects in a set are called elements or members of a set. set is said to contain its elements. Recall the notation: for a set, an element x we write x if contains x and otherwise. Latex notation: \in, \neg\in. x

Terminology I Two sets, and B are equal if they contain the same elements. In this case we write = B. {2, 3, 5, 7} = {3, 2, 7, 5} since a set is unordered. lso, {2, 3, 5, 7} = {2, 2, 3, 3, 5, 7} since a set contains unique elements. However, {2, 3, 5, 7} {2, 3}. Terminology II multi-set is a set where you specify the number of occurrences of each element: {m 1 a 1, m 2 a 2,..., m r a r } is a set where m 1 occurs a 1 times, m 2 occurs a 2 times, etc. Note in CS (Databases), we distinguish: a set is w/o repetition a bag is a set with repetition Terminology III We ve already seen set builder notation: O = {x (x Z) (x = 2k for some k Z)} should be read O is the set that contains all x such that x is an integer and x is even. set is defined in intension, when you give its set builder notation. O = {x (x Z) (x 8)} set is defined in extension, when you enumerate all the elements. O = {0, 2, 6, 8}

Venn Diagram set can also be represented graphically using a Venn diagram. U x y z B a C Figure: Venn Diagram More Terminology & Notation I set that has no elements is referred to as the empty set or null set and is denoted. singleton set is a set that has only one element. We usually write {a}. Note the different: brackets indicate that the object is a set while a without brackets is an element. The subtle difference also exists with the empty set: that is { } The first is a set, the second is a set containing a set. More Terminology & Notation II is said to be a subset of B and we write B if and only if every element of is also an element of B. That is, we have an equivalence: B x(x x B)

More Terminology & Notation III Theorem For any set S, S and S S (Theorem 1, page 81.) The proof is in the book note that it is an excellent example of a vacuous proof! Latex notation: \emptyset, \subset, \subseteq. More Terminology & Notation IV set that is a subset of B is called a proper subset if B. That is, there is some element x B such that x. In this case we write B or to be even more definite we write B Let = {2}. Let B = {x (x 100) (x is prime)}. Then B. Latex notation: \subsetneq. More Terminology & Notation V Sets can be elements of other sets. {, {a}, {b}, {a, b}} and {{1}, {2}, {3}} are sets with sets for elements.

More Terminology & Notation VI If there are exactly n distinct elements in a set S, with n a nonnegative integer, we say that S is a finite set and the cardinality of S is n. Notationally, we write S = n set that is not finite is said to be infinite. More Terminology & Notation VII Recall the set B = {x (x 100) (x is prime)}, its cardinality is B = 25 since there are 25 primes less than 100. Note the cardinality of the empty set: = 0 The sets N, Z, Q, R are all infinite. Proving Equivalence I You may be asked to show that a set is a subset, proper subset or equal to another set. To do this, use the equivalence discussed before: B x(x x B) To show that B it is enough to show that for an arbitrary (nonspecific) element x, x implies that x is also in B. ny proof method could be used. To show that B you must show that is a subset of B just as before. But you must also show that x((x B) (x )) Finally, to show two sets equal, it is enough to show (much like an equivalence) that B and B independently.

Proving Equivalence II Logically speaking this is showing the following quantified statements: ( x(x a x B) ) ( x(x B x ) ) We ll see an example later. The Power Set I The power set of a set S, denoted P(S) is the set of all subsets of S. Let = {a, b, c} then the power set is P(S) = {, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}} Note that the empty set and the set itself are always elements of the power set. This follows from Theorem 1 (Rosen, p81). The Power Set II The power set is a fundamental combinatorial object useful when considering all possible combinations of elements of a set. Fact Let S be a set such that S = n, then P(S) = 2 n

Tuples I Sometimes we may need to consider ordered collections. The ordered n-tuple (a 1, a 2,..., a n ) is the ordered collection with the a i being the i-th element for i = 1, 2,..., n. Two ordered n-tuples are equal if and only if for each i = 1, 2,..., n, a i = b i. For n = 2, we have ordered pairs. Cartesian Products I Let and B be sets. The Cartesian product of and B denoted B, is the set of all ordered pairs (a, b) where a and b B: B = {(a, b) (a ) (b B)} The Cartesian product is also known as the cross product. subset of a Cartesian product, R B is called a relation. We will talk more about relations in the next set of slides. Cartesian Products II Note that B B unless = or B = or = B. Can you find a counter example to prove this?

Cartesian Products III Cartesian products can be generalized for any n-tuple. The Cartesian product of n sets, 1, 2,..., n, denoted 1 2 n is 1 2 n = {(a 1, a 2,..., a n ) a i i for i = 1, 2,..., n} Notation With Quantifiers Whenever we wrote xp (x) or xp (x), we specified the universe of discourse using explicit English language. Now we can simplify things using set notation! x R(x 2 0) x Z(x 2 = 1) Or you can mix quantifiers: a, b, c R x C(ax 2 + bx + c = 0) Set Operations Just as arithmetic operators can be used on pairs of numbers, there are operators that can act on sets to give us new sets.

Set Operators Union The union of two sets and B is the set that contains all elements in, B or both. We write B = {x (x ) (x B)} Latex notation: \cup. Set Operators Intersection The intersection of two sets and B is the set that contains all elements that are elements of both and B We write B = {x (x ) (x B)} Latex notation: \cap. Set Operators Venn Diagram U B Sets and B

Set Operators Venn Diagram : Union U B Union, B Set Operators Venn Diagram : Intersection U B Intersection, B Disjoint Sets Two sets are said to be disjoint if their intersection is the empty set: B = U B Figure: Two disjoint sets and B.

Set Difference The difference of sets and B, denoted by \ B (or B) is the set containing those elements that are in but not in B. U B Figure: Set Difference, \ B Latex notation: \setminus. Set Complement The complement of a set, denoted Ā, consists of all elements not in. That is, the difference of the universal set and ; U \. Ā = {x x } U Figure: Set Complement, Latex notation: \overline. Set Identities There are analogs of all the usual laws for set operations. gain, the Cheat Sheet is available on the course web page. http://www.cse.unl.edu/cse235/files/ LogicalEquivalences.pdf Let s take a quick look at this Cheat Sheet

Proving Set Equivalences Recall that to prove such an identity, one must show that 1. The left hand side is a subset of the right hand side. 2. The right hand side is a subset of the left hand side. 3. Then conclude that they are, in fact, equal. The book proves several of the standard set identities. We ll give a couple of different examples here. Proving Set Equivalences I Let = {x x is even} and B = {x x is a multiple of 3} and C = {x x is a multiple of 6}. Show that B = C Proof. ( B C): Let x B. Then x is a multiple of 2 and x is a multiple of 3, therefore we can write x = 2 3 k for some integer k. Thus x = 6k and so x is a multiple of 6 and x C. (C B): Let x C. Then x is a multiple of 6 and so x = 6k for some integer k. Therefore x = 2(3k) = 3(2k) and so x and x B. It follows then that x B by definition of intersection, thus C B. We conclude that B = C Proving Set Equivalences II n alternative prove uses membership tables where an entry is 1 if it a chosen (but fixed) element is in the set and 0 otherwise. (Exercise 13, p95): Show that B C = Ā B C

Proving Set Equivalences II Continued B C B C B C Ā B C Ā B C 0 0 0 0 1 1 1 1 1 0 0 1 0 1 1 1 0 1 0 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 1 0 0 0 1 0 1 1 1 1 0 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 0 1 under a set indicates that an element is in the set. Since the columns are equivalent, we conclude that indeed, B C = Ā B C Generalized Unions & Intersections I In the previous example we showed that De Morgan s Law generalized to unions involving 3 sets. Indeed, for any finite number of sets, De Morgan s Laws hold. Moreover, we can generalize set operations in a straightforward manner to any finite number of sets. The union of a collection of sets is the set that contains those elements that are members of at least one set in the collection. n i = 1 2 n i=1 Generalized Unions & Intersections II Latex notation: \bigcup. The intersection of a collection of sets is the set that contains those elements that are members of every set in the collection. n i = 1 2 n i=1 Latex notation: \bigcap.

Computer Representation of Sets I There really aren t ways to represent infinite sets by a computer since a computer is has a finite amount of memory (unless of course, there is a finite representation). If we assume that the universal set U is finite, however, then we can easily and efficiently represent sets by bit vectors. Specifically, we force an ordering on the objects, say U = {a 1, a 2,..., a n } For a set U, a bit vector can be defined as { 0 if ai b i = 1 if a i for i = 1, 2,..., n. Computer Representation of Sets II Let U = {0, 1, 2, 3, 4, 5, 6, 7} and let = {0, 1, 6, 7} Then the bit vector representing is 1100 0011 What s the empty set? What s U? Set operations become almost trivial when sets are represented by bit vectors. In particular, the bit-wise Or corresponds to the union operation. The bit-wise nd corresponds to the intersection operation. Computer Representation of Sets III Let U and be as before and let B = {0, 4, 5} Note that the bit vector for B is 1000 1100. The union, B can be computed by 1100 0011 1000 1100 = 1100 1111 The intersection, B can be computed by What sets do these represent? 1100 0011 1000 1100 = 1000 0000 Note: If you want to represent arbitrarily sized sets, you can still do it with a computer how?

Conclusion Questions?