Wa0006.
Wa0006.
DISCRETE MATHEMATICS
Dr OmiezaYusuf
(3 Credits
Units)TOPICS
1. SET THEORY
2. LOGIC
3. FUNCTIONS AND RELATIONS
4. BOOLEAN ALGEBRA
5. ELEMENTS OF GRAPH THEORY
6. FUNDAMENTALS OF MATHEMATICAL PROOFS.
Contents
1 SETTHEORY 6
1.1 RusselsParadox:....................................................................................................6
1.2 CartesianProduct..................................................................................................9
1.3 PropertiesofSets.................................................................................................10
1.4 De Morgan′s Law:.............................................................................................12
1.5 CardinalityofaSet:...............................................................................................14
1
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
2 LOGIC 16
3 FUNCTIONSANDRELATIONS 24
3.1 RELATIONS:.....................................................................................................24
3.1.1 INVERSERELATION:.........................................................................25
3.1.2 PICTURESOFRELATIONONFINITESETS:..................................25
3.1.3 COMPOSITIONOFRELATION:....................................................... 27
3.1.4 TYPESOFRELATIONS:.................................................................... 27
3.2 FUNCTIONS:....................................................................................................31
3.2.1 CompositionofFunctions:......................................................................32
3.2.2 One-to-oneFunctions:............................................................................33
3.2.3 OntoFunctions:......................................................................................34
4 BOOLEANALGEBRA 36
4.1 INTRODUCTION:.............................................................................................36
4.2 COMBINATORIALCIRCUITS:......................................................................36
4.3 SWITCHINGCIRCUITS:.................................................................................40
4.4 BOOLEANALGEBRA:....................................................................................43
4.5 BOOLEANFUNCTIONS:................................................................................46
5 ELEMENTSOFGRAPHTHEORY 48
5.1 Graphs,PathsandCircuits:...............................................................................48
5.1.1 Graphs:.................................................................................................. 48
5.1.2 PATH:...................................................................................................53
5.1.3 CIRCUITorCYCLE:.............................................................................53
5.1.4 CONNECTEDANDDISCONNECTEDGRAPH:...............................54
5.1.5 EULERPATHANDEULERCIRCUIT:...............................................54
5.1.6 HAMILTONIAN PATH AND HAMILTONIAN CIRCUIT: . 54
5.2 TREES...............................................................................................................55
5.2.1 RootedTree:...........................................................................................57
6 FUNDAMENTALSOFMATHEMATICALPROOFS 61
6.1 MethodsofDirectProof..................................................................................61
2
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
6.1.1 VacuousProof:....................................................................................63
6.1.2 TrivialProof:.......................................................................................63
6.1.3 ProofbyCases:...................................................................................64
6.1.4 Methods of Indirect Proofs: Contradiction and Contrapositive 65
6.1.5 MethodsofProofbyInduction:.......................................................65
List of Figures
1 Arrow Diagram.................................................................................................26
2 Arrow Diagram.................................................................................................26
3 Graph.................................................................................................................49
4 Multigraph.........................................................................................................49
5 (a).......................................................................................................................49
6 (b)......................................................................................................................49
7...................................................................................................................................50
8...................................................................................................................................51
9...................................................................................................................................51
3
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
10.................................................................................................................................52
11.................................................................................................................................53
12 (a).......................................................................................................................54
13 (b).......................................................................................................................54
14 (a).......................................................................................................................55
15 (a).......................................................................................................................55
16 (a).......................................................................................................................56
17 (b).......................................................................................................................56
18 (c)........................................................................................................................56
List of Tables
4
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
5
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
1 SET THEORY
Example 1.2. Use a property to give a description of each of the following sets.
Solution
6
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
using⊆.Solution
N ⊆ Z ⊆ Q ⊆ R where,
A B
Solution
(i) A= B.
7
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
(a) x ∈ {x}, (b) {x} ≤ {x}, (c) {x} ∈ {x}, (d) {x} ∈ {{x}}, (e) ∅ ≤ {x}, (f ) ∅ ∈
{x}.
Solution
A ∪ B = {x : x ∈ A or x ∈ B}.
A ∩ B = {x :x ∈ A and x ∈ B}.
A − B = {x : x ∈ A and x ∈/ B}.
Solution
∪∞
i=1 Ai = {x : x ∈ Ai, for some i}.
8
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
∩∞
i=1 Ai = {x : x ∈ Ai, ∀ i}.
Assignment
Let An = {x ∈ R : x < 1 + 1
n
}. Show that n=1
∞
∩
An = {x∈ R : x ≤ 1}.
Definition 8. Let A and B be two sets, the symmetric difference between A and
B denoted by AΔB is given by
Solution
AΔB = (A − B) ∪ (B − A).
= {7} ∪ {5}.
∴ AΔB = {5, 7}.
Given n sets, A1, A2, . . . An, the cartesian product of these sets is the set A1 × A2 ×
· · · × An = {(a1, a2, . . . , an) : a1 ∈ A1, a2 ∈ A2, . . . , an ∈ An}.
9
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
(i) A × B × C.
10
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
(ii) (A × B) × C
Solution
A × B × C = {(x, 1, a), (x, 1, b), (x, 2, a), (x, 2, b), (x, 3, a), (x, 3, b),
(y, 1, a), (y, 1, b), (y, 2, a), (y, 2, b), (y, 3, a), (y, 3, b)}.
C}. A× B ={(x, 1), (x, 2), (x, 3), (y, 1), (y, 2), (y,
3)}.
(A × B) × C = {((x, 1), a), ((x, 2), a), ((x, 3), a), ((y, 1), a), ((y, 2), a), ((y, 3), a),
((x, 1), b), ((x, 2), b), ((x, 3), b), ((y, 1), b), ((y, 2), b), ((y, 3), b)}.
But A ⊆ B (assumption)
=⇒ x ∈ B
But B ⊆ C (assumption)
=⇒ x ∈ C
∴ ∀ x ∈ A, x ∈ C
Hence A ⊆ C.
Example 1.11. Let A = {1, 2}, B = {1, 2, 3}, C = {1, 2, 3, 4}. Find (i) A ⊆ B
(ii) B ⊆ C (iii) A ⊆ C
(i) A ∩ B ⊆ Aand A ∩ B ⊆ B.
(ii) A ⊆ B ∪ A and A ⊆ B ∪ B.
11
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Proof:
Let x ∈ A ∩ B.
=⇒ x ∈ A and x ∈ B
∴ x ∈ A.
Hence A ∩ B ⊆ A.
Let x ∈ A.
=⇒ x∈ A ∪ B.
=⇒ A ∈ A ∪ B.
Hence A ⊆ A ∪ B.
(vi) A∪A = A (vii) A∪∅ = A (viii) A∩∅ = ∅ (ix) A∪B = B∪A (x) A∩B = B∩A.
Proof:
Now,
Let x ∈ A ∩ (B ∪ C).
=⇒ x ∈ A and x ∈ (B ∪ C).
=⇒ x ∈ A and x ∈ B or x ∈ C.
=⇒ x ∈ A and x ∈ B or x ∈ A and x ∈ C.
=⇒ x ∈ (A ∩ B) or x ∈ (A ∩ C).
=⇒ x ∈ (A ∩ B) ∪ (A ∩ C).
12
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
=⇒ A ∩ (B ∪ C) ⊆ (A ∩ B) ∪ (A ∩ C).
∴ A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C).
=⇒ x ∈ (A ∩ B) or x ∈ (A ∩ C).
=⇒ x ∈ A and x ∈ B or x ∈ A and x ∈ C.
=⇒ x ∈ A and x ∈ B or x ∈ C.
=⇒ x ∈ A and x ∈ (B ∪ C).
=⇒ x ∈ A ∩ (B ∪ C).
=⇒ (A ∩ B) ∪ (A ∩ C) ⊆ A ∩ (B ∪ C).
∴ A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C).
Proof:
Now,
Let x ∈ (A ∪ B)c.
=⇒ x ∈ A and x ∈ (B ∪ C).
=⇒ x ∈/ (A ∪ B)c.
=⇒ x ∈/ A and x ∈ B .
=⇒ x ∈ (A ∩ B) or x ∈ (A ∩ C).
13
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
=⇒ x ∈ Ac and x ∈ Bc.
=⇒ x ∈ (Ac ∪ Bc).
Conversely,
Letx ∈ Ac ∪ Bc.
=⇒ x ∈ Ac and x ∈ Bc.
=⇒ x ∈/ A and x ∈/ B.
=⇒ x ∈/ A ∪ B .
=⇒ x ∈ (A ∪ B)c.
=⇒ Ac ∩ Bc ⊆ (A ∪ B)c······················································································· ∗ ∗
Combining ∗ and ∗∗ we
Exercise:
Proof:
(A − B) ∩ B = A ∩ Bc ∩ B = A ∩ ∅.
{Note : A − B = A ∩ Bc ∩ B = x ∈ A ∩ Bc.}
∞
(i) Ui=1 Ai = A.
(ii) Ai ∩ Aj = ∅, i /= j.
14
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution:
(i) A1 ∪ A2 ∪ A3 = A.
(ii) A1 ∩ A2 = ∅, A1 ∩ A3 = ∅, A2 ∩ A3 = ∅.
The number of elements of a set is called the cardinality of the set denoted |A| or
Card(A) or n(A).
Solution:
Solution:
(a) |A| = 3
(b) |A| = 5.
Definition 10. LetA ⊆U.Then, the power set ofAdenotedP(A) is the collection of
all possible subsets ofAtogether with the empty set.
Solution:
P(A) = {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
Exercise:
15
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution:
|A| = 8.
16
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
2 LOGIC
Remark: Statements that are not propositions include:- questions and commands.
Exercise: Which of the following are proposition? Give the truth value of each.
a 2 + 3 = 7. (F)
Solution
17
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
p ∨ q: 4 < 8 or 7 < 5
Solution
p ∨ q: It is Friday or It is raining.
Definition12. A truth table displays the relationship between the truth value of
a proposition.
p q p∧ q
T T T
T F F
F T F
F F F
rows).i.e
21 , p = {T or F}.
22 , p, q = {TT, TF, FT, FF}.
23 , p, q, r = {TTT, TTF, TFT, FTT, FFF, FTF, FFT, TFF}.
18
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
p q p⊕ q
T T F
T F T
F T T
F F F
Solution
p q r p⊕ q (p ⊕ q)⊕r
T T T F T
T T F F F
T F T T F
T F F T T
F T T T F
F T F T T
F F F F F
F F T F T
p ~p
T F
F T
q:2+7=9
∨r.Solution
~ p : x < −5 or x > 0.
19
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
p q r p∨ q ~ (p ∨ q) [∼ (p ∨ q)] ∨r.
T T T T F T
T T F T F F
T F T T F T
T F F T F F
F T T T F T
F T F T F F
F F T F T T
F F F F T T
1. ∼(p ∧ q) ≡ ∼ p ∼ p∨ ∼ q.
2. ∼ (p ∨ q) ≡ ∼ p ∧ ∼ q
Solution
p q ~p ~q p∧ q ~ (p ∧ q) ~ p ∨ ∼ q.
T T F F T F F
T F F T F T T
F T T F F T T
F F T T F T T
Solution
p q p∨ q ~q p ∨ ∼ q (p ∨ q) ∨ (p ∨ ∼ q).
T T T F T T
T F T T T T
F T T F F T
F F F T T T
20
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Definition 14. Two proposition are equivalent if they have exactly the same truth
values under all circumstance.
i ∼ (p ∨ q) ≡ ∼ p ∧ ∼ q
ii ∼ (p ∧ q) ≡ ∼ p ∨ ∼ q
iii ∼ (∼ p) ≡ p
Remarks: (i) and (ii) are called De Morgan′s laws and (iii) is called involution.
(a) p ∧ q = q ∧ p and p ∨ q = q ∨ p
(b) (p ∨ q) ∨ r = p ∨ (q ∨ r) and (p ∧ q) ∧ r = (p ∧ q) ∧ r.
(c) (p ∧ q) ∨ r ≡ (p ∨ r) ∧ (q ∨ r) and (p ∨ q) ∧ r ∧ (p ∧ r) ∨ (q ∧ r.
(d) ∼ (p ∧ q) /≡∼ p ∧ ∼ q.
Solution
p q r p∧ q (p ∧ q) ∨ r p∨ r q∨ r (p ∨ r) ∧ (q ∨ r)
T T T T T T T T
T T F T T T T T
T F T F T T T T
T F F F F T F F
F T T F T T T T
F T F F F F T F
F F T F T T T T
F F F F F F F F
Definition 15. A compound proposition that has the value F for all possible
values of the proposition in it is called contradiction.
Solution
p ~p p∧∼p
T F F
F T F
21
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
p is called the hypothesis and q is called the conclusion. The connective → is called
conditional connective.
Solution
p q p→q
T T T
T F F
F T T
F F T
Solution
p q ~p p→q ~ ∨q
T T F T T
T F F F F
F F T T T
F F T T T
Hence p → q ≡ ∼ p ∨ q.
(a) p implies q.
(b) If p then q.
(c) p is a sufficient condition for q.
(d) q is a necessary condition for p.
(e) p if only q.
22
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
(a) Negative.
(b) →.
(c) ∨, or ∧.
Example 2.14. ∼ (p → q) =∼ (∼ p ∨ q)
⇒∼ (p → q) ≡ ∼ (∼ p ∨ q).
p → q ≡ ∼ p ∨ q.
Solution
Wednesday.
Wednesday.p→q ≡ ∼p∨ q.
Exercise:
1) Show that p → ≡ ∼ q →∼ p.
i) p → q /≡ q → q
ii) p → q /≡∼ q →∼ q.
Solution
23
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
p q p→q q→p
T T T T
T F F T
F T T F
F F T T
i) p if and only if q
ii) p and q are both necessary and sufficient condition for each other.
Solution
p q p ⇐⇒ q p→q q→p (p → q) ∧ (q → p)
T T T T T T
T F F F T F
F T F T F F
F F T T T T
Hence p ⇐⇒ q ≡ (p → q) ∧ (q → p).
24
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
3.1 RELATIONS:
The domain of a relation is the set of all first elements of the ordered pair which
belong toR and the range is the set of all the second elements.
Example 3.4. Let A be any set, then A × A and ∅are subsets of A × A and
hence are relation onAcalleduniversalrelation andemptyrelation respectively.
∅ ⊆ A (Empty relation) ∅ ⊆ A × A.
Example 3.5. Let A = {1, 4, 6}. Write down the universal relation on A.
25
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution
Solution
Suppose A and B are finite sets, there are two ways of picturing a relation from A
to B.
Example 3.7. Represent the relation {(1, y), (1, z), (3, y)}.
Solution
i)
y z
1 1 1
3 1 0
ii)
26
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Example 3.8. Represent the relation {(1, z), (1, y), (2, z), (3, y), (4, x), (4, z)}.
Solution
i)
x y z
1 0 1 1
2 0 0 1
3 0 1 0
4 1 0 1
ii)
Fi
g
ur
e
2:
A
rr
o
w
Di
a
gr
a
m
.
27
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution
R = {(1, a), (2, d), (3, a), (3, b), (3, d)}.
1. Reflexive Relation:
28
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
2. Symmetric Relation:
R1 = {(1, 1), (1, 2), (2, 3), (1, 3), (4, 4)}. C
R2 = {(1, 1), (2, 2), (2, 1), (3, 3), (4, 4)}. ✓
29
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
3. Antisymmetric Relation:
A relation R on a set A is antisymmetric if whenever aRb and bRa then a =
b.Thus R is not antisymmetric if there exist distinct elements a and b in A
suchthataRbandbRa.
R1 = {(1, 1), (1, 2), (2, 3), (1, 3), (4, 4)}. C
R2 = {(1, 1), (2, 2), (2, 1), (3, 3), (4, 4)}. ✓
R4 = ∅.
R5 = A × A. ✓
4. Transitive Relation:
A relation R onaset A istransitiveifwhen aRb and bRa then aRc, i.e,if
whenever (a, b), (b, c) ∈ R then(a, c) ∈ R. Thus, R isnottransitiveifthere
exist a, b, c∈ R such that (a, b), (b, c)∈ R but (a, c)∈/ R.
5. Equivalence Relation:
A relation R on a set A is said to be equivalence relation if it is reflexive,
symmetric and transitive.
That is;
(1) a = a for a ∈ R.
(2) If a =b then b = a.
(3) If a = b, b = c then a = c.
31
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Example3.19. (a) LetL be the set of lines andT be the set of triangles in
the Euclidean plane.
(i) The relation “is parallel to or identical to” is an equivalence relation on
L.
(b) The relation ⊆ not equivalence, since A ⊆ B does not imply B ⊆ A.
(3) Let m be a fixed positive integer. Two integers a and b are said to be
congruent modulo m, written
a ≡ b(mod m),
if m divides a − b.
32
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
3.2 FUNCTIONS:
Example 3.20.
Solution
33
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
f:R→
1
R,f (x)=
x
1
f (0) = 0
, f is not defined.
∴ Dom (f ) = R − {0}.
√
(ii) Find the domain of f (x) = x.
Solution
f:R→
R,f (x) =
√
x.
Solution
Example 3.22.
34
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution
Solution
= g(|sinx|)
√
= |sinx|.
f (a) = f (b) ⇒ a = b
35
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
e.g
Proof:
a=b by a+1=b+1subtract 1
∴a=b
∴ f is a one-to-one function.
Proof:
by definition, a2 = b2.
Example 3.25.
36
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution:
−1 −1
f (r) = 1, f (s) = 4.
−1 −1
f (t) = 2, f (u) = 3.
37
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
4 BOOLEAN ALGEBRA
4.1 INTRODUCTION:
When George Boole (1815-1886) developed an algebra for logic, little did he realise
thathewasforminganalgebrathathasbecomeidealfortheanalysisanddesign
ofcircuitsusedincomputers,calculatorsandahostofdevicescontrolledbymicroelectroni
cs.
Thecircuitsandswitchingarrangementsusedinelectronicsareverycomplex. Although
this study only deals with simple circuits, the functioning of all microchip
circuitsisbasedontheidealsinthisstudy. Theflowofelectricalpulseswhich represent
the binary digits 0 and 1 (bits) is controlled by combinations of electronics devices.
These logic gates act as switches for the electrical pulses.
NOT gate:
The NOT gate is capable of reversing the input pulse. The truth table for NOT
gate is as follows:
Input Output
a ~a
0 1
1 0
a ∼a
38
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
The NOT gate receives an input, either a pulse (1) or no pulse (0) and produces
an output as follows:
If inputais 0,output is 1.
AND gate:
The AND gate receives two inputs a and b, and produces an output denoted a ∧ b.
The truth table for an AND gate is as follows:
a
a∧b
b
The only way that the output can be 1 is whenaANDbare both 1.In other words
there needs to be an electrical pulse at a AND b before the AND gate will output
an electrical pulse.
OR gate:
The OR gate receives two inputs a and b, and produces an output denoted a ∨ b.
The truth table for an OR gate is as follows:
a
a∨b
b
39
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
(a) ∼ p ∨ q.
(b) (x ∨ y) ∧ ∼ x.
Solution
(a)
p q ~p ~ p∨ q
0 0 1 1
0 1 1 1
1 0 0 0
1 1 0 1
p ~p
~ p∨ q
q
(b)
x y x∨ y ~x (x ∨ y) ∧ ∼
0 0 0 1 x 0
0 1 1 1 1
1 0 1 0 0
1 1 1 0 0
~x
(x ∨ y) ∧ ∼ x
x
y (x ∨ y)
Exercises:
Use logic gates to represent these expressions and draw up the corresponding
truthtables.
40
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
1. x ∧ (∼ y ∨ x
2. a ∨ (∼ b ∧ c)
3. [a ∨ (∼ b ∨ c)] ∧ b
Write down the Boolean expression for each of the circuit below: -
a
b
c
4.
p
q
5.
EQUIVALENT CIRCUITS:
a
b
Solution
41
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
The truth tables for both circuits will show if they are equivalent.
a b ~ (a ∧
0 0 b) 1
0 1 1
1 0 1
1 1 0
a b ~a∨∼
0 0 b 1
0 1 1
1 0 1
1 1 0
∴ ∼ (a ∧ b) =∼ a ∨ ∼ b
Exercises: Show if these combinatorial circuits are equivalent by working out the
Boolean expression and the truth table for each circuit.
a
b
1.
a
b
2.
a
b
Generally the switches are used to control the flow of an electrical current but you
42
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
mightfinditeasiertoconsideraswitchingcircuitasaseriesofwaterpipewith taps or
values at certain points.
A B C Circuit Output
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
The truth table shows that there will be anoutput (i.e 1) when A AND B are 1
ORC is 1.This circuit can therefore be represented as;
(A AND B) OR C, i.e (A ∧ B) ∨ C.
43
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
44
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Example 4.3. Represent the circiut shown below symbolically and give the
switching table.
Solution
A B C ∼ A (A ∧ B ) (C ∧ ∼ A) (A ∧ B ) ∨ (C ∧ ∼ A)
0 0 0 1 0 0 0
0 0 1 1 0 1 1
0 1 0 1 0 0 0
0 1 1 1 0 1 1
1 0 0 0 0 0 0
1 0 1 0 0 0 0
1 1 0 0 1 0 1
1 1 1 0 1 0 1
45
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Exercises 1:
expressions:1.
2.
3. A ∨ (∼ B ∧ C).
4. A ∧ ((∼ B ∧ C) ∨ (B ∧ ∼ C)).
A variety of Boolean expressions have been used but George Boole was responsible
for the development of a computer algebra.
The operators ∧ and ∨ have certain properties similar to those of the arithmetic
operators such as+,—,×, and ÷.
46
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
a) Associative laws
(a ∨ b) ∨ c= a ∨ (b ∨ c),and
(a ∧ b) ∧ c= a ∧ (b ∧ c).
b) Commutative laws
a ∨ b = b ∨ a, and
a ∧ b) = b ∧ c.
c) Distributive laws
a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ b), and
a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ b).
These laws enable Boolean expressions to be simplified and another law developed
by an Englishman, Augustus de Morgan (1806-1871), is useful.
a) De Morgan’s laws
~ (a ∨ b) = ∼ a ∧ ∼ b, and
~ (a ∧ b) = ∼ a ∨ ∼ b.
Two more laws complete the range of laws which are included in the
Booleanalgebra
e) Identity laws
a ∨ 0 = a,
47
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
and
a ∧ 1 = a.
f) Complement laws
a ∨ ∼ a = 1,
and
a ∧ ∼ a = 0.
48
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Inthesamewayasalgebraicfunctionsdescribetherelationshipbetweenthe domain; (a
set of inputs) and the range (a set of outputs), a Boolean functioncan be
described by a Boolean expression.
Example 4.4. Iff (x1, x2, x3)=x1 ∧(∼ x2 ∨x3) thenf is the Booleanfunction andx1
∧ (∼ x2 ∨ x3) is the Boolean expression.
Example 4.5. Draw the truth table for the Boolean function defined as
f (x1, x2, x3) = x1 ∧ (∼ x2 ∨ x3).
Solution
The inputs and outputs of this Boolean functions are shown in the following table.
x1 x2 x3 f ( x1 , x2 , x3 )
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 1
Example 4.6. For the given truth table, form a Boolean function.
a b c f (a, b, c)
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 1
Solution
49
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
All these combinations are joined using the connective ∨ to give the
Booleanexpression;
(a ∧ b ∧ c) ∨ (a ∧ b ∧ ∼ c) ∨ (a ∧ ∼ b ∧ ∼ c) ∨ (∼ a ∧ ∼ b ∧ ∼ c).
50
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Here, we present the basic concepts related to graphs and trees such as the degree
of avertex, connectedness, Euler and Hamiltonian circuits, isomorphism of graphs,
rootedandspanningtrees.
5.1.1 Graphs:
Parallel: Two edges associated to the same vertices are called parallel.
Isolated: A vertex that is not incident in any edge is called an isolated vertex.
Simple graph: A graph with neither loops nor parallel edges is called a
simplegraph.
i) V consists of vertices A, B, C, D.
ii) E consists of edges e1 = {A, B}, e2 = {B, C}, e3 = {C, D}, e4 = {A, C}, e5 =
{B, D}.
Multigraphs:
Consider the diagram in fig2. The edges e4 and e5 are called multiple edges since
51
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
they connect the same endpoints, and the edge e6 is called a loop since its
endpoints are the same vertex. Such a diagram is called amultigraph.
Solution
b) G is simple.
52
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Figure 7
Solution
a.) EG = {e1, e2, e3, e4, e5, e6} and V G = {v1, v2, v3, v4, v5, v6, v7}.
Complete graph:
53
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution
Figure 8
Figure 9
Degree of vertex:
54
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Example 5.5. What are the degree of the vertices in the following graph.
Figure 10
Solution
Σ
2|EG| =
v∈V (G)
deg(V ).
Proof:
Solution
Since G is complete, each vertex is adjacent to the remaining vertices. Thus, the
degree of each of the n vertices is n — 1, and we have the sum of the degrees of all
the vertices being n(n —1). By Theorem 1. n(n —1) = 2|EG|.
55
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
5.1.2 PATH:
Simple Circuit:
A path or circuit is simple if it does not contain the same vertex more than once.
A graph that does not contain any circuit is calledacyclic.
Example5.7. In the graph below, determine whether the following sequences are
paths, simple paths, circuits or simple circuits.
Figure 11
a.) v0e1v1e10v5e9v2e2v1.
b.) v3e3v4e8v5e10v1e3v2.
c.) v1e2v2e3v1.
d.) v5e9v2e4v3e5v4e6v4e8v5.
Solution
a.) A path (no repeated edge), not a simple path, (repeated vertex v1), not
acircuit.
b.) A simple path.
56
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution
a.) Connected.
b.) Disconnected since there is no path connecting the vertices v1 and v4.
A simple path that contains all edges of a graph G is called Euler path. If this path
is also a circuit, it is called an Euler circuit.
A path is called Hamiltonian path, if it visits every vertex of the graph exactly
once. A circuit that visits every vertex exactly once except for the last vertex
which duplicates the first one is called aHamiltonian circuit.
57
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution
Example 5.10. Show that the following graph has a Hamiltonian path but no
Hamiltonian circuit.
Solution
5.2 TREES
An undirected graph is called atree if each pair of distinct vertices has exactly one
path between them. Thus, a tree has no parallel edges and no loops.
Theorem 8. Any tree with more than one vertex has one vertex of degree 1.
Proof:
58
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Aseachnewvertexisreached,checkwhetherithasdegree1. Ifsoavertexof
degree1hasbeenfound. Ifnot,itispossibletoexitfromthenewvertexalonga different
edge from that used to reach the vertex.BecauseT is a tree, it is circuit
free,andsothepathneverreturnstoapreviouslyusedvertex. Sincethenumber of
vertices of T is finite, the process of building a path must eventually terminate.
When that happens, the final vertex of the path must have degree 1.
Solution
b.) Do not satisfy the conclusion of theorem 10 and therefore, not a tree.
c.) Do not satisfy the conclusion of theorem 10 and therefore, not a tree.
59
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Level of a Vertex:
The level of a vertex v is the length of the simple path from the root to v.
The height of a rooted tree is the maximum level number that occur.
Example 5.12. Find the level of each vertex and the height of the following
rooted tree.
V1
V2 V3
V4 V5 V6 V7
Solution
Vertex Level
V2 1
V3 1
V4 2
V5 2
V6 2
V7 2
Definition 21. LetT be a rooted tree with root atV0.Suppose (V0, V2, . . . , Vn) is
a simple path inT andX, Y, Zare three vertices. Then: -
60
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
V1
V3 V5
V2 V4
V6 V7 V8 V9
Solution
a.) V2.
61
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
d.) None.
g.)
V7
Binary Tree:
A binary tree is a rooted tree such that each vertex has at most two children.
Moreover, each child is designated as either a left child or a right child.
Example 5.14. a.) Show that the following tree is a binary tree.
V1
V2 V3
V4 V5
V6 V7
b.) Find the left child and right child of vertex V5.
c.) A fullbinary tree is a binary tree in which each vertex has either two children
or zero children. Construct an example of a full binary tree.
Solution
c.)
62
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
V1
V2 V3
V5
V6 V7
63
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
6 FUNDAMENTALS OF MATHEMATICAL
PROOFS
Lemma: A lemma is a theorem that is usually not interesting in its own but is
useful in proving another theorem.
Example 6.1. (i) Points and lines are examples of undefined terms.
(ii) An example of a definition: Two angles are supplementary if the sum of their
measures is 180◦.
(iii) Anexampleofanaxiom: Giventwodistinctpoints,thereisexactlyoneline that
contain them.
(iv) An example of a theorem: if two sides of a triangle are equal, then the angles
opposite are equal.
(v) An example of a corollary: If a triangle is equilateral, then it is equiangular.
Example 6.2. (i) Show that there exist a positive integer whose squares can be
written as the sum of the squares of two positive integers.
Solution:
Example 6.3. (i) Show that there exist a positive integer x such that x2 = 15, 129.
Solution:
64
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution:
p(1) = 11, p(2) = 13, p(3) = 17, p(4) = 23, p(5) = 31, p(6) = 41, p(7) = 53,
p(8) = 67, p(9) = 83, p(10) = 101.
The most powerful technique for proving a universal proposition is one that works
regardlessofthesizeofthedomainoverwhichthepropositionisquantified. Itis called
the method ofgeneralizingfromthegenericparticular.
Theorem 10. For all n, m ∈ Z, if m and n are even then so m + n.
Proof:
Let m and n be two even integers. There exists integers k1 and k2 such that n =
2k1 andm=2k2.
m + n = 2k1 + 2k2
= 2(k1 + k2)
= 2k.
Proof:
Proof:
Let a and b be two rational numbers. Then there exists integers a1, a2, b1 /= 0, and
b2 /= 0 such thata =b1
a1
and b = a2
.
65
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
2 b
66
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Thus, a + b ∈ Q.
Solution:
Example 6.6. Use the method of vacuous proof to show that if x ∈ Q then
David is playing pool.
Solution:
Since the proposition x ∈ Q is always false, the given proposition is vacuously true.
A trivial proof of an implication p→ qis one in which qis shown to be true without
any reference toq.
Example 6.7. Use the method of trivial proof to show that if n is an even integer
then,nis divisible by 1.
Solution:
67
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution:
Case 1. Suppose that n is even. Then there is k ∈N such that n = 2k. In this
case n3 +n =8k3 +2k =2(4k3 +k) which is even.
Example 6.9. Use the method of proof by cases to prove that the triangle
inequality |x+y|=|x| +|y|.
Solution:
Case 2. x ≥ 0 and y < 0. Then x + y < x + 0 < |x| ≤ |x| + |y|. On the other hand
y|.Thus,
+ |y|.
68
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Recall that in a direct proof one starts with the hypothesis of an implicationp→
qand then proves that the the conclusion is true. Any other method of proof will be
referred to as an indirect proof.
Proof by Contradiction:
We want to show thatpis true. We assume it is not and therefore∼ pis trueand
then derive a contradiction. By the rule of contradiction, p must by true.
Theorem 13. If n2 is an even integer so is n.
Proof:
Proof:
√
Suppose the contrary. That is, suppose that2 is rational. Then there exist two
√
integers m and n with no common divisors such that 2= nm .
Squaring both sides of this equality, we find that 2n2 = m2.Thus,m2 is even. By
Theorem,(if n2 isanevenintegersois n), m iseven. Thatis2divides m. but then m=
2k forsomeinteger k. Takingthesquarewefindthat2n2 = m2 = 4k2, that isn2 =
2k2.This says thatn2 is even and by the same theorem,nis even.
Withtheemphasisonstructuredprogramminghascomethedevelopmentofan area
called program verification, which means your program is correct as you writing it.
Onetechniqueessentialtoprogramverificationis mathematicalinduction, a method of
proof that has been useful in every area of mathematics as well.
69
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution:
1(1+1)
(i) (Basis of induction. Show that ) P (1) : 1 = 2
= 1. That is, P (1) is true.
1 + 2 + 3 + · · · + n + (n + 1) = (1 + 2 + 3 + · · · + n) + n + 12 = n(n+1)
+ n + 1.
(n+1)( n+2)
= 2 .
(1 — r)
70
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution:
0+1 Σ
−r ) n
(i) (Basis of induction. Show that ) a = a(1
1−r = k=0
ark. i.e, P (0) is true.
n+1
a(1−r )
ark = is true.
71
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
b) By (a), we have;
1 1
P (n) : 1 +
+···+ 1 —( 21 )n
2 2n−1 = .
1 — (21 )
.
= 2 1—
n — ≤
1
2
72
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
1
=2 1 2.
2n−1
Solution:
(a + (k — 1)r).
73
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
n
That is, P (n) : Σ (a +(k 1)r) = n [2a + (n 1)r] is true.
— 2
k=1
74
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Proof:
Since 3|(22n — 1) and 3|(22n · 3), we have 3|((22n · 3 + 22n — 1). This ends the proof
of the theorem.
Example 6.13. a) Use induction to prove that ; n < 2n for all non-negative
integersn.
75
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution:
a) Let P (n) : n<2n. We want to show that P (n) is valid for all n ≥ 0. By the
method of mathematical induction we have,
(i) (Basis of induction. Show that ) 20 — 0 = 1 > 0. i.e, 0 < 20. Thus, P (0)
istrue.
(iii) (Inductive step). We must show that P (n + 1) is also true. That is,
n + 1 < 2n+1.
Indeed, 2n+1 — (n + 1) = 2n · 2 — n — 1.
= 2n(1 + 1) — n — 1.
= 2n + 2n — n — 1.
= (2n — n) + (2n — 1).
> 2n — 1.
> 0.
b) Let P (n) : 2n<n!. We want to show that P (n) is valid for all n≥ 4. By the
method of mathematical induction we have,
(i) (Basis of induction. Show that ) 4! — 24 = 8 > 0. i.e, 8 > 0. Thus, P (0) is true.
(iii) (Inductive step). We must show that P (n + 1) is also true. That is,
2n+1 < (n + 1)!.
76
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
Solution:
a) Let P (n) : (1 + nh) ≤ (1 + h)n. We want to show that P (n) is valid for
all negative integers.
(iii) (IS). We must show that P (n + 1) is also true. That is, (1 + (n + 1)h) ≤
(1 + h)n+1.
Exercises:
2 2
n(n+1)
4. Use mathematical induction to show that 13 + 23 + · · · + n3 = for
all integers n ≥ 1.
5. Use mathematical induction to show that 1
+ 1
+···+ 1
= n(n+1)
1·2
2·3
n(n+1) 2
77
MTH 122: INTRODUCTION TO DISCRETE MATHEMATICS
2
to find the value of the sum,
3 + 4 + · · · + 1000.
L
∗∩∪?† ± ∓ ∈ ⊂ /≡ ⊆
→—
78