CH 01
CH 01
Discrete Mathematics
CS@SIT, KMUTT
2024
1
Image credit: https://i.ytimg.com/vi/cz4nPSA9rlc/maxresdefault.jpg
Discrete math is …
2
https://bard.google.com/
Discrete vs. Continuous
3
Credit: https://www.quora.com/The-probability-distribution-of-discrete-and-continuous-random-variable-
can-be-defined-in-terms-of-what
Type of variables
4
https://www.bitcoininsider.org/article/23740/continuous-vs-discrete-variables-context-machine-learning
Section 1.1
7
If there are 10 people
numbered 1 to 10 in a
circle, and every other
person is killed starting
with number 2, which
person is left?
8
If there are 10 people
numbered 1 to 10 in a
circle, and every other
person is killed starting
with number 2, which
person is left?
Final one.
9
Example 2
5
3 4
1 2
10
A Simple Envelope
Discussion Questions
11
Hint: Euler Trail; it begins and ends with the two nodes of odd degree.
Example 3
12
Ans: 50%
Example 4
13
S1.1P4
Answer: 12/20 or 60%; note that the winner must win the last game.
Section 1.2
14
Guess the next number in the
sequence
1. 1, 3, 5, 7, 9, 11, _____
15
Two well-known sequences and series
16
https://bard.google.com/
Two well-known sequences and series
Geometric
series
17
https://en.wikipedia.org/wiki/Geometric_series
Notation and Terminology
Recursive formula
Each term is described in relation to a previous term (or
terms) of the sequence. Must have info how the list
begins for the recursive relationship.
Closed formula
Each term is described only in relation to its position in
the list.
Sequence notation
Use lowercase letter (a, b, c, etc.) to name sequences,
and use subscripting to indicate position. an indicates
the nth term of the sequence of a. It is read as “a sub n”.
18
Example 1
1, 3, 5, 7, 9, ….
A recursive formula for the sequence
19
Practice Problem 1
Consider the sequence 4, 6, 8, 10, 12, …
1. Describe the sequence in each of the three
ways we just listed (recursive, closed, a known
set)
20
Example
an = 3 n + n
Compute the first five terms
• 1, 3, 9, 27, 81, …
23
Practice Problem 2
Give the next term in the sequence and
several descriptions for each of the
following:
5, 10, 15, 20, 25, ___, …
24
Fibonacci numbers
The Fibonacci numbers are a famous sequence
for which a recursive formula is easy to find and
an explicit formula is much more difficult. The
Fibonacci numbers are:
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, …
n
n
1 1 5 1 5
Closed form: Fn 2 2 25
5
Sums and sigma notation
Examples
1. Write 2 + 4 + 6 + 8 + 10 + 12 using
sigma notation.
5
2. Evaluate the sum
2
k 0
k
n
Geometric series: ar
i 0
i
a (1 r n1 )
1 r 26
Example
Find a recursive formula for the sequence
whose closed formula is
an = 2n – 3
27
Example
Find a closed formula for the sequence
whose recursive formula is
s1 = 1, and sn = sn-1 + n for n 2
28
Practice Problem 3
Verify that the sequence given by the closed
formula
an = n2 + n
satisfies the recurrence relation
an = an-1 + 2n for all n 2
29
Exercise
30
Section 1.3
31
Liars and Truthtellers
33
Liars and Truthtellers
In each of these situations, we consider the two statements that
were made. To keep from getting dizzy, we will initially make our
assessment purely with regard to the actual statements and with
no regard to who makes the statements.
Both A and B
A is a Liar
are TruthTellers
Scenario A is a B is a
#1 TruthTeller TruthTeller
Scenario A is a
B is a Liar
#2 TruthTeller
Scenario B is a
A is a Liar
#3 TruthTeller
Scenario
A is a Liar B is a Liar
#4
34
Truth Table
Liars and Truthtellers
In each of these situations, we consider the two statements that
were made. To keep from getting dizzy, we will initially make our
assessment purely with regard to the actual statements and with
no regard to who makes the statements.
Both A and B
A is a Liar
are TruthTellers
Scenario A is a B is a Truth
T F
#1 TruthTeller Teller
Scenario A is a
B is a Liar F F
#2 TruthTeller
Scenario B is a Truth
A is a Liar F T
#3 Teller
Scenario
A is a Liar B is a Liar F T
#4
35
Truth Table
Proposition
Proposition is ….
a sentence that is unambiguously true or false,
and not both.
E.g.,
Today is Friday.
Bangkok is in Thailand.
36
Propositional logic
37
Propositional logic
T T T F
T F F F
F T F T
F F F T
39
Propositional logic
Practice Problem. Write each of the following
statements in propositional logic using the
propositional variable c for “Sue is a CS/IT major”
and the variable j for “Sue is a junior.”
1. Sue is a junior CS/IT major.
Or using a shorthand, c j 40
Truth tables for compound statements
The key to making a truth table is to analyze the truth of
statements from simple to complex in each of the possible
scenarios for the values of the propositional variables.
Example. Give the truth table for the statement,
“ (p q)”
p q pq (p q)
T T
T F
F T
F F
41
Truth tables for compound statements
p q p q ( p) ( q)
T T
T F
F T
F F
42
Negations of formal propositions
43
Negations of formal propositions
44
Logical equivalence
45
Exercise
S1.3P1b
46
Answer: A is, also either B or C, but not both.
Section 1.4
Predicate logic
47
Predicates
48
Exercise
49
Examples
51
Practice
Let D = {4, 5, 6, 7, 8, 9, 10, 11}
Which of the following predicates are true for
all elements of D? Which are false for all
elements of D?
52
Quantifiers
Let D = {4, 5, 6, 7, 8, 9, 10, 11}
Which of the following statements
are true?
x D, P( x) x D, P( x)
54
Negating quantifiers
The following two statements are equivalent:
x D, P( x) x D, P( x)
55
Practice
Write the following using predicate logic notation:
n N , ( P(n) S (n 1))
n N , P(n) S ( n 1) 56
Practice
Write the negation of each of the following using predicate logic
notation and then using an English sentence. Which is true, the
original statement or the negated statement?
Its negation is
x Z , y Z , x 2 y 3
58
Negation of more than one quantifier
More example:
x Z , y Z , x y 13, and xy 36
Its negation is
x Z , y Z , ( x y 13) ( xy 36)
59
Exercise
1. x Z , y Z , x 2 y 3
2. x Z , y Z , x y 15
3. y Z , x Z , x y 15
60
Answer: 1. False; 2. True, and 3. False.
Section 1.5
Implications
61
Mathematical statements
Which of the following mathematical statements seem to
state “universal truths” about the positive integers?
1. If n ends in the digit “2”, then n is divisible by 2.
2. If n ends in the digit “3”, then n is divisible by 3.
3. If n is odd, then n2 – 1 is evenly divisible by 8.
4. If n is evenly divisible by 3, then n2 + n is evenly
divisible by 4.
5. If n or m is odd, then n + m is odd.
6. If n or m is even, then n × m is even.
62
Truth of implicational statements
Using the false statements below as models, complete the
sentence that follows in your own words.
If n is evenly divisible by 3, then n2 + n is evenly
divisible by 4.
If n ends in the digit “3”, then n is divisible by 3.
If n or m is odd, then n + m is odd.
To show that a predicate of the form P(x) Q(x) is false
on the domain D, we must …
65
Truth tables for if,then statements
T T T
T F F
F T T
F F T
67
Truth tables for contrapositive
T T T F F
T F F T F
F T T F T
F F T T T
68
Truth tables for biconditional
Practice. Give the truth table for the compound
statement, p ↔ q ≡ (p q) ʌ (q p)
T T
T F
F T
F F
Any relationship to p q?
69
Implication in English
The English construction “If property 1 holds, then property 2 holds”
states a relationship between properties 1 and 2. In the
investigation of this type of relationship, there is some standard
terminology you should know:
70
Examples
71
Examples
72
Examples
73
Implication in predicate logic
The majority of mathematical
statements can be written
in the form
x D, P( x) Q( x)
74
Examples in English
75
Contrapositive, Converse, and Inverse
Given x D, P( x) Q( x)
Its converse is
x D, Q( x) P ( x)
Its inverse is
x D, P( x) Q( x)
Its contrapositive is
x D, Q( x) P( x)
Validity of Arguments
77
Ways to say about implications
Modus Ponens
p q,
p,
q
Modus Tollens
p q,
q ,
p
79
Invalid Form of Reasoning
Converse fallacy
p q,
q,
p
Inverse fallacy
p q,
p ,
q
80
Exercise