CMPT 285 Discrete Mathematics - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

CMPT 285 Discrete Mathematics

Description:

( order matters) choose the first object in n ways. choose the ... order does not matter. It is equivalent to selecting subsets of size r from a set of size n. ... – PowerPoint PPT presentation

Number of Views:67
Avg rating:3.0/5.0
Slides: 12
Provided by: ecsu
Category:

less

Transcript and Presenter's Notes

Title: CMPT 285 Discrete Mathematics


1
CMPT 285Discrete Mathematics
  • by Kossi Edoh
  • Department of Computer Science
  • Montclair State University

2
Section 4.1 The basics of Counting
The Rule of Sum If A and B are disjoint sets the
A?B AB Example Suppose statement
labels in a programming must be a single
letter or a single decimal digit. since
a label cannot be both at the same time, the
number of labels of letters of
decimals 26
10 The Rule of Products A x B
A B Example Statement labels in Basic can
be either - a single letter or -
a letter followed by a digit
3
Example Continued
  • Find the number of possible labels.
  • Solution
  • The set of all labels L S ? D has the
    partitions
  • the set of single letter labels S
  • the set of single letters followed by a digit
    D
  • The elements of D are ordered pairs of the form
    a,d
  • where a is an alphabetic character and d is a
    digit.
  • By the rule of product the cardinality of D is
    the product
  • of the cardinality of the sets
  • (the alphabetic characters)(the decimal
    digits)(26)(10)
  • L D S 26 260 286

4
The Principle of Inclusion-Exclusion
If A and B are not disjoint A?? B
A B - A ?B Example Count the number of
bits strings of length 4 which begin with a 1 or
end with a 00 Solution A set of bit strings
which begin with 1 1000, 1001, 1010, 1011, 1100,
1101, 1110, 1111 B set of bit
strings which end with 00 0000, 0100, 1000, 1100
A?? B 8 4 2 10
5
Example
Example A class contains 25 computer science
majors, 13 math majors and 8 with joint majors
in math and computer science. How many students
are in the class? C ? M C M - C ?
M 25 13 - 8
30
6
Example cont
  • A ? B ? C A B C - A ? B - B ? C
    - A ? C
  • A ? B ? C
  • Example
  • 1232 students have taken Spanish
  • students have taken French
  • students have taken Russian
  • 103 students have takes Spanish and French
  • 23 students have taken Spanish and
    Russian
  • 14 students have taken French and
    Russian
  • 2092 have taken French, Russian and Spanish
  • 2092 1232 879 114 - 103 - 23 - 14 A ? B
    ? C
  • Therefore A ? B ? C 7

7
Section 4.3 Permutation and Combination
Given a set of n objects in an urn We are going
to pick (select) r objects from the urn in a
sequence. After we choose an object we
can replace it (selection with replacement)
or not (selection without replacement) Permut
ation selection without replacement of r objects
from the urn with n objects. (order
matters) choose the first object in n ways
choose the second object in n-1 ways
choose the rth
object in n-r1 ways
8
Permutation and Combination continued
The number of permutations of n things taken r at
time P(n,r) n (n-1) (n-2) (n-r1)
n!/(n-r)! Example Count the number of
injections from the set A to the set B, where
A ? B Solution There are P(B, A)
injections Combination is a selection without
replacement but order does not matter It is
equivalent to selecting subsets of size r from a
set of size n.
9
Combination
The number of combinations of n things taken r at
a time n choose r
the binomial coefficient C(n,r)
(n,r) P(n,r)/ P(r,r)
n! / ((n-r)! r!) Example How many subsets
of size r can be constructed from a set of n
objects? Solution C(n,r)
n Corollary ?C(n,r) 2n r0
10
Example
Suppose you flip a fair coin n times. How many
different ways can you get no head
C(n,0) exactly one
head C(n,1) exactly two heads
C(n,2) exactly r heads
C(n,r) at least 2 heads
2n C(n,0) - C(n,1) Pascals Identity
C(n1,k) C(n, k-1) C(n,k)
11
Example continued
How many bit strings of length 4 have exactly 2
ones ( exactly two zeros) Solution C(4,2)
4!/ 2! 2! 6 How
many bit strings of length 4 have at least 2
ones Solution exactly 0 one exactly 1 one
exactly 2 ones C(4,0) C(4,1) C4,2) 1 4
6 11
Write a Comment
User Comments (0)
About PowerShow.com