counting

# counting - CSCE 222 Discrete Structures for Computing...

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

CSCE 222 Discrete Structures for Computing Counting Dr. Hyunyoung Lee Based on slides by Andreas Klappenecker 1

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

View Full Document
Counting The art of counting is known as enumerative combinatorics. One tries to count the number of elements in a set (or, typically, simultaneously count the number of elements in a series of sets). For example, let S 1 ,S 2 ,S 3 ,... be sets with 1,2,3,. .. elements, respectively. Then the number of subsets of S i is given by f(i)=|P(S i )|=2 i . The basic principles are extremely simple, but counting is a nontrivial task. 2
The Product Rule Suppose that a task can be broken down into a sequence of two subtasks. If there are n 1 ways to solve subtask 1 and n 2 ways to solve subtask 2, then there must be n 1 n 2 ways to solve the task. Let S 1 and S 2 be sets describing the ways of the first and second subtasks, so n 1 =|S 1 | and n 2 =|S 2 |. Then |S 1 x S 2 | = n 1 n 2 . 3

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

View Full Document
Product Rule: Example 1 How many different license plates can be made if each plate contains a sequence of three uppercase English letters followed by three digits (and no sequence of letters are prohibited). There are 26 choices for each of the three uppercase letters, and 10 choices for each of the three digits. Thus, 26 x 26 x 26 x 10 x 10 x 10 = 17,576,000 possible license plates. Since Texas has already a population of 26,059,203, this is perhaps not a good choice here. 4
Product Rule: Example 2 How many functions are there from a set with m elements to a set with n elements? For each of the m elements in the domain, we can choose any element from the codomain as a function value. Hence, by the product rule, we get n x n x . .. x n = n m different functions. 5

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

View Full Document
Product Rule: Example 3 How many injective functions are there from a set with m elements to a set with n elements? If m > n , then there are 0 injective functions. If m <= n , then there are n ways to choose the value for the first element in the domain, n-1 ways to choose the value for the second element (as one has to avoid the previously chosen value), n-2 for the third element of the domain and so forth. Thus, we have n(n-1). ..(n-m+1) injective functions in this case. 6
Sum Rule If a task can be done either in one of n 1 ways or in one of n 2 ways, where none of the set of n 1 ways is the same as any of the set of n 2 ways, then there are n 1 + n 2 ways to do the task. Let S 1 and S 2 be disjoint sets with n 1 =|S 1 | and n 2 =|S 2 |. Then |S 1 S 2 | = n 1 +n 2 . 7

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

View Full Document
Sum Rule: Example 1 A student can choose a computer project from one of three lists. The three lists contain 23, 15, and 19 possible projects, respectively. No project is on more than one lists. How many possible projects are there to choose from? There are 23+15+19=57 projects to choose from. 8
Sum Rule: Example 2 How many sequences of 1s and 2s sum to n? Let us call the answer to this question a n . a 0 = 1 { one sequence, namely the empty sequence () } a 1 = 1 { one sequence, namely (1) } a 2 = 2 { the sequences (1,1) and (2) } a 3 = 3 { the sequences (1,1,1), (1,2), and (2,1) } a 4 = 5 { the sequences (1,1,1,1), (1,1,2), (1,2,1), (2,1,1), and (2,2) } 9

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

View Full Document
Sum Rule: Example 2 (Cont.) How many sequences of 1s and 2s sum to n?
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 50

counting - CSCE 222 Discrete Structures for Computing...

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

View Full Document
Ask a homework question - tutors are online