MATH 22. Lecture B: 9/4/2003 COUNTING. I counted two and seventy stenches, All well-defined, and several stinks.

Similar documents
Elementary Combinatorics

Finite Math - Fall 2016

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

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

CS 237: Probability in Computing

Permutations and Combinations. MATH 107: Finite Mathematics University of Louisville. March 3, 2014

COUNTING AND PROBABILITY

Permutations and Combinations Section

CISC 1400 Discrete Structures

We introduced the Counting Principle earlier in the chapter.

Counting Things. Tom Davis March 17, 2006

Combinatorics: The Fine Art of Counting

Math 3012 Applied Combinatorics Lecture 2

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6

Counting and Probability Math 2320

STAT 430/510 Probability

Chapter 2. Permutations and Combinations

Learning Objectives for Section 7.4 Permutations and Combinations. 7.4 Permutations and Combinations

Probability (Devore Chapter Two)

CPCS 222 Discrete Structures I Counting

A Probability Work Sheet

TOPIC 2: HOW TO COUNT

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

Chapter 5 - Elementary Probability Theory

Reading 14 : Counting

Permutations and Combinations Problems

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

Finite Mathematics MAT 141: Chapter 8 Notes

1 = 3 2 = 3 ( ) = = = 33( ) 98 = = =

Math 166: Topics in Contemporary Mathematics II

CHAPTER 5 BASIC CONCEPTS OF PERMUTATIONS AND COMBINATIONS

Topics to be covered

Principles of Counting. Notation for counting elements of sets

Counting (Enumerative Combinatorics) X. Zhang, Fordham Univ.

EECS 203 Spring 2016 Lecture 15 Page 1 of 6

CSE 21 Mathematics for Algorithm and System Analysis

STAT 430/510 Probability Lecture 1: Counting-1

JUST THE MATHS UNIT NUMBER PROBABILITY 2 (Permutations and combinations) A.J.Hobson

Unit 2 Lesson 2 Permutations and Combinations

CSC/MATA67 Tutorial, Week 12

Chapter Permutations and Combinations. Section 4 Permutations and Combinations. Example. Definition of n Factorial (n!)

Section Summary. Finite Probability Probabilities of Complements and Unions of Events Probabilistic Reasoning

MATHEMATICS S-152, SUMMER 2005 THE MATHEMATICS OF SYMMETRY Outline #1 (Counting, symmetry, Platonic solids, permutations)

CS1800: Permutations & Combinations. Professor Kevin Gold

Permutations and Combinations

Name: Exam 1. September 14, 2017

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

PERMUTATIONS AND COMBINATIONS

MATH 2420 Discrete Mathematics Lecture notes

Math236 Discrete Maths with Applications

4.4: The Counting Rules

Combinatorial Proofs

Generalized Permutations and The Multinomial Theorem

Mixed Counting Problems

Counting. Chapter 6. With Question/Answer Animations

Permutations and Combinations

Combinatorics and Intuitive Probability

Strings. A string is a list of symbols in a particular order.

Concepts. Materials. Objective

Section : Combinations and Permutations

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}?

SET THEORY AND VENN DIAGRAMS

commands Homework D1 Q.1.

Permutations and Combinations. Quantitative Aptitude & Business Statistics

1111: Linear Algebra I

Week 1: Probability models and counting

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

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

With Question/Answer Animations. Chapter 6

CS1800: More Counting. Professor Kevin Gold

FOURTH LECTURE : SEPTEMBER 18, 2014

LEVEL I. 3. In how many ways 4 identical white balls and 6 identical black balls be arranged in a row so that no two white balls are together?

A Mathematical Analysis of Oregon Lottery Keno

6.1 Basics of counting

Math 14 Lecture Notes Ch. 3.6

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

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

COUNTING METHODS. Methods Used for Counting

Section Introduction to Sets

Finite Math Section 6_4 Solutions and Hints

Multiple Choice Questions for Review

17. Symmetries. Thus, the example above corresponds to the matrix: We shall now look at how permutations relate to trees.

n(s)=the number of ways an event can occur, assuming all ways are equally likely to occur. p(e) = n(e) n(s)

Mathematics Probability: Combinations

Rotational Puzzles on Graphs

CIS 2033 Lecture 6, Spring 2017

Section The Multiplication Principle and Permutations

Chapter 11: Probability and Counting Techniques

7 5 Compound Events. March 23, Alg2 7.5B Notes on Monday.notebook

Mathematical Foundations of Computer Science Lecture Outline August 30, 2018

Grade 7/8 Math Circles. Visual Group Theory

Compound Probability. Set Theory. Basic Definitions

Question 1: How do you count choices using the multiplication principle?

Math141_Fall_2012 ( Business Mathematics 1) Week 7. Dr. Marco A. Roque Sol Department of Mathematics Texas A&M University

Permutations And Combinations Questions Answers

Math 1116 Probability Lecture Monday Wednesday 10:10 11:30

Unit Nine Precalculus Practice Test Probability & Statistics. Name: Period: Date: NON-CALCULATOR SECTION

LISTING THE WAYS. getting a total of 7 spots? possible ways for 2 dice to fall: then you win. But if you roll. 1 q 1 w 1 e 1 r 1 t 1 y

Permutation and Combination

Math 475, Problem Set #3: Solutions

Transcription:

MATH 22 Lecture B: 9/4/2003 COUNTING How do I love thee? Let me count the ways. Elizabeth Barrett Browning, Sonnets from the Portuguese, XLIII I counted two and seventy stenches, All well-defined, and several stinks. Samuel Taylor Coleridge, Cologne Tros Tyriusque mihi nullo discrimine agetur. Virgil, Aeneid I:574 Copyright 2003 Larry Denenberg

Administrivia Roll call Academic Resource Center (Dowling Hall) Homework, in folders, is due Tuesday 9/9 http://denenberg.com/lectureb.pdf Questions about Lecture A, first problem set, first project? Office hours after class today in room 214, or by appointment anytime. (Don t believe anything about office hours Tuesday.) Today: Counting, rules of sum & product, examples, factorials, permutations, permutations with repetitions, combinations. I shall recognize no difference between the Tyrian and the Trojan.

Counting The area of discrete math called combinatorics often asks the question How many different ways can something happen? How many different poker hands are there? How many different ways can two dice land? How many different ways are there to pick four baseball teams given 36 people? How many different ways are there to fully parenthesize the expression a*b+c*d-e+f*g? How many distinct bytes of memory can be addressed by a 32-bit word? (For example, this question constantly arises in calculating probabilities, as we ll see later.) Counting, also known as enumeration, can be one of the hardest problems in mathematics. In this course we ll only get the slightest taste of its complexity. The absolutely crucial word in all of these questions is the word different (or distinct).

What does different mean? Problem: How many different ways are there to seat five people, A, B, C, D, and E, around a circular table (whose seats don t move)? A B E B A C D C E D B C A D E Are these three arrangements distinct? Or all the same? Or maybe the upper two are the same but the third is different? What if it were keys on a ring rather than people around a table? The answer to the problem depends on what you want different to mean! (As an example of how tricky this can be, consider Example 1.22 on p. 16, which Grimaldi gets wrong.)

Rule of Sum Suppose there are m ways to do something, and there are n ways to do something different, but you only want to do one thing or the other. Then there are m+n things you can do. Example: If a store has 12 records by the Beatles, and 15 records by the Rolling Stones, and you can buy only one record, then you have a choice of 27 records. Frankly, I find this rule almost too silly to require explicit formulation. You mostly just apply it instinctively. But consider: Example: If one store has 12 records by the Beatles, and another store has 15 records by the Beatles, and you can buy only one record, then you may or may not have a choice of 27 different records. It may be as few as 15! There is a beautiful generalization of this rule called the Principle of Inclusion and Exclusion that covers this and much more complex cases.

Rule of Product Suppose there are m ways to do a first thing, and n ways to do a second thing. Then there are mn ways to do both things (the first followed by the second, in order). Example: If a store has 12 records by the Beatles, and 15 records by the Rolling Stones, and you want one of each, then there are (12)(15) ways you can spend your $. This rule is used in zillions of counting problems. (Again, it s pretty instinctive.) Before giving examples, let s generalize: Suppose there are m 1 ways to do a first thing, m 2 ways to do a second thing, m 3 ways to do a third thing,..., and m k ways to do a k th thing. Then there are m 1 m 2 m 3 m k ways to do the k things successively, one after another. Example: If a store has 12 records by the Beatles, 15 by the Rolling Stones, and 7 by Rudy Vallee, and you want one of each, then there are (12)(15)(7) ways you can buy three records.

Less Trivial Examples Example: How many three-letter words are possible? We must pick the first letter, then the second, then the third. There are 26 choices in each case. So there are 26 3 possible three-letter words. Wow. Qqq. Zxy. Example: How many four-digit numbers are there? We must pick the first digit, then the second, the third, the fourth. For the first digit we have nine choices (it can t be 0), for the other three we have ten choices each. So there are (9)(10)(10)(10) = 9000 four-digit numbers. Example: A bit can be 0 or 1. How many 32- bit words are possible? We have to pick the first bit (2 choices), then the second (2 choices), etc. for 32 bits. So there are 2 32 possibilities. (Be sure you understand why it s not 32 2!!)

An Even Less Trivial Example A Nebraska license plate consists either of 3 letters followed by 3 digits, or 4 letters followed by 2 digits, e.g. ABC838, AAA111, ABCD12, XXXX33 (but not AB1212 or 123ABC). How many Cornhusker cars can there be? We break this problem into two cases. First consider the 3-letter plates. There are (26)(26)(26)(10)(10)(10) of these. Similarly, there are (26)(26)(26)(26)(10)(10) plates with 4 letters and 2 digits. Since each plate is one or the other and not both, the total number of plates is the sum of these two values (which I m far too lazy to compute). Note how we ve used both the Rule of Sum and the Rule of Product here. It s critical that our two cases are separate: no plate appears in both cases!

A Bogus Example An Illinois license plate consists of six digits, where either each digit is 6 or greater, or each digit is odd. For example, 886796 or 987899 or 313793 or 991135, but not 123456. How many Hoosier cars can there be? Again, break the problem into two cases. First consider the plates with digits 6 or greater; there are four such digits and hence 4 6 plates. Next consider the plates with odd digits; there are 5 odd digits and hence 5 6 such plates. So far so good. But it s wrong to say that the total number of plates is 4 6 +5 6, because the two cases aren t separate as required by the Rule of Sum. License plate 799779 falls into both cases (as do many others) and therefore has been counted twice! We say that we ve made a mistake of double counting. The correct answer is smaller than 4 6 +5 6. (See Venn.)

Permutations A very important application of the Rule of Product happens when we re selecting items from a fixed set and can use each only once. How many three-letter words are possible if no letter may appear more than once? The answer is not (26)(26)(26) because we can t reuse letters: AAA is not permitted. The answer is that we can pick the first letter in 26 ways, the second letter in 25 ways (since the first letter is no longer valid), and the third letter in 24 ways. The answer is (26)(25)(24). How many ten-digit numbers are there in which no digit is repeated? The first digit can be any of 10, the second any of 9, the third any of 8, etc. The answer is (10)(9)(8)(7) (2)(1). [How many eleven-digit numbers are there in which no digit is repeated?]

Factorials (This slide is a digression, purely about notation.) We need a handy way to represent products of the form (n)(n-1)(n-2) (3)(2) (1) We write n! and say n factorial (or n bang ) to denote this product. Examples: 5! = (5)(4)(3)(2)(1) = 120 2! = (2)(1) = 2 1! = 1 Useful facts: n! / k! = (n)(n-1)(n-2) (k+1) [why?] n! = n(n-1)! [why?] This last fact helps us to settle a puzzling case: What is zero factorial (an important quantity)? We must have 1! = 1(0!) which makes it clear that 0! must equal 1. (This is also true because a product of zero factors must equal 1, just as a sum of zero terms must equal 0. Don t worry if you don t understand that last sentence.) And what about 1!? Well, we have 0! = 0( 1!) which means that 1! = 1/0, that is, 1! doesn t exist. And neither do 2!, 3!, 4!, etc. But 1.5! does exist (as does 1.5!), though that s beyond the scope of this course.

Back to Permutations In general, suppose we have n different items. How many ways there are to arrange r of these items in order without reusing any? The answer is called the number of permutations of n things taken r at a time, written P(n,r) in this class but n P r in days of yore. The answer is that the first item can be any of the n, the second item can be any of the n-1 remaining, the third item can be any of the n-2 remaining, etc., and the r th item can be any of the (n-r+1) remaining. So the answer is P(n,r) = (n)(n-1)(n-2) (n-r+1) = n! / (n-r)! In the three-letter word problem we have n=26 and r=3, so the answer is P(26,3) = 26! / 23!. (This is the answer, by the way. Not 15600.) In the ten-digit number problem we have n=r=10, giving P(10,10) = 10! / 0! = 10!. It s easy to see that P(n,n) = n! for all n.

Permutations with Repetitions A twist: What happens when the objects to be permuted aren t different? How many permutations are there of (all) the four letters A, B, C, D? Answer: P(4,4) = 4! = 24. But how many permutations are there of the four letters A, A, A, A? Answer: Only one, namely AAAA. We can choose a first A then a second, etc., but they re all the same A! How many permutations are there of the four letters A, A, B, B? Or of the letters in the word MISSISSIPPI (the classic example)? How do we handle this problem in general?

Perms w/ Reps, cont. Here s what we do. Suppose we want to find all the permutations of the letters A, A, B, C. We start by relabelling the two As so that they are distinct. The letters are now A 1, A 2, B, C. We know there are P(4,4) = 4! permutations of these four letters. So far so good. Key point: These permutations come in pairs whose only difference is the labelling on the two As. For example, A 1 BCA 2 and A 2 BCA 1 form a pair, as do BA 1 A 2 C and BA 2 A 1 C. When we erase the labels on the As, the two elements of the pairs look exactly alike! So the real question we need to answer is: How many pairs are there? Well, each permutation belongs to exactly one pair, and the pairs are all distinct, so there are 4!/2 pairs. And this is the answer.

Forging ahead Next step: How many permutations are there of the letters A,A,A,B,C? Again, label the As so they re distinct, giving A 1,A 2,A 3,B,C. We know there are P(5,5)=5! permutations of these five distinct letters. Key point: These permutations come in clumps of 6 whose only difference is the labelling on the As. One clump, for example, is A 1 BA 2 A 3 C, A 1 BA 3 A 2 C, A 2 BA 1 A 3 C, A 2 BA 3 A 1 C, A 3 BA 1 A 2 C, A 3 BA 2 A 1 C. Again, everything in a clump is the same if you erase the labels, so all we need is the number of clumps, which is 5! / 6. [Where did 6 come from in this example? It s the number of ways of permuting the three As; each clump contains every possible way of permuting A 1,A 2,A 3, and there are P(3,3)=3!=6 such ways.]

Forg 1 ing 2 a 1 hea 2 d What if more than one letter is duplicated? How many different permutations are there of the letters A,A,A,B,B,B,B,C? The answer is that the clumps now have size 3!4! (there are 3! ways of permuting the As and 4! ways of permuting the Bs, and a member of a clump has one of each). If we keep the As and Bs distinct there are 8! permutations, so there must be 8!/4!3! clumps. And as before, the number of clumps is the answer. The book gives the general formula. You should now be able to tell how many ways there are of rearranging the letters of MISSISSIPPI: it s 11! / (4!)(4!)(2!). [Comment: In all the perms-with-dups examples we ve asked for the number of reorderings of all the letters. But how many ways are there to make a five-letter word from the letters in MISSISSIPPI? If you try to work this out you ll come across a problem: The clumps don t have the same size, so you can t just divide! Solving this seemingly-only-slightly-more-difficult problem is beyond the scope of this course.]

Ignoring Order All the work we ve done so far has been with arrangements, that is, ordered selections. (For example, CAT and ACT are different threeletter words. We choose the first letter, then the second, then the third. If we weren t doing it this way, we couldn t apply the Rule of Product.) But now: What if order doesn t matter? How many different ways are there of picking a committee of three from a group of 26 people? Suppose we label the people A, B, C,..., Z. The answer is not P(26,3) = (26)(25)(24) because the order isn t important; a committee with C, A, and T is the same as a committee with A, C, and T. The order is irrelevant, and the Rule of Product doesn t apply directly. What to do?

Clumps Again Clumps to the rescue! Suppose we consider all the permutations of the 26 letters taken 3 at a time. These fall into clumps where the letters are the same but the order is different. (For example, one clump consists of ACT, ATC, CAT, CTA, TCA, and TAC.) Luckily, each clump has the same size; in this example, each clump has size 6. (Why 6? Because there are 6 ways of permuting the three letters in each clump.) As before, the answer we want is just the number of clumps; in this case (26)(25)(24)/6. In general, if we want the number of ways of choosing r items out of a set of n distinct items, we consider all P(n,r) ordered arrangements of the n items taken r at a time, and we note that they fall into clumps of size P(r,r) = r!. So the answer is P(n,r)/P(r,r) = P(n,r)/r!.

Combinations This number, the number of ways of selecting r objects from n distinct objects where order doesn t matter, is called the number of combinations of n things taken r at a time. It can be written C(n,r) but is most commonly written in a way I can t manage here. It s quite typically pronounced n choose r. To recap, we have C(n,r) = P(n,r) / P(r,r) = n! / (n-r)!r! Example: In the original Mass Megabucks lottery, a ticket was 6 of the numbers 1,2,3,,36, with order unimportant. How many tickets are there? Answer: C(36,6) = 36! / 6! 30! We re going to see a lot of these numbers; they re more important than permutations. Many more examples next time.