Week 1 - Introduction To Discrete Structures-Merged
Week 1 - Introduction To Discrete Structures-Merged
1 INTRODUCTION
It is a common perception for students who would like to take IT Education to choose programs other
than Computer Science. This is mainly because they want to avoid the courses of mathematics such as
Discrete Mathematics or Discrete Structure. Little do they know that the study of mathematics,
particularly Discrete Mathematics, is a pre-requisite knowledge in order to learn algorithms used in
computer programming.
This course will teach you sets of mathematical facts and how to apply them, more importantly, the
course would teach you how to think logically and mathematically.
Objectives:
DISCRETE STRUCTURES 1 1
Introduction to Discrete Structures
Discrete Mathematics
• Discrete mathematics is the part of mathematics devoted to the study of discrete objects.
• Discrete mathematics is used whenever objects are counted, when relationships between finite
(or countable) sets are studied, and when processes involving a finite number of steps are
analyzed.
A successful discrete mathematics course should carefully blend and balance all five themes.
1. Mathematical Reasoning
2. Combinatorial Analysis
3. Discrete Structures
A course in discrete mathematics should teach students how to work with discrete
structures, which are the abstract mathematical structures used to represent discrete
objects and relationships between these objects.
4. Algorithmic Thinking
Discrete mathematics has applications to almost every conceivable area of study. There
are many applications to computer science and data networking, as well as applications
to such diverse areas as chemistry, biology, linguistics, geography, business, and the
Internet.
1. To develop your mathematical maturity: that is, the ability to understand and create
mathematical arguments;
2. It provides the mathematical foundations for many computer science courses including data
structures, algorithms, database theory, automata theory, formal languages, compiler theory,
computer security, and operating systems.
DISCRETE STRUCTURES 1 2
Introduction to Discrete Structures
References:
1. Kenneth H. Rosen. Discrete Mathematics and Its Applications, 7th Edition. McGrawHill, 2012
2. Gary Weiss Damian Lyons, et al., Fundamentals of Discrete Structures, 2nd edition, Pearson
Learning Solutions, 2012.
3. Susanna S. Epp, Discrete Mathematics with Applications, Brooks Cole; 4th edition, 2011.
4. James L. Hein, Discrete Structures, Logic, and Computability, 3rd edition, Jones & Bartlett
Publishers, 3rd edition, 2009.
5. Kolman, B., Busby, R. C., Ross, S. C. Discrete Mathematical Structures, 6th Edition. Prentice Hall,
2008.
DISCRETE STRUCTURES 1 3
Logic
2 LOGIC
The rules of logic specify the meaning of mathematical statements. It is the basis of all mathematical
reasoning (Rosen, 2012). Its application in the area of computer science is very vast that even the
computer itself defends on it, True or False, 1 or 0, and the presence or absence of bit. The study of logic
will increase your knowledge in formulating logical statements for the reason that program statements
and expressions are built from repeated application of logical operators. This module will help you
analyze arguments to determine the truth value of it.
Objectives:
1. Define Logic.
2. Appreciate the importance of Logic in mathematics.
3. Identify Propositions.
4. Convert Propositions to propositional variables.
5. Apply logical connectives to form compound propositions.
6. Construct and prove statements using Truth Table.
DISCRETE STRUCTURES 1 4
Logic
Definition
• Logic is the study of the methods and principles used to distinguish good (correct) from bad
(incorrect) reasoning.
• The term is derived from the Greek word logike – the feminine of the word logikos which means
“of reason.”
Importance of Logic
• Logic is the basis of all mathematical reasoning, and of all automated reasoning. It has practical
applications to the design of computing machines, to the specification of systems, to artificial
intelligence, to computer programming, to programming languages, and to other areas of
computer science, as well as to many other fields of study.
• The statement being supported is the conclusion of the argument and the statements that
support it are the premises of the argument.
3. Fuzzy Logic
Propositional Logic
• Propositional Logic or PL is that part of logic which deals with statements that are either true or
false but not both.
• The bases for propositional logic are the three laws of Aristotelian logic. These are:
– Law of Excluded Middle. “A statement is either true or false but not both.”
DISCRETE STRUCTURES 1 5
Logic
Example of Argument
If the program syntax is faulty or if program execution results in division by zero, then
the computer will generate an error message. Therefore, if the computer does not
generate an error message, then the program syntax is correct and program execution
does not result in division by zero.
• Propositional Logic or PL is that part of logic which deals with statements that are either true or
false but not both.
• The bases for propositional logic are the three laws of Aristotelian logic. These are:
– Law of Excluded Middle. “A statement is either true or false but not both”
Propositions
• The rules of logic gives precise meaning of mathematical statements. These rules are used to
distinguish valid and invalid mathematical arguments.
Example:
– 1+5=6
– The Earth revolves around the Sun
– 10 – 4 = 5
– Pigs can fly
– x+3=5
– x+y=z
– When is your birthday?
– Pass your assignment.
Sentences 1 and 2 are not propositions because they are neither true nor false.
Sentences 1 and 2 are not propositions because they are not declarative sentences.
DISCRETE STRUCTURES 1 6
Logic
Propositional Variable
Example:
Exercise
1. 10 is greater than 5
3. 5 + a = 10
Compound Proposition
Can be obtained by: Negating a proposition, or Combining two or more propositions using
logical connectives
Logical Connectives
The basic logical connectives are: not, and, or, if then, and if and only if.
Not is used to modify propositions while and, or, if then and if and only if are used to join
propositions.
DISCRETE STRUCTURES 1 7
Logic
Precedence Rules
In forming sentences, we put grouping symbols (parentheses, brackets, or braces). Without the
presence of grouping symbols, we will assume that the grouping will follow the precedence
rules for the logical connectives.
Logical Connectives
Not
And
Or
If then
If and only if
The connective with the higher priority will be considered first over the one with the lower
priority. Connectives having the same priorities are then considered from left to right.
Truth Table
A table that lists the truth value of the compound proposition for all possible values of its
proposition variables.
Truth tables can be used to show how these operators can combine propositions to form
compound propositions.
Negation (Not)
F: T
Proposition Negation
p : The sun is shining p : The sun is not shining
q : The program is running q : The program is not running
r : The value of x is positive r : The value of x is not positive
DISCRETE STRUCTURES 1 8
Logic
Conjunction (And)
In logic, the word “but” is sometimes used instead of conjunction “and”. Generally, the
word “but” is used in place of “and” when the part of the sentence that follows is, in some way,
unexpected.
Example:
Let
p : Mathematics is easy
The proposition will only result into TRUE if the statements p and q are both true. If one
of the statements results into False, the entire proposition will result into False.
Example:
Let
p : Today is Monday
Find p q
DISCRETE STRUCTURES 1 9
Logic
Disjunction (Or)
p : Mathematics is easy
The proposition will result into TRUE if the statements p or q are true. If one of the
statements results into True, the entire proposition will result into True.
Example:
Let
p : Today is Monday
Find p q
The notation for inequalities involves and and or statements. For instance, if x, a, and b
are particular real numbers, then
DISCRETE STRUCTURES 1 10
Logic
Exclusive or (XOR)
p q : Either the Earth revolves around the Sun or pigs can fly
TF:T p q pq
T T F
T F T
F T T
F F F
Example:
Let
p : Mathematics is easy
The proposition will only result into TRUE if one of the statements is true. If both
statements result into True or False, the entire proposition will also result to False.
Example:
Let
p : Today is Monday
Find p q
If p then q p q pq
p is sufficient for q T T T
q is necessary for p
T F F
F T T
p : Hypothesis
F F T
q : Conclusion
p q
DISCRETE STRUCTURES 1 11
Logic
Example:
Let:
pr sp
If 2 < 6, then 2 < 10 If 2 < 1, then 2 < 6
TT:T FT:T
ps st
If 2 < 6, then 2 < 1 If 2 < 1, then 5 < 3
TF:F FF:T
Example:
Let
p : Mathematics is easy
The proposition will only result into FALSE when p is true and q is false, and TRUE
otherwise. In the conditional statement p q, p is called hypothesis and q is called conclusion.
Example:
Let
p : Today is Monday
Find p q
DISCRETE STRUCTURES 1 12
Logic
Example:
Let
p : Mathematics is easy
The proposition will only result into TRUE when both p and q have the same value of
either True or False.
Example:
Let
p : Today is Monday
Find p q
Statements and operators can be combined in any way to form new statements.
Example:
p q p q p) v (q)
T T F F F
T F F T T
F T T F T
F F T T T
DISCRETE STRUCTURES 1 13
Logic
Exercise
1. ¬p q
2. p(qr)
3. ¬(p q ) (p q )
4. p (¬q r )
DISCRETE STRUCTURES 1 14
Logic
References:
1. Kenneth H. Rosen. Discrete Mathematics and Its Applications, 7th Edition. McGrawHill, 2012
2. Gary Weiss Damian Lyons, et al., Fundamentals of Discrete Structures, 2nd edition, Pearson
Learning Solutions, 2012.
3. Susanna S. Epp, Discrete Mathematics with Applications, Brooks Cole; 4th edition, 2011.
4. James L. Hein, Discrete Structures, Logic, and Computability, 3rd edition, Jones & Bartlett
Publishers, 3rd edition, 2009.
5. Kolman, B., Busby, R. C., Ross, S. C. Discrete Mathematical Structures, 6th Edition. Prentice Hall,
2008.
DISCRETE STRUCTURES 1 15
Logic
3 LOGIC
There are some formulas whose truth values are always True or always False regardless of the truth
value assigned to the variables. The negation of tautology is contradiction and vice-versa. The
knowledge on the simplification of proposition will aid in determining validity of the argument faster
than the use of Truth Table and the use of Laws of Logic (inference rules), which can be used to
construct more complicated valid argument forms. This module will teach you how to establish the
validity of arguments and simplify compound propositions using Laws of Logic.
Objectives:
DISCRETE STRUCTURES 1 16
Logic
Tautology is a statement that is always true regardless of the truth values of the individual
logical variables.
Example:
R (R)
If S T is a tautology, we write S T.
If S T is a tautology, we write S T.
A contradiction is a statement that is always false regardless of the truth values of the
individual logical variables.
Example:
R (R)
The negation of any tautology is a contradiction, and the negation of any contradiction is
a tautology.
Logical Equivalence
Two proposition forms are called logically equivalent if and only if they have identical truth
values for each possible substitution of propositions for their proposition variable.
P≡Q
2. Construct the truth table for Q using the same proposition variables for identical component
propositions.
3. Check each combination of truth values of the proposition variables to see whether the
truth value of P is the same as the truth value of Q.
DISCRETE STRUCTURES 1 17
Logic
Equivalence Check
1. If in each row the truth value of P is the same as the truth value of Q, then P and Q are
logically equivalent.
2. If in some row P has a different truth value from Q, then P and Q are not logically equivalent.
Example:
Solution:
The corresponding truth values of p and ¬ (¬p) are same, hence equivalence is justified.
Exercise
Show that the proposition forms ¬(p q) and ¬p ¬q are NOT logically equivalent.
De Morgan’s laws
De Morgan’s laws state that: The negation of a proposition is logically equivalent to the
proposition in which each component is negated.
¬(p q) ≡ ¬p ¬q
¬(p q) ≡ ¬p ¬q
Example:
Solution:
John is not six feet tall or he weighs less than 200 pounds.
The bus was not late and Tom’s watch was not slow.
DISCRETE STRUCTURES 1 18
Logic
Example:
-1< x ≤ 4
Solution:
-1< x and x ≤ 4
-1 ≥ x or x > 4.
Tautology
A tautology is a proposition form that is always true regardless of the truth values of the
individual propositions substituted for its proposition variables.
A proposition whose form is a tautology is called a tautological proposition.
Contradiction
A contradiction is a proposition form that is always false regardless of the truth values of the
individual propositions substituted for its proposition variables.
A proposition whose form is a contradiction is called a contradictory proposition.
Example:
Show that the proposition form p U ¬p is a tautology and the proposition form p ∩ ¬p is a
contradiction.
Exercise
Show that the proposition form r s ≡ r is a tautology and the proposition form r s ≡ s is a
contradiction.
Laws of Logic
DISCRETE STRUCTURES 1 19
Logic
Example:
Solution:
Exercise
Prove that
DISCRETE STRUCTURES 1 20
Logic
References:
1. Kenneth H. Rosen. Discrete Mathematics and Its Applications, 7th Edition. McGrawHill, 2012
2. Gary Weiss Damian Lyons, et al., Fundamentals of Discrete Structures, 2nd edition, Pearson
Learning Solutions, 2012.
3. Susanna S. Epp, Discrete Mathematics with Applications, Brooks Cole; 4th edition, 2011.
4. James L. Hein, Discrete Structures, Logic, and Computability, 3rd edition, Jones & Bartlett
Publishers, 3rd edition, 2009.
5. Kolman, B., Busby, R. C., Ross, S. C. Discrete Mathematical Structures, 6th Edition. Prentice Hall,
2008.
DISCRETE STRUCTURES 1 21