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

Similar documents
Counting: Basics. Rosen, Chapter 6.1

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

Counting Product Rule

CS228 - Basic Counting and the Pigeonhole Principle

Basic Counting Principles: The Product Rule

Counting. Andreas Klappenecker

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

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

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

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

Notes for Recitation 13

Discrete Structures Lecture The Basics of Counting

Ma/CS 6b Class 12: Ramsey Theory

Sets. X. Zhang Dept. of Computer & Information Sciences Fordham University

Solutions to In Class Problems Week 9, Fri.

Ma/CS 6b Class 10: Ramsey Theory

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

Solutions to First Exam, Math 170, Section 002 Spring 2012

Math Circles: Pigeons and Rams(ey)

Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Sets Fall / 31

UNIT-II NUMBER THEORY

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

SETS. Sets are of two sorts: finite infinite A system of sets is a set, whose elements are again sets.

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

Lecture 25 : Counting DRAFT

CSCI FOUNDATIONS OF COMPUTER SCIENCE

CSC Discrete Math I, Spring Sets

Counting Pigeonhole principle

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

This Lecture. We will first introduce some basic set theory before we do counting. Basic Definitions. Operations on Sets.

Discrete Structures for Computer Science

1 Sets, Fields, and Events

LESSON 1: INTRODUCTION TO COUNTING

r=1 The Binomial Theorem. 4 MA095/98G Revision

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

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

396 6 / Counting 6.1. Exercises

ELEC-270 Solutions to Assignment 5

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

CISC 1400 Discrete Structures

5 Graphs

2.1 Sets 2.2 Set Operations

Math 187 Sample Test II Questions

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

Math Summer 2012

2 Fundamentals of data structures

COMP Logic for Computer Scientists. Lecture 17

Fall 2018 September 18, Written Homework 02

Counting. Chapter Basic Counting. The Sum Principle. We begin with an example that illustrates a fundamental principle.

Mathematics for Computer Scientists 2 (G52MC2)

THE UNIVERSITY OF MANITOBA

Solution: It may be helpful to list out exactly what is in each of these events:

1.1 - Introduction to Sets

SET DEFINITION 1 elements members

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

Problem Set 7 Solutions

2. There are 7 people to be seated at a round table. How many seating arrangements are possible? How many times must they change places so that

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

Set and Set Operations

2014 State Math Contest Wake Technical Community College

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

The dictionary problem

CS 1200 Discrete Math Math Preliminaries. A.R. Hurson 323 CS Building, Missouri S&T

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time:

Sets. Mukulika Ghosh. Fall Based on slides by Dr. Hyunyoung Lee

Problem Y A limit 1 second. Zigzag

Review of Sets. Review. Philippe B. Laval. Current Semester. Kennesaw State University. Philippe B. Laval (KSU) Sets Current Semester 1 / 16

Abe Mirza Test 1 Review & Practice Math 1. List all the elements for: 1. B C 2. B A 3. C B. Draw the Venn diagram and shade the proper region for,

Section Sets and Set Operations

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

2. Sets. 2.1&2.2: Sets and Subsets. Combining Sets. c Dr Oksana Shatalov, Fall

COT 3100 Spring 2010 Midterm 2

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

Outline. CISC 1100/1400 Structures of Comp. Sci./Discrete Structures Chapter 1 Sets. Sets. Enumerating the elements of a set

11 Sets II Operations

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

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Discussion 8A Solutions

IT Account Registration

Section 1.1. Inductive Reasoning. Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Finite Math - J-term Homework. Section Inverse of a Square Matrix

CSE 215: Foundations of Computer Science Recitation Exercises Set #9 Stony Brook University. Name: ID#: Section #: Score: / 4

COMP3121/3821/9101/ s1 Assignment 1

Section 8.2 Graph Terminology. Undirected Graphs. Definition: Two vertices u, v in V are adjacent or neighbors if there is an edge e between u and v.

13 th Annual Johns Hopkins Math Tournament Saturday, February 19, 2011 Automata Theory EUR solutions

Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory

Full file at C How to Program, 6/e Multiple Choice Test Bank

Rational Numbers CHAPTER Introduction

Chapter 4 Fuzzy Logic

10/11/2018. Partial Orderings. Partial Orderings. Partial Orderings. Partial Orderings. Partial Orderings. Partial Orderings

Discrete Mathematics Introduction

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

Discrete Structures. Fall Homework3

1. You have a complete bipartite graph where each part contains exactly n nodes, numbered from 0 to n - 1 inclusive.

AMS /672: Graph Theory Homework Problems - Week V. Problems to be handed in on Wednesday, March 2: 6, 8, 9, 11, 12.

2 Review of Set Theory

SOFTWARE ENGINEERING DESIGN I

An Improved Upper Bound for the Sum-free Subset Constant

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

BLAST - Basic Local Alignment Search Tool

Transcription:

A simple counting problem Counting: Basics Possible answers: 6 x 10 6 + 10 Rosen, Chapter 6.1 Counting: the product rule If there are n1 ways of doing one task, and for each of those there are n2 ways of doing a second task, then there are n1n2 ways of performing both tasks. We can express the set of all outfits as: : We can express the set of all outfits as: This is an example of a Cartesian product The Cartesian product of sets A and B is denoted by A x B and is defined as: A x B = { (a,b) a A and b B} AxB = A B

How would a program for enumerating outfits work? Product rule You would like to print all elements of the set Assume that shirts and pants are stored in two arrays. Product rule Colorado assigns license plates as three digits followed by three uppercase letters. How many license plates are possible? 310 x 326 2 x 310 x 326 103 x 263 More examples Use the product rule to show that the number of different subsets of a finite set S is 2 S Product rule and Cartesian products: A1 x A2 x,,x An = A1 A2 An Colorado assigns license plate as three digits followed by three uppercase letters. How many license plates are possible? More examples How many bit strings with 7 digits are there? How many functions are there from a set with m elements to a set with n elements? mn nm How many one-to-one functions are there from a set with m elements to a set with n elements? (Rosen Section 2.3) DNA and proteins DNA is a long chain of nucleotides, each one being A, C, G, or T. DNA can code for proteins that are chains of amino acids. There are 20 amino acids. How many nucleotides does it take to code for a single amino acid? 2 3 4

A different counting problem X has decided to shop at a single store, either in old town or the foothills mall. If X visits old town, X will shop at one of three stores. If X visits the mall, then X will shop at one of two stores. How many ways could X end up shopping? A student can choose a computer project from one of three lists. The three lists contain 23, 15, and 4 possible projects. No project is on more than one list. How many possible projects are there to choose from? If a task can be done either in one of n1 ways or in one of n2 ways, and none of the n1 ways is the same as the n2 ways, then there are n1 + n2 ways to do the task. This is a statement about set theory: if two sets A and B are disjoint then A B = A + B 3+2 3x2 3! x 2! The Sum Rule Suppose you need to pick a password that has 6, 7 or 8 characters, where each character is an uppercase letter or a digit, and each password must contain at least one digit. How many possible passwords are there? Hint: need to use both the product rule and the sum rule. How many license plates can be made using either two or three uppercase letters followed by two or three digits? The inclusion exclusion principle A more general statement than the sum rule: A B = A + B - A B

How many numbers between 1 and 30 are divisible by 2 or 3? The inclusion exclusion principle How many bit strings of length eight start with a 1 or end with 00? 1------------00 how many? how many? if I add these, how many have I counted twice? A hairy problem In Denver there are two people that have the same number of hairs. The pigeonhole principle True False If k is a positive integer and k+1 or more objects are placed into k boxes, then there is at least one box containing two or more objects. On average, non balding people have 90K-150K hairs depending on color. So let s assume the maximum number is less than 300K. Image: http://en.wikipedia.org/wiki/file:toomanypigeons.jpg s s In a group of 367 people, there must be at least two with the same birthday In a group of 367 people, there must be at least two with the same birthday A drawer contains a dozen brown socks and a dozen black socks, all unmatched. A guy takes socks out at random in the dark. A drawer contains a dozen brown socks and a dozen black socks, all unmatched. A guy takes socks out at random in the dark. he has at least two socks of the same color? 13 3 12 he has at least two socks of the same color? he has at least two black socks?

s Show that if five different digits between 1 and 8 are selected, there must be at least one pair of these with a sum equal to 9. ask yourself: what are the pigeon holes? what are the pigeons?