Professional Documents
Culture Documents
INFORMATION SHEET
CODE AND
J12 DIPLOMA IN COMPUTER ENGINEERING TECHNOLOGY
PROGRAM
NAME
CODE AND
DKB3204 DISCRETE MATHEMATICS
COURSE NAME
INTRODUCTION
Suppose that a password on a computer system consists of six, seven, or eight characters. Each
of these characters must be a digit or a letter of the alphabet. Each password must contain at
least one digit. How many such passwords are there? The techniques needed to answer this
question and its known as counting. Counting problems arise throughout mathematics and
computer science. For example, we must count the successful outcomes of experiments and all
the possible outcomes of these experiments to determine probabilities of discrete events. We
need to count the number of operations used by an algorithm to study its time complexity.
1. There are 18 math majors and 25 science majors. How many ways are there to pick
one math major AND one science majors?
Solution:
There are 18 ways to select math major and 25 ways to select science major.
Total is 18 25 450
Solution:
The procedure of choosing a port consists of two tasks, first picking a microcomputer
and then picking a port on this microcomputer. Because there are 32 ways to choose
the micro-computer and 24 ways to choose the port no matter which microcomputer
has been selected, the product rule shows that there are 32·24=768 ports.
3. 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 sequences of letters
are prohibited)?
Solution:
Sum Rule
Also called the addition rule
If there are m ways to do task 1, and n ways to do task 2
If these tasks can be done at the same time, then…
2
EXAMPLES
1. There are 18 math majors and 25 science majors. How many ways are there to pick
one math major OR one science majors?
Solution:
There are 18 ways to select math major and 25 ways to select science major.
Total is 18 25 43
2. In how many ways can we select one book from different subjects among five
distinct computer science books, three distinct mathematics books, and two distinct
arts books?
Solutions:
There are 5 + 3 + 2 = 10 ways to selecting one book from different subject among the
computer science, mathematics and arts books.
5.2.1 Permutation
A permutation is the number of ways that that objects can be arranged, in which the
order of the objects matters
There are basically 2 types of permutation:
a) Permutation Without Repetition
A permutation of a set of n distinct objects taken r at a time without repetition is
an arrangement of r objects in a specific order.
We can calculate P(n, r) with the product rule:
(n choices for the first element, (n – 1) for the second one, (n – 2) for the third one…).
3
i) Permutations of all elements; P(n,n) = n!
Example
What are the total number of arrangements for the following six balls if all
balls must be used?
Example
1. What are the total number of arrangements for the following six balls if only
three balls must be used?
2. In how many ways can you arrange the 3 objects in the set {A, B,C} without
repetition?
Solution:
3. How many ways are there to select a first prize winner, a second winner, and a third
prize winner from 100 different people who have entered a contest?
Solution :
Because it does matter which person wins which prizes, use permutations.
The number of ways to pick the 3 prize winner from 100 people
P100,3 100 99 98
970200
4
4. A class consists of 10 students. Find the number of ways 3 student can be arranged
without replacement
Solution:
P10,3 10 9 8 10
3 P 720
720 @
How many permutations of the letter ABCDEFGH contain the string ABC (ABC
occur as a block)?
Solution :
Because the letter ABC must occur as a block, we can find the number of
permutations of six object :
Block ABC
Individual letter (D,E,F,G,H)
ABC D E F G H
6! = 720
Hence, there are 720 permutations of the letter ABCDEFGH in which ABC
occurs as a block.
When you have n things to choose from ... you have n choices each time!
When choosing r of them, the permutations are:
n × n × ... (r times) = nr
General Formula;
r
n
where n is the number of things to choose from, and you choose r of them
(Repetition allowed, order matters)
5
EXAMPLE
1. For the lock, there are 10 numbers to choose from (0,1,..9) and you choose 3 of them:
Solution:
2. A password consists of two letters of the alphabet followed by three digits chosen
from 0 to 9. Repetitions are allowed. How many different possible passwords are
there?
Solution:
5.2.2 Combinations
A combination is the number of ways that objects can be arranged, in which order of
the objects does not matter.
6
EXAMPLE
1. How many committee of three can be formed from seven people?
Solution:
Each committee is a combination of seven people taken three at a time.
Thus, the number of committee can be formed is;
n!
n
C
r!n r !
r
7!
3C
7
3!7 3!
7 6 5 4 3 2 1
3 2 1 4 3 2 1
35
2. In how many ways can we select a committee of two women and three men from a
group of five distinct women and six distinct men?
Solution :
5!
5
C
2! 5 2!
2
5 4 3 2 1
2 1 3 2 1
120
12
10
6!
C
6
3! 6 3!
3
6 5 4 3 2 1
3 2 1 3 2 1
720
36
20
Hence, by the multiplication Rule, the total number of committee that can be formed is
10 20 200
7
b) Combination With Repetition
General Formula :
C n r 1 , r C n r 1 , n 1
n r 1!
r!n 1!
Example
Suppose that a cookie shop has four different kinds of cookies. How many different ways
can six cookies be chosen? Assume that only the type of cookie, and not the individual
cookies or the order in which they are chosen, matters.
Solution:
The number of ways to choose six cookies is the number of 6 – combinations of a set
with four elements.
C 4 6 1 , 6 C 4 6 1 , 4 1
C 9,6 C 9,3
98 7
1 2 3
84
8
IMPORTANT !!!
If the order does matter it is a Permutation
n!
Pn, r
Permutations No (n r )!
C n, r
n!
Combinations No r!n r !
r
n
Permutations Yes
C n r 1 , r C n r 1 , n 1
Combinations Yes
n r 1!
r!n 1!