DISCRETE MATHS - Lecture 2
DISCRETE MATHS - Lecture 2
DISCRETE MATHS - Lecture 2
Propositions
Truth value
Propositional calculus/propositional logic
Negation, conjunction, disjunction
Compound proposition
Exclusive or, inclusive or
Implications
Converse, contrapositive, inverse
Propositional Equivalence
• Sometimes it is necessary, in a
mathematical argument to replace one
statement with a statement with the same
truth value.
Definition
• A compound proposition that is always true,
no matter what the truth values of the
propositions that occur in it, is called a
tautology. A compound proposition that is
always false is called a contradiction. Finally,
a proposition that is neither a tautology nor a
contradiction is called a contingency.
From the below table we can see that
p 5p is a tautology
p 5p is a contradiction
p 5p p 5p p 5p
T F T F
F T T F
Logical Equivalence
• Compound propositions that have the
same truth values in all possible cases
are called logically equivalent.
Definition
• The propositions p and q are called
logically equivalent if p q is a
tautology. The notation p q denotes
that p and q are logically equivalent.
• Example: Show that 5 (p q) and 5p
5q are logically equivalent.
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
• See handout
• We can use a truth table to show that
compound propositions are logically
equivalent OR we can use a series of logical
equivalences.
• Solution:
T Domination Laws
Next we will look at:
• Methods of Proofs
– Rules of Inference
– Rules of Inference for Quantified Statements
– Methods of proving theorems
Predicates and Quantifiers
Consider the statement: “x < 5” which is found in computer
programs.
“x < 5” has two parts:
• The variable “x” is the subject of the statement.
• While “is less than 5” is the predicate and refers to
the property that the subject of the statement can
have.
Solution:
• Since P(x) is true for all real numbers x, (any
number multiplied by zero is zero) then œx P(x) is
true.
Example 2
• What is the truth value of the function œx Q(x),
where Q(x) is the statement “x2 < 10” and the
universe of discourse consist of
Solution:
• Let M(x) : x is a male.
• Let P(x): x is a parent.
• Let F(x, y): x is the father of y.
• The statement given may be rephrased as follows:
Example 2 (a)
• Express the statement “Everyone has a best friend” using
quantifiers and logical connectives.
Solution:
• Let B(x, y) : y is the best friend of x. The statement
given may be rephrased as follows.
• For every person x there is another person y, such
that y is the best friend of x.
Example 2 (b)
• Express the statement “Everyone has exactly one best
friend” using quantifiers and logical connectives.
Solution:
• Let B(x, y) : y is the best friend of x. The statement
given may be rephrased as follows.
• For every person x there is another person y, such
that y is the best friend of x and if z is another
person other than y, then z is not the best friend of
x.
The negation of this statement is: “It is not the case that
every student in the class likes Discrete Maths”. 5œx P(x)
• See handout
Methods of Proofs
Addition:
• 1. p
2. Therefore, p or q.
1. It is raining
2. Therefore, either it is raining or the sun is
shining.
Simplification:
• 1. p and q.
2. Therefore, p.
1. It is raining in both Barbados and St. Lucia.
2. Therefore, it is raining in Barbados.
Conjunction:
• 1. p
2. q
3. Therefore, p and q.
1. It is raining in Barbados.
2. It is raining in St. Lucia
3. Therefore, it is raining in both Barbados and St. Lucia
Modus Ponens:
• 1. p.
2. If p then q.
3. Therefore, q.
1. It is raining.
2. If it is raining, then I will get wet.
3. Therefore, I will get wet.
Modus Tollens:
• 1. If p then q.
2. Not q. (q).
3. Therefore, not p (p).
1. If I get a racket then I would play tennis.
2. I did not play tennis.
3. Therefore, I never got a racket.
Hypothetical Syllogism:
• 1. If p then q.
2. If q then r.
3. Therefore, if p then r.
1. If it rains, then I will get wet.
2. If I get wet, then my shirt will be ruined.
3. If it rains, then my shirt will be ruined.
Disjunctive Syllogism:
• 1. Either p or q.
2. Not p (p).
3. Therefore, q.
1. Either it rained or I took a ride to the park.
2. It did not rain.
3. Therefore, I took a ride to the park.
Lets look at some examples of how these rules are used:
Example 1:1
• Given the hypotheses r s and s, show that r is a
valid conclusion.
Solution:
1. rs hypothesis (premise)
2. s r 1, contrapositive
3. s hypothesis (premise)
4. r 2, 3 modus ponens
Solution:
1. p (r s) hypothesis (premise)
2. p hypothesis
3. r s 1, 2 modus ponens
4. r p hypothesis
5. p r 4, contrapositive
6. p s 3, 5 hypothetical syllogism
7. s 2, 6 modus ponens
Example 2b:
2b
Solution:
• Let p be the proposition “It is sunny this afternoon”
• Let q be the proposition “It is colder than yesterday”
• Let r be the proposition “We will go swimming”
• Let s be the proposition “We will take a canoe trip”
• Let t be the proposition “We will be home by sunset”
Example 4:
Show that the hypotheses:
• “It is not sunny this afternoon and it is colder than
yesterday” p q
• “We will go swimming only if it is sunny” r p
• “If we do not go swimming, then we will take a
canoe trip” r s
• “If we take a canoe trip, then we will be home by
sunset” st
lead to the conclusion “We will be home by
sunset”. t
• Then the hypotheses become p q, r p,
r s and s t. The conclusion is t. We
construct the argument as follows:
1. p q hypothesis
2. p 1, simplification
3. rp hypothesis
4. r 2, 3 modus tollens
5. r s hypothesis
6. s 4, 5 modus ponens
7. st hypothesis
8. t 6, 7 modus ponens
• Excercise
Solution:
Let p: n3 + 5 is odd and q: n is even.
• The theorem can be stated as p q. In a proof
by contradiction we assume p and q. We then
use indirect proof (q p) to prove p.
• Now q: n is not even i.e. n is odd.
Therefore n = 2k + 1 for some integer k.
Then n3 + 5 = (2k + 1)3 + 5
= 8k3 + 12k2 + 6k + 1 + 5
= 2(4k3 + 6k2 + 3k + 3)
which is even, which contradicts the assumption
that n3 + 5 is odd.
Excercise
• Growth of Functions
Mathematical Induction
• A proof by mathematical induction that P(n) is
true for every positive integer n consists of two
steps:
• Basis step The proposition P(1) is shown to
be true.
• Inductive step The implication P(n) P(n + 1)
is shown to be true for every
positive integer n.
• Expressed as a rule of inference, this proof
technique can be stated as:
[P(1) œn (P(n) P(n + 1))] œn P(n)
Example 1
Prove that the following statement P(n) is true for all n $ 1
1+2+3+… +n =
n ( n 1)
Solution: 2
1 (1 1 )
Basis step: (n = 1) 1
2
1 + 2 + 3 + … + n + (n + 1) = (n 1)(n 2)
2
Now
[1 + 2 + 3 + … + n ]+ (n + 1) = n(n 1) + (n + 1)
2
n(n 1) 2(n 1)
=
2
=
n 3n 2
2
2
(n 1)(n 2)
=
2
Since P(1) is true and the implication P(n) P(n + 1) is
true for all positive integers n, P(n) is true for all n $ 1.
Example 2: Prove by mathematical induction that
n1
n
k 1
i 0
k
i
k 1
i0
k k k k ... k
i 0 1 2 n
n
k n 1 1
Let P(n) be the statement
i0
k
i
k 1
01
k 1 k 1
Solution: Basis step: (n = 0) P(0) k
0
1
k 1 k 1
Inductive step n
k n1
1
Assume that P(n) is true that is
i0
k
i
k 1
we need to show that P(n +1) is also true, that is
n2
n1
k 1
k k 1
i
i0
Now
n1 n
k i
= k
i0
i
k n1
i 0
k n1 1 n1
= k
k 1
= k n1 1 k n2 k n1
k 1
n2
=
k 1
k 1
Since P(1) is true and the implication P(n) P(n + 1)
is true for all integers n, P(n) is true for all n $ 0.
Exercise
Solution:
Basis step: (n = 0): 20 = 20+1 – 1 => 1 = 1
Now
[1 + 2 + 22 + 23 + … + 2n] + 2n+1
= 2n+1 – 1 + 2n+1
= 2n+1 + 2n+1 – 1
= 2(2n+1 ) – 1 = 2n+2 – 1
• Example 3:
• Inductive step:
Assume that P(n) is true, that is 5n – 1 is divisible by 4
•
5n+1 – 1 = 5n+1 – 1
= 5.5n – 1
= 5 (5n – 1) + 4
• Inductive step:
Assume that P(n) is true, that is “15n - 8n is divisible
by 7”
Therefore
P(n+1): 15n+1 – 8n+1 = 15(15n ) – 8(8n )
= 15(15n – 8n ) + 7(8n )
• Inductive step:
Assume that P(n) is true, that is 2n + 1 # n2
• Therefore for P(n + 1) we get
• 2(n + 1) + 1 = 2n + 2 + 1
= 2n + 1 + 2
# n2 + 2
from the assumption 2n + 1 # n2
# n2 + 2n + 1 since 2n +1 $2 œn $3
# (n + 1)2
• Since P(3) is true and the implication P(n) P(n
+ 1) is true for all integers n $ 3, P(n) is true for
all n $ 3.
Functions
• Definition of a function, sum function, product function
• composition of the functions
• ceiling and floor functions
Definition
• Let A and B be sets. A function f from A to B is an
assignment of exactly one element of B to each element
of A. We write f(a) = b if b is the unique element of B
assigned by the function f to the element a of A. If f is the
function from A to B, we write f : AB.
Definition
• If f is a function from A to B, we say that A is the
domain of f and B is called the codomain of f. If
f(a) = b, then b is the image of a under f and a is
the preimage of b. The range of f is the set of all
images of f.
Example 1
• Let f be a function from A to B as defined below.
• A B
1 3
2 6
3 9
12
Domain of f = { 1, 2, 3}
codomain f = { 3, 6, 9, 12}
Range f = { 3, 6}
Image of 2 = 6
Preimage of 6 = 2, 3
Definition
• Let f1 and f2 be functions from A to R. Then the sum
function f1 + f2; and product function f1 f2, are also
functions from A to R defined by:
(f1 + f2)(x) = f1(x) + f2(x)
(f1 f2)(x) = f1(x) f2(x).
Example:
Let f1 and f2 be functions from R to R such that
f1(x) = x2 and f2(x) = x – x2. What are the functions
f1 + f2 (sum function) and f1 f2 (product function)?
Solution:
From the definition the sum and product functions, it
follows that
Definition
• Let f and g be functions from the set of integers
to the set of integers or the set of real numbers to
the set of real numbers. We say that f(x) is
±(g(x)) if there are constants C and k such that
*f(x)*#C*g(x)* whenever x > k.
This reads “f(x) is big-oh of g(x)”.
• Note that in order to show that f(x) is ±(g(x)), we
need only find one pair of constants C and k such
that *f(x)*#C*g(x)* whenever x > k. However a
pair C, k that satisfies the definition is never
unique, there are infinitely many pairs.
Solution:
Since
0 # x2 + 2x + 1 # x2 + 2x2 + x2 = 4x2
• Whenever x >1, it follows that f(x) is ±(x2). Here
C = 4 and k = 1 and g(x) = x2
• Another approach is to note that when x >2 it
follows that 2x # x2.
• Therefore 0 # x2 + 2x + 1 # x2 + x2 + x2 = 3x2.
Here C = 3 and k = 2 and g(x) = x2
Example:
• Give a big-± estimate for f(x) = 3x log (x!) +
(x2 +3)log x.
• Solution:
First we deal with the product 3x log (x!).
Example:
Give a big-± estimate for
f(x) = (x + 1) log (x2 + 1) + 3x2 .