+ All Categories
Home > Documents > Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals...

Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals...

Date post: 11-Feb-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
15
Lecture Notes on Discrete Mathematics and Its Applications 7 th ed, Kenneth H. Rosen By Prof. Dr. Hisham B. Mahdi 1
Transcript
Page 1: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

Lecture Notes on

Discrete Mathematics and Its Applications

7thed, Kenneth H. Rosen

By

Prof. Dr. Hisham B. Mahdi

1

Page 2: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

Islamic University - Gaza

CSCI 2303-2018/2019

Syllabus for Discrete Math 

Instructor

Name: Prof. Dr. Hisham B. Mahdi Website: http://site.iugaza.edu.ps/hmahdi/ E-mail Address: [email protected] Office Location: C734 الطابق السادس –مبنى كلیة العلوم Office Hours: S,M(11:00 - 12:00), W(10:00 -11:00), N,T (11:30 - 12:30). Office Telephone Number: 2832000-2614.

Course Description

Propositional logic, Sets, Functions, Sequences, Matrices, Algorithms, Number theory and cryptography, Mathematical reasoning, Relations, Graphs, Trees.

Aims of the course: This is an introductory course in discrete mathematics. The goal of this course is

1. to introduce students to ideas and techniques from discrete mathematics that are widely used in science and engineering.

2. This course teaches the students techniques in how to think logically and mathematically and apply these techniques in solving problems.

3. To achieve this goal, students will learn logic and proof, sets, functions, as well as algorithms and mathematical reasoning. Key topics involving relations, graphs, trees and formal languages and computability are covered in this course.

Text Kenneth H. Rosen, Discrete Mathematics and Its Applications, 7th- ed, McGraw-Hill (2012). Reference    1. Epp, S. S. , Discrete mathematics with applications, Cengage learning (2010). 

2. Goodaire, E. , & Parmenter, M. M., Discrete mathematics with graph theory, Pren ce Hall PTR (2002).

Methods of Teaching          By lectures, discussions and solving selected problems.

Notation: Learning Mathemeatics is not the same as learning other subjects. You will not be able to learn everything you need in class. You will have to learn a fair amount by yourself. The best way to lean Mathematics is to practice it. Because of this we ask you do solve a number of problems listed in the following table. We will be very happy to answer your questions about the selected problems during the office hours.

شيء في المحاضرة أو بفھم و یختلف عن تعلم الموضوعات األخرى، فالطالب ال یستطیع تعلم كل تعلم الریاضیات بصفة عامة: ملحوظةھي الممارسة، أي حل الریاضیات المنفصلةأفضل طریقة لتعلم . حفظ المحاضرات فقط و لكن البد من تعلم جزء من الموضوع تعلم ذاتي

.أكبر عدد ممكن من التمارین، لذلك فإننا سنكون سعداء لمساعدتك في الساعات المكتبیة

Evaluation and Grading                  Homework& Quizzes              15 %          

                                              Midterm Exam                            30% 

                                                                                         Final Exam                                  55% 

                                                                                         Total                                           100% 

2nd Semester 2018/2019  

Page 3: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

Topic Schedule The following is a approximate reading schedule for the semester. While I might not cover every topic or example in the text, you are responsible for everything in the sections.

Week  Section to be covered  Week  Section to be covered 

1  Week        9/2 –13/2:                                          

1.1  Propositional Logicns 1.2  Applications of Propositional Logic 

9 Week      6/4–10/4: 

                        Midterm Exam 

2  Week      16/2 – 20/2: 

1.3  Propositional Equivalences 1.4  Predicates and Quantifiers 1.5  Nested Quantifiers  

10 Week        13/4 – 17/4: 

4.3   Primes and Greatest Common Divisors         4.6   Cryptography 

3  Week      23/2 – 27/2: 

        1.6   Rules of Inference               1.7   Introduction to Proofs   

11 Week        20/4 – 24/4: 

5.1   Mathematical Induction         5.2   Strong Induction andWell‐Ordering         5.3   Recursive Definitions and Structural Induction 

4  Week      2/3 – 6/3: 

       2.1   Sets        2.2   Set Operations 

12 Week      27/4 – 1/5: 

6.1   The Basics of Counting          6.2   The Pigeonhole Principle          6.3   Permutations and Combinations              

5  Week        9/3 –13/3: 

      2.3   Functions       2.4   Sequences and Summations 

13 Week      4/5– 8/5:  

         6.4   Binomial Coefficients and Identities          10.1 Graphs and Graph Models         

6  Week      16/3 – 20/3: 

      3.1   Algorithms 

3.2 The Growth of Functions 

14 Week        11/5 –15/5: 

       10.2  Graph Terminology and Special Types of Graphs 

       10.3  Representing Graphs and Graph Isomorphism 

7  Week       23/3 – 27/3: 

     3.2   The Growth of Functions  (continue)      3.3   Complexity of Algorithms  

15 Week       18/5 – 22/5: 

       10.4  Connectivity  10.6  Shortest‐Path Problems 

8  Week    30/3 – 3/4 :  

    4.1  Divisibility and Modular Arithmetic       4.2  Integer Representations and Algorithms  

16 Week      25/5 – 29/5: 

Review 

Final Exam 

 

Page 4: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

Chapter 1

The Foundations: Logic and Proofs

1.1 Propositional Logic

Definition 1.1.1. Logic defines a formal language for representing knowledge and for making

logical inferences.

By logic, we define:

1. Syntax of statements.

2. The meaning of statements.

3. The rules of logical inferences.

Proposition

Definition 1.1.2. A proposition is a declarative sentence that is either true or false, but not

both.

Remark 1.1.3. 1. We will use the letters p, q, r, s, · · · for propositional variables.

2. The truth value of a proposition is true (T) if it is a true proposition, and the truth value

is false (F) if it is a false proposition.

Example 1.1.4. Determine the propositions in the following sentences, and if you can, deter-

mine the truth value of each proposition:

1. Jerusalem is the capital of Palestine.

2. Washington is the capital of Canada.

2

Page 5: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

3. ”A” comes after ”B” in the English alphabetic.

4. How old are you?

5. Be careful.

6. I hope you get A+ in this course.

7. x + 5 ≥ 3

8. She is smart.

9. He is a good student.

10. It is raining today.

11. Maradona scored 572 goals during his career.

12. It will be sunny on Saturday.

13. There are other life forms on other planets in the universe.

Paradox

Look at the following sentences:

1. This statement is false.

2. I have always told lies.

3. (a) The following statement is true.

(b) The previous statement is false.

3

Page 6: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

Each statement changes its truth values. When it is true, then it becomes false and vice versa.

These types of statements are called Paradox.

Compound Propositions

More complex propositional statements can be build from elementary statements using

logical connectives.

Example 1.1.5.

Proposition p: It rains outside.

Proposition q: I will stay home.

A new (combined) proposition: If it rains outside, then I will stay home.

Table of logical connectives

No. Logical connective Usage Symbol

1 Negation not ¬

2 Conjunction and ∧

3 Disjunction or ∨

4 Exclusive or xor ⊕

5 Implication if .., then −→

6 Bi-conditional if and only if ←→

Negation

Definition 1.1.6. Let p be a proposition. The negation of p, denoted by ¬p (also denoted by

p), is the statement ”It is not the case that p.” The proposition ¬p is read ”not p.” The truth

value of the negation of p, ¬p, is the opposite of the truth value of p.

Example 1.1.7. 1. Prop. p: Today is Friday.

¬p: It is not the case that today is Friday. Alternatively, today is not Friday.

2. Prop. q: Ali eats ice-cream every day.

¬q: It is not the case that Ali eats ice-cream every day. Alternatively, Ali does not eat

ice-cream every day.

3. Prop. r: 10 is prime number.

¬r: It is not the case that 10 is prime number. Alternatively, 10 is not prime number.

4

Page 7: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

Truth Table

Definition 1.1.8. A truth table is a table displays the relationships between n different propo-

sitions and their truth values (T or F ) including all 2n possible combinations of values for the

elementary propositions.

The Truth Table for the Negation of a Proposition

p ¬p

T F

F T

Example 1.1.9. Find the negation of the proposition ”Omer’s smartphone has at least 32GB

of memory”, and express this in simple English.

Conjunction and Disjunction

Definition 1.1.10. Let p and q be propositions.

1. The conjunction of p and q, denoted by p∧q, is the proposition ”p and q.” The conjunction

p ∧ q is true when both p and q are true and is false otherwise.

2. The disjunction of p and q, denoted by p∨ q, is the proposition ”p or q.” The disjunction

p ∨ q is false when both p and q are false and is true otherwise.

The Truth Table of the conjunction and disjunction

p q p ∧ q p ∨ q

T T T T

T F F T

F T F T

F F F F

Example 1.1.11. Find the truth value of the following propositions:

1. It is raining today or 2 is a prime number. ( )

2. 13 is a perfect square and 5 + 2 = 7. ( )

5

Page 8: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

3. 9 is a prime number or 5 + 2 = 8. ( )

4. Today is Friday and 9 is prime number. ( )

5. Today is Friday or it is sunny today. ( )

6. Today is Friday and it is raining today. ( )

7. 9 is perfect square and 13 is a prime number. ( )

Example 1.1.12. Find the conjunction and the disjunction of the two propositions:

p: Ali’s PC has more than 16GB free hard disk space.

q: The processor in Ali’s PC runs faster than 1GHz.

Exclusive or

Definition 1.1.13. Let p and q be propositions. The proposition ”p exclusive or q”, denoted

by p⊕ q, is true when exactly one of p and q is true and it is false otherwise.

The Truth Table of the exclusive or

p q p⊕ q

T T F

T F T

F T T

F F F

Conditional Statements

Definition 1.1.14. Let p and q be propositions. The conditional statement p −→ q is the

proposition ”if p, then q.” The conditional statement p −→ q is false when p is true and q is

false, and true otherwise. A conditional statement is also called an implication.

6

Page 9: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

In the conditional statement p −→ q, p is called the hypothesis(or antecedent or premise)

and q is called the conclusion (or consequence).

Remark 1.1.15. The conditional statement p −→ q can be expressed in the following equivalent

forms:

1. If p, then q.

2. p implies q.

3. p only if q.

4. p is sufficient for q.

5. A sufficient condition for q is p.

6. q is necessary for p.

7. A necessary condition for p is q.

8. q whenever p.

9. q follows from p.

10. q if p.

11. q when p.

12. q unless ¬p.

The Truth Table of the conditional statement

p q p −→ q

T T T

T F F

F T T

F F T

To understand the truth value of a conditional statement, consider a statement that a

professor might make: ”If you get 100% on the final, then you will get an A.” If you manage

to get a 100% on the final, then you would expect to receive an A. If you do not get 100% you

may or may not receive an A depending on other factors. However, if you do get 100%, but

the professor does not give you an A, you will feel cheated.

7

Page 10: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

Example 1.1.16. 1. Consider the two propositions:

p: ”Ali studies hard”.

q: ”Ali will get a good grade”.

Express the statement p −→ q as a statement in English language.

2. Find the truth value of the statement: ”if 10 is not prime numbers, then 2+3=6”.

3. Find the truth value of the statement: ”if 9 is a perfect square, then 13 is a prime num-

ber”.

4. Find the truth value of the statement: ”if Ahmed has a smartphone, then 2 + 3 = 5”.

5. If x = 3, what is the value of the variable x after the statement: ”if 2 + 2 = 4, then

x := x + 1”.

CONVERSE, CONTRAPOSITIVE, AND INVERSE

We can form some new conditional statements starting with a conditional statement p −→ q.

In particular, there are three related conditional statements that occur so often that they have

special names.

1. The converse of p −→ q is the proposition proposition q −→ p.

2. The contrapositive of p −→ q is the proposition ¬q −→ ¬p.

3. The inverse of p −→ q is proposition ¬p −→ ¬q.

Example 1.1.17. Show that of these three conditional statements formed from p −→ q, only

the contrapositive always has the same truth value as p −→ q.

8

Page 11: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

Proof. The contrapositive, ¬q −→ ¬p of a conditional statement p −→ q is false only when ¬p

is false and ¬q is true, that is, only when p is true and q is false; equivalently, when p −→ q is

false.

For all possible truth values of p and q, neither the converse, q −→ p, nor the inverse, ¬p −→ ¬q,

has the same truth value as p −→ q. Note that when p is true and q is false, the original

conditional statement p −→ q is false, but the converse and the inverse are both true.

Remark 1.1.18. Note that the inverse of p −→ q is exactly the contapositive of the converse of

p −→ q. Thus by Example 1.1.17, they always have the same truth value.

Definition 1.1.19. Two compound propositions are called equivalent if they have the same

truth values.

Remark 1.1.20. According to this definition, we have the following:

1. A conditional statement and its contrapositive are equivalent.

2. The converse and the inverse of a conditional statement are also equivalent.

3. Neither the converse nor the inverse of a conditional statement is equivalent to the original

conditional statement. (We will study equivalent propositions in Section 1.3.) Take note

that one of the most common logical errors is to assume that the converse or the inverse

of a conditional statement is equivalent to the original conditional statement.

Example 1.1.21. What are the contrapositive, the converse, and the inverse of the conditional

statement

”The home team wins whenever it is raining”

Solution: Because ”q whenever p” is one of the ways to express the conditional statement

p −→ q, the original statement can be rewritten as ”If it is raining, then the home team wins.”

Consequently, the contrapositive of this conditional statement is

”If the home team does not win, then it is not raining.”

The converse is

”If the home team wins, then it is raining.”

The inverse is

”If it is not raining, then the home team does not win.”

Only the contrapositive is equivalent to the original statement.

Example 1.1.22. What are the contrapositive, the converse, and the inverse of the conditional

statement

” The traffic moves slowly unless it does not snow.”

9

Page 12: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

Biconditionals

Definition 1.1.23. Let p and q be propositions. The biconditional statement p ←→ q is the

proposition ”p if and only if q.” The biconditional statement p ←→ q is true when p and q

have the same truth values, and is false otherwise. Biconditional statements are also called

bi-implications.

The Truth Table of the Biconditionals

p q p←→ q

T T T

T F F

F T F

F F T

Remark 1.1.24. 1. From the truth table, note that the statement p←→ q is true when both

the conditional statements p −→ q and q −→ p are true and is false otherwise. That is,

p←→ q is equivalent to (p −→ q) ∧ (q −→ p).

2. This illustrate why we express this logical connective by ”if and only if” and why it is

symbolically written by combining the symbols −→ and ←−.

3. There are some other common ways to express p←→ q:

(a) ”p is necessary and sufficient for q.”

(b) ”if p then q, and conversely.”

(c) ”p iff q.”

10

Page 13: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

Example 1.1.25. Let p be the statement ”You can take the flight,” and let q be the statement

”You buy a ticket.” Then p←→ q is the statement

”You can take the flight if and only if you buy a ticket.”

Constructing the truth table

1. We can use logical connectives to build up complicated compound propositions involving

any number of propositional variables.

2. We can use truth tables to determine the truth values of these compound propositions.

3. We use a separate column to find the truth value of each compound expression that occurs

in the compound proposition as it is built up.

4. The truth values of the compound proposition for each combination of truth values of the

propositional variables in it is found in the final column of the table.

Example 1.1.26. Construct the truth table of the compound proposition:

1. (p ∨ ¬q) −→ (p ∧ q).

2. (p −→ q) ∧ (¬p←→ q).

3. p −→ ¬(r ∨ q).

11

Page 14: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

Precedence of Logical Operators

To reduce the number of parentheses, we specify precedence levels of the logical operators,

¬, ∧, ∨, −→, and ←→. The precedence order is given in the following table:

Operator Precedence

¬p 1

∧ 2

∨ 3

−→ 4

←→ 5

Example 1.1.27. Express each of the following propositions using parentheses:

1. p ∧ q ∨ r.

2. p ∨ ¬q −→ r.

3. q ∨ ¬p −→ q.

4. p←→ ¬r ∨ q −→ r.

Logic and Bit Operations

Computers represent information using bits. A bit is a symbol with two possible values,

namely, 0 (zero) and 1 (one). This meaning of the word bit comes from binary digit, because

zeros and ones are the digits used in binary representations of numbers. A bit can be used to

represent a truth value, because there are two truth values, namely, true and false. We will

use a 1 bit to represent true and a 0 bit to represent false. That is, 1 represents T (true), 0

represents F (false).

Definition 1.1.28. A variable is called a Boolean variable if its value is either true or false.

Consequently, a Boolean variable can be represented using a bit.

Computer bit operations correspond to the logical connectives. By replacing true by a one

and false by a zero in the truth tables.

12

Page 15: Lecture Notes onsite.iugaza.edu.ps/hmahdi/files/2019/02/Sec-1.1.pdf · 11.Maradona scored 572 goals during his career. 12.It will be sunny on Saturday. 13.There are other life forms

Table for the Bit Operators AND, OR, and XOR.

x y x ∧ y x ∨ y x⊕ y

0 0 0 0 0

0 1 0 1 1

1 0 0 1 1

1 1 1 1 0

Definition 1.1.29. A bit string is a sequence of zero or more bits. The length of this string is

the number of bits in the string.

For example, 101010011 is a bit string of length nine.

Bit Operations

We can extend bit operations to bit strings. We define the bitwise OR, bitwise AND, and bitwise

XOR of two strings of the same length to be the strings that have as their bits the OR, AND,

and XOR of the corresponding bits in the two strings, respectively. We use the symbols ∨, ∧,

and ⊕ to represent the bitwise OR, bitwise AND, and bitwise XOR operations, respectively.

Example 1.1.30. Find the following expressions:

1. 0110110110 ∨ 1100011101.

2. (0110110110 ∧ 1100011101)⊕ 0111001001.

13


Recommended