Sets and set operations



Similar documents
CS 3719 (Theory of Computation and Algorithms) Lecture 4

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

Set Theory Basic Concepts and Definitions

Discrete Mathematics

Mathematics Review for MS Finance Students

INTRODUCTORY SET THEORY

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

Automata and Formal Languages

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

THE LANGUAGE OF SETS AND SET NOTATION

Lecture 16 : Relations and Functions DRAFT

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

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

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

SOLUTIONS TO ASSIGNMENT 1 MATH 576

All of mathematics can be described with sets. This becomes more and

7 Relations and Functions

A Course in Discrete Structures. Rafael Pass Wei-Lung Dustin Tseng

Basic Concepts of Set Theory, Functions and Relations

Set operations and Venn Diagrams. COPYRIGHT 2006 by LAVON B. PAGE

3. Mathematical Induction

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

Georg Cantor and Set Theory

mod 10 = mod 10 = 49 mod 10 = 9.

A Little Set Theory (Never Hurt Anybody)

Regular Languages and Finite State Machines

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

Mathematical Induction. Lecture 10-11

Math 55: Discrete Mathematics

1. Prove that the empty set is a subset of every set.

Lecture 17 : Equivalence and Order Relations DRAFT

Elements of probability theory

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

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

Cartesian Products and Relations

MATH 289 PROBLEM SET 4: NUMBER THEORY

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

Handout #1: Mathematical Reasoning

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

3. SETS, FUNCTIONS & RELATIONS

Georg Cantor ( ):

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

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.

(IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

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

Decision making in the presence of uncertainty II

5.1 Radical Notation and Rational Exponents

1 if 1 x 0 1 if 0 x 1

6.3 Conditional Probability and Independence

Factorizations: Searching for Factor Strings

MA651 Topology. Lecture 6. Separation Axioms.

MATH10040 Chapter 2: Prime and relatively prime numbers

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

Cardinality. The set of all finite strings over the alphabet of lowercase letters is countable. The set of real numbers R is an uncountable set.

Book of Proof. Richard Hammack Virginia Commonwealth University

Collinear Points in Permutations

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

Reading 13 : Finite State Automata and Regular Expressions

Set Theory. 2.1 Presenting Sets CHAPTER2

LEARNING OBJECTIVES FOR THIS CHAPTER

SECTION 10-2 Mathematical Induction

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

SOLUTIONS TO EXERCISES FOR. MATHEMATICS 205A Part 3. Spaces with special properties

Computability Theory

E3: PROBABILITY AND STATISTICS lecture notes

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

Check Skills You ll Need. New Vocabulary union intersection disjoint sets. Union of Sets

3 Some Integer Functions

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

COUNTING SUBSETS OF A SET: COMBINATIONS

The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

Basic Probability Concepts

Licensed to: Printed in the United States of America

CS 103X: Discrete Structures Homework Assignment 3 Solutions

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

On Integer Additive Set-Indexers of Graphs

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

Math 3000 Section 003 Intro to Abstract Math Homework 2

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

MATH 304 Linear Algebra Lecture 9: Subspaces of vector spaces (continued). Span. Spanning set.

Turing Machines: An Introduction

Chapter 9. Systems of Linear Equations

Zero: If P is a polynomial and if c is a number such that P (c) = 0 then c is a zero of P.

SECTION 10-5 Multiplication Principle, Permutations, and Combinations

EQUATIONS and INEQUALITIES

Name: Section Registered In:

Full and Complete Binary Trees

Sample Induction Proofs

ON GENERALIZED RELATIVE COMMUTATIVITY DEGREE OF A FINITE GROUP. A. K. Das and R. K. Nath

Solving Systems of Linear Equations

INCIDENCE-BETWEENNESS GEOMETRY

1(a). How many ways are there to rearrange the letters in the word COMPUTER?

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

Chapter 11 Number Theory

Lecture 2: Universality

Math Week in Review #4. A proposition, or statement, is a declarative sentence that can be classified as either true or false, but not both.

A Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions

The Ideal Class Group

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

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

Transcription:

CS 441 Discrete Mathematics for CS Lecture 7 Sets and set operations Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square asic discrete structures Discrete math = study of the discrete structures used to represent discrete objects Many discrete structures are built using sets Sets = collection of objects Examples of discrete structures built with the help of sets: Combinations Relations Graphs 1

Set Definition: set is a (unordered) collection of objects. These objects are sometimes called elements or members of the set. (Cantor's naive definition) Examples: Vowels in the English alphabet V = { a, e, i, o, u } First seven prime numbers. X = { 2, 3, 5, 7, 11, 13, 17 } Representing sets Representing a set by: 1) Listing (enumerating) the members of the set. 2) Definition by property, using the set builder notation {x x has property P}. Example: Even integers between 50 and 63. 1) E = {50, 52, 54, 56, 58, 60, 62} 2) E = {x 50 <= x < 63, x is an even integer} If enumeration of the members is hard we often use ellipses. Example: a set of integers between 1 and 100 = {1,2,3, 100} 2

Important sets in discrete math Natural numbers: N = {0,1,2,3, } Integers Z = {, -2,-1,0,1,2, } Positive integers Z + = {1,2, 3. } Rational numbers Q = {p/q p Z, q Z, q 0} Real numbers R Russell s paradox Cantor's naive definition of sets leads to Russell's paradox: Let S = { x x x }, is a set of sets that are not members of themselves. Question: Where does the set S belong to? Is S S or S S? Cases S S?: S does not satisfy the condition so it must hold that S S (or S S does not hold) S S?: S is included in the set S and hence S S does not hold paradox: we cannot decide if S belongs to S or not Russell s answer: theory of types used for sets of sets 3

Equality Definition: Two sets are equal if and only if they have the same elements. Example: {1,2,3} = {3,1,2} = {1,2,1,3,2} Note: Duplicates don't contribute anything new to a set, so remove them. The order of the elements in a set doesn't contribute anything new. Example: re {1,2,3,4} and {1,2,2,4} equal? No! Special sets Special sets: The universal set is denoted by : the set of all objects under the consideration. The empty set is denoted as or { }. 4

Venn diagrams set can be visualized using Venn Diagrams: V={,, C } C Subset Definition: set is said to be a subset of if and only if every element of is also an element of. We use to indicate is a subset of. lternate way to define is a subset of : x (x ) (x ) 5

Empty set/subset properties Theorem S Empty set is a subset of any set. Proof: Recall the definition of a subset: all elements of a set must be also elements of : x (x x ). We must show the following implication holds for any S x (x x S) Since the empty set does not contain any element, x is always False Then the implication is always True. End of proof Subset properties Theorem: S S ny set S is a subset of itself Proof: the definition of a subset says: all elements of a set must be also elements of : x (x x ). pplying this to S we get: x (x S x S) which is trivially True End of proof Note on equivalence: Two sets are equal if each is a subset of the other set. 6

proper subset Definition: set is said to be a proper subset of if and only if and. We denote that is a proper subset of with the notation. proper subset Definition: set is said to be a proper subset of if and only if and. We denote that is a proper subset of with the notation. Example: ={1,2,3} ={1,2,3,4,5} Is:? Yes. 7

Cardinality Definition: Let S be a set. If there are exactly n distinct elements in S, where n is a nonnegative integer, we say S is a finite set and that n is the cardinality of S. The cardinality of S is denoted by S. Examples: V={1 2 3 4 5} V = 5 ={1,2,3,4,, 20} =20 = 0 Infinite set Definition: set is infinite if it is not finite. Examples: The set of natural numbers is an infinite set. N = {1, 2, 3,... } The set of reals is an infinite set. 8

Power set Definition: Given a set S, the power set of S is the set of all subsets of S. The power set is denoted by P(S). Examples: ssume an empty set What is the power set of? P( ) = { } What is the cardinality of P( )? P( ) = 1. ssume set {1} P( {1} ) = {, {1} } P({1}) = 2 Power set P( {1} ) = {, {1} } P({1}) = 2 ssume {1,2} P( {1,2} ) = {, {1}, {2}, {1,2} } P({1,2} ) =4 ssume {1,2,3} P({1,2,3}) = {, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} } P({1,2,3} = 8 If S is a set with S = n then P(S) =? 9

Power set P( {1} ) = {, {1} } P({1}) = 2 ssume {1,2} P( {1,2} ) = {, {1}, {2}, {1,2} } P({1,2} ) =4 ssume {1,2,3} P({1,2,3}) = {, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} } P({1,2,3} = 8 If S is a set with S = n then P(S) = 2 n N-tuple Sets are used to represent unordered collections. Ordered-n tuples are used to represent an ordered collection. Definition: n ordered n-tuple (x1, x2,..., xn) is the ordered collection that has x1 as its first element, x2 as its second element,..., and xn as its N-th element, N 2. Example: y x Coordinates of a point in the 2-D plane (12, 16) 10

Cartesian product Definition: Let S and T be sets. The Cartesian product of S and T, denoted by S x T, is the set of all ordered pairs (s,t), where s S and t T. Hence, S x T = { (s,t) s S t T}. Examples: S = {1,2} and T = {a,b,c} S x T = { (1,a), (1,b), (1,c), (2,a), (2,b), (2,c) } T x S = { (a,1), (a, 2), (b,1), (b,2), (c,1), (c,2) } Note: S x T T x S!!!! Cardinality of the Cartesian product S x T = S * T. Example: = {John, Peter, Mike} ={Jane, nn, Laura} x = {(John, Jane),(John, nn), (John, Laura), (Peter, Jane), (Peter, nn), (Peter, Laura), (Mike, Jane), (Mike, nn), (Mike, Laura)} x = 9 =3, =3 = 9 Definition: subset of the Cartesian product x is called a relation from the set to the set. 11

Set operations Definition: Let and be sets. The union of and, denoted by, is the set that contains those elements that are either in or in, or in both. lternate: = { x x x }. Example: = {1,2,3,6} = { 2,4,6,9} = { 1,2,3,4,6,9 } Set operations Definition: Let and be sets. The intersection of and, denoted by, is the set that contains those elements that are in both and. lternate: = { x x x }. Example: = {1,2,3,6} = { 2, 4, 6, 9} = { 2, 6 } 12

Disjoint sets Definition: Two sets are called disjoint if their intersection is empty. lternate: and are disjoint if and only if =. Example: ={1,2,3,6} ={4,7,8} re these disjoint? Yes. = Cardinality of the set union Cardinality of the set union. = + - Why this formula? 13

Cardinality of the set union Cardinality of the set union. = + - Why this formula? Correct for an over-count. More general rule: The principle of inclusion and exclusion. Set difference Definition: Let and be sets. The difference of and, denoted by -, is the set containing those elements that are in but not in. The difference of and is also called the complement of with respect to. lternate: - = { x x x }. Example: = {1,2,3,5,7} = {1,5,6,8} - ={2,3,7} 14