counting - Counting Margaret M. Fleck 29 October 2010 These...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Counting Margaret M. Fleck 29 October 2010 These notes cover counting methods. (Sections 5.1, 5.3, 5.4, 5.5 of Rosen.) 1 Introduction to counting Many applications require counting, or estimating, the size of a finite set. For small examples, you can just list all the elements. For examples with a simple structure, you could probably improvise the right answer. But when it’s not so obvious, some techniques are often helpful. 2 Product rule Let’s start with the more obvious rules, e.g. The product rule : if you have p choices for one part of a task, then q choices for a second part, and your options for the second part don’t depend on what you chose for the first part, then you have pq options for the whole task. So if T-shirts can come in 4 colors and 3 sizes, there are 4 · 3 = 12 types of T-shirts. In general, if the objects are determined by a sequence of independent decisions, the number of different objects is the product of the number of 1 options for each decision. So if the T-shirts come in 4 colors, 5 sizes, and 2 types of necklines, there are 4 · 5 · 2 = 40 types of shirts. Yup. That’s pretty much what you thought. Nothing hard here. 3 The sum rule, inclusion/exclusion The sum rule : suppose your task can be done in one of two ways, which are mutually exclusive. If the first way has p choices and the second way has q choices, then you have p + q choices for how to do the task. Example: it’s late evening and you want to watch TV. You have 37 programs on cable, 57 DVD’s on the shelf, and 12 movies stored in I-tunes. So you have 37 + 57 + 12 = 106 options for what to watch. Weeeellll, maybe. This analysis assumes that there is no overlap between the movies available on the three media. If any movies are in more than one collection, this will double-count them. So we would need to subtract off the number that have been double-counted. For example, if the only overlap is that 2 movies are on I-tunes and also on DVD, you would have only (37 + 57 + 12) − 2 = 104 options. The formal name for this correction is the “Inclusion-Exclusion Princi- ple”. Formally, suppose you have two sets A and B . Then Inclusion-Exclusion Principle: | A ∪ B | = | A | + | B | − | A ∩ B | We can use this basic 2-set formula to derive the corresponding formula for three sets A , B , and C : 2 | A ∪ B ∪ C | = | A | + | B ∪ C | − | A ∩ ( B ∪ C ) | = | A | + | B | + | C | − | B ∩ C | − | A ∩ ( B ∪ C ) | = | A | + | B | + | C | − | B ∩ C | − | ( A ∩ B ) ∪ ( A ∩ C ) | = | A | + | B | + | C | − | B ∩ C | − ( | A ∩ B | + | A ∩ C | − | ( A ∩ B ) ∩ ( A ∩ C ) | ) = | A | + | B | + | C | − | B ∩ C | − | A ∩ B | − | A ∩ C | + | A ∩ B ∩ C | 4 Combining these basic rules Let’s see what happens on a more complex example, where we have to use both the product and the sum rules. Suppose S contains all 5-digit decimal numbers that start with 2 one’s or end in 2 zeros, where we don’t allow...
View Full Document

This note was uploaded on 01/27/2011 for the course CS 173 taught by Professor [email protected] during the Spring '08 term at University of Illinois at Urbana–Champaign.

  • Spring '08
  • [email protected]

Page1 / 14

counting - Counting Margaret M. Fleck 29 October 2010 These...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online