CSCI FOUNDATIONS OF COMPUTER SCIENCE

Similar documents
Sec$on Summary. Permutations Combinations Combinatorial Proofs

Section Summary. Permutations Combinations Combinatorial Proofs

The Product Rule The Product Rule: A procedure can be broken down into a sequence of two tasks. There are n ways to do the first task and n

With Question/Answer Animations. Chapter 6

Counting. Chapter 6. With Question/Answer Animations

Discrete Structures Lecture Permutations and Combinations

Sec.on Summary. The Product Rule The Sum Rule The Subtraction Rule (Principle of Inclusion- Exclusion)

Sec 5.1 The Basics of Counting

With Question/Answer Animations. Chapter 6

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6

Topics to be covered

Discrete Mathematics. Spring 2017

Discrete Mathematics: Logic. Discrete Mathematics: Lecture 15: Counting

Permutations and Combinations

CPCS 222 Discrete Structures I Counting

6.1 Basics of counting

Permutations and Combinations

DISCRETE STRUCTURES COUNTING

The Product Rule can be viewed as counting the number of elements in the Cartesian product of the finite sets

What is counting? (how many ways of doing things) how many possible ways to choose 4 people from 10?

COUNTING TECHNIQUES. Prepared by Engr. JP Timola Reference: Discrete Math by Kenneth H. Rosen

Jong C. Park Computer Science Division, KAIST

Discrete Mathematics with Applications MATH236

Permutations and Combinations

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

Introductory Probability

Today s Topics. Sometimes when counting a set, we count the same item more than once

Section : Combinations and Permutations

Mat 344F challenge set #2 Solutions

Theory of Probability - Brett Bernstein

9.5 Counting Subsets of a Set: Combinations. Answers for Test Yourself

Outline. Content The basics of counting The pigeonhole principle Reading Chapter 5 IRIS H.-R. JIANG

CSE 312: Foundations of Computing II Quiz Section #2: Combinations, Counting Tricks (solutions)

Lecture 18 - Counting

Probability Theory. Mohamed I. Riffi. Islamic University of Gaza

Counting in Algorithms

Combinatorial Proofs

2. How many bit strings of length 10 begin with 1101? a b. 2 6 c. 2 4 d. None of the above.

Reading 14 : Counting

COUNTING AND PROBABILITY

Permutations and Combinations. Quantitative Aptitude & Business Statistics

Math 42, Discrete Mathematics

Math 166: Topics in Contemporary Mathematics II

MA 524 Midterm Solutions October 16, 2018

Counting: Basics. Four main concepts this week 10/12/2016. Product rule Sum rule Inclusion-exclusion principle Pigeonhole principle

Multiple Choice Questions for Review

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

Generalized Permutations and The Multinomial Theorem

Well, there are 6 possible pairs: AB, AC, AD, BC, BD, and CD. This is the binomial coefficient s job. The answer we want is abbreviated ( 4

Chapter 2. Permutations and Combinations

Math236 Discrete Maths with Applications

Combinations AMC AMS AMR ACS ACR ASR MSR MCR MCS CRS

DISCUSSION #8 FRIDAY MAY 25 TH Sophie Engle (Teacher Assistant) ECS20: Discrete Mathematics

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

Elementary Combinatorics CE 311S

Counting and Probability Math 2320

Problems from 9th edition of Probability and Statistical Inference by Hogg, Tanis and Zimmerman:

THE PIGEONHOLE PRINCIPLE. MARK FLANAGAN School of Electrical and Electronic Engineering University College Dublin

CSE 21 Mathematics for Algorithm and System Analysis

NOTES ON SEPT 13-18, 2012

Mathematical Foundations of Computer Science Lecture Outline August 30, 2018

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

Section 6.1 #16. Question: What is the probability that a five-card poker hand contains a flush, that is, five cards of the same suit?

MC215: MATHEMATICAL REASONING AND DISCRETE STRUCTURES

CS 3233 Discrete Mathematical Structure Midterm 2 Exam Solution Tuesday, April 17, :30 1:45 pm. Last Name: First Name: Student ID:

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

Week 1: Probability models and counting

The Pigeonhole Principle

Problem Set 8 Solutions R Y G R R G

HOMEWORK ASSIGNMENT 5

6/24/14. The Poker Manipulation. The Counting Principle. MAFS.912.S-IC.1: Understand and evaluate random processes underlying statistical experiments

Finite Math - Fall 2016

PERMUTATIONS AND COMBINATIONS

Foundations of Computing Discrete Mathematics Solutions to exercises for week 12

Week 3-4: Permutations and Combinations

2. Combinatorics: the systematic study of counting. The Basic Principle of Counting (BPC)

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

Counting integral solutions

Exercises Exercises. 1. List all the permutations of {a, b, c}. 2. How many different permutations are there of the set {a, b, c, d, e, f, g}?

n! = n(n 1)(n 2) 3 2 1

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

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

Combinatorics. Chapter Permutations. Counting Problems

About Permutations and Combinations: Examples

Chapter 1. Probability

Probability. Engr. Jeffrey T. Dellosa.

Lecture 1. Permutations and combinations, Pascal s triangle, learning to count

Distribution of Aces Among Dealt Hands

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

Sets. Gazihan Alankuş (Based on original slides by Brahim Hnich et al.) August 6, Outline Sets Equality Subset Empty Set Cardinality Power Set

Review I. October 14, 2008

FOURTH LECTURE : SEPTEMBER 18, 2014

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

NANYANG TECHNOLOGICAL UNIVERSITY SEMESTER II EXAMINATION MH1301 DISCRETE MATHEMATICS. Time Allowed: 2 hours

7.4 Permutations and Combinations

12. 6 jokes are minimal.

Elementary Combinatorics

CSE 21 Math for Algorithms and Systems Analysis. Lecture 4 Mul<nomial Coefficients and Sets

Permutations and Combinations Section

Week 1. 1 What Is Combinatorics?

Transcription:

1 CSCI- 2200 FOUNDATIONS OF COMPUTER SCIENCE Spring 2015 April 2, 2015

2 Announcements Homework 6 is due next Monday, April 6 at 10am in class. Homework 6 ClarificaMon In Problem 2C, where you need to count the number of strings where G precedes A, G does not need to immediately precede A.

3 Review of CounMng I 1. How many strings of six uppercase English leters are there? 2. How many are there that start with a vowel? 3. How many are there that contain no vowels? 4. How many strings are there if leters cannot be repeated?

4 Review of CounMng I 1. How many strings of six uppercase English leters are there? 2. How many are there that start with a vowel? 3. How many are there that contain no vowels? 4. How many strings are there if leters cannot be repeated?

5 Review of CounMng II 1. How many funcmons are there from the set X = {0,1} to the set Y={1,2,3,4}. 2. How many of these funcmons are injecmve? 3. How many of these funcmons are surjecmve?

6 Review of CounMng III How many subsets of a set with 100 elements have more than 1 element?

7 Tree Diagrams Suppose that I Love FOCS T- shirts come in five different sizes: S,M,L,XL, and XXL. Each size comes in four colors (white, red, green, and black), except XL, which comes only in red, green, and black, and XXL, which comes only in green and black. What is the minimum number of shirts that the campus book store needs to stock to have one of each size and color available?

8 THE PIGEONHOLE PRINCIPLE SecMon 6.2

9 The Pigeonhole Principle Pigeonhole Principle: If k is a posimve integer and k + 1 objects are placed into k boxes, then at least one box contains two or more objects.

10 Proof of the Pigeonhole Principle Pigeonhole Principle: If k is a posimve integer and k + 1 objects are placed into k boxes, then at least one box contains two or more objects.

11 Example of the Pigeonhole Principle Among any group of 367 people, there must be at least two with the same birthday. How many possible birthdays are there? 366 What are the pigeonholes? The 366 birthdays What are the pigeons? The 367 people

Show that, among any group of five integers, there are two with the same remainder when divided by 4. 12

13 Show that for every posi?ve integer n there is a mul?ple of n that has only 0s and 1s in its decimal expansion (only contains the digits 0 and 1). Let n be a posimve integer. Consider the n + 1 integers 1, 11, 111,., 111 1 (where the last integer has n + 1 1s). There are n possible remainders when an integer is divided by n. By the pigeonhole principle, when each of the n + 1 integers is divided by n, at least two must have the same remainder. Let x be the largest one and let y be the smallest one. x y is divisible by n and contains only the digits 0 and 1.

14 The Generalized Pigeonhole Principle If N objects are placed into k boxes, then there is at least one box containing at least N/k objects. Among 100 people there are at least how many who were born in the same month?

Example - Generalized Pigeonhole Principle How many cards must be selected from a standard deck of 52 cards to guarantee that at least three cards of the same suit are chosen? 15

16 PERMUTATIONS AND COMBINATIONS SecMon 6.3

17 PermutaMons A permuta?on of a set of dismnct objects is an ordered arrangement of these objects. An ordered arrangement of r elements of a set is called an r- permuta?on. Example: Let S = {1,2,3}. 3,1,2 is a permutamon of S. 3,2 is a 2- permutamon of S. The number of r- permutamons of a set with n elements is denoted by P(n,r).

18 A Formula for the Number of PermutaMons Theorem: If n is a posimve integer and r is an integer with 1 r n, then there are P(n, r) = n(n 1)(n 2) (n r + 1) r- permutamons of a set with n dismnct elements. Proof: Use the product rule. The first element can be chosen in n ways. The second in n 1 ways, and so on until there are (n ( r 1)) ways to choose the last element. Note that P(n,0) = 1, since there is only one way to order zero elements.

19 CounMng PermutaMons How many ways are there to select a first- prize winner, a second prize winner, and a third- prize winner from 100 different people who have entered a contest?

20 More CounMng PermutaMons Suppose a saleswoman must visit 8 different cimes. She must begin her trip in a specified city, but she can visit the other seven cimes in any order she wishes. How many possible orders can the saleswoman use when visimng these cimes? SoluMon: The first city is chosen. Hence the number of possible orders is 7! = 7 6 5 4 3 2 1 = 5040 If she wants to Cind the tour with the shortest path that visits all the cities, she must consider 5040 paths!

21 The Traveling Salesman Problem Suppose a saleswoman must visit all 6 cimes. The distances between the cimes are given. What is the shortest tour she can take that visits every city exactly once and then returns to the starmng city?

22 Even More CounMng PermutaMons How many permutamons of the leters A, B, C, D,E, F,G, H contain the string ABC?

23 CombinaMons An r- combina?on of elements of a set is an unordered selecmon of r elements from the set. An r- combinamon is simply a subset of the set with r elements. The number of r- combinamons of a set with n dismnct elements is denoted by C(n, r). The notamon coefficient. is also used and is called a binomial

24 Example I - CombinaMons Let S be the set {a, b, c, d}. Then {a, c, d} is a 3- combinamon from S. It is the same as {d, c, a} since the order does not mater. What is C(4,2)? What is P(4,2)?

25 CombinaMons Theorem 2: The number of r- combinamons of a set with n elements, where n r 0, equals

How many poker hands of five cards can be dealt from a standard deck of 52 cards? 26

27 CombinaMons Corollary: Let n and r be nonnegamve integers with r n. Then C(n, r) = C(n, n r). Proof: From the previous theorem, it follows that and Hence, C(n, r) = C(n, n r).

A group of 30 people have been trained as astronauts to go on the first mission to Mars. How many ways are there to select a crew of six people to go on this mission? 28

How many bit strings of length 10 contain at least three 0s and at least three 1s? 29

30 Good Problems to Review SecMon 6.2: 3, 5, 7, 9, 17, SecMon 6.3: 3, 5, 7, 11, 15, 17, 19 21, 23, 27, 31, 33