Use mathematical induction to prove that

advertisement
Question Bank
Propositional Logic/Predicate Logic
Problem 1
Represent as propositional expressions:
Tom is a math major but not computer science major
P: Tom is a math major
Q: Tom is a computer science major
Use De Morgan's Laws to write the negation of the expression, and translate the negation
in English
Solution:
a. P Λ ¬ Q (Tom is a math major but not computer science
major)
b. ¬ (P Λ ¬ Q) = ¬ P V Q (De Morgan's Laws)
c. translation:
¬ P V Q is equivalent to P → Q
If Tom is a math major then Tom is a computer science major
Problem 2
Let
P = "John is healthy"
Q = "John is wealthy"
R = "John is wise"
Represent:
John is healthy and wealthy but not wise: P Λ Q Λ ¬ R
John is not wealthy but he is healthy and wise: ¬ Q Λ P Λ R
John is neither healthy nor wealthy nor wise: ¬ P Λ ¬ Q Λ ¬R
Problem 3
Translate the sentences into propositional expressions:
"Neither the fox nor the lynx can catch the hare if the hare is alert and quick."
Solution
Let
P: The fox can catch the hare
Q: The lynx can catch the hare.
R: The hare is alert
S: The hare is quick
Translation into logic: (R Λ S) → ~P Λ ~Q
Since ~P Λ ~Q is equivalent to ~( P V Q), another translations is:
(R Λ S) → ~( P V Q)
Problem 4
"You can either (stay at the hotel and watch TV ) or (you can go to the museum and
spend some time there)".
The parentheses are used to avoid ambiguity concerning the priority of the logical
connectives.
P: You stay at the hotel.
Q: You watch TV
R: You go to the museum
S: You spend some time in the museum
Translation: (P Λ Q) V (R Λ S)
Problem 5
. Given a conditional statement in English,
a. translate the sentence into a logical expression
b. write the negation of the logical expression and translate the
negation into English
c. write the converse of the logical expression and translate the
converse into English
d. write the inverse of the logical expression and translate the inverse
into English
e. write the contrapositive of the logical expression and translate the
contrapositive into English
"If we are on vacation we go fishing."
f. Let
P: we are on vacation
Q: we go fishing
The logical expression for the above sentence is: P → Q
g. negation: P Λ ¬ Q
"We are on vacation and we do not go fishing."
h. converse: Q → P
"If we go fishing, we are on vacation."
i. inverse: ¬ P → ¬ Q
"If we are not on vacation, we don't go fishing."
j. contrapositive: ¬ Q → ¬ P
"If we don't go fishing, we are not on vacation."
Problem 6
Write the contrapositive, converse and inverse of the expressions:
P → Q, ~P → Q, Q → ~P
contrapositive
converse
inverse
P→Q
~Q → ~ P
Q→P
~P → ~Q
~P → Q
~Q→P
Q → ~P
P → ~Q
Q → ~P
P → ~Q
~P → Q
~Q→P
Problem 7
Determine whether the following arguments are valid or invalid:
Premises:
a. If I read the newspaper in the kitchen, my glasses would be
on the kitchen table.
b. I did not read the newspaper in the kitchen.
Conclusion : My glasses are not on the kitchen table.
Solution:
This is an invalid argument.
In order to show this we will represent the argument formally.
Let
P: I read the newspaper in the kitchen
Q: my glasses would be on the kitchen table.
Formal representation:
(1) P → Q
(2) ~P
(3) Therefore ~Q
We know that when P is false, i.e. we have ~P, the implication is true
for any value of Q.
Hence we cannot say whether Q is true or false.
The error in the above argument is called inverse error.
Problem 8
Premises:
c. If I don't study hard, I will not pass this course
d. If I don't pass this course I cannot graduate this
year.
Conclusion: If I don't study hard, I won't graduate this
year.
Solution:
This is a valid argument, based on the hypothetical syllogism.
In order to show this we will represent the argument formally.
Let
P: I don't study hard
Q: I will not pass this course
R: I cannot graduate this year
Formal representation:
(1) P → Q
(2) Q → R
(3) Therefore P → R
Problem 9
Premises:
e. You will get an extra credit if you write a paper or if
you solve the test problems.
f. You don’t write a paper, however you get an extra
credit.
Conclusion: You have solved the test problems.
Solution:
This is an invalid argument.
In order to show this we will represent the argument formally.
Let
P: you get an extra credit
Q: you write a paper
R: you solve the problems
Formal representation:
(1) (Q V R) → P
(2) ~Q
(3) P
(4) Therefore R
The above argument is a combination of disjunctive syllogism and modus ponens,
however the modus ponens is not applied correctly.
The disjunctive syllogism consists in the following:
Given that (Q V R) is true, and that Q is false (~Q is true) we conclude that R is true.
However we cannot know whether Q V R is true, given that P is true.
The error in concluding that Q V R is true is called converse error.
Problem 10
Premises:
g. You will get an extra credit if you write a paper or if
you solve the test problems.
h. You don’t write a paper and you don't get an extra
credit.
Conclusion: You have not solved the test problems.
Solution:
This is a valid argument.
In order to show this we will represent the argument formally.
Let
P: you get an extra credit
Q: you write a paper
R: you solve the problems
Formal representation:
(1) (Q V R) → P
(2) ~Q
(3) ~P
(4) Therefore ~R
From ~P we can conclude that Q V R is false (modus tollens).
A disjunction is false only when both of its sides are false.
Hence R must be false.
Note, that the premise ~Q is not necessary. Since both sides of the disjunction must be
false, Q must be false too.
A valid argument would be the following one:
(1) (Q V R) → P
(2) ~P
(3) Therefore ~Q and ~R
Predicate logic
Problem 11
Translate the sentences in quantified expressions of predicate logic, write down the
negated expression and then translate the negated expression in English. The predicates
to be used are given in parentheses.
Some problems are difficult. (problem(x), difficult(x))
 x,
(problem(x)  difficult(x))
Negation:


x, (problem(x)  difficult(x))) =

x (~(problem(x)  difficult(x))) =
x (~problem(x) V ~ difficult(x)) =

x (problem(x)  ~ difficult(x))
Translation: No problems are difficult.
Problem 12
All students that study discrete math are good at logic.
(student(x), study_discrete_math(x), good_at_logic(x))
x
(student(x)  study_discrete_math(x)  good_at_logic(x))
Negation:
x

(student(x)  study_discrete_math(x)  good_at_logic(x)) =
x (~ (student(x)  study_discrete_math(x)  good_at_logic(x))) =
 x
(~ (~( student(x)  study_discrete_math(x)) V good_at_logic(x))) =
 x
(~ ((~student(x) V ~study_discrete_math(x)) good_at_logic(x))) =
 x
(~ ( ~student(x) V ~study_discrete_math(x) V good_at_logic(x))) =
 x
((student(x)  study_discrete_math(x))  ~ good_at_logic(x)))
Translation: There is a student that studies discrete math and is not good at logic
Problem 13
No students are allowed to carry guns. (student(x), carry_gun(x))

x (student(x)  ~carry_gun(x))
Negation:

~(
x, (student(x)  ~carry_gun(x))) =
 x,
~(student(x)  ~carry_gun(x))) =
 x,
~(~student(x) V ~carry_gun(x)) =
x,
(student(x)  carry_gun(x))
Translation:There is a student that carries a gun
Problem 14
International students are not eligible for federal loans.
(international_student(x), eligible(x))
 x
(international_student(x)  ~eligible(x))
Negation:
 x

(international_student(x)  ~eligible(x))) =
x, ~(international_student(x)  ~eligible(x)) =
 x,
 x,
~(~international_student(x) V ~eligible(x)) =
(international_student(x)  eligible(x))
Translation: Some international students are eligible for federal loans.
Problem 15
Let p, q, and r be the following propositions:



p: You get an A on the final exam
q: You do every exercise in the book.
r: You get an A in this class.
Write the following formulas using p, q, and r and logical connectives.
1. You get an A in this class, but you do not do every exercise in the book.
2. To get an A in this class, it is necessary for you to get an A on the final.
3. Getting an A on the final and doing every exercise in the book is sufficient for
getting an A in this class.
Solution to Problem 12
1. r^ ¬q
2. r => p
Think of the English being reworded to “ If you got an A in this class, you must
have gotten an A on the final. ”
3. p^q => r
Mathematical Induction
Problem 16
Use mathematical induction to prove that
1 + 2 + 3 + ... + n = n (n + 1) / 2
for all positive integers n.
Solution:

Let the statement P (n) be
1 + 2 + 3 + ... + n = n (n + 1) / 2

STEP 1: We first show that p (1) is true.
Left Side = 1
Right Side = 1 (1 + 1) / 2 = 1

Both sides of the statement are equal hence p (1) is true.

STEP 2: We now assume that p (k) is true
1 + 2 + 3 + ... + k = k (k + 1) / 2

and show that p (k + 1) is true by adding k + 1 to both sides of the above
statement
1 + 2 + 3 + ... + k + (k + 1) = k (k + 1) / 2 + (k + 1)
= (k + 1)(k / 2 + 1)
= (k + 1)(k + 2) / 2

The last statement may be written as
1 + 2 + 3 + ... + k + (k + 1) = (k + 1)(k + 2) / 2

Which is the statement p(k + 1).
Problem 17:
Prove that
1 2 + 2 2 + 3 2 + ... + n 2 = n (n + 1) (2n + 1)/ 6
For all positive integers n.
Solution

Statement P (n) is defined by
1 2 + 2 2 + 3 2 + ... + n 2 = n (n + 1) (2n + 1)/ 2

STEP 1: We first show that p (1) is true.
Left Side = 1 2 = 1
Right Side = 1 (1 + 1) (2*1 + 1)/ 6 = 1

Both sides of the statement are equal hence p (1) is true.

STEP 2: We now assume that p (k) is true
1 2 + 2 2 + 3 2 + ... + k 2 = k (k + 1) (2k + 1)/ 6

and show that p (k + 1) is true by adding (k + 1) 2 to both sides of the above
statement
1 2 + 2 2 + 3 2 + ... + k 2 + (k + 1) 2 = k (k + 1) (2k + 1)/ 6 + (k + 1) 2

Set common denominator and factor k + 1 on the right side
= (k + 1) [ k (2k + 1)+ 6 (k + 1) ] /6

Expand k (2k + 1)+ 6 (k + 1)
= (k + 1) [ 2k 2 + 7k + 6 ] /6

Now factor 2k 2 + 7k + 6.
= (k + 1) [ (k + 2) (2k + 3) ] /6

We have started from the statement P(k) and have shown that
1 2 + 2 2 + 3 2 + ... + k 2 + (k + 1) 2 = (k + 1) [ (k + 2) (2k + 3) ] /6

Which is the statement P(k + 1).
Problem 18:
Use mathematical induction to prove that
1 3 + 2 3 + 3 3 + ... + n 3 = n 2 (n + 1) 2 / 4
for all positive integers n.
Solution

Statement P (n) is defined by
1 3 + 2 3 + 3 3 + ... + n 3 = n 2 (n + 1) 2 / 4

STEP 1: We first show that p (1) is true.
Left Side = 1 3 = 1
Right Side = 1 2 (1 + 1) 2 / 4 = 1

hence p (1) is true.

STEP 2: We now assume that p (k) is true
1 3 + 2 3 + 3 3 + ... + k 3 = k 2 (k + 1) 2 / 4

add (k + 1) 3 to both sides
1 3 + 2 3 + 3 3 + ... + k 3 + (k + 1) 3 = k 2 (k + 1) 2 / 4 + (k + 1) 3

factor (k + 1) 2 on the right side
= (k + 1) 2 [ k 2 / 4 + (k + 1) ]

set to common denominator and group
= (k + 1) 2 [ k 2 + 4 k + 4 ] / 4
= (k + 1) 2 [ (k + 2) 2 ] / 4

We have started from the statement P(k) and have shown that
1 3 + 2 3 + 3 3 + ... + k 3 + (k + 1) 3 = (k + 1) 2 [ (k + 2) 2 ] / 4

Which is the statement P(k + 1).
Problem 19
Prove that for any positive integer number n , n 3 + 2 n is divisible by 3
Solution

Statement P (n) is defined by
n 3 + 2 n is divisible by 3

STEP 1: We first show that p (1) is true. Let n = 1 and calculate n 3 + 2n
1 3 + 2(1) = 3
3 is divisible by 3

hence p (1) is true.

STEP 2: We now assume that p (k) is true
k 3 + 2 k is divisible by 3
is equivalent to
k 3 + 2 k = 3 M , where M is a positive integer.

We now consider the algebraic expression (k + 1) 3 + 2 (k + 1); expand it and
group like terms
(k + 1) 3 + 2 (k + 1) = k 3 + 3 k 2 + 5 k + 3
= [ k 3 + 2 k] + [3 k 2 + 3 k + 3]
= 3 M + 3 [ k2 + k + 1 ] = 3 [ M + k2 + k + 1 ]

Hence (k + 1) 3 + 2 (k + 1) is also divisible by 3 and therefore statement P(k + 1)
is true.
Problem 20:
Prove that 3 n > n 2 for n = 1, n = 2 and use the mathematical induction to prove that 3 n >
n 2 for n a positive integer greater than 2.
Solution

Statement P (n) is defined by
3n > n2

STEP 1: We first show that p (1) is true. Let n = 1 and calculate 3 1 and 1 2 and
compare them
31 = 3
12 = 1

3 is greater than 1 and hence p (1) is true.

Let us also show that P(2) is true.
32 = 9
22 = 4

Hence P(2) is also true.

STEP 2: We now assume that p (k) is true
3k > k2

Multiply both sides of the above inequality by 3
3 * 3k > 3 * k2

The left side is equal to 3 k + 1. For k >, 2, we can write
k 2 > 2 k and k 2 > 1

We now combine the above inequalities by adding the left hand sides and the
right hand sides of the two inequalities
2 k2 > 2 k + 1

We now add k 2 to both sides of the above inequality to obtain the inequality
3 k2 > k2 + 2 k + 1

Factor the right side we can write
3 * k 2 > (k + 1) 2

If 3 * 3 k > 3 * k 2 and 3 * k 2 > (k + 1) 2 then
3 * 3 k > (k + 1) 2

Rewrite the left side as 3 k + 1
3 k + 1 > (k + 1) 2

Which proves tha P(k + 1) is true
Problem 21:
Prove that n ! > 2 n for n a positive integer greater than or equal to 4. (Note: n! is n
factorial and is given by 1 * 2 * ...* (n-1)*n.)
Solution

Statement P (n) is defined by
n! > 2 n

STEP 1: We first show that p (4) is true. Let n = 4 and calculate 4 ! and 2 n and
compare them
4! = 24
2 4 = 16

24 is greater than 16 and hence p (4) is true.

STEP 2: We now assume that p (k) is true
k! > 2 k

Multiply both sides of the above inequality by k + 1
k! (k + 1)> 2 k (k + 1)

The left side is equal to (k + 1)!. For k >, 4, we can write
k+1>2

Multiply both sides of the above inequality by 2 k to obtain
2 k (k + 1) > 2 * 2 k

The above inequality may be written
2 k (k + 1) > 2 k + 1

We have proved that (k + 1)! > 2 k (k + 1) and 2 k (k + 1) > 2 k + 1 we can now
write
(k + 1)! > 2 k + 1

We have assumed that statement P(k) is true and proved that statment P(k+1) is
also true.
Set Theory
Problem 22
In a room of 50 people whose dresses have either red or white color, 30 are wearing red
dress, 16 are wearing a combination of red and white. How many are wearing dresses that
have only white color?
Solution
Number of people wearing a red dress = 30
i.e., n(R) = 30
Number of people wearing a combination of red and white = 16
i.e., n (R W) = 16
The total number of people in the room = number of people who are wearing dresses that
have either red or white color = n (R W) = 50.
We know,
n (R W) = n(R) + n(W) - n(R W)
50 = 30 + n(W) - 16
50 - 14 = n(W) - 16
n(W) = 36
i.e., the number of people who are wearing a white dress = 36.
Therefore, number of people who are wearing white dress only = n(W) - n(R
16 = 20
W) = 36 -
Problem 23
:How many members of {1, 2, 3, ………….., 105} have nontrivial factors in common
with 105?
Solution
105 = 3 . 5. 7, so a number shares factors with 105 if and only if it is divisible by 3, 5, or
7.
Let A, B, and C be the members of {1, 2, 3, ………….., 105} divisible by 3, 5, and 7
respectively.
Clearly |A| = 35, |B| = 21, and |C| = 15. Furthermore, A ∩B consists of those numbers
divisible by both and 5, i.e., divisible by 15. Likewise, A ∩ C and B ∩ C contain
multiples of 21 and 35
respectively, so |A ∩ B| = 7, |A ∩C| = 5, and |B ∩ C|= 3. Finally, A ∩ B∩ C consists only
of the number 105, so it has 1 member total. Thus,
|A U B U C| = 35 + 21 + 15 - 7 - 5 - 3 + 1 = 57
Problem 24
At Sunnydale High School there are
_ 28 students in algebra class,
_ 30 students in biology class, and
_ 8 students in both classes.
How many students are in either algebra or biology class?
Solution. Let A denote the set of students in algebra class and B denote the set of
students in biology class. To find the number of students in either class, we first add up
the students in each class:
|A| + |B|
However, this counts the students in both classes twice. Thus we have to subtract them
once:
-|A ∩ B|
This shows
|AUB|=|A| + |B|-|A ∩ B|
|AUB|=28 + 30 - 8 = 50
so there are 50 students in at least one of the two classes.
Problem 25
At Sunnydale High School there are
_ 55 students in either algebra, biology, or chemistry class
_ 28 students in algebra class
_ 30 students in biology class
_ 24 students in chemistry class
_ 8 students in both algebra and biology
_ 16 students in both biology and chemistry
_ 5 students in both algebra and chemistry
How many students are in all three classes?
Solution.
Let A,B,C denote the set of students in algebra, biology, and chemistry class,
respectively. Then A U BU C is the set of students in one of the three classes, A∩B is
the set of students in both algebra and biology, and so forth. To count the number of
students in all three classes, i.e. count | A U BU C |, we can first add all the number of
students in all three classes:
|A| + |B|+|C|
However, now we've counted the students in two classes too many times. So we subtract
out the students who are in each pair of classes:
-|A ∩ B|-|A ∩ C|-|B ∩ C|
For students who are in two classes, we've counted them twice, then subtracted them
once, so they're counted once. But for students in all three classes, we counted them 3
times, then subtracted them 3 times. Thus we need to add them again:
|A∩B∩C|
Thus
| A U BU C |=|A| + |B|+|C| -|A ∩ B|-|A ∩ C|-|B ∩ C|+|A∩B∩C|
55 = 28 + 30 + 24 - 8 - 16 - 5 + |A∩B∩C|
Thus |A∩B∩C| = 2, i.e. there are 2 students in all three classes.
Probabilty
Problem 26: A die is rolled, find the probability that an even number is obtained.
Solution
Let us first write the sample space S of the experiment.
S = {1,2,3,4,5,6}

Let E be the event "an even number is obtained" and write it down.
E = {2,4,6}

We now use the formula of the classical probability.
P(E) = n(E) / n(S) = 3 / 6 = 1 / 2
Problem 27
Two coins are tossed, find the probability that two heads are obtained.
Note: Each coin has two possible outcomes H (heads) and T (Tails).
Solution
The sample space S is given by.
S = {(H,T),(H,H),(T,H),(T,T)}

Let E be the event "two heads are obtained".
E = {(H,H)}

We use the formula of the classical probability.
P(E) = n(E) / n(S) = 1 / 4
Problem 28
A die is rolled and a coin is tossed, find the probability that the die shows an odd number
and the coin shows a head.
Solution
The sample space S of the experiment described in question 5 is as follows
S = { (1,H),(2,H),(3,H),(4,H),(5,H),(6,H)
(1,T),(2,T),(3,T),(4,T),(5,T),(6,T)}

Let E be the event "the die shows an odd number and the coin shows a head".
Event E may be described as follows
E={(1,H),(3,H),(5,H)}

The probability P(E) is given by
P(E) = n(E) / n(S) = 3 / 12 = 1 / 4
Problem 29
A card is drawn at random from a deck of cards. Find the probability of getting a queen.
Solution

The sample space S of the experiment in question 7 is shwon above (see question
6)

Let E be the event "getting a Queen". An examination of the sample space shows
that there are 4 "Queens" so that n(E) = 4 and n(S) = 52. Hence the probability of
event E occuring is given by
P(E) = 4 / 52 = 1 / 13
Problem 30
A jar contains 3 red marbles, 7 green marbles and 10 white marbles. If a marble is drawn
from the jar at random, what is the probability that this marble is white?
Solution
We first construct a table of frequencies that gives the marbles color distributions as
follows
color
red
green
white
frequency
3
7
10

We now use the empirical formula of the probability

P(E)= Frequency for white color/ Total frequencies in the above table
= 10 / 20 = 1 / 2
Problem 31
Each of the 11 letters A, H, I, M, O, T, U, V, W, X and Z appears same when looked at in
a mirror. They are called symmetric letters. Other letters in the alphabet are asymmetric
letters. How many three letter computer passwords can be formed (no repetition allowed)
with
at
least
one
symmetric
letter?
Solution
Answer
There are three possible cases that will satisfy the condition of forming three letter
passwords
with
at
least
1
symmteric
letter.
Case
Case
Case
1:
2:
3:
=
{(11C1
=
{11
=
1
2
*
symmetric
symmetric
all
15
C2 )
*
{1155
+
*
825
2
1
asymmetric
or
asymmetric
or
symmetric
3
(11C2
+
+
and
and
15
*
C1 )
15
+
+
+
11
C3}
*
}
165}
x
*
3!
6
6
= 2145 * 6 = 12870
Problem 32
A bag contains 5 yellow balls and 6 orange balls. When 4 balls are drawn at random
simultaneously from the bag, what is the probability that not all of the balls drawn are
orange?
Solution
Answer
Sample Space (Denominator) : Four balls can be drawn from a bag containing 11 balls
11
in
C4
ways
Event (Numerator) : The number of ways in which all four balls drawn will be orange =
6
C4.
Probability:
The
probability
that
all
four
balls
drawn
are
orange
=
Therefore, the probability that not all of the balls drawn are orange = 1 - probability of all
four
being
orange
=>
=>
Problem 33
Functions
Definition : A function f from a set X to a set Y is a subset of the Cartesian product X x Y, f  X x
Y, such that
x  X y  Y, such that
a. (x,y)  f, and
b. (x,y1)  f Λ (x,y2)  f → y1 = y2
i.e. if (x,y1)  f and (x,y2)  f, then y1 = y2.
Thus all elements in X can be found in exactly one pair of f.
1. Notation: Let f be a function from A to B. We write:
f : A → B,
f(a) = b , a  A, b  B
Examples:
Let A = {1,2,3}, B = {a,b}
R = {( 1,a ),( 2,a ),( 3,b )} is a function
S = {( 1,a ),( 1,b ),( 2,a ),( 3,b )} is not a function. Why?
T = {( 1,a ),( 3,b )} is not a function. Why?
Other Definitions:
Let f be a function from A to B.
1. Domain of f: the set A
2. Range of f
3. Image of a under f: f(a)
Example:
Let A = {1,2,3}, B = {a,b}
f = {( 1,a ),( 2,a ),( 3,b )}
domain: { 1, 2, 3},
range: { a, b }
a is image of 1 under f: f(1) = a, f(2) = ….. f(3) = ……
Problem 34
Functions of special interest
a. one-to-one
distinct elements have distinct images: if a1 ≠ a2, then f(a1) ≠ f(a2)
Example:
Let A = { 1, 2, 3 }, B = { a, b, c, d }
one-to-one function f = {( 1, a ), ( 2, c ), ( 3, b )}
b. onto
Every element in B is an image of some element in A
Example:
Let A = { 1, 2, 3 }, B = { a, b }
onto function f = {( 1, a ), ( 2, b ), ( 3, b )}
c. bijection
f is bijection iff f is a one-to-one function and f is a onto function
Example:
Let A = { 1, 2, 3 }, B = { a, b, c } bijection f = {( 1, a ), ( 2, c ), ( 3, b )}
d. Inverse function
If f is a bijection, f -1 is a function, also a bijection: f-1 ={(y,x) | (x,y)
Example:
Let A = { 1, 2, 3 }, B = { a, b, c }
f = {( 1, a ), ( 2, c ), ( 3, b )}
f -1 ={( a, 1 ), ( b, 3 ),( c, 2 )}
Problem 35
Composition of functions
Let f : A → B, g : B → C be two functions.
The composition h = g  f is a function from A to C such that h(a) = g(f(a)).
Example: Let f (x) = x + 1, g(x) = x2.
The composition h(x) = g (x)  f(x) is the function g( f( x )
) = (x+1)2
The composition p(x) = f(x)  g(x) is the function f( g( x ) )
= x2 + 1
For the composition of a function with its inverse function we have: :
Let f : A → B
f -1 ( f( a ) ) = a, f (f -1 ( b ) ) = b, a  A, b  B
For the inverse of a composition of two functions we have: :
Let f : A → B, g : B → C be two functions.
(g  f) -1 = f-1  g -1
Thus we have: h(c) = (g  f) -1 (c) = f-1  g -1 = f -1 ( g-1 (c))
Note, that the domain of (g  f) -1 is the set C.
Problem 36
Not a function:
Let A = {a,b,c}, B = {1,2,3}
R = {(a,1),(a,2),(b,3),(c,3)} is not a function,
because the element a has two images.
Problem 37
Function, not one-to-one, not onto:
Let A = {a,b,c}, B = {1,2,3}
R = {(a,1),(b,1),(c,3)} is a function.
The function is not one-to-one because two distinct elements in A, a and b,
have one and the same image in B.
The function is not onto, because the element 2 in B is not an image under the function.
Problem 38
Function, one-to-one, not onto
Let A = {a,b,c}, B = {1,2,3,4,5}
R = {(a,1),(b,2),(c,5)} is a function.
The function is one-to-one because every two distinct elements in A
have distinct images in B.
The function is not onto, because the element 3 and 4 in B are not images
of elements in A under the function.
Problem 39
Function, onto, not one-to-one
Let A = {a,b,c,d}, B = {1,2,3}
R = {(a,1),(b,1),(c,2),(d,3)} is a function.
The function is not one-to-one because two distinct elements in A, a and b,
have one and the same image in B.
The function is onto, because each element in B is an image of some element in A
Problem 40
Function, bijection:
Let A = {a,b,c}, B = {1,2,3}
R = {(a,1),(b,2),(c,3)} is a function.
The function is one-to-one because every two distinct elements in A
have distinct images in B.
The function is onto, because each element in B is an image of some element in A.
Hence the function is a bijection. Its inverse function is also a bijective function.
Relations
Problem 41
A college cafeteria line has two stations: main courses and desserts.
The main course station offers spaghetti or fish; the dessert station offers pie or cake.
Three students Ann, Paul, and Tom, go through the line and make the following choices:
Ann: spaghetti, pie
Tom: fish, pie, cake
Paul: spaghetti, fish, pie
Main course
spaghetti
Ann
X
Tom
Paul
fish
X
Desserts
pie
cake
X
X
X
X
X
X
This table describes a relation between the set of persons {Ann, Tom, Paul} and the set
of food items {spaghetti, fish, pie, cake}
Let A = {Ann, Tom, Paul}, B = { spaghetti, fish, pie, cake }
Each checked box in the table corresponds to a pair (a,b), a
.
The relation is given by the set of all such pairs:
R = {(Ann, spaghetti), (Ann, pie),(Tom, fish), (Tom, pie), (Tom, cake),(Paul, spaghetti),
(Paul, fish), (Paul, pie) }
Problem 42
A = set of students in a college, B = set of courses, C = set of professors
R = {(student , course, professor) | student is registered for course taught by professor}
Problem 43
Let A = {2, 3, 6, 8, 12}
R can be represented as a directed graph:
Problem 44
Representing relations as tables and matrices
Consider the relation
Main course
spaghetti
Ann
X
fish
Desserts
pie
X
cake
Tom
Paul
X
X
X
X
X
X
The example shows how relations can be represented by tables.
A table can be converted into a matrix, by dropping the headings.
If a relation between two elements holds, we write 1 in the matrix, if not - we write 0.
Hence the above relation can be represented also as:
1010
0111
1110
Problem 45
Set operations and relations
Relations are sets. All set operations are applicable to relations
Let A: {3, 5, 6, 7}, B = {4, 5, 9}
Consider two relations R and S from A to B:
R = {(x,y)| x Î A, y Î B, x < y}
The elements of R are: {(3,4),(3,5),(3,9),(5,9), (6,9),(7,9)}
S = {(x,y)| x Î A, y Î B, |x-y| = 2}
The elements of S are: {(3,5), (6,4), (7,5), (7,9)}
a. intersection of R and S:
R Ç S = {(x,y) | xRy L xSy}, R Ç S = {(3,5),(7,9)}
b. union of R and S:
R È S = {(x,y) | xRy V xSy}
R È S = { (3,4),(3,5),(3,9),(5,9), (6,9),(7,9), (6,4), (7,5) }
a. difference R - S, S - R:
R - S = {(x,y) | xRy L ~(xSy)}
R - S = {(3,4),(3,9),(5,9), (6,9)}
b. complementation:
Rc = {(x,y) | ~( xRy)}
Rc = E - R
For R and S the universal set E is A x B:
{(3,4), (3, 5), (3, 9),
(5, 4), (5, 5), (5, 9),
(6, 4), (6, 5), (6, 9),
(7, 4), (7, 5), (7, 9)}
R = {(3,4), (3,5), (3,9), (5,9), (6,9), (7,9)}
E - R = {(5,4), (5,5), (6,4), (7,4), (7,5)}
Note that for any two sets A and B, A - B = A Ç Bc
Problem 46
Let A = {1,2,3}, B = {1,4,9}
Let R: B® A be the set {(1,1), (1,4), (2,2), (2,4), (3,3)}
R-1 : B® A is the relation {(1,1), (4,1), (2,2), (4,2), (3,3)}
a. Let A = {1,2,3}, R: A® A be the relation {(1,2), (1,3), (2,3)}
R-1 is the relation: {(2,1), (3,1), (3,2)}
b. other examples:
R is >, R-1 is < 5 > 8, 8 < 5
R : parent(x,y), R-1 : child(y,x)
Problem 47
Let X, Y, and Z be the sets:
X: {1,3,5}
Y: {2,4,8}
Z :{2,3,6}
Let R : X ® Y, and S : Y ® Z, be the relation "less than":
R = {(1,2),(1,4),(1,8),(3,4),(3,8),(5,8)}
S = {(2,3),(2,6),(4,6)}
S º R :{(1,3), (1,6), (3,6)}
The element (1,3) is formed by combining (1,2) from R and (2,3) from S
The element (1,6) is formed by combining (1,2) from R and (2,6) from S
Note, that (1,6) can also be obtained by combining (1,4) from R and (4,6)
from S.
The element (3,6) is formed by combining (3,4) from R and (4,6) from S
Graphical representation of the composition:
Problem 48
Reflexive relations
Definition
Let R be a binary relation on a set A.R is reflexive, iff for all x Î A, (x,x) Î R, i.e. xRx is
true.
Examples:
a. Equality is a reflexive relation for any object x, x = x is true.
b. "less then" is not a reflexive relation. It is irreflexive for any
number x, x < x is not true
c. " less then or equal to" is a reflexive relation for any number x, x
£ x is true
d. A = {1,2,3,4}, R = {(1,1), (1,2), (2,2), (2,3), (3,3), (3,4), (4,4)}
e. A = {1,2,3,4}, R = {(1,2), (2,3), (3,4), (4,1)} - not reflexive
(it is irreflexive)
f. A = {1,2,3,4}, R = {(1,1), (1,2), (3,4), (4,4)} - not reflexive
(it is neither reflexive nor irreflexive)
Problem 49
Graph representation of reflexive relations
Rule: if xRx is true, there is a loop on node x.
Example:
A:= {1,2,3}
R = "less then or equal to"
R = {(1,1),(1,2),(1,3),(2,2),(2,3),(3,3)}
Problem 50
Matrix representation of reflexive relations
The relation R in the above example would be represented thus:
1
1
2
3
1 2 3
1 0 0
0 1 0
0 0 1
There are 1's on the diagonal
Problem 51
Reflexive and irreflexive relations
Compare the three examples below:
1. A = {1,2,3,4}, R1 = {(1,1), (1,2), (2,2), (2,3), (3,3), (3,4),
(4,4)}
2. A = {1,2,3,4}, R2 = {(1,2), (2,3), (3,4), (4,1)}
3. A = {1,2,3,4}, R3= {(1,1), (1,2), (3,4), (4,4)}
R1 is a reflexive relation. R2 ? R3 ?
Definition:
Let R be a binary relation on a set A.
R is irreflexive iff for all x Î A, (x,x) Ï R
Definition:
Let R be a binary relation on a set A.
R is neither reflexive, nor irreflexive iff
there is x Î A, such that (x, x) Î R, and there is y Î A such that (y, y) Ï R
Thus R2 is irreflexive, while R3 is neither reflexive nor irreflexive.
Summary



Problem 52
Symmetric relations
Definition
reflexive: for all x: xRx
irreflexive: for no x: xRx
neither: for some x: xRx is true, for some y: yRy is false
R is symmetric, iff for all x, y Î A, if (x, y) Î R, then (y, x) Î R,
i.e xRy ® yRx is true
This means: if two elements x and y are in relation R, then y and x are also in R,
i.e. if xRy is true, yRx is also true.
Examples:
b.
c.
d.
e.
f.
g.
h.
i.
equality is a symmetric relation: if a = b then b = a
"less than" is not a symmetric relation, it is anti-symmetric.
"sister" on the set of females is symmetric.
"sister" on the set of all human beings is not symmetric.
(It is neither symmetric nor anti-symmetric)
"friends" is symmetric: friend(a,b) ® friend(b,a)
A = {1,2,3,4}, R1 = {(1,1), (1,2), (2,1), (2,3), (3,2), (4,4)}
The relation is symmetric.
A = {1,2,3,4}, R2 = {(1,1), (1,2), (2,3), (4,4)} - not
symmetric
(it is anti-symmetric)
A = {1,2,3,4}, R3 = {(1,1), (1,2), (2,1) , (2,3), (4,4)} - not
symmetric
(it is neither symmetric nor anti-symmetric)
Problem 53
Graph representation of symmetric relations
Rule: if R is a symmetric relation, all links are bi-directional.
Example:
friend(x,y), x,y Î {Ann, Tim, Paul, Jane, Jim}
Problem 54
Matrix representation of symmetric relations
Ann Tim Paul Jane Jim
Ann 0 1
0
0
0
Tim
1 0
1
0
0
Paul
0 1
0
0
0
Jane 0 0
0
0
1
Jim
0 0
0
1 0
The matrix is symmetric.
Problem 55
Symmetric and anti-symmetric relations
Compare the relations:
A = {1,2,3,4}, R1 = {(1,1), (1,2), (2,1), (2,3), (3,2), (4,4)}
A = {1,2,3,4}, R2 = {(1,1), (1,2), (2,3), (4,4)}
A = {1,2,3,4}, R3 = {(1,1), (1,2), (2,1) , (2,3), (4,4)}
Definition:
Let R be a binary relation on a set A.
R is anti-symmetric if for all x, y Î A, x ¹ y, (x, y) Î R ® (y, x) Ï R.
i.e. for all pairs (x,y) in R, x ¹ y, the pair (y,x) is not in R.
Definition: R is neither symmetric nor anti-symmetric iff
it is not symmetric and not anti-symmetric.
Summary



symmetric: xRy ® yRx for all x and y
anti-symmetric: xRy and yRx ® x = y
neither: for some x and y both xRy and yRx are true,
for others xRy is true, yRx is not true.
Problem 56
Transitive relations
Definition
Let R be a binary relation on a set A.
R is transitive iff for all x, y, z Î A, if (x, y) Î R and (y,z) Î R , then
(x, z) Î R
i.e. (xRy L yRz) ® xRz is true
Examples:







Equality is a transitive relation: a = b, b = c, hence a = c
"less than" is a transitive relation: a < b, b < c, hence a < c
mother(x,y) is not a transitive relation
sister(x,y) is a transitive relation
brother (x,y) is a transitive relation
A = {1,2,3,4} R = {(1,1), (1,2), (1,3), (2,3), (4,3)} - transitive
A = {1,2,3,4} R = {(1,1), (1,2), (1,3), (2,3), (3,4)} - not transitive
Problem 57
Graph representation of transitive relations
Rule: if there is a link from a to b, and a link from b to c,
then there must be a link from a to c.
Example:
A = {1,2,3,4}R = {(1,2), (1,3), (1,4),(2,3),(2,4),(3,4)}
This is the relation "less than"
Problem 58
Consider the set T of all triangles and relation R = {(x,y)| x and y have equal angles}
R is an equivalence relation. It has the three properties:
1. Reflexivity xRx
2. Symmetry: If xRy then yRx
3. Transitivity: If xRy and yRz, then xRz
Problem 59
Consider the set P of all persons and the relation R "having same age".
R is a relation of equivalence:
2
3
4
Reflexivity: obviously, a person has same age as him/herself.
Symmetry: If person a has same age as person b, then person b has
same age as person a
Transitivity: If person a has same age as person b, and person b has
same age as person c, then person a has same age as person c.
Problem 60
a. Consider the set S of all students in a college and the relation R "having the same
advisor".
R is a relation of equivalence:
1
2
3
Reflexivity: obviously, a student has the same advisor.
Symmetry: If student a has the same advisor as student b, then
student b has the same advisor as student a
Transitivity: If student a has the same advisor as student b,
and student b has the same advisor as student c, then student a has
the same advisor as student c.
b. Consider the set of all people and the relation R having same first name.
R is a relation of equivalence.
c. Consider the set of all English words and the relation
R = {(a,b)| a and b have same number of letters. R is a relation of
equivalence.
Problem 61
Definition:Let R be a binary relation defined on a set A. R is a partial order relation iff R
is transitive and anti-symmetric.
Weak partial order: R is reflexive.
Strict partial order: R is not reflexive (irreflexive or neither reflexive nor irreflexive).
Consider the power set of a set A = {a, b, c} and the relation R defined on the power set
of A. R = {(Ai,Aj)| Ai
j}. R is a partial order. It is not a total order.
1. If we eliminate the links implied by the transitivity, we get a simpler
diagram, called Hasse diagram:
Hasse Diagram
As with the functions and relations there is a convenient graphical rept of partial order –
Hasse diagram.
Consider digraph representation of partial order-means relation must be reflexive and
transitive. Thus we can simplify the graph as follows:
 Remove all self loops
 Remove all transitive edges
 Make the graph direction less-that is ,we can assume that the orientation is
upwards
Example of How to make Hasse Diagram
Problem 61
Example of Hasse Diagram
{ <a, b> | a<=b } on {1, 2, 3, 4}
Lattices
Definition:
A poset is a lattice if every pair of elements has a lub (join) and a glb (meet).
Least upper bound (lub)
Let < A, ≤ > be a poset and B be a subset of A.
1. An element a  A is an upper bound for B iff for every element a' B, a' ≤a.
2. An element a  A is a least upper bound (lub) for B iff a is an upper bound for B and
for every upper bound a' for B, a ≤a'.
Greatest lower bound (glb)
Let < A, ≤ > be a poset and B be a subset of A.
1. An element a  A is a lower bound for B iff for every element a' B, a≤a'.
2. An element a  A is a greatest lower bound (glb) for B iff a is a lower bound for B and
for every lower bound a' for B, a'≤a.
Theorem:
Let <L, ≤> be a lattice, For any a, b, c L,
(i) a*a=a (i') a+a=a (idempotent)
(ii) a*b=b*a (ii') a+b=b+a (Commutative)
(iii) (a*b)*c= a*(b*c) (iii') (a+b)+c= a+(b+c) (Associative)
(iv) a*(a+b)=a (iv') a+(a*b)=a (Absorption)
Theorem:
− Let <L, ≤> be a lattice for any a, b L, the following
property holds.
a≤ ba*b=a a+b=b
Theorem:
− Let <L, ≤> be a lattice, For any a, b, c L, the following
properties hold.
b≤c => a*b≤a*c, a+b≤a+c
Theorem:
− Let <L, ≤> be a lattice, For any a, b, c L, the following
properties hold.
a≤b ^ a≤c => a≤b+c
a≤b ^ a≤c =>a≤b*c
b≤a ^ c≤a =>b*c ≤a
b≤a ^ c≤a => b+c≤a
Theorem:
− Let < L, ≤> be a lattice, For any a, b, c L, the
following inequalities hold.
a+(b*c)≤(a+b)*(a+c)
(a*b)+(a*c)≤a*(b+c)
Theorem:
Let <A, *, +> be an algebra which satisfies the
1. Idempotent law, (a*a=a, a+a=a)
2. Commutative law, (a*b=b*a, a+b=b+a)
3. Associative law, ( (a*b)*c= a*(b*c), (a+b)+c= a+(b+c) )
4. Absorption law ( a*(a+b)=a, a+(a*b)=a )
Then there exists a lattice <A, ≤>, such that * is a glb, + is a lub,
and is ≤ defined as follows:
x≤y iff x*y=x
x≤y iff x+y=y
Definitions
Algebraic system :A lattice is an algebraic system <L, *, +> with two binary operations
* and + on L which are both (1) commutative and (2) associative and (3) satisfy the
absorption law.
Sublattice : Let <L, *, +> be a lattice and let S be a subset of L. The algebra <S, *, +> is
a sublattice of <L, *, +> iff S is closed under both operations * and +.
Lattice homomorphism: Let <L, *, +> and <S, ^,V> be two lattice. A mapping g:L→S
is called a lattice homomorphism from the lattice <L, *, +> to <S, ^ , V > if for any a,
bL,
g(a*b)=g(a) ^ g(b) and g(a+b)=g(a) V g(b).
Order-preserving :Let <P, ≤> and <Q, ≤'> be two partially ordered sets, A mapping f: P
→ Q is said to be order-preserving relative to the ordering ≤ in P and ≤' in Q iff for any
a,bP such that a≤ b, f(a) ≤' f(b) in Q.
Complete Lattice: A lattice is called complete if each of its nonempty subsets has a least
upper bound and a greatest lower bound.
Greatest and Least elements
Let < A, ≤ > be a poset and B be a subset of A.
1. An element a  B is a greatest element of B iff for every element a' B, a' ≤a.
2. An element a  B is a least element of B iff for every element a' B, a ≤a '.
Least upper bound (lub)
Let < A, ≤ > be a poset and B be a subset of A.
1. An element a  A is an upper bound for B iff for every element a' B, a' ≤a.
2. An element a  A is a least upper bound (lub) for B iff a is an upper bound for B and
for every upper bound a' for B, a ≤a'.
Greatest lower bound (glb)
Let < A, ≤ > be a poset and B be a subset of A.
1. An element a  A is a lower bound for B iff for every element a' B, a≤a'.
2. An element a  A is a greatest lower bound (glb) for B iff a is a lower bound for B and
for every lower bound a' for B, a'≤a.
Maximal and Minimal Elements: Let (A, R) be a poset. Then a in A is a minimal
element if there does not exist an element b in A such that bRa.
Similarly for a maximal element.
Upper and Lower Bounds
Let S be a subset of A in the poset (A, R). If there exists an element a in A such that sRa
for all s in S, then a is called an upper bound. Similarly for lower bounds.
Bounds of the lattice :The least and the greatest elements of a lattice, if they exist, are
called the bounds of the lattice, and are denoted by 0 and 1 respectively.
Bounded lattice: In a bounded lattice <L, *, +, 0, 1>, an element b L is called a
complement of an element a  L, if a*b=0,
a+b=1.
Complemented lattice :A lattice <L, *, +, 0, 1> is said to be a complemented lattice if
every element of L has at least one complement.
Distributive lattice :A lattice <L, *, +> is called a distributive lattice if for any a, b, c
L, a*(b+c)=(a*b)+(a*c) a+(b*c)=(a+b)*(a+c)
Problem 62
Construct the Hasse diagram of (P({a, b, c}), ).
The elements of P({a, b, c}) are

{a}, {b}, {c}
{a, b}, {a, c}, {b, c}
{a, b, c}
The digraph is
In the above Hasse diagram, is a minimal element and {a, b, c} is a maximal element.
In the poset above {a, b, c} is the greatest element. is the least element.
In the poset above, {a, b, c}, is an upper bound for all other subsets. is a lower bound
for all other subsets.
{a, b, c}, {a, b} {a, c} and {a} are upper bounds and {a} is related to all of them, {a}
must be the lub. It is also the glb.
Problem 63
In the poset (P(S), ), lub(A, B) = A B. What is the glb(A, B)?
Solution:
Consider the elements 1 and 3.
• Upper bounds of 1 are 1, 2, 4 and 5.
• Upper bounds of 3 are 3, 2, 4 and 5.
• 2, 4 and 5 are upper bounds for the pair 1 and 3.
• There is no lub since
- 2 is not related to 4
- 4 is not related to 2
- 2 and 4 are both related to 5.
• There is no glb either.
The poset is n o t a lattice.
Problem 64
Determine whether the posets represented by each of the following Hasse diagrams have
a greatest element an a least element.
Discrete Mathematics
Solution
• The least element of the poset with Hasse diagram (a) is a. This poset has no greatest
element.
• The poset with Hasse diagram (b) has neither a least nor a greatest element.
• The poset with Hasse diagram (c) has no least element. Its greatest element is d.
• The poset with Hasse diagram (d) has least element a and greatest element d.
Problem 65
Find the lower and upper bounds of the subsets {a, b, c}, {j, h}, and {a, c, d, f } and find
the greatest lower bound and the least upper bound of {b, d, g}, if they exist.
Solution
The upper bounds of {a, b, c} are e, f, j, h, and its only lower bound is a.
There are no upper bounds of {j, h}, and its lower bounds are a, b, c, d, e, f .
The upper bounds of {a, c, d, f } are f, h, j, and its lower bound is a.
The upper bounds of {b, d, g} are g and h. Since g _ h, g is the least upper bound.
The lower bounds of {b, d, g} are a and b. Since a _ b, b is the greatest lower bound.
Problem 66
Determine whether the posets represented by each of the following Hasse diagrams are
lattices.
Solution
The posets represented by the Hasse diagrams in (a) and (c) are both lattices because in
each poset every pair of elements has both a least upper bound and a greatest lower
bound.
On the other hand, the poset with the Hasse diagram shown in (b) is
not a lattice, since the elements b and c have no least upper bound. To see this note that
each of the elements d, e and f is an upper bound, but none of these three elements
precedes the other two with respect to the ordering of this poset.
Problem 67
Determine whether (P(S ),_) is a lattice where S is a set.
Solution
Let A and B be two subsets of S . The least upper bound and the greatest lower bound of
A and B are A U B and A ∩B, respectively.
Hence (P(S ),  ) is a lattice.
Download