You are on page 1of 63

Course Outline

Text Book: Discrete Mathematics by K. P. Bogart


Complementary: Discrete mathematics and its applications,
Kenneth H. Rosen ( sixth edition).
Topics:
Sets and statements
Symbolic Logic
Relations
functions
Mathematical Induction
Counting Techniques
Recurrence relations
Trees
Graphs

Grades:
First: 25%
Second 25%
Final 50%
*Note: The outline is subject to change

Discrete Mathematics
Is

the one we use to analyze discrete


processes that are carried out in a step-bystep fashion.

Algorithm
A list

of step by step instructions for carrying


out a process

Chapter 1

Sets and Statements

Statements
A declarative

sentence can be true, false or

ambiguous
A statement is an unambiguous declarative
sentence that is either true or false (also
called a proposition).

Example
5

plus 7 is 12
5 plus 7 is 5
5 plus 7 is large
Did you have coffee this morning?

Sets
Set:

an unambiguous description of a
collection of objects
EX:
Set of outcomes for flipping a coin
S={H,T}
However, the list of outcomes might be:
HTTTHHH.

Sets

Members of a set are called elements


aA a is an element of A
a is a member of A
aA
a is not an element of A

EX: Set of +ve integers


S={x |x>0}
3 S
-5 S

Sets
Universe of a statement is the set whose elements are
discussed by the statement
EX:
x multiplied by x is +ve
The universe could be:
- Set of +ve integers
- Set of ve integers
- Set of all integers
Flipping a coin
-Universe: {H,T}

Sets
Note:
P, q,

r, s are used to represent statements


X, y, z, w are used to represent variables

Compound Statements
Simple statements are represented by symbols
EX:
P: x is a positive integer
Compound statements are represented by symbols+ logical
connectives
Logical Connectives:

Conjunction AND.
Symbol ^
Inclusive disjunction OR
Symbol v
Exclusive disjunction OR
Symbol
Negation Symbol
Implication
Symbol

Compound Statements
Example:
-I will take calculas1 and I will take physics class.
Represented as: p ^ q
I will have coffee or I will have tea
Represented as: p v q
Ali is at school or Ali is at home
Represented as: p q
p: x is greater than 2
p: x is not greater than 2
-George is at school and either Sue is at store or Sue is at home.
P ^( q r )
*Note the use of parentheses ( see example 4 page 7).

Truth sets
The

set of all values of x that make a


symbolic statement p true is called the truth
set of the proposition p.
(the set of all values in the universe that makes
p true).
The symbolic statements p and q are
equivalent if they have the same truth sets.

Truth sets
EX:

Universe: The result of flipping 2 coins


P: the result has one head
q: the result has one tail
P and q are equivalent since the have the same
truth sets.

Fundamental Principle of Set Equality


To show

that the sets T and S are equal, we


may show that each element in T is an
element in S and vise versa.
EX:
Universe: 300 coin flips
p: the result has 2 Hs
q: the result has 298 Ts
Show that p and q are equivalent.

Finite and infinite sets

Finite sets
- Examples:

A = {1, 2, 3, 4}
B = {x | x is an integer, 1 < x < 4}
D = {dog, cat, horse}

Infinite sets
- Examples:

Z = {integers} = {, -3, -2, -1, 0, 1, 2, 3,}


Natural numbers N = {0, 1, 2, 3, }
S={x| x is a real number and 1 < x < 4} = [0, 4]

Section 1.2: Sets

Venn diagrams
A Venn

diagram
provides a graphic
view of sets and
their operations:
union, intersection,
difference and
complements can
be identified

Set operations
Given

two sets X and Y the following are


operations that can be performed on them:

Union
Intersection
Complement
Difference

Union

The union of X and Y is defined as the


set A B = { x | x A or x B}

Intersection

The intersection of X and Y is defined as the


set: X Y = { x | x X and x Y}
X

Y
xy

Two sets X and Y are disjoint


if X Y =

X
XY=

Complement

The complement of a set Y contained in a


universal set U is the set Yc = U Y

U Yc

Difference
The

difference of two sets


X Y = { x | x X and x Y}

The difference is also called the relative complement of Y


in X
X-yX

Properties of set operations


Theorem : Let U be a universal set, and A, B
and C subsets of U.
The following properties hold:
a) Associativity: (A B) C = A (B C)
(A B) C = A (B C)
b) Commutativity:
AB=BA
AB=BA

Properties of set operations (2)


c) Distributive laws:
A(BC) = (A B) (A C)
A(BC) = (A B) (A C)
d) Identity laws:
AU=A

A = A

e) Complement laws:
AAc = U

AAc =

Properties of set operations (3)

f) Idempotent laws:
AA = A

AA = A

g) Bound laws:
AU = U

A =

h) Absorption laws:
A(AB) = A

A(AB) = A

Properties of set operations (4)


i) Involution law: (Ac)c = A
j) 0/1 laws: c = U

Uc =

k) De Morgans laws for sets:


(AB)c = AcBc
(AB)c = AcBc

Demorgans Laws for sets


~(A

B) = (~A) (~B)
-Proof: To be discussed in class

~(A

B) = (~A) (~B)
-Proof: exercise

Theorem
Let

p and q be statements and let P and Q


be their truth sets, then:

- P Q is the truth set of p^q (proof discussed


in class)
- P Q is the truth set of pvq
- ~P is the truth set of p

Example: Venn Diagrams


that P (Q R) = (P Q) (P R)
Using Venn diagrams
Show

- See example 9 page 18

Subsets

It is a relation between sets ( not operation)


A set S is a subset of set T if each element in S is also an
element in T.

Examples:
A = {3, 9}, B = {5, 9, 1, 3},
is A B ?

A = {3, 3, 3, 9}, B = {5, 9, 1, 3},


is A B ?

A = {1, 2, 3}, B = {2, 3, 4},


is A B ?

Equality: X = Y if X Y and Y X

Subsets using Venn diagrams

The ellipse is a subset of the circle

Theorem
Let

R and S be two sets then:


- R and S are subsets of R S
- R S is a subset of both R and S
- R S = S if and only if R S
- R S=R if and only if R S

Example
Prove

that
R (S T) S (R T)

The Empty Set

The empty set has no elements.


Also called null set or void set.

EX:
P is the truth set of p: x>0
Q is the truth set of q: x<0
The truth set of p^q = P Q=
P and Q are disjoint sets

Section 1.3

Determining the Truth of Symbolic Statements

Truth tables
Truth

tables are used to determine truth or


falsity of compound statements

Truth table of conjunction


Truth table of conjunction

p^q

p ^ q is true only when both p and q are true.

Truth table of disjunction

pvq

p q is false only when both p and q are false

Exclusive disjunction

pq

p q is true only when p is true and q is false, or p is false


and q is true.

Example: p = "John is programmer, q = John is a lawyer"


p q = "Either John is a programmer or John is a lawyer"

Negation

Negation of p: in symbols p
p

p is false when p is true, p is true when p is false

Example: p = "John is a programmer"

p = "It is not true that John is a programmer"

Truth tables
Examples:

Truth table for :


- pvq
- (pvq) ^ (p^q)

Definition
2

statements are equivalent if their truth


tables have the same final column

Exercise
Use
-

the truth tables to find out whether the


following statements are equivalent:
(p^q) v (p^r)
P^(qvr)

Section 1.4

The

Conditional Connectives

Conditional propositions and


logical equivalence

A conditional

proposition is of the form


If p then q
In symbols: p q
Example:

p = " John is a programmer"


q = " Mary is a lawyer "
p q = If John is a programmer then Mary is a
lawyer"

Truth table of p q

pq
T

p q is true when both p and q are true


or when p is false

P q is equivalent to pvq
Recall:

2 statements are equivalent if their


truth tables have the same final column
Exercise:
Show that p q and p v q are equivalent.
Note: it is important to represent the
implication() and the exclusive OR using
other connectives (^,V, ), why??

Example
Rewrite

without arrows:
r ( s v (r ^ t))

Example
Consider

flipping a coin 3 times


p is the statement the first flip comes up
heads
q is the statement there are at least 2
heads
Find the truth sets of p, q, pq
Answer: {TTT,TTH,THT,THH,HHH,HHT,HTH}

Section 1.5
Boolean Algebra:
When we apply known laws about set
operations to derive other ones algebraically,
we say we are doing Boolean Algebra.

Example: ( not required)


Use Boolean algebra to prove the unique inverse property.
if x P= and x P = U then x= ~P
x=xU
(identity law)
= x (P ~P)
(inverse law)
= (x P) (x ~P)
(distributive law)
= (x ~P)
(given property)
= (P ~P) (x ~P)
(Inverse law)
= (P x) ~P
(distributive law)
= U ~P
(given property)
= ~P
(Identity law)

Boolean Algebra for statements


A formula says that 2 truth sets are equal corresponds to a
formula saying that 2 statements are equivalent ( so all set laws
are translated directly into statement laws).
The statements about a universe satisfy the following rules:
a) Associativity: (p V q) V r = p v (q v r)
(p ^ q) ^ r = p ^ (q^ r)

b) Commutativity:

pVq=qVp
p^q=q^p

Boolean Algebra for Statements


c) Distributive laws:
p ^ (q v r) = (p ^ q) V (p ^ r)
p V ( q ^ r) = (p V q) ^(p V r)
d) Identity laws:
p^1=p
e) Complement laws:
p V p = 1
f) Idempotent laws:
pVp=p
g) Bound laws:
pV1=1
h) Absorption laws:
pv(p^q)=p

pV0 = p

p ^ p = 0
p^p=p

p^0=0

p ^ ( p v q) = p

i) Double negation law: p = p


j) De Morgans laws:
(p V q) = p ^ q
(p ^ q) = p V q

Final Example
Simplify:

( r) V (s V (r ^ t))
Answer : r V s
-

( (r ^ s) V (r V s)) ^ ( (r V s) V (r ^ s))
Answer: (r ^ s ) V (r ^ s)
-

Constructing New Logical


Equivalences
By

developing a series of logical


equivalences show that the following are
equivalent:
1. (p q) and p ^ q
2. ( p ( p ^ q)) and p ^ q
3. Show that (p ^ q) ( p q) is a tautology

Applications of Logic (examples)


Artificial

intelligence
Determine the consistency of system
specifications
Design of computer circuits
Construction of computer programs
Verifying the correctness of programs
Most web search engines support Boolean
searching techniques

System Specifications (example)


1.

2.

Express the specification The automated


reply cannot be sent when the file system is
full using logical connectives.(implication)
Determine whether these system
specifications are consistent.

The diagnostic message is stored in the buffer or it is retransmitted


The diagnostic message is not sorted in the buffer
If the diagnostic message is sorted in the buffer, then it is retransmitted

3. Do the system specifications in example 15 remain consistent if


the specification The diagnostic message is not
retransmitted is added?

Web Page searching ( example )


Searching:

Universities in New Mexico


- search engine looks for pages including
New AND Mexico AND Universities
and will also include results such as:
New universities in Mexico
( in search engines the word AND is not
needed but implicitly understood)

Web Page searching ( example )


Searching: Universities in New Mexico or
Arizona
Look for : (New AND Mexico OR Arizona) AND
universities
The result will include all pages containing the
word (Universities) and either the words ( New
and Mexico) or the word Arizona.
Note: Pages besides those of interest will be listed.

Web Page Searching ( example )


To

look for universities in Mexico and (not New


Mexico)
1- Mexico and Universities
Results will include both universities in New Mexico as
well as the ones in Mexico
2- (Mexico AND Universities) NOT new
In google search terms would be: Mexico Universities
New
(( NOT is replaced by the minus sign))

Logic Puzzles (example)


An

island has two kinds of inhabitants,


knights who always tell the truth, and their
opposites, knaves, who always lie. You
encounter two people A and B. What are A
and B if A says B is a knight and B says
The two of us are opposite types?