You are on page 1of 39

Discrete Mathematics

Why Are You Studying this Course


• This course will develop your mathematical maturity
• Discrete mathematics provides the mathematical
foundations for many computer science courses
- Data Structures
- Algorithm Analysis and Design
- Database Management Systems and Database Theory
- Compiler Construction
- Computer Security
- Digital Logic Design
- Artificial Intelligence
COURSE INFORMATION
Syllabus:
- Logic
- Sets
- Relations
- Functions
- Combinatory: counting, permutations, combinations
- Recursion
- Probability
- Mathematical Induction
- Graph theory: Graphs and Trees
COURSE INFORMATION
Textbook:
- Discrete Mathematics and it’s Applications by Kenneth.
H. Rosen, 7th Edition
- Discrete mathematics with Application by Susana. 4th
Edition, 2010
INTRODUCTION
What is Discrete Mathematics:
- Part of mathematics devoted to the study of discrete
objects.
- Discrete means consisting of distinct or unconnected
elements.

- As computers are discrete object operating one jumpy,


discontinuous step at a time.

- Discrete math is the right framework for describing


precisely Computer Science concepts.
INTRODUCTION
What is Discrete Mathematics:
- In computer science we usually deal with finite discrete
objects.
-For Example, we cannot store a real number (infinite precision)
in a computer but can only store bits (finite precisions).
Definition:

- Discrete Mathematics is a collection of mathematical


topics that examine and use finite or countably
infinite mathematical objects.
Problems Solved Using DM
- How many ways are there to choose a valid password on a
computer system?
- What is the probability of winning a lottery?
- Is there a link between two computers in a network?
- How can I identify spam e-mail messages?
- How can I encrypt a message so that no unintended recipient can
read it?
- What is the shortest path between two cities using a
transportation system?
- How can a list of integers be sorted so that the integers are in
increasing order?
- How many steps are required to do such a sorting?
- How can it be proved that a sorting algorithm correctly sorts a
list?
- How can a circuit that adds two integers be designed?
- How many valid Internet addresses are there?
LOGIC

Logic is the study of the principles and


methods that distinguishes between a valid and
an invalid arguments.
STATEMENT

A statement is a declarative sentence that is


either true or false but not both.

A statement is also referred to as a proposition.


EXAMPLES

2+2=4

It is Sunday today.
TRUTH VALUES of propositions

If a proposition is true, we say that it has a truth value of


“true” denoted by T

If a proposition is false, we say that it has a truth value of


“false” denoted by F
EXAMPLES

1. Grass is green.
2. 4 + 2 = 6
3. 4 + 2 = 7
4. There are four fingers in a hand.
STATEMENTS TRUTH TABLES

1. Grass is green. T
2. 4+2=6 T
3. 4+2=7 F
4. There are four fingers in a hand. F
EXAMPLE

X=1
X>2
X > 2 is a statement with truth – value FALSE
UNDERSTANDING STATEMENTS

1. X + 2 is positive.
2. May I come in?
3. Logic is interesting.
4. It is hot today.
5. -1 > 0
6. x + y = 12
COMPOUND STATEMENTS

- Simple statements could be used to build a


compound statement.
EXAMPLES:

1. “3 + 2 = 5” and “ Lahore is a city in Pakistan”


2. “The grass is green “ or ” It is hot today”
3. “Discrete Mathematics is not difficult to me”

AND OR NOT are called LOGICAL CONNECTIVES


SYMBOLIC REPRESENTATION

- Statements are symbolically represented by letters such as


p, q, r,….

EXAMPLES:
p = “Manila is the capital of Philippines”
q = “17 is divided by 3”
LOGICAL CONNECTIVES
CONNECTIVE MEANING SYMBOL CALLED
Negation Not ~ Tilde
Conjunction And ^ Hat
Disjunction Or ᵥ Vel
Conditional If…then… Arrow
Biconditional If and only if Double Arrow
EXAMPLES

p = “Manila is the capital of Philippines”


q = “17 is divisible by 3”
p ^ q = “Manila is the capital of Philippines and 17 is
divisible by 3”
p v q = “Manila is the capital of Philippines or 17 is divisible
by 3”
~p = “It is not the case that Manila is the capital of
Philippines or simply “Manila is not the capital of
Philippines”
TRANSLATING FROM
ENGLISH TO SYMBOLS

Let p = “It is hot” and q = “It is sunny”


SENTENCE SYMBOLIC FORM
1. It is not hot.
2. It is hot and sunny.
3. It is hot or sunny.
4. It is not hot but sunny.
5. It is neither hot nor sunny.
TRANSLATING FROM
ENGLISH TO SYMBOLS

Let m = “Gravy is good in Mathematics”


c = “Gravy is an IT student”
Let m = “Gravy is good in Mathematics”
c = “Gravy is an IT student”

SYMBOLIC FORM SENTENCES


1.) ~c

2.) c v m

3.) m ^ ~c
NEGATION ( ~ )
If p is a statement variable, then negation of p, “not p”, is
denoted as “~p”

It has opposite truth value from p that is,

if p is true, ~p is false; if p is false, ~p is true.


TRUTH TABLE FOR

~p

p ~p
T F
F T
CONJUNCTION
^

If p and q are statements, then the conjunction of


p and q is “ p and q”, denoted as “p ^ q”.
It is true when, and only when, both p and q are
true. If either p or q is false, or if both are false, p ^ q
is false.
TRUTH TABLE FOR
p^q

p q p^q
T T T
T F F
F T F
F F F
DISJUNCTION
v
If p and q are statements, then the
disjunction of p and q is “ p or q”, denoted as
“p v q”.
It is true when at least one of p or q is true
and is false only when both p and q are false.
TRUTH TABLE FOR
p v q

p q pvq
T T T
T F T
F T T
F F F
TRUTH TABLE
1.) ~p ^ q
2.) ~p ^ ( q v ~r )
3.) ( p v q ) ^ ~ ( p ^ q )
• Advance versions of many Internet search engines
allow you to use form of and, or and not to refine the
research process.
• Imagine that you want to find web pages about careers
in mathematics or computer science but not finance or
marketing.
• With a search engine that uses quotation marks to
enclose exact phrases and expresses and as AND, or as OR,
and not as NOT, you would write
• Careers AND (mathematics OR “computer science”)
• AND NOT (finance OR marketing).
TRUTH TABLE
1.) ~p ^ q

p q ~p ~p ^ q

T T
T F
F T
F F
TRUTH TABLE
2.) ~p ^ ( q v ~r )

p q r ~r q v ~p ~p ~p ^ (q v ~r )
T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F
TRUTH TABLE
3.) ( p v q ) ^ ~ ( p ^ q )
p q pv q p ^ q ~(p ^ q) (p v q) ^ ~ (p ^ q)

T T
T T
T F
T F
EXCLUSIVE OR

When or used in its exclusive sense, The


statement “p or q” means “p or q but not both”
or
“ p or q and not p and q” which translates
into symbols as:
(p v q) ^ ~ (p ^ q)
SYMBOL FOR EXCLUSIVE OR

p q
or
p XOR q
LOGICAL EQUIVALENCE

Two statement forms are called logically equivalent if


and only if, they have identical truth values for all
possible truth values for their statement variables.

The logical equivalence of statement forms p and q is


denoted by writing p q.
DOUBLE NEGATION
~ (~ p ) p

p ~p ~ (~ p)
T F T
F T F
EXAMPLES
~ (~ p ) p
Rewrite in a simpler form:
“It is not true that I am not happy”
Solution:
Let p = “I am happy”
then ~ p = “ I am not happy”
and ~ (~ p ) = “ It is not true that I am not happy”
Since ~ (~ p ) p
Hence the given statement is equivalent to:
“I am happy”

You might also like