Block 1 - Sets and Basic Combinatorics. Main Topics in Block 1:

Similar documents
Elementary Combinatorics

Compound Probability. Set Theory. Basic Definitions

Slide 1 Math 1520, Lecture 13

November 6, Chapter 8: Probability: The Mathematics of Chance

CSE 21 Mathematics for Algorithm and System Analysis

Probability MAT230. Fall Discrete Mathematics. MAT230 (Discrete Math) Probability Fall / 37

Intermediate Math Circles November 1, 2017 Probability I

Probability. Ms. Weinstein Probability & Statistics

Define and Diagram Outcomes (Subsets) of the Sample Space (Universal Set)

Section Introduction to Sets

Chapter 1. Probability

MATHEMATICS 152, FALL 2004 METHODS OF DISCRETE MATHEMATICS Outline #10 (Sets and Probability)

The probability set-up

The next several lectures will be concerned with probability theory. We will aim to make sense of statements such as the following:

Chapter 2. Permutations and Combinations

Lecture 2: Sum rule, partition method, difference method, bijection method, product rules

8.2 Union, Intersection, and Complement of Events; Odds

Theory of Probability - Brett Bernstein

Reading 14 : Counting

Week 3 Classical Probability, Part I

Probability. The MEnTe Program Math Enrichment through Technology. Title V East Los Angeles College

Such a description is the basis for a probability model. Here is the basic vocabulary we use.

The probability set-up

Math 166: Topics in Contemporary Mathematics II

Probability (Devore Chapter Two)

Counting and Probability Math 2320

CHAPTER 8 Additional Probability Topics

Name: Exam 1. September 14, 2017

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Math236 Discrete Maths with Applications

CSCI 2200 Foundations of Computer Science (FoCS) Solutions for Homework 7

Section : Combinations and Permutations

Chapter 1. Probability

Finite Math - Fall 2016

Probability. Dr. Zhang Fordham Univ.

CIS 2033 Lecture 6, Spring 2017

If you roll a die, what is the probability you get a four OR a five? What is the General Education Statistics

November 8, Chapter 8: Probability: The Mathematics of Chance

EECS 203 Spring 2016 Lecture 15 Page 1 of 6

Discrete Structures for Computer Science

Combinatorics and Intuitive Probability

The study of probability is concerned with the likelihood of events occurring. Many situations can be analyzed using a simplified model of probability

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

CS1802 Week 6: Sets Operations, Product Sum Rule Pigeon Hole Principle (Ch )

SET THEORY AND VENN DIAGRAMS

7.1 Experiments, Sample Spaces, and Events

It is important that you show your work. The total value of this test is 220 points.

Mixed Counting Problems

Grade 7/8 Math Circles February 25/26, Probability

Probability and Counting Techniques

The topic for the third and final major portion of the course is Probability. We will aim to make sense of statements such as the following:

Chapter 5: Probability: What are the Chances? Section 5.2 Probability Rules

Unit 1 Day 1: Sample Spaces and Subsets. Define: Sample Space. Define: Intersection of two sets (A B) Define: Union of two sets (A B)

4.1 Sample Spaces and Events

Combinatorics: The Fine Art of Counting

CS1802 Week 6: Sets Operations, Product Sum Rule Pigeon Hole Principle (Ch )

Probability and Statistics. Copyright Cengage Learning. All rights reserved.

Discrete Mathematics with Applications MATH236

3 The multiplication rule/miscellaneous counting problems

Multiple Choice Questions for Review

Discrete Structures Lecture Permutations and Combinations

Math 42, Discrete Mathematics

MA 524 Midterm Solutions October 16, 2018

Sample Spaces, Events, Probability

CSC/MATA67 Tutorial, Week 12

2. Nine points are distributed around a circle in such a way that when all ( )

PROBABILITY. Example 1 The probability of choosing a heart from a deck of cards is given by

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 11

Principle of Inclusion-Exclusion Notes

Math Exam 2 Review. NOTE: For reviews of the other sections on Exam 2, refer to the first page of WIR #4 and #5.

Math Exam 2 Review. NOTE: For reviews of the other sections on Exam 2, refer to the first page of WIR #4 and #5.

In how many ways can we paint 6 rooms, choosing from 15 available colors? What if we want all rooms painted with different colors?

MATH 1324 (Finite Mathematics or Business Math I) Lecture Notes Author / Copyright: Kevin Pinegar

Basic Probability Models. Ping-Shou Zhong

CSE 312: Foundations of Computing II Quiz Section #2: Inclusion-Exclusion, Pigeonhole, Introduction to Probability (solutions)

Math 1313 Section 6.2 Definition of Probability

Probability Models. Section 6.2

MAT104: Fundamentals of Mathematics II Summary of Counting Techniques and Probability. Preliminary Concepts, Formulas, and Terminology

Permutations: The number of arrangements of n objects taken r at a time is. P (n, r) = n (n 1) (n r + 1) =

1. An office building contains 27 floors and has 37 offices on each floor. How many offices are in the building?

CHAPTER 7 Probability

Solution: This is sampling without repetition and order matters. Therefore

Chapter 2 Basic Counting

Sets. Definition A set is an unordered collection of objects called elements or members of the set.

Probability and Randomness. Day 1

Discrete mathematics

Introduction to probability

Georgia Department of Education Georgia Standards of Excellence Framework GSE Geometry Unit 6

Week 1: Probability models and counting

Mutually Exclusive Events

MATH CALCULUS & STATISTICS/BUSN - PRACTICE EXAM #1 - SPRING DR. DAVID BRIDGE

Sets, Venn Diagrams & Counting

Introduction. Firstly however we must look at the Fundamental Principle of Counting (sometimes referred to as the multiplication rule) which states:

Chapter 1: Sets and Probability

4.3 Rules of Probability

Chapter 5 - Elementary Probability Theory

Math 227 Elementary Statistics. Bluman 5 th edition

Chapter 3: Elements of Chance: Probability Methods

Important Distributions 7/17/2006

RANDOM EXPERIMENTS AND EVENTS

Transcription:

Block 1 - Sets and Basic Combinatorics Main Topics in Block 1: A short revision of some set theory Sets and subsets. Venn diagrams to represent sets. Describing sets using rules of inclusion. Set operations. Representation of these operations in Venn diagrams. The laws of set theory. Counting cardinalities of sets Cartesian products of sets. The Multiplication Principle. Power sets. Use of binary strings to count subsets. Partitions. The Addition Principle. The Principle of Inclusion-Exclusion Permutations and combinations. 1 Discrete Mathematics - Lecture Notes Part 1

Sets A set is any collection of objects such that we can tell whether any given object is in the set or not. The objects in the set are called the elements of the set. A set has no order and repeated elements are disregarded. Two sets are equal if they have exactly the same elements. Example We write {x Z 0 < x < 5} to represent the set of all integers which are positive and less than 5. This set is {1, 2, 3, 4}. The set {1, 3, 5, 5} is equal to the set {1, 3, 5}. On the left the element 5 occurs twice, but we only count it once. The sets {1, 3, 5} and {3, 5, 1} are equal since they have exactly the same elements. The sets {1, 3, 5} and {{1, 3, 5}} are not equal, e.g. 3 {1, 3, 5} but 3 {{1, 3, 5}}. The first set consists of the three elements 1, 3 and 5, the second set has just one element, namely the set {1, 3, 5}. 2 Discrete Mathematics - Lecture Notes Part 1

Venn diagrams for sets A Venn diagram is a method for visualising a set. When we are working with sets, they usually all have elements from some underlying universal set. If for example all elements from a set are integers (sv: heltal), the universal set would be the set of all integers, Z. In Swedish the universal set is called grundmängd, and we shall therefore call our universal sets G or U. In a Venn diagram, we draw the universal set as a big rectangle and the sets we work with are drawn as closed regions (usually circles, ovals or rectangles) inside it. Example Let G = {0, 1, 2, 3, 4, 5, 6} and consider the two sets A = {2, 3, 4} and B = {0, 3, 6, }. The Venn diagram for this scenario is as follows. A 4 2 3 6 0 B 1 G 3 Discrete Mathematics - Lecture Notes Part 1

Subsets A subset T of a set S, written T S, is a set all of whose elements are in the set S. Example The set {1, 3} is a subset of the set {1, 3, 5}: The Venn diagram is {1, 3} {1, 3, 5} G 1 3 T 5 S Any set is a subset of itself, e.g. {1, 3, 5} {1, 3, 5}. Any set has the empty set, usually denoted { } or, as a subset, e.g. {1, 3, 5}. A subset of a set S which is not all of S itself is called a proper subset (sv: äkta delmängd) of S. In the above example the set {1, 3} is a proper subset of the set {1, 3, 5}. We write to emphasise this. {1, 3} {1, 3, 5} 4 Discrete Mathematics - Lecture Notes Part 1

Binary Operations on Sets Union The union of sets S and T, S T, is the set of all elements which are in either of the sets S or T or in both. Example If S = {1, 2, 3} and T = {2, 3, 4} then S T = {1, 2, 3, 4}. The Venn diagram is G S 1 2 3 4 T Intersection (sv:snittet) The intersection of sets S and T, S T, is the set of elements which are in both the sets S and T. Example If S = {1, 2, 3} and T = {2, 3, 4} then S T = {2, 3}. The Venn diagram is G S 1 2 3 4 T 5 Discrete Mathematics - Lecture Notes Part 1

Set Difference The difference of the sets S and T, written S T, is the set of elements which are in the set S but not in T. Example If S = {1, 2, 3} and T = {2, 3, 4} then S T = {1}. The Venn diagram is S 1 2 3 4 T U Note that generally S T T S Symmetric Difference The symmetric difference of sets S and T is S T is the set of elements in S or T but not in both. Example If S = {1, 2, 3} and T = {2, 3, 4} then S T = {1, 4}. The Venn diagram is S 1 2 3 4 T U S T = (S T ) (S T ) 6 Discrete Mathematics - Lecture Notes Part 1

Complements The complement S of a set S is everything in the universal set G which is not in S. We can think of S as G S. Example If G = Z and S = {x x > 3 or x < 1} then S = { 1, 0, 1, 2, 3}. The Venn diagram is 1 S 0 2 1 U 3 You should be aware of the fact that the complement of a set S depends on the universal set. The operations of union, intersection, difference and symmetric difference depend on the sets S and T but not on the universal set. 7 Discrete Mathematics - Lecture Notes Part 1

Some universal sets of numbers The set of positive integers is Z + = {1, 2, 3, 4,...}. Note that 0 is not a positive integer. The set consisting of positive integers and 0 is the set of natural numbers (sv: naturliga tal) N = {0, 1, 2, 3, 4,...}. The set of negative integers is Z = { 1, 2, 3, 4,...}. Note that 0 is not a negative integer. The set of all integers is called Z. Z = Z + {0} Z. 8 Discrete Mathematics - Lecture Notes Part 1

Describing sets For many sets the easiest way of describing them is by listing their elements as we have done in the examples above. For example the set of even integers between 1 and 15 is {2, 4, 6, 8, 10, 12, 14}. But sometimes listing all elements of a set is too much work. E.g. the set of even integers between 1 and 1500 (inclusive) has 750 elements, and we cannot list them all. We write this set as {2, 4, 6, 8, 10,..., 1500}, where the...-symbol means and so on. We can use the...-symbol only when it is clear from the context which elements we mean. Another way of describing the same set would be by using rules of inclusion, e.g. {2n n Z, 1 n 750} or {x Z 1 x 1500, x is even}. 9 Discrete Mathematics - Lecture Notes Part 1

Some more sets described by rules of inclusion {( 1) i i i Z + } = { 1, 2, 3, 4, 5, 6, 7,...} {3x x N} = {0, 3, 6, 9, 12, 15, 18, 21,...} {2n + 1 n N} = {1, 3, 5, 7, 9,...} Combine the last two to get all positive, odd multiples of 3: {3(2n + 1) n N} = {3, 9, 15, 21,...} 10 Discrete Mathematics - Lecture Notes Part 1

Combining set operations The laws for combining set operations were covered on the introductory maths course. You can find all the laws in [J] Theorem 1.1.21, but here are a few of the more important ones. The Associative Laws for Union and Intersection Let A, B and C be subsets of a universal set G. Then (A B) C = A (B C) (A B) C = A (B C) Such identities can be illustrated by Venn diagrams, e.g. 11 Discrete Mathematics - Lecture Notes Part 1

Combining set operations The Distributive Laws Let A, B and C be subsets of a universal set G. Then A (B C) = (A B) (A C) A (B C) = (A B) (A C) 12 Discrete Mathematics - Lecture Notes Part 1

Combining set operations De Morgan s Laws Let A and B be subsets of a universal set G. Then (A B) = A B (A B) = A B 13 Discrete Mathematics - Lecture Notes Part 1

Counting Things If we toss a coin five times how many sequences of heads and tails can arise? In order to find this we use the multiplication principle. In this case we have five events recorded and for each there are two possible outcomes. The total number can be determined by looking at the number of options for each and multiplying these together. In this case it is 2 2 2 2 2 = 32 The multiplication principle states that if we have a procedure with n stages and each stage r has a r possible outcomes then the total number of possible outcomes is a 1 a 2 a 3... a n 14 Discrete Mathematics - Lecture Notes Part 1

Example On my shelf I have 12 different mathematics books and 6 different computing books. In how many ways can I select two books, one from each subject, to take on a weekend trip? Example In my local pizzeria they have 52 different pizzas on the menu, 8 kinds of drinks in their fridge and two kinds of salad. In how many ways can I choose a meal consisting of one pizza, one drink and one salad? Example Suppose we roll two dice. One die is blue and one die is red. How many possible rolls are there? How many outcomes are possible where the red die shows 6? How many outcomes are possible where the red die shows an even number and the blue die shows an odd number? 15 Discrete Mathematics - Lecture Notes Part 1

Example There are 2 n n-bit binary strings. Proof. We can find any n-bit binary string in n stages: Stage 1: Choose the 1st bit in the string Stage 2: Choose the 2nd bit in the string. Stage i: Choose the ith bit in the string. Stage n: Choose the nth bit in the string. At each stage we have precisely 2 choices, either the bit is 0 or the bit is 1, and each choice is independent of the previous choices. The multiplication principle with a 1 = a 2 = a 3 =... = a n = 2 thus gives us that there are 2 n n-bit binary strings. 16 Discrete Mathematics - Lecture Notes Part 1

Some more sets and their cardinalities The cardinality of a set S is the number of (distinct) elements in it. We let S denote this number. Example Let S = {2, 4, 6} then S = 3. Let A and B be subsets of the universal set U. The Cartesian product of A and B, written A B, consists of all ordered pairs (a, b) where a A and b B. Example Let A = {1, 2} and B = {a, b}, then A B = {(1, a), (1, b), (2, a), (2, b)} Note that in general A B B A. In our example B A = {(a, 1), (b, 1), (a, 2), (b, 2)}. Using the multiplication principle we find the cardinality A B = A B. 17 Discrete Mathematics - Lecture Notes Part 1

More general product sets Let A 1, A 2, A 3,..., A n be subsets of the universal set U. The product set consists of all n-tuples where a i A i for 1 i n. A 1 A 2 A 3... A n (a 1, a 2, a 3,..., a n ), Using the multiplication principle we find the cardinality A 1 A 2 A 3... A n = A 1 A 2 A 3... A n. 18 Discrete Mathematics - Lecture Notes Part 1

How do we show that two sets are the same size? We have two ways: 1. Count the number of elements in each set and check that they are equal. 2. Pair up the elements of the two sets. (This is also known as setting up a 1-1 correspondence (sv: bijektion) between the two sets, we shall learn more about 1-1 correpondences later in the course.) 19 Discrete Mathematics - Lecture Notes Part 1

Power sets The set of all subsets of a set X is called the power set of X and is denoted P(X). Result If X = n then P(X) = 2 n. We can prove this by pairing off the elements of P(X) with the elements in the set of all n-bit binary strings, and since we know that there are 2 n n-bit binary strings, there will thus also be 2 n elements of P(X). Suppose that X = {x 1, x 2,..., x n }, and let S be any subset of X, then we pair off S with the following unique n-bit binary string. Bit 1 is 1 if x 1 S and 0 if x 1 S; Bit 2 is 1 if x 2 S and 0 if x 2 S;. Bit i is 1 if x i S and 0 if x i S;. Bit n is 1 if x n S and 0 if x n S. Let us do this for a small example: 20 Discrete Mathematics - Lecture Notes Part 1

Example Suppose that X = {a, b, c}, and let S be any subset of X, then we use a 3-bit binary string to code S as follows: Bit 1 is 1 if a S and 0 if a S; Bit 2 is 1 if b S and 0 if b S; Bit 3 is 1 if c S and 0 if c S. The 1-1 correspondence between subsets and codes is thus subset {a} {b} {c} {a, b} {a, c} {b, c} {a, b, c} code 000 100 010 001 110 101 011 111 21 Discrete Mathematics - Lecture Notes Part 1

Partitions A collection of non-empty sets A 1, A 2, A 3,..., A n is a partition of the set X if the following two conditions hold. 1. The union of all the sets is X, that is X = A 1 A 2 A 3... A n. 2. The sets are pairwise disjoint, that is A i A j = when i j. The n sets A 1, A 2, A 3,..., A n are known as the parts of the partition, and since each element of X is in exactly one of the A i, we can conclude that X = A 1 + A 2 + A 3 +... + A n. This result is known as the addition principle. A 1 A 2 A 3... A n Example Suppose that in a bag of sweets there are 5 Dumle, and 7 mints and 8 jelly beans. How many sweets are there in the bag? X 22 Discrete Mathematics - Lecture Notes Part 1

Example On my shelf I have 5 Maths books, 3 Computing books and 4 Physics books. In how many ways can I choose a pair of books from different subjects among the books on my shelf? The solution to this is easily seen, when you note that I have exactly three different kinds of pair of subjects, namely A. Maths & Computing; B. Maths & Physics; C. Computing and Physics. Note also that the three categories A, B and C are disjoint so all pairs of books fall into precisely one of the categories. A B C pairs Using the multiplication principle, the selection in A can be done in 5 3 ways. Similarly there are 5 4 selections in B and 3 4 selections in C. Hence by the addition principle there are 5 3 + 5 4 + 3 4 = 47 ways of choosing a pair of books on different subjects among the books on my shelf. 23 Discrete Mathematics - Lecture Notes Part 1

The Principle of Inclusion-Exclusion Suppose we have two sets A and B and we know the sizes of these sets. Do we know the size of the union of these sets? Unfortunately, we cannot simply add the sizes of the individual sets, as if there are elements that lie in both sets they will be counted twice but will only count as one in the union. Thus for each element that is in both sets, and therefore is in the intersection of the sets, the sum of the sizes of the sets is one too great. Therefore in order to find the size of the union of the sets we have to sum the sizes of the individual sets and then subtract the size of the intersection of the sets. This gives: A B = A + B A B A B U 24 Discrete Mathematics - Lecture Notes Part 1

Example If A = {a, b, c, d} and B = {b, e, f} then: and A B = {a, b, c, d, e, f} A B = {b} A = 4, B = 3, A B = 6, A B = 1 We can therefore see that in this case A B = A + B A B. 25 Discrete Mathematics - Lecture Notes Part 1

Example If in a town 50% of people use buses, 40% of people use trains, and 20% of people use both, how many people use at least one of these forms of transport? Let U = the set of people in the town. Let A = the set of people who use buses. A = 50 100 U. Let B = the set of people who use trains. B = 40 100 U, A B = 20 100 U. Then: A B = A + B A B = 50 40 20 70 U + U U = 100 100 100 100 U Thus 70% of people in the town use at least one of these forms of transport. 26 Discrete Mathematics - Lecture Notes Part 1

The Principle of Inclusion-Exclusion for more than two sets The result extends to three (and even more!) sets: A B C = A + B + C A B A C B C + A B C A B U C Example How many integers in the set are not divisible by 2, 3, or 5? {1, 2, 3, 4, 5,..., 100} 27 Discrete Mathematics - Lecture Notes Part 1

Selections Two important examples 1. I know 4 children. In how many ways can I choose a pair of children where one is to help me do the gardening while the other is to help me with my maths exercises? 2. I know 4 children. In how many ways can I choose a pair of children to take to the cinema? The two examples are fundamentally different: In the first example I am making an ordered selection, i.e. choosing an ordered pair of children. In the second example I am making an unordered selection, i.e. choosing a set with 2 children in it. 28 Discrete Mathematics - Lecture Notes Part 1

Ordered selections without repetition Problem: How many ways are there of choosing an ordered selection of k objects from a set of n objects where repetition is not allowed? Such selections are called permutations of length k from n objects, and we denote their number by P (n, k). How many are there? By the multiplication principle we get that P (n, k) = n (n 1) (n 2) (n (k 1)). Or if you prefer a neater expression, use the factorial function and write n! P (n, k) = (n k)! Recall that n! (n factorial) is defined for all natural numbers n N: 0! = 1, 1! = 1, 2! = 2 1, 3! = 3 2 1. In general n! = n (n 1) (n 2) 3 2 1. 29 Discrete Mathematics - Lecture Notes Part 1

Unordered selections without repetition Problem: How many ways are there of choosing a subset of k elements from a set of n elements? Such selections are called combinations of k elements chosen from n, and we denote their number by ( ) n k This notation is read n choose k (sv: n över k). Some books use the alternative notation C(n, k) for such combinations. How many are there? Answer: ( ) n k = n! k!(n k)! Example The number of ways of choosing a subset of size 2 from {A,B,C,D} is ( ) 4 2 = 4! 2! 2! = 4 3 2 1 2 1 2 1 = 4 3 2 1 = 6, they are {A, B}, {A, C}, {A, D}, {B, C}, {B, D}, {C, D}. 30 Discrete Mathematics - Lecture Notes Part 1

( ) n n! Result There are = ways of choosing a subset k k!(n k)! of k elements from a set of n elements. Proof. Recall the problem of choosing an ordered list of k elements without repetition from a set of n elements. A. We found the number of such lists is P (n, k) = n! (n k)!. B. Now solve the problem again, but this time by following a 2-stage procedure: 1. First choose a set of k elements from the n elements. This can be done in ( n k) ways. This is the number we are seeking. 2. Next order the chosen set from stage 1 so that it becomes a list. This can be done in P (k, k) = k! ways. So by the multiplication principle the number of ordered lists of k elements chosen without repetition from a set of n elements is ( ) n k! k Comparing the two solutions from A and B, we thus have that ( ) n! n (n k)! = k! k which in turn yields the required formula for ( n k). 31 Discrete Mathematics - Lecture Notes Part 1

Examples 1. In how many ways can a committee with 12 members choose a chairperson, a treasurer and a secretary? Order? Yes! Answer: 12 11 10 2. How many rearrangements are there of the word DISKRET? Order? Yes! Answer: 7 6 5 4 3 2 1 = 7! 3. How many possible 4-digit PIN-codes are there for a credit card? Answer: By the multiplication principle there are 10 4 possible PIN-codes. 4. How many 4-digit PIN-codes for a credit card have a repeated digit? Answer: There are 10 4 possible PIN-codes for a credit card. P (10, 4) = 10 9 8 7 of these have no repeated digits, so have at least one repeated digit. 10 4 10 9 8 7 = 4960 32 Discrete Mathematics - Lecture Notes Part 1

Examples (cont.) 5. A poker hand consists of a selection of 5 cards from a deck of 52 cards. How many possible poker hands are there? Order? No! ( ) 52 Answer: 5 = 52 51 50 49 48. 5 4 3 2 1 6. How many possible poker hands are there where all five cards are of the same suit? Answer: There are ( ) ( 13 5 hands all hearts, 13 ) ( 5 hands all diamonds, 13 ) ( 5 hands all clubs and 13 ) 5 hands all spades. By the addition principle the number of such hands is thus ( ) 13 4 13 12 11 10 9 4 =. 5 5 4 3 2 1 7. This morning I was very sleepy and chose blindly a pair of socks from my drawer. Given that the drawer contained just 4 socks (3 black and 1 white), what is the chance that I am wearing a matching pair of socks today? Answer: Altogether there are ( 4 2) = 6 possible pairs of socks. Of these ( 3 2) = 3 are a black pair. I have thus a 50% chance of wearing a matching pair. 33 Discrete Mathematics - Lecture Notes Part 1