# n10 - CS 70 Spring 2012 Counting Discrete Mathematics and...

This preview shows pages 1–2. Sign up to view the full content.

CS 70 Discrete Mathematics and Probability Theory Spring 2012 Alistair Sinclair Note 10 Counting In the next major topic of the course, we will be looking at probability. Suppose you toss a fair coin a thousand times. How likely is it that you get exactly 500 heads? And what about 1000 heads? It turns out that the chances of 500 heads are roughly 5%, whereas the chances of 1000 heads are so inﬁnitesimally small that we may as well say that it is impossible. But before you can learn to compute or estimate odds or probabilities you must learn to count! That is the subject of this note. We will learn how to count the number of outcomes while tossing coins, rolling dice and dealing cards. Many of the questions we will be interested in can be cast in the following simple framework, called the occupancy model : We have a set of k balls. We wish to place them into n bins. How many different possible outcomes are there? How do we represent coin tossing and card dealing in this framework? Consider the case of n = 2 bins labelled H and T , corresponding to the two outcomes of a coin toss. The placement of the k balls correspond to the outcomes of k successive coin tosses. To model card dealing, consider the situation with 52 bins corresponding to a deck of cards. Here the balls correspond to successive cards in a deal. The two examples illustrate two different constraints on ball placements. In the coin tossing case, different balls can be placed in the same bin. This is called sampling with replacement . In the cards case, no bin can contain more than one ball (i.e., the same card cannot be dealt twice). This is called sampling without replacement . As an exercise, what are n and k for rolling dice? Is it sampling with or without replacement? We are interested in counting the number of ways of placing k balls in n bins in each of these scenarios. This is easy to do by applying the ﬁrst rule of counting: First Rule of Counting: If an object can be made by a succession of k choices, where there are n 1 ways of making the ﬁrst choice, and for every way of making the ﬁrst choice there are n 2 ways of making the second choice, and for every way of making the ﬁrst and second choice there are n 3 ways of making the third choice, and so on up to the n k -th choice, then the total number of distinct objects that can be made in this way is the product n 1 · n 2 · n 3 ··· n k . Here is another way of picturing this rule: consider a tree with branching factor

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 03/18/2012 for the course CS 70 taught by Professor Papadimitrou during the Spring '08 term at Berkeley.

### Page1 / 4

n10 - CS 70 Spring 2012 Counting Discrete Mathematics and...

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

View Full Document
Ask a homework question - tutors are online