This preview shows page 1. Sign up to view the full content.
Unformatted text preview: , we have n(n1)...(nm+1) injective functions in this case. 6 Sum Rule
If a task can be done either in one of n1 ways or
in one of n2 ways, where none of the set of n1
ways is the same as any of the set of n2 ways,
then there are n1 + n2 ways to do the task.
Let S1 and S2 be disjoint sets with n1=S1 and
n2=S2. Then S1 ∪ S2 = n1+n2. 7 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 an.
a0 = 1 { one sequence, namely the empty sequence () }
a1 = 1 { one sequence, namely (1) }
a2 = 2 { the sequences (1,1) and (2) }
a3 = 3 { the sequences (1,1,1), (1,2), and (2,1) }
a4 = 5 { the sequences (1,1,1,1), (1,1,2), (1,2,1), (2,1,1), and (2,2) }
9 Sum Rule: Example 2 (Cont.)
How many sequences of 1s and 2s sum to n?
Let us call the answer to this question an.
a0 = 1, a1 = 1
an = an1 + an2 for n >=2
Indeed, there are
 an1 sequences starting with 1 (remaining seq. summing to n1)
 an2 sequences starting with 2 (remaining seq. summing to n2)
Thus, by the sum rule an = an1 + an2
Defining a1=0, we get an=fn+1 where fn is the Fibonacci sequence. IPv4 Address Example
Computer addresses belong to one of the following 3 types:
– Class A: address contains a 7bit “netid” ≠ 17, and a 24bit
“hostid”
– Class B: address has a 14bit netid and a 16bit hostid.
– Class C: address has 21bit netid and an 8bit hostid. Hostids that are all 0s or all 1s are not allowed. How many valid computer addresses are there?
11 IPv4 Address Example (Cont.)
(# addrs)
= (# class A) + (# class B) + (# class C)
(by sum rule) # class A = (# valid netids)·(# valid hostids)
(by product rule) (# valid class A netids) = 27 − 1 = 127.
(# valid class A hostids) = 224 ...
View
Full
Document
This note was uploaded on 03/24/2014 for the course CSCE 222 taught by Professor Math during the Fall '11 term at Texas A&M.
 Fall '11
 math

Click to edit the document details