0% found this document useful (0 votes)
64 views14 pages

Reviewer in Discrete Mathematics

The document discusses counting techniques including the product rule, sum rule, and pigeonhole principle. It provides examples of applying these rules to problems involving counting outcomes of tasks, license plates, exam scores, and more. Permutations are also introduced.

Uploaded by

Al-Jame Balina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views14 pages

Reviewer in Discrete Mathematics

The document discusses counting techniques including the product rule, sum rule, and pigeonhole principle. It provides examples of applying these rules to problems involving counting outcomes of tasks, license plates, exam scores, and more. Permutations are also introduced.

Uploaded by

Al-Jame Balina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

DISCRETE MATHEMATICS REVIEWER FINALS- Babao

COUNTING TECHNIQUES port no matter which microcomputer has


been selected, the product rule shows that
1. The Product Rule there are
• Suppose that a procedure can be broken • t1t2 = 3224 = 768 different ports to a
down into a sequence of two tasks microcomputer in the center
• If there are n1 ways to do the first task and
n2 ways to do the second task after the first
task has been done, then there are n1n2 ways
to do the procedure.
• We can extend product rule to more than
two tasks.

Example 1:
Example 3: How many different bit strings are there of
• The chairs of an auditorium are to be length 7?
labeled with a letter and a positive
Solution:
integer not exceeding 100.
• What is the largest number of chairs • Each of the seven bits can be chosen in two
that can be labeled differently? ways, since each bit is either 0 or 1.
• Therefore, the product rule shows that there
Solution:
are
• The procedure of labeling a chair consists of • t1t2t3t4t5t6t7 = t 7 = 2 7 = 128 different
two tasks, namely: bit strings of length seven
• t1)Assigning a chair with one of the 26 letters;
• t2) Assigning a chair with one of the 100
possible positive integers not exceeding 100.
• Using product rule, it shows that there are
• t1t2 = 26100 = 2600 different ways that a
chair can be labeled.
• Therefore, the largest number of chairs that
Example 4: How many different license plates are
can be labeled differently is 2600.
available if each plate contains a sequence of three
letters followed by three digits (and no sequences of
letters are prohibited, even if they are obscene)?

Example 2:

• There are 32 microcomputers in a computer


center.
• Each microcomputer has 24 ports.
• How many different ports to a microcomputer
in the center are there?

Solution:

• The procedure of choosing a port consists of


two tasks, namely:
• t1) Picking a microcomputer;
• t2) Picking a port on this microcomputer.
• Since there are 32 ways to choose the
microcomputer and 24 ways to choose the
DISCRETE MATHEMATICS REVIEWER FINALS- Babao
• t1 + t2 + t3 = 23 + 15 + 19 = 57 projects to
choose from
2. The Sum Rule
• If a first task can be done in n1 ways
and a second task in n2 ways, and if
these tasks cannot be done at the
same time, then there are n1 + n2
ways to do one of these tasks.
• We can extend sum rule to more than
two tasks.

Example 1:

• Suppose that either a member of the


mathematics faculty or a student who is
mathematics major is chosen as a
representative to a university committee.
• How many different choices are there for this • The Pigeonhole Principle is also called the Dirichlet
representative if there are 37 members of the drawer principle, states that if k + 1 or more objects
mathematics faculty and 83 mathematics are placed into k boxes, then there is at least one box
majors? containing two or more of the objects.

Solution: Example 1:

• The first task t1: choosing a member of the 1.a) Among a group of 367 people, there must be at
mathematics faculty, can be done in 37 ways least two with the same birthday, because there are
• The second task t2: choosing a mathematics only 366 possible birthdays.
major, can be done in 83 ways. 1.b) In any group of 27 English words, there must be at
• From the sum rule, it follows that there are: least two that begins with the same letter, since there
• t1 + t2 = 37 + 83 = 120 possible ways to pick are 26 letters in the English alphabet.
this representative
Example 2: How many students must be in class to
guarantee that at least two students receive the same
score on the final exam, if the exam is graded on a
scale from 0 to 100 points?

Solution:

• There are 101 possible scores on the final


exam.
• The pigeonhole principle shows that among
Example 2:
any 102 students there must be at least two
• A student can choose a computer project students with the same score.
from one of three lists.
Example 3:
• The three lists contain 23, 15, and 19 possible
projects, respectively. • What is the minimum number of students
• How many possible projects are there to required in a discrete mathematics class to be
choose from sure that at least six will receive the same
grade, if there are five possible grades: A, B,
Solution:
C, D and F?
• The student can choose a project from the
Solution:
first list in 23 ways, from the second list in 15
ways, and from the third list in 19 ways. • Since there are five possible grades, if five
• Hence, there are: students be assigned to each of the possible
grades then 55 = 25 students
DISCRETE MATHEMATICS REVIEWER FINALS- Babao
• But since there should be at least six 12. How many numbers must be selected from the set
students who will receive the same grade so { 1, 2, 3, 4, 5, 6 } to guarantee that at least one pair of
we add 1 student to the count and that these numbers add up to 7?
makes it : 25 + 1 = 26 as the minimum
4. PERMUTATIONS
number of students
• A permutation of a set of distinct objects is an
Exercises:
ordered arrangement of these objects.
1. There are 18 mathematics majors and 325 • We are also interested in ordered
computer science majors at a college. arrangement of some of the elements of a
set.
a) How many ways are there to pick 2 representatives,
• An ordered arrangement of r elements of a
so that one is a mathematics major and the other is a
set is called an r-permutation.
computer science major?
• Let S = { 1, 2, 3 }. The arrangement 3, 1, 2 is a
b) How many ways are there to pick one permutation of S. The arrangement 3, 2 is a 2-
representative who is either a mathematics major or a permutation of S
computer science major.

2. A particular brand of shirt comes in 12 colors, has a


male version and a female version, and comes in three
sizes for each sex. How many different types of this
shirt are made?

3. How many different three-letter initials can people


have?

4. How many different three-letter initials are there


that begin with ‘A’?
Example 1:
5. How many bit strings of length ten begin and ends
with a 1? • How many ways are there to select a first prize
winner, a second-prize winner, and a third-
6. How many strings are there of lowercase letters of
prize winner from 100 different people who
length 4 or less?
have entered a contest?
7. How many bit strings of length 10 either begin with Solution:
3 0s or end with 2 0s?
• Because it matters which person wins which
8. How many license plates can be made using either
prize, the number of ways to pick the three
two letters followed by four digits or two digits
prize winners is the number of ordered
followed by four letters?
selections of three elements from a set of 100
10. In how many ways can a photographer at a elements, that is, the number of 3-
wedding arrange six people in a row, including the permutations of a set of 100 elements.
bride and groom, if • n = 100, r = 3

a) the bride must be next to the groom?

b) the bride is not next to the groom?

c) the bride is positioned somewhere to the left of the


groom? Example 2:

11. A drawer contains a dozen brown socks and a • Suppose that there are eight runners in a race.
dozen black socks, all unmatched. A man takes socks • The winner receives a gold medal, the second-
out at random in the dark. How many socks must he place finisher receives a silver medal, and the
take out to be sure that he has at least 2 socks of the third-place finisher receives bronze medal.
same color?
DISCRETE MATHEMATICS REVIEWER FINALS- Babao
• How many different ways are there to award
these medals, if all possible outcomes of the
race can occur and there are no ties?

Solution:
5. COMBINATIONS
• The number of different ways to award the
medals is the number of 3-permutations of a • An r-combination of elements of a set is an
set with eight elements. unordered selection of r elements from the
• Hence, there are: set.
• Thus, an r-combination is simply a subset of
the set with r elements.
• Let S be the set { 1, 2, 3, 4 }. Then { 1, 3, 4 } is
a 3-combination from S.
Example 3: • The number of r-combinations of a set with n
distinct elements is denoted by 𝐶(𝑛, 𝑟) and is
• Suppose that a saleswoman has to visit eight
called binomial coefficient.
different cities.
• The number of r-combinations of a set with n
• She must begin her trip in a specified city, but
elements, where n is a nonnegative integer
she can visit the other seven cities in any
and r is an integer with 0  r  n, equals
order she wishes.
• How many possible orders can the
saleswoman use when visiting these cities?

Solution:
Example 1:
• The number of possible paths between the
How many ways are there to select five
cities is the number of permutations of seven
players from a 10-member tennis team to
elements, since the first city is determined,
make a trip to a match at another school?
but the remaining seven can be ordered
arbitratily, then there are only 7 elements to
Solution:
arrange.
• The answer is given by the number of 5-
• P(n,r) = P(7,7) = 7! = 5,040 possible ways for
combinations of a set with ten elements.
the saleswoman to choose her tour
• The number of such combinations is:

Example 4:

• How many permutations of the letters ABC


DEFGH contain the string ABC?

Solution:

• Because the letters ABC must occur as a block,


we can find the answer by finding the number
of permutations of six objects, namely, the
block ABC and the individual letters, D, E, F,G
and H.
• Because these six objects can occur in any
order, there are
P(n,r) = P(6,6) = 6! = 720 permutations of the
letters ABCDEFGH in which ABC occurs as a
block
DISCRETE MATHEMATICS REVIEWER FINALS- Babao
Example 4:

How many ways are there to select a committee to


develop a discrete mathematics course at a school if
the committee is to consist of three faculty members
from the mathematics department and four from the
computer science department, if there are nine
faculty members of the mathematics department and
Example 2:
11 of the computer science department?
A group of 30 people have been trained as
astronauts to go on the first mission to Mars.

How many ways are there to select a crew of Solution:


six people to go on this mission (assuming • By the product rule, the answer is the product
that all crew members have the same job)? of the number of 3-combinations of a set with
nine elements and the number of 4-
Solution: combinations of a set with 11 elements.
• The number of ways to select a crew • The number of ways to select the committee
of six from the pool of 30 people is is:
the number of 6-combinations of a set
with 30 elements, because the order
in which these people are chosen
does not matter.
• The number of such combinations is:

Example 3:

How many bit strings of length n contain exactly r 1s?

Solution:

• The positions of r 1s in a bit string of length n


form an r-combinations of the set { 1, 2, 3, .. ,n
}.
• Hence, there are 𝑪 𝒏, 𝒓 bit strings of length n
that contains exactly r 1s.
DISCRETE MATHEMATICS REVIEWER FINALS- Babao
DISCRETE MATHEMATICS REVIEWER FINALS- Babao
RELATIONS Properties of Relation

Writing relation as a table 1.) Reflexive ( x є X)

X Y Example:
a 6 X= {1,2,3,4}
b 2
R= {(1,1), (2,1), (2,2), (3,1), (3,3), (4,1), (4,4)}
a 1
c 1 It is a Reflexive because the ordered pairs are
present.

Writing relation as an ordered pair. // pero kapag si 5 is element ng X then walang


siyang ordered pair ibigsabihin hindi reflexive ang
R= {(8440, Hammer), (9921, Pliers), (452, Paint), relation.
(220, Carpet.)}
2.) Symmetric ( x, y ) є R, (Y, X) є R
Domain = X Range= Y - Dapat may kabaliktad sa relation niya.

Example:
Getting the Domain and Range of R.
Example: R= {(1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,1), (3,2),
R= {(1,1), (2,1), (2,2), (3,1), (3,3), (4,1), (4,4)} (3,3)}
Domain of R = {1,2,3,4} It is a symmetric since the ordered pair (1,2) may
Range of R = {1,2,3,4} kabaliktad which is (2,1).

Digraph

- an informative way to picture a relation on a 3.) Antisymmetric (x, y) є R and (x ≠ y) then (y, x )
set is to draw its graph. is not element of R.
- Pagbabaliktarin ang ordered pair dapat wala
Steps in Drawing Digraph sa relation.
1. Draw Dots - Okay lang may magloop isali lang ito sa
2. Draw an arrow (Called directed Edge). evaluation.

Note:

- Relation on X lang ang pwede gawan ng Example:


Digraph. R= {(1,1), (1,2), (1,3), (1,4), (2,2), (2,3), (2,4), (3,3),
- Relation from x to y →R used x ≠ y (3,4), (4,4)}
- Relation on x → R used x =y (XxY, XxX)
R= {(1,1), (2,2), (3,3) (x ≠ y)

4.) Transitive (x, y), (y, z) = (x, z)


Example:
Example:
R= {(1,1), (1,2), (1,3), (1,4), (2,2), (2,3), (2,4), (3,3),
(3,4), (4,4)} R= {(1,1), (1,2), (1,3), (1,4), (2,2), (2,3), (2,4), (3,3),
(3,4), (4,4)}

1 2 (x, y) = (1,1)

(y, z) = (1,2)

(x, z) = (1,2)

R= {(1,2), (1,3), (1,4), (2,3), (2,4), (3,4)}


3 4
DISCRETE MATHEMATICS REVIEWER FINALS- Babao
5.) Partial Order (Reflexive, Antisymmetric,
Transitive)

➢ Comparable
- (x ≤ y or y ≤ x)
- Mas maliit si x sa y vice versa
- Consistent ang order
➢ Incomparable
- Hindi consistent ang order.

Example:
{(3,1), (4,2), (5,3)} Comparable
{(1,3), (1,5), (4,3)} Incomparable

➢ Total Order
- If every pair of an element in x is comparable,
we call R a Total Order.

➢ Inverse (R -1)
- Kabaliktaran ng relation
- Example:
R= {(1,1), (1,2), (1,3), (1,4), (2,5), (2,3)}
R-1= {(1,1), (2,1), (3,1), (4,1), (5,2), (3,2)}
//sa relation na mag focus dili na sa given na
may rule pa.

Getting the Domain and Range of Inverse


Domain of R-1 = {1,2,3,4,5}
Range of R-1 = {1,2}

➢ The Composition of (R2 o R1, R1 o R2)


(x, y), (y, z) = (x, z)

Example:
R1 = {(1,2), (1,6), (2,4), (3,4), (3,6), (3,8)}
R2 = {(2, u), (4,5), (4, t), (6, t), (8, u)}

R2 o R1 = {(1, u), (1, t), (2, 5), (2, t), (3, 5), (3, t),
(3, u)}

//wag na isali sa pagsulat ang ordered pair na may


kapareha.
DISCRETE MATHEMATICS REVIEWER FINALS- Babao
GRAPHS 4.) Directed Graph
- It has directed edges, multiple edges is
-are discrete structures consisting of vertices and
not allowed but looping is allowed.
edges that connect these vertices.

TYPES OF GRAPHS

1.) Simple Graph


- G=(V,E)
- V -A nonempty set of vertices
- E- A set of unordered pairs of distinct
elements of V called edges.

5.) Directed Multigraph


- It is directed edges, multiple edges are
allowed and looping is also allowed.

Note: it is undirected edges, multiple Edges


are not allowed and looping is also not
allowed.

2.) Multigraph
- Function f from E to {(u, v ) |u, v is an
element of a V, u is not equal to v.

GRAPH MODELS

- Graphs are used in a wide variety of


models.
1.) Niche Overlap Graph in Ecology.
- The competition between species in an
ecosystem can be modeled using this
graph.
Note: it is undirected, multiple edges is - Each Species is represented by a vertex.
allowed but looping is not allowed.

3.) Pseudograph
- Function f from E to {(u, v) |u, v is an
element of a V.
- An edge loop if f(e) = {u, u} = {u} for some
u is an element of V.
-
-
-
-
-
-
-
-
Note: it is undirected edges and Multiple
edges and looping is allowed.
DISCRETE MATHEMATICS REVIEWER FINALS- Babao
2.) Acquaintanceship Graph 5.) Round-Robin Tournaments
- We use this model to represent various - A tournament where each team plays
relationships between people. each other team exactly once.
- Each Person represented by a vertex and - Such tournaments can be modeled using
an undirected edge is used to connect two Directed Graph where each team is
people when these people know each represented by a vertex.
other.

3.) Influence Graph


- A directed graph called an influence graph
can be used to model this behavior.
6.) Collaboration Graph
- Each person represented by a vertex.
- Used to model joint authorship of
academic papers.
- Vertices represents people and edges link
two people if they have jointly written a
paper.

7.) Call Graph


4.) The Hollywood Graph - Used to model telephone calls made in
- It represents actors by vertices network, such as long-distance telephone
- When the actors have worked with network.
another actor on a movie then they are - Directed Multigraph can be used to model
connected. calls.
- Telephone is the vertex and each
telephone call is represented by a directed
edge.
DISCRETE MATHEMATICS REVIEWER FINALS- Babao
Continuation of number 7

- When we care only whether there has


been a call connecting two telephone
numbers, we use an undirected graph
with an edge connecting telephone
numbers when there has been a call
between these numbers.
8.) The Web Graph
- The World Wide Web can be modeled as a
directed graph.
- Each web page is represented by a vertex.
And where an edge starts at the web page
a and ends at the web page b.

9.) Precedence Graph and Concurrent Processing


- Each statement is represented by a vertex,
and there is an edge from one vertex to a
second vertex if the statement
represented by the second vertex cannot
be executed before the statement
represented by the first vertex has been
executed.
- This graph is called a precedence graph.

SHORTEST-PATH PROBLEMS

- • Problems involving distances can be


modeled by assigning distances between
cities to the edges.
- • Problems involving flight time can be
modeled by assigning flight times to
edges.
- • Problems involving fares can be
modeled by assigning fares to the edges.
- Graphs that have a number assigned to
each edge are called weighted graphs.
Weighted graphs are used to model
computer networks.
DISCRETE MATHEMATICS REVIEWER FINALS- Babao

SHORTEST_PATH ALGORITM

• Dijkstra’s algorithm (Dikestras)


- An Algorithm discovered by the dutch
mathematician Edsger Dijkstra in 1959.
- • solves problem in undirected weighted
graphs where all the weights are positive
- • easy to adapt to solve shortest-path
problems in directed graphs

EXAMPLE:
DISCRETE MATHEMATICS REVIEWER FINALS- Babao
EXERCISES:

• Draw graph models, stating the type of graph used,


to represent airline routes where every day there are
four flights from Boston to Newark, two flights from
Newark to Boston, three flights from Newark to
Miami, two flights from Miami to Newark, one flight
from Newark to Detroit, two flights from Detroit to
Newark, three flights from Newark to Washington,
two flights

from Washington to Newark, and one flight from 6. The intersection graph of a collection of sets A1 , A2
Washington to Miami, with: ,…,An is the graph that has a vertex for each of these
sets and has an edge connecting the vertices
a) an edge between vertices representing cities that
representing two sets if these sets have a nonempty
have a flight between them (in either direction).
intersection. Construct the intersection graph of these
b) an edge between vertices representing cities for collections of sets.
each flight that operates between them (in either
a)
direction).
A1 = {0, 2, 4, 6, 8},
c) an edge between vertices representing cities for A2 = {0, 1, 2, 3, 4},
each flight that operates between them (in either A3 = {1, 3, 5, 7, 9},
direction), plus a loop for a special flight sightseeing A4 = {5, 6, 7, 8, 9},
trip that takes off and lands in Miami A5 = {0, 1, 8, 9}
b)
d) an edge from a vertex representing a city where a
A1 = {…, -4, -3, -2, -1, 0},
flight starts to the vertex representing the city where
A2 = {…, -2, -1, 0, 1, 2, …},
it ends.
A3 = {…, -6, -4, -2, 0, 2, 4, 6, …},
e) an edge for each flight from a vertex representing a A4 = {…, -5, -3, -1, 1, 3, 5, …},
city where the flight begins to the vertex representing A5 = {…, -6, -3, 0, 3, 6, …}
the city where the flight ends.
7. Construct a niche overlap graph for six species of
For Exercises 2-5, determine whether the graph shown birds, where the hermit thrush competes with the
is a simple graph, a multigraph (and not a simple robin and with the blue jay, the robin also competes
graph), a pseudograph (and not a multigraph), a with the mockingbird, the mockingbird also competes
directed graph, or a directed multigraph (and not a with the blue jay, and the nuthatch competes with the
directed graph). hairy woodpecker.

8. Construct an influence graph for the board


members of a company if the President can influence
the Director of Research and Development, the
Director of Marketing, and the Director of Operations;
the Director of Research and Development can
influence the Director of Operations; the Director of
Marketing can influence the Director of Operations;
and no one can influence, or be influenced by, the
Chief Financial Officer.

9. In a round-robin tournament the Tigers beat the


Blue Jays, the Tigers beat the Cardinals, the Tigers
beat the Orioles, the Blue Jays beats the Cardinals, the
Blue Jays beat the Orioles, and the Cardinals beat the
Orioles. Model this outcome with a directed graph.
DISCRETE MATHEMATICS REVIEWER FINALS- Babao
10. Construct a precedence graph for the following
program:
S1 : x := 0
S2 : x := x + 1
S3 : y := 2
S4 : z := y
S5 : x := x + 2
S6 : y := x + z
S7 : z := 4

a) Find a shortest route in distance between Newark


3. Find a shortest path between a and z in each of the and Camden, and between Newark and Cape May,
weighted graphs in using these roads.
Exercises 1- 2.
b) Find a least expensive route in terms of total tolls
4. Find the length of the shortest path between these using the roads in the graph between the pairs of
pairs of vertices in the weighted graph in cities in part (a) of this exercise.
Exercise 2.
a) a and d
b) a and f
c) c and f
d) b and z

5. Find the shortest paths in the weighted graph in


Exercise 2 between the pairs of vertices in Exercise 4.

6. The weighted graphs in the figures here show some


major roads in New Jersey. Part (a) shows the
distances between cities on these roads; part (b)
shows the tolls.

You might also like