CS228 - Basic Counting and the Pigeonhole Principle

Similar documents
Basic Counting Principles: The Product Rule

Introduction. CS243: Discrete Structures. Combinatorics. Product Rule. Basic Counting Rules. Example 2. Example 1

Counting: Basics. Rosen, Chapter 6.1

Discrete Structures Lecture The Basics of Counting

Counting. Andreas Klappenecker

Counting Product Rule

Counting. Rosen, Chapter 6 Walls and Mirrors, Chapter 3

Counting: Basics. A simple counting problem. Counting: the product rule. Relation to Cartesian products. Relation to Cartesian products

Math 3336 Section 6.1 The Basics of Counting The Product Rule The Sum Rule The Subtraction Rule The Division Rule

Counting Pigeonhole principle

Solution : a) C(18, 1)C(325, 1) = 5850 b) C(18, 1) + C(325, 1) = 343

1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall

Solutions to In Class Problems Week 9, Fri.

Midterm 2 Solutions. CS70 Discrete Mathematics and Probability Theory, Spring 2009

CSCI FOUNDATIONS OF COMPUTER SCIENCE

Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets

Discrete Mathematics Exam File Fall Exam #1

ELEC-270 Solutions to Assignment 5

Sets and set operations

Notes for Recitation 13

It is important that you show your work. There are 134 points available on this test.

Discrete Structures for Computer Science

Exponential Notation

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

Math 55 - Spring Lecture notes # 14 - March 9 (Tuesday)

Adding Integers. Unit 1 Lesson 6

c) the set of students at your school who either are sophomores or are taking discrete mathematics

Lecture 11a: Maximum Matchings Lale Özkahya

Packet #6: Counting & Graph Theory. Applied Discrete Mathematics

1-3 Variables and Algebraic Expressions. Warm Up Problem of the Day Lesson Presentation Lesson Quizzes

COMP Logic for Computer Scientists. Lecture 17

Homework Set 1- Fundamentals

8/27/2016. ECE 120: Introduction to Computing. Graphical Illustration of Modular Arithmetic. Representations Must be Unambiguous

Lecture 3.4: Recursive Algorithms

Discrete mathematics , Fall Instructor: prof. János Pach

Math 4410 Fall 2010 Exam 3. Show your work. A correct answer without any scratch work or justification may not receive much credit.

VARIABLES & ASSIGNMENTS

CSE 20 DISCRETE MATH WINTER

1 Sets, Fields, and Events

Functions. Jason Filippou UMCP. Jason Filippou UMCP) Functions / 19

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.

In this lesson, we will use the order of operations to evaluate and simplify expressions that contain numbers and variables.

1 st Grade Math 2007 Standards, Benchmarks, Examples & Vocabulary

Rational Numbers CHAPTER Introduction

18 Spanning Tree Algorithms

CS159. Nathan Sprague. September 11, 2015

is evenly divisibly by 10. What is the check digit for the mild RO TEL?

Set4. 8 February 2019 OSU CSE 1

Get to Know Your Calculator!

Chapter 2 Bits, Data Types, and Operations

CS 441 Discrete Mathematics for CS Lecture 24. Relations IV. CS 441 Discrete mathematics for CS. Equivalence relation

o Counter and sentinel controlled loops o Formatting output o Type casting o Top-down, stepwise refinement

Discrete Structures. Fall Homework3

Grade 6 Integers. Answer the questions. Choose correct answer(s) from the given choices. For more such worksheets visit

Trees and Intro to Counting

Chapter 1: Foundations for Algebra

CS101 Lecture 04: Binary Arithmetic

Binary Search. Not your parents binary search. Ethan Arnold, Arnav Sastry. Spring 2017 CS 104C

TILING PROBLEMS: FROM DOMINOES, CHECKERBOARDS, AND MAZES TO DISCRETE GEOMETRY

5 Graphs

Chapter 2 Bits, Data Types, and Operations

4 + 4 = = 1 5 x 2 = 10

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value

MAT 142 College Mathematics. Module ST. Statistics. Terri Miller revised July 14, 2015

//If target was found, then //found == true and a[index] == target.

Discrete Mathematics 2 Exam File Spring 2012

CSC Discrete Math I, Spring Sets

Foundations of Discrete Mathematics

STUDENT NUMBER: MATH Final Exam. Lakehead University. April 13, Dr. Adam Van Tuyl

Symmetric Product Graphs

CISC 1400 Discrete Structures

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

Using only 1, 2 and 3, and the rules of the 3-number challenge, show how we could use addition only or multiplication only to arrive at 6.

Advanced Algebra I Simplifying Expressions

Graph Coloring. Discrete Mathematics (MA 2333) Faculty of Science Telkom Institute of Technology Bandung - Indonesia

Elementary Number Theory. Kenneth H. Rosen Sixth Edition

Slides for Faculty Oxford University Press All rights reserved.

GAP CLOSING. Integers. Intermediate / Senior Facilitator s Guide

GAP CLOSING. Grade 9. Facilitator s Guide

To illustrate what is intended the following are three write ups by students. Diagonalization

11 Sets II Operations

Discrete Mathematics Introduction

Grade 6 Math Circles November 6 & Relations, Functions, and Morphisms

1. (15 points) Solve the decanting problem for containers of sizes 199 and 179; that is find integers x and y satisfying.

Place Value. Unit 1 Lesson 1

C++ Programming Language Lecture 2 Problem Analysis and Solution Representation

Susan had $50 to spend at the carnival. She spent $12 on food and twice as much on rides. How many dollars did she have left to spend?

3. Determine whether f is a function from the set of all bit strings to the set of integers if

CSE 312 Foundations II. 2. Counting. Winter 2017 W.L. Ruzzo

GRADE 6 PAT REVIEW. Math Vocabulary NAME:

Outline. Program development cycle. Algorithms development and representation. Examples.

GRADE 7 MATH LEARNING GUIDE

Using Genetic Programming to Evolve a General Purpose Sorting Network for Comparable Data Sets

Matchings in Graphs. Definition 1 Let G = (V, E) be a graph. M E is called as a matching of G if v V we have {e M : v is incident on e E} 1.

Introduction II. Sets. Terminology III. Definition. Definition. Definition. Example

Advanced Computer Networks. Rab Nawaz Jadoon DCS. Assistant Professor COMSATS University, Lahore Pakistan. Department of Computer Science

Combinatorics Prof. Dr. L. Sunil Chandran Department of Computer Science and Automation Indian Institute of Science, Bangalore

Chapter 3. Set Theory. 3.1 What is a Set?

Measuring With Jugs: A Solution in Finite Domain

Lesson 9: An Application of Linear Equations

Transcription:

CS228 - Basic Counting and the Pigeonhole Principle Nathan Sprague February 19, 2014 Material in these slides is from Discrete Mathematics and Its Applications 7e, Kenneth Rosen, 2012.

The Product Rule A procedure can be broken down into a sequence of two tasks. There are n 1 ways to do the first task and for each of these ways there are n 2 ways to do the second task. Then there are n 1 n 2 ways to do the procedure.

The Product Rule A procedure can be broken down into a sequence of two tasks. There are n 1 ways to do the first task and for each of these ways there are n 2 ways to do the second task. Then there are n 1 n 2 ways to do the procedure. Example: How many bit strings of length seven are there?.

The Product Rule A procedure can be broken down into a sequence of two tasks. There are n 1 ways to do the first task and for each of these ways there are n 2 ways to do the second task. Then there are n 1 n 2 ways to do the procedure. Example: How many bit strings of length seven are there?. Solution: Each bit is either 0 or 1, so the answer is 2 7 = 128

Counting Functions How many functions are there from a set with m elements to a set with n elements?

Counting Functions How many functions are there from a set with m elements to a set with n elements? Solution: Since a function represents a choice of one of the n elements of the codomain for each of the m elements in the domain, the product rule tells us that there are n n... n = n m such functions.

Counting Functions How many functions are there from a set with m elements to a set with n elements? Solution: Since a function represents a choice of one of the n elements of the codomain for each of the m elements in the domain, the product rule tells us that there are n n... n = n m such functions. How many one to one functions are there from a set with m elements to a set with n elements?

Counting Functions How many functions are there from a set with m elements to a set with n elements? Solution: Since a function represents a choice of one of the n elements of the codomain for each of the m elements in the domain, the product rule tells us that there are n n... n = n m such functions. How many one to one functions are there from a set with m elements to a set with n elements? Solution: n(n 1)(n 2)...(n m + 1) such functions.

Product Rule in Terms of Sets If A 1, A 2,..., A m are finite sets, then the number of elements in the Cartesian product of these sets is the product of the number of elements of each set. The task of choosing an element in the Cartesian product A 1 A 2... A m is done by choosing an element in A 1, an element in A 2,..., and an element in A m. By the product rule, it follows that: A 1 A 2... A m = A 1 A 2... A m

The Sum Rule If a task can be done either in one of n 1 ways or in one of n 2 ways to do the second task, where none of the set of n 1 ways is the same as any of the n 2 ways, then there are n 1 + n 2 ways to do the task.

The Sum Rule If a task can be done either in one of n 1 ways or in one of n 2 ways to do the second task, where none of the set of n 1 ways is the same as any of the n 2 ways, then there are n 1 + n 2 ways to do the task. Example: The mathematics department must choose either a student or a faculty to serve on a committee. How many choices are there for this representative if there are 37 faculty members and 83 majors and no one is both a faculty member and a student.

The Sum Rule If a task can be done either in one of n 1 ways or in one of n 2 ways to do the second task, where none of the set of n 1 ways is the same as any of the n 2 ways, then there are n 1 + n 2 ways to do the task. Example: The mathematics department must choose either a student or a faculty to serve on a committee. How many choices are there for this representative if there are 37 faculty members and 83 majors and no one is both a faculty member and a student. Solution: By the sum rule it follows that there are 37 + 83 = 120 possible ways to pick a representative.

The Sum Rule in Terms of Sets A B = A + B as long as A and B are disjoint sets. More generally: A 1 A 2... A m = A 1 + A 2 +... + A m as long as A i A j = for all i, j.

The Subtraction Rule If a task can be done either in one of n 1 ways or in one of n 2 ways, then the total number of ways to do the task is n 1 + n 2 minus the number of ways to do the task that are common to the two different ways. Also known as the principle of inclusion-exclusion: A B = A + B A B

Subtraction Rule Example How many bit strings of length eight either start with a 1 bit or end with the two bits 00?

Subtraction Rule Example How many bit strings of length eight either start with a 1 bit or end with the two bits 00? Solution: Number of bit strings of length 8 that start with a 1: 2 7 = 128. Number of bit strings that end with 00: 2 6 = 64. Number of bit strings that start with 1 and end with 00: 2 5 = 32. Answer: 128 + 64-32 = 160.

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

Pigeonhole Principle If k is a positive integer and k + 1 objects are placed into k boxes, then at least one box contains two or more objects. Example: Among any group of 367 people, there must be at least two with the same birthday, because there are only 366 possible birthdays.

Generalized Pigeonhole Principle If N objects are placed into k boxes, then there is at least one box containing at least N/k objects. Example: Among 100 people there are at least 100/12 = 9 who were born in the same month.