Você está na página 1de 127

1

Solutions
Problem 1.1
Indicate which of the following sentences are propositions.
a. 1,024 is the smallest four-digit number that is perfect square.
b. She is a mathematics major.
c. 128 = 2
6
d. x = 2
6
.
Solution.
a. Proposition with truth value (T). Note that 32
2
= 1024 and 31
2
= 961.
b. Not a proposition since the truth or falsity of the sentence depends on the
reference for the pronoun she. For some values of she the statement is
true; for others it is false.
c. A proposition with truth value (F).
d. Not a proposition
Problem 1.2
Consider the propositions:
p: Juan is a math major.
q: Juan is a computer science major.
Use symbolic connectives to represent the proposition Juan is a math major
but not a computer science major.
Solution.
p q
Problem 1.3
In the following sentence is the word or used in its inclusive or exclusive
sense? A team wins the playos if it wins two games in a row or a total of
three games.
Solution.
Exclusive
2
Problem 1.4
Write the truth table for the proposition: (p ( p q)) (q r).
Solution.
Let s = (p ( p q)) (q r).
p q r p r p q q r (q r) p ( p q) s
T T T F F T F T T T
T T F F T T T F T F
T F T F F F F T T T
T F F F T F F T T T
F T T T F T F T T T
F T F T T T T F T F
F F T T F T F T T T
F F F T T T F T T T
Problem 1.5
Let t be a tautology. Show that p t t.
Solution.
p t p t
T T T
F T T
Problem 1.6
Let c be a contradiction. Show that p c p.
Solution.
p c p c
T F T
F F F
Problem 1.7
Show that (r p) (( r (p q)) (r q)) p q.
3
Solution.
Let s = ( r (p q)) (r q).
p q r r p r q r (p q) s (r p) s p q
T T T T T T T T T
T T F T T T T T T
T F T T T F F F F
T F F T F T F F F
F T T T T F F F F
F T F F T T F F F
F F T T T F F F F
F F F F F T F F F
Problem 1.8
Use De Morgans laws to write the negation for the proposition:This com-
puter program has a logical error in the rst ten lines or it is being run with
an incomplete data set.
Solution.
This computer program is error free in the rst ten lines and it is being run
with complete data.
Problem 1.9
Use De Morgans laws to write the negation for the proposition:The dollar
is at an all-time high and the stock market is at a record low.
Solution.
The dollar is not at an all-time high or the stock market is not at a record
low.
Problem 1.10
Assume x R. Use De Morgans laws to write the negation for the proposition:0
x > 5.
Solution.
x 5 or x > 0.
4
Problem 1.11
Show that the proposition s = (p q) ( p (p q)) is a tautology.
Solution.
p q p q p (p q) p q s
T T F F F T T
T F F T T F T
F T T F T F T
F F T T T F T
Problem 1.12
Show that the proposition s = (p q) ( p q) is a contradiction.
Solution.
p q p q p q) p q s
T T F F F T F
T F F T T F F
F T T F F T F
F F T T F T F
Problem 1.13
a. Find simpler proposition forms that are logically equivalent to p p and
p (p p).
b. Is (p q) r p (q r)? Justify your answer.
c. Is (p q) r (p r) (q r)? Justify your answer.
Solution.
a. Constructing the truth table for p p we nd
p p p
T F
F F
Hence, p p c, where c is a contradiction.
Now, (p p) p c p p.
5
b. (p q) r , p (q r) because of the following truth table.
p q r p q (p q) r p (q r)
T T T F T T
T T F F F F
T F T T T ,= F
T F F T T T
F T T T T ,= F
F T F T T T
F F T T T T
F F F F F F
c. (p q) r , (p r) (q r) because of the following truth table.
p q r p q (p q) r (p r) (q r)
T T T F F F
T T F F F ,= T
T F T T T T
T F F T F F
F T T T T T
F T F T F F
F F T T T ,= F
F F F F F F
Problem 1.14
Show the following:
a. p t p, where t is a tautology.
b. p c c, where c is a contradiction.
c. t c and c t.
d. p p p and p p p.
Solution.
a.
p t p t
T T T
F T F
b.
p c p c
T F F
F F F
6
c.
t t c
T F F
T F F
c c t
F T T
F T T
d.
p p p
T T
F F
p p p
T T
F F
7
Problem 2.1
Rewrite the following proposition in if-then form: This loop will repeat
exactly N times if it does not contain a stop or a go to.
Solution.
If this loop does not contain a stop or a go to then it will repeat exactly N
times.
Problem 2.2
Construct the truth table for the proposition: p q r.
Solution.
p q r p p q p q r
T T T F T T
T T F F T F
T F T F F T
T F F F F T
F T T T T T
F T F T T F
F F T T T T
F F F T T F
Problem 2.3
Construct the truth table for the proposition: (p r) (q r).
Solution.
p q r p r q r (p r) (q r)
T T T T T T
T T F F F T
T F T T T T
T F F F T F
F T T T T T
F T F T F F
F F T T T T
F F F T T T
8
Problem 2.4
Write negations for each of the following propositions. (Assume that all vari-
ables represent xed quantities or entities, as appropriate.)
a. If P is a square, then P is a rectangle.
b. If today is Thanksgiving, then tomorrow is Friday.
c. If r is rational, then the decimal expansion of r is repeating.
d. If n is prime, then n is odd or n is 2.
e. If x 0, then x > 0 or x = 0.
f. If Tom is Anns father, then Jim is her uncle and Sue is her aunt.
g. If n is divisible by 6, then n is divisible by 2 and n is divisible by 3.
Solution.
a. P is a square and P is not a rectangle.
b. Today is Thanksgiving and tomorrow is not Friday.
c. r is rational and its decimal expansion is not repeating.
d. n is prime and both n is not odd and is not 2.
e. x 0 and both x 0 and x ,= 0.
f. Tom is Anns father and either Jim is not her uncle or Sue is not her aunt.
g. n is divisible by 6 and either n is not divisible by 2 or n is not divisible
by 3
Problem 2.5
Write the contrapositives for the propositions of problem ??
Solution.
a. If P is not a rectangle, then P is not a square.
b. If tomorrow is not Friday, then today is not Thanksgiving.
c. If the decimal expansion of r is not repeating, then r is not rational.
d. If n is even and n ,= 2, then n is not prime.
e. If x < 0, then x is negative.
f. If either Jim is not Anns uncle or Sue is not her aunt, then Tom is not
her father.
g. If either n is not divisible by 2 or n is not divisible by 3 then n is not
divisible by 6
Problem 2.6
Write the converse and inverse for the propositions of problem ??
9
Solution.
a. converse : If P is a rectangle, then P is a square.
inverse : If P is not a square, then P is not a rectangle.
b. converse : If tomorrow is Friday, then today is Thanksgiving.
inverse; If today is not Thanksgiving, then tomorrow is not Friday.
c. converse : If the decimal expansion of r is repeating, then r is rational.
inverse : If r is not rational, then its decimal expansion is not repeating.
d. converse: If n is odd or n = 2, then n is prime.
inverse : If n is not prime, then both n is even and n ,= 2.
e. converse : If x 0, then x is nonnegative.
inverse : If x is negative, then x < 0.
f. converse : If either Jim is Anns uncle or Sue is her aunt, then Tom is her
father.
inverse : If Tom is not Anns father, then neither Jim is her uncle nor Sue is
her aunt.
g. converse : If n is divisible by 2 and n is divisible by 3 then n is divisible
by 6.
inverse : If n is not divisible by 6, then either n is not divisible by 2 or n is
not divisible by 3
Problem 2.7
Use the contrapositive to rewrite the proposition The Cubs will win the
penant only if they win tomorrows game in if-then form in two ways.
Solution.
If the cubs do not win tomorrows game then they will not win the pennant.
If the cubs win the pennant then they will win tomorrows game
Problem 2.8
Rewrite the proposition : Catching the 8:05 bus is sucient condition for
my being on time for work in if-then form.
Solution.
If I catch the 8:05 bus then I am on time for work
Problem 2.9
Use the contrapositive to rewrite the proposition being divisible by 3 is a
necessary condition for this number to be divisible by 9 in if-then form in
two ways.
10
Solution.
If this number is divisible by 9 then it is divisible by 3.
If this number is not divisible by 3, then it is not divisible by 9
Problem 2.10
Rewrite the proposition A sucient condition for Hals team to win the
championship is that it wins the rest of the games in if-then form.
Solution.
If Hals team wins the rest of the games, then it will win the championship
Problem 2.11
Rewrite the proposition A necessary condition for this computer program
to be correct is that it not produce error messages during translation in
if-then form.
Solution.
If the computer program does not produce error messages during translation
then this program is correct
11
Problem 3.1
Use modus ponens or modus tollens to ll in the blanks in the argument
below so as to produce valid inferences.
If

2 is rational, then

2 =
a
b
for some integers a and b.
It is not true that

2 =
a
b
for some integers a and b.
..
Solution.
If

2 is rational, then

2 =
a
b
for some integers a and b.
It is not true that

2 =
a
b
for some integers a and b.
..

2 is not rational
Problem 3.2
Use modus ponens or modus tollens to ll in the blanks in the argument
below so as to produce valid inferences.
If logic is easy, then I am a monkeys uncle.
I am not a monkeys uncle.
..
Solution.
If logic is easy, then I am a monkeys uncle.
I am not a monkeys uncle.
.. Logic is not easy
Problem 3.3
Use truth table to determine whether the argument below is valid.
p q
q p
.. p q
Solution.
12
The truth table is
p q p q q p p q
T T T T T
T F F T T
F T T F T
F F T T F
Because of the last row, the given argument is invalid
Problem 3.4
Use truth table to determine whether the argument below is valid.
p
p q
q r
.. r
Solution.
The truth table is
p q r p q q r
T T T T T
T T F T F
T F T F T
T F F F T
F T T T T
F T F T F
F F T T T
F F F T T
Because of the rst row, the given argument is valid
Problem 3.5
Use symbols to write the logical form of the given argument and then use a
truth table to test the argument for validity.
If Tom is not on team A, then Hua is on team B.
If Hua is not on team B, then Tom is on team A.
.. Tom is not on team A or Hua is not on team B.
13
Solution.
Let
p : Tom is on team A.
q : Hua is on team B.
Then the given argument is of the form
p q
q p
.. p q
The truth table is
p q p q q p p q
T T T T F
T F T T T
F T T T T
F F F F T
Because of the rst row, the given argument is invalid
Problem 3.6
Use symbols to write the logical form of the given argument. If the argument
is valid, identify the rule of inference that quarantees its validity. Otherwise
state whether the converse or the inverse error is made.
If Jules solved this problem correctly, then Jules obtined the answer 2.
Jules obtined the answer 2.
.. Jules solved this problem correctly.
Solution.
Let
p : Jules solved this problem correctly.
q : Jules obtained the answer 2.
Then the given argument is of the form
p q
q
.. p
14
Its truth table is
p q p q
T T T
T F F
F T T
F F T
From the third row we see that the argument is invalid. This argument
becomes valid if p q is replaced by its converse q p. Thus, converse
error is made
Problem 3.7
Use symbols to write the logical form of the given argument. If the argument
is valid, identify the rule of inference that quarantees its validity. Otherwise
state whether the converse or the inverse error is made.
If this number is larger than 2, then its square is larger than 4.
This number is not larger than 2.
.. The square of this number is not larger than 4.
Solution.
Let
p : This number is larger than 2.
q : The square of this number is larger than 4.
Then the given argument is of the form
p q
p
.. q
Its truth table is
p q p q p q
T T T F F
T F F F T
F T T T F
F F T T T
From the third row we see that the argument is invalid. This argument
becomes valid if p q is replaced by its inverse p q. Thus, inverse
error is made
15
Problem 3.8
Use the valid argument forms of this section to deduce the conclusion from
the premises.
p q r
s q
t
p t
p r s
.. q
Solution.
(1) p t premise
t premise
.. p by modus tollens
(2) p by (1)
.. p q by disjunctive addition
(3) p q r premise
p q by (2)
.. r by modus ponens
(4) p by (1)
r by (3)
.. p r by conjunctive addition
(5) p r s premise
p r by (4)
.. s by modus ponens
(6) s q premise
s by (5)
.. q by disjunctive syllogism
Problem 3.9
Use the valid argument forms of this section to deduce the conclusion from
16
the premises.
p r s
t s
u p
w
u w
.. t w
Solution.
(1) w premise
u w premise
.. u by disjunctive syllogism
(2) u p premise
u by (1)
.. p by modus ponens
(3) p r s premise
p by (2)
.. r s by modus ponens
(4) r s by (3)
.. s by conjunctive simplification
(5) t s premise
s by (4)
.. t by modus tollens
(6) t by (5)
.. t w by disjunctive addition
17
Problem 4.1
By nding a counterexample, show that the proposition: For all positive
integers n and m, m.n m+n is false.
Solution.
Let m = n = 1. Then m.n = 1 < m+n = 2.
Problem 4.2
Consider the statement
x R such that x
2
= 2.
Which of the following are equivalent ways of expressing this statement?
a. The square of each real number is 2.
b. Some real numbers have square 2.
c. The number x has square 2, for some real number x.
d. If x is a real number, then x
2
= 2.
e. Some real number has square 2.
f. There is at least one real number whose square is 2.
Solution.
(b), (c), (e), and (f) they mean the same thing
Problem 4.3
Rewrite the following propositions informally in at least two dierent ways
without using the symbols and :
a. squares x, x is a rectangle.
b. a set A such that A has 16 subsets.
Solution.
a. All squares are rectangles.
Every square is a rectangle.
b. There exists a set A which has 16 subsets.
Some sets have 16 subsets.
Problem 4.4
Rewrite each of the following statements in the form x such that :
a. Some problems have answers.
b. Some real numbers are rational.
18
Solution.
a. an problem x such that x has an answer.
b. x R such that x Q.
Problem 4.5
Rewrite each of the following statements in the form , if then .:
a. All COBOL programs have at least 20 lines.
b. Any valid argument with true premises has a true conclusion.
c. The sum of any two even integers is even.
d. The product of any two odd integers is odd.
Solution.
a. x, if x is a COBOL program then x has at least 20 lines.
b. x, if x is a valid argument with true premises then x has true conclusion.
c. integers m and n, if m and n are even then m+n is also an even integer.
d. integers m and n, if m and n are odd then m n is also an odd integer.
Problem 4.6
Which of the following is a negation for Every polynomial function is con-
tinuous?
a. No polynomial function is continuous.
b. Some polynomial functions are continuous.
c. Every polynomial function fails to be continuous.
d. There is a noncontinuous polynomial function.
Solution
(b) and (d)
Problem 4.7
Determine whether the proposed negation is correct. If it is not, write a
correct negation.
Proposition : For all integers n, if n
2
is even then n is even.
Proposed negation : For all integer n, if n
2
is even then n is not even.
Solution.
Correct negation : There exists an integer n such that n
2
is even and n is
not even
19
Problem 4.8
Let D = 48, 14, 8, 0, 1, 3, 16, 23, 26, 32, 36. Determine which of the fol-
lowing propositions are true and which are false. Provide counterexamples
for those propositions that are false.
a. x D, if x is odd then x > 0.
b. x D, if x is less than 0 then x is even.
c. x D, if x is even then x 0.
d. x D, if the ones digit of x is 2, then the tens digit is 3 or 4.
e. x D, if the ones digit of x is 6, then the tens digit is 1 or 2
Solution.
a. True.
b. True.
c. False. 26 is even and positive.
d. True.
e. False. A counterexample is 36.
Problem 4.9
Write the negation of the proposition :x R, if x(x +1) > 0 then x > 0 or
x < 1.
Solution.
x R such that x(x + 1) > 0 and 1 x 0.
Problem 4.10
Write the negation of the proposition : If an integer is divisible by 2, then it
is even.
Solution.
Note that the given proposition can be written in the form: n Z, if n
is divisible by 2 then n is even. The negation to this proposition is: an
integer n such that n is divisible by 2 and n is not even.
Problem 4.11
Given the following true propostion: real numbers x, an integer n such
that n > x. For each x given below, nd an n to make the predicate n > x
true.
a. x = 15.83 b. x = 10
8
c. x = 10
10
10
.
20
Solution.
a. n = 16 b. n = 10
8
+ 1 c. n = 10
10
10
+ 1.
Problem 4.12
Given the proposition: x R, a real number y such that x +y = 0.
a. Rewrite this proposition in English without the use of the quantiers.
b. Find the negation of the given proposition.
Solution.
a. For all real numbers x, there exists a real number y such that x +y = 0.
b. x R, y R, x +y ,= 0.
Problem 4.13
Given the proposition: x R, y R, x +y = 0.
a. Rewrite this proposition in English without the use of the quantiers.
b. Find the negation of the given proposition.
Solution.
a. There exists a real number x such that for all real numbers y we have
x +y = 0.
b. For every real number x there exists a real number y such that x +y ,= 0.
Problem 4.14
Consider the proposition Somebody is older than everybody. Rewrite this
proposition in the form a person x such that .
Solution.
a person x such that persons y, x is older than y.
Problem 4.15
Given the proposition: There exists a program that gives the correct answer
to every question that is posed to it.
a. Rewrite this proposition using quantiers and variables.
b. Find a negation for the given proposition.
21
Solution.
a. a program x such that question y that is posed to x the program gives
a correst answer.
b. programs x, a question y for which the program gives a wrong answer.
Problem 4.16
Given the proposition: x R, y R such that x < y.
a. Write a proposition by interchanging the symbols and .
b. State which is true: the given proposition, the one in part (a), neither, or
both.
Solution.
a. x R, y R, x < y.
b. The given proposition is correct whereas the one given in a. is false.
Problem 4.17
Find the contrapositive, converse, and inverse of the proposition x R, if
x(x + 1) > 0 then x > 0 or x < 1.
Solution.
Contrapositive: x R, if 1 x 0 then x(x + 1) 0.
Converse : x R, if x > 0 or x < 1 then x(x + 1) > 0.
Inverse : x R, if x(x + 1) 0 then 1 x 0.
Problem 4.18
Rewrite the following proposition in if-then form : Earning a grade of C

in this course is a sucient condition for it to count toward graduation.


Solution.
If an individual earns a grade of C

in this course then this is counted toward


graduation.
Problem 4.19
Rewrite the following proposition in if-then form : Being on time each day
is a necessary condition for keeping this job.
Solution.
If a person is not on time each day, then the person will not keep this job.
22
Problem 4.20
Rewrite the following proposition without using the words necessary or
sucient : Divisibility by 4 is not a necessary condition for divisibility by
2.
Solution.
There is a number that is divisible by 2 and is not divisible by 4.
23
Problem 5.1
Use the rule of universal modus ponens to ll in valid conclusion for the ar-
gument.
For all real numbers a, b, c, and d, if b ,= 0 and d ,= 0 then
a
b
+
c
d
=
ad+bc
bd
.
a = 2, b = 3, c = 4, and d = 5 are particular real numbers such that b ,= 0
and d ,= 0.
..
Solution.
For all real numbers a, b, c, and d, if b ,= 0 and d ,= 0 then
a
b
+
c
d
=
ad+bc
bd
.
a = 2, b = 3, c = 4, and d = 5 are particular real numbers such that b ,= 0
and d ,= 0.
..
2
3
+
4
5
=
22
15
Problem 5.2
Use the rule of universal modus tonens to ll in valid conclusion for the ar-
gument.
If a computer is corresct, then compilation of the program does not pro-
duce error messages.
Compilation of this program produces error messages.
..
Solution.
If a computer is corresct, then compilation of the program does not produce
error messages.
Compilation of this program produces error messages.
.. The computer program is incorrect
Some of the following arguments are valid; others are invalid. State which
are valid and which are invalid. Justify your answer.
Problem 5.3
All freshmen must take writing.
Caroline is a freshman.
.. Caroline must take writing.
24
Solution.
This is a valid argument by the universal modus ponens or universal instan-
tiation
Problem 5.4
All cheaters sit in the back row.
George sits in the back row.
.. George is a cheater.
Solution.
This is an invalid argument by the converse error
Problem 5.5
All honest people pay their taxes.
Darth is not honest.
.. Darth does not pay his taxes.
Solution.
This is an invalid argument by the inverse error
25
Problem 6.1
Construct the truth tables of the gates discussed in this section.
Solution.
Truth table for NOT - gate:
P R
1 0
0 1
Truth table for AND - gate:
P Q R
1 1 1
1 0 0
0 1 0
0 0 0
Truth table for OR - gate:
P Q R
1 1 1
1 0 1
0 1 1
0 0 0
Truth table for NAND - gate:
P Q R
1 1 0
1 0 1
0 1 1
0 0 1
Truth table for NOR - gate:
P Q R
1 1 0
1 0 0
0 1 0
0 0 1
26
Problem 6.2
Give the output signal S for the following circuit:
Solution.
Answer: S = 0
Problem 6.3
Write the input/output table for the circuit of the previous problem.
Solution.
P Q R S
1 1 1 1
1 1 0 1
1 0 1 1
1 0 0 1
0 1 1 1
0 1 0 0
0 0 1 0
0 0 0 0
Problem 6.4
Find the Boolean expression that corresponds to the circuit of Problem ??.
Solution.
(P Q) (P R)
27
Problem 6.5
Construct the circuit corresponding to the Boolean expression: (P Q)
R.
Solution.
Problem 6.6
For the following input/output table, construct (a) the corresponding Boolean
expression and (b) the corresponding circuit:
P Q R S
1 1 1 0
1 1 0 1
1 0 1 0
1 0 0 0
0 1 1 1
0 1 0 0
0 0 1 0
0 0 0 0
Solution.
(a) (P Q R) ( P Q R).
(b)
28
Problem 6.7
Show that the following two circuits are equivalent:
Solution.
The Boolean expression corresponding to a. is given by (P Q) Q and
that corresponding to b. is (P Q) Q. These two expressions are logically
equivalent:
(P Q) Q (P Q) (Q Q)
(P Q) Q.
Problem 6.8
Consider the following circuit
29
Let P and Q be single binary digits and P + Q = RS. Complete the fol-
lowing table
P Q R S
1 1
1 0
0 1
0 0
The given circuit is called a half -adder. It computes the sum of two single
binary digits.
Solution.
P Q R S
1 1 1 0
1 0 0 1
0 1 0 1
0 0 0 0
Problem 6.9
Express the numbers 104 and 104 in twos complement representation with
8 bits.
Solution.
+104
10
= 01101000
2
104
10
= 10011000
2
30
Problem 6.10
What is the decimal representation for the integer with twos complement
10101001?
Solution.
The two complement of 10101001 is 01010111
2
= 87
10
31
Problem 7.1
Find the decimal value of the following binary numbers:
a. 1100101
2
b. 110110
2
Solution.
a. 1100101
2
= 1 2
6
+ 1 2
5
+ 0 2
4
+ 0 2
3
+ 1 2
2
+ 0 2 + 1 = 101.
b. 110110
2
= 1 2
5
+ 1 2
4
+ 1 2
2
+ 1 2 = 54.
Problem 7.2
Represent the following decimal integers in binary notation:
a. 1297
10
b. 458
10
Solution.
a. Using the procedure mentioned aboe we nd:
1297 = 648 2 + 1
648 = 324 2 + 0
324 = 162 2 + 0
162 = 81 2 + 0
81 = 40 2 + 1
40 = 20 2 + 0
20 = 10 2 + 0
10 = 5 2 + 0
5 = 2 2 + 1
2 = 1 2 + 0
1 = 0 2 + 1
Hence, 1297
10
= 10100010001
2
.
b. Similarly, one nds that 458
10
= 111001010
2
.
Problem 7.3
Evaluate the following sums:
a. 11011101
2
+ 1001011010
2
b. 101101
2
+ 11101
2
32
Solution
a.
1 1 1 1
0 0 1 1 0 1 1 1 0 1
+ 1 0 0 1 0 1 1 0 1 0
1 1 0 0 1 1 0 1 1 1
b. Similar to a. we nd 101101
2
+ 11101
2
= 1001010
2
Problem 7.4
Convert the number A2BC
16
to base 10.
Solution.
A2BC
16
= A 16
3
+ 2 16
2
+B 16 +C
= 10 16
3
+ 2 16
2
+ 11 16 + 12
= 41404
10
Problem 7.5
Convert the number B53DF8
16
to base 2.
Solution.
We have B = 1011
2
, 5 = 0101
2
, 3 = 0011
2
, D = 1101
2
, F = 1111
2
, 8 = 1000
2
.
Hence, B53DF8
16
= 101101010011110111111000
2
.
Problem 7.6
Convert the number 101101111000101
2
to base 16.
Solution.
We have 101101111000101
2
= 0101[1011[1100[0101 = 5BC5
16
33
Problem 8.1
Show that the number r = 6.321521521... is a rational number.
Solution.
Note rst that r = 6.32 + 0.00152152.... =
632
100
+ 0.00152152... Let x =
0.00152152... then 100000x = 152.152152... that is 100000x = 152 + x and
solving for x we nd x =
152
99999
. Thus, r =
632
100
+
152
99999
Problem 8.2
Prove the following theorem.
Theorem. The product of two rational numbers is a rational number.
Solution.
Proof. Let p and q be two rational numbers. Then there exist integers a, b, c,
and d with b ,= 0, d ,= 0 and p =
a
b
, q =
c
d
. Hence, pq =
ac
bd
Q
Problem 8.3
Use the previous problem to prove the following.
Corollary. The square of any rational number is rational.
Solution.
Proof. Let a = b in the previous theorem to nd that a
2
= a.a Q
Problem 8.4
Use the method of constructive proof to show that if r and s are two real
numbers then there exists a real number x such that r < x < s.
Solution.
Indeed, one can easily check that x =
r+s
2
satises the inequality r < x < s
Problem 8.5
The following Pascal program segment does not nd the minimum value in
a data set of N integers. Find a counterexample.
MINN := 0;
FOR I := 1 TO N DO
BEGIN
READLN (A);
If A < MINN THEN MINN := A
END
34
Solution.
Let N = 2 with the two numbers 1, 3. According to the algorithm the
minimum is found to be 0 which is false.
35
Problem 9.1
Prove that for any integer n the product n(n + 1) is even.
Solution.
We use the method of proof by cases.
Case 1. Suppose n is even. Then there is an integer k such that n = 2k.
Thus, n(n+1) = 2k(2k+1) = 2k

where k

= k(2k+1) Z. That is, n(n+1)


is even.
Case 2. Suppose that n is odd. Then there exists an integer k such that
n = 2k+1. So, n(n+1) = 2(2k+1)(k+1) = 2k

where k

= (2k+1)(k+1) Z.
Again, n(n + 1) is even
Problem 9.2
Prove that the square of any integer has the form 4k or 4k + 1 for some
integer k
Solution.
We use the method of proof by cases.
Case 1. Suppose n is even. Then there is an integer m such that n = 2m.
Taking the square of n we nd n
2
= 4m
2
= 4k where k = m
2
Z.
Case 2. Suppose n is odd. Then there is an integer m such that n = 2m+1.
Taking the square of n we nd n
2
= 4m
2
+4m+1 = 4(m
2
+m) +1 = 4k +1
where k = m
2
+m Z.
Problem 9.3
Prove that for any integer n, n(n
2
1)(n + 2) is divisible by 4.
Solution.
We use the method of proof by cases.
Case 1. Suppose n is even. Then there is an integer m such that n = 2m This
implies that n(n
2
1)(n+2) = 2m(4m
2
1)(2m+2) = 4m(4m
2
1)(m+1) =
4k where k = m(4m
2
1)(m+1) Z. Thus, n(n
2
1)(n +2) is divisible by
4.
Case 2. Suppose n is odd. Then there is an integer m such that n = 2m+1.
Thus, n(n
2
1)(n + 2) = (2m + 1)(4m
2
+ 4m)(2m + 3) = 4k where k =
(2m+ 1)(m
2
+m)(2m+ 3) Z. Thus, n(n
2
1)(n + 2) is divisible by 4.
36
Problem 9.4
State a necessary and sucient condition for the oor function of a real
number to equal that number.
Solution.
Theorem. x| = x if and only if x Z.
Proof. Suppose that x| = x. From the denition of the oor func-
tion, x Z. Conversely, if x Z then x is the smallest integer such that
x x < x + 1. That is, x| = x
Problem 9.5
Prove that if n is an even integer then
n
2
| =
n
2
.
Solution.
If n is an even integer then there is an integer k such that n = 2k. In this
case,

n
2
| = k| = k =
n
2
Problem 9.6
Show that the equality x y| = x| y| is not valid for all real numbers
x and y.
Solution.
As a counterexample, let x = 0 and y =
1
2
. Then
x y| =
1
2
| = 0
whereas
x| y| =
1
2
| = (1) = 1.
Problem 9.7
Show that the equality ,x +y| = ,x| +,y| is not valid for all real numbers
x and y.
37
Solution.
As a counterexample, let x = y =
1
2
. Then
,x +y| = ,1| = 1
whereas
,x| +,y| = 2.
Problem 9.8
Prove that for all real numbers x and all integers m, ,x +m| = ,x| +m.
Solution.
Suppose that x R and m Z. Let n = ,x|. By denition of ceil function,
n Z and
n 1 < x n.
Add m to all sides to obtain
n +m1 < x +m n +m.
Since n +m Z and n = ,x| then
,x +m| = n +m = ,x| +m.
Problem 9.9
Show that if n is an odd integer then ,
n
2
| =
n+1
2
.
Solution.
Let n be an odd integer. Then there is an integer k such that n = 2k 1.
Hence,
n
2
= k
1
2
. By the previous problem
,
n
2
| = ,k
1
2
| = k +,
1
2
| = k =
n + 1
2
.
38
Problem 10.1
Use the proof by contradiction to prove the proposition There is no greatest
even integer.
Solution.
Suppose the contrary. That is, suppose there is a greatest even integer N.
Then for any even integer n we have N n. Dene the number M := N +2.
Since the sum of two even integers is again an even integer then M is even.
Moreover, M > N. This contradicts the supposition that N is the largest
even integer. Hence, there in no greatest even integer
Problem 10.2
Prove by contradiction that the dierence of any rational number and any
irrational number is irrational.
Solution.
Suppose the contrary. That is, suppose there exist a rational number x and
an irrational number y such that x y is rational. By the denition of
rational numbers, there exist integers a, b, c, and d with b ,= 0 and d ,= 0 such
that x =
a
b
and x y =
c
d
. Thus,
a
b
y =
c
d
.
Solving for y we nd
y =
ad bc
bd
=
p
q
where p = adbc Z and q = bd Z0. This contradicts the assumption
that y is irrational
Problem 10.3
Use the proof by contraposition to show that if a product of two positive real
numbers is greater than 100, then at least one of the numbers is greater than
10.
Solution.
We must prove by the method of contraposition the implication if x and y
are positive real numbers such that xy > 100 then either x > 10 or y > 10.
Instead, we will show that if x 10 and y 10 then xy 100. Indeed, if
0 < x 10 and 0 < y 10 then the algebra of inequalities we have xy 100.
39
Problem 10.4
Use the proof by contradiction to show that the product of any nonzero
rational number and any irrational number is irrational.
Solution.
Suppose the contrary. That is, suppose there exist a rational number x and an
irrational number y such that xy Q. By the denition of rational numbers
there exist integers a, b ,= 0, c, and d ,= 0 such that x =
a
b
and xy =
c
d
. Since
x ,= 0 then it has a multiplicative inverse, that is we can multiply both side
of the equality xy =
c
d
by
b
a
to obtain y =
bc
ad
=
p
q
where p = bc Z and
q = ad Z 0. This shows that y Q which contradcits the assumption
that y is irrational
40
Problem 11.1
Use the method of induction to show that
2 + 4 + 6 + + 2n = n
2
+n
for all integers n 1.
Solution.
Let P(n) = 2 + 4 + 6 + + 2n. We will show that P(n) = n
2
+ n for all
n 1 by the method of mathematical induction.
(i) (Basis of induction) P(1) = 2 = 1
2
+ 1. So P(n) holds for n = 1.
(ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) = n
2
+n.
(iii) (Induction step) We must show that P(n+1) = (n+1)
2
+n+1. Indeed,
P(n + 1) = 2 + 4 + + 2n + 2(n + 1)
= P(n) + 2(n + 1)
= n
2
+n + 2n + 2
= n
2
+ 2n + 1 + (n + 1)
= (n + 1)
2
+ (n + 1)
Problem 11.2
Use mathematical induction to prove that
1 + 2 + 2
2
+ + 2
n
= 2
n+1
1
for all integers n 0.
Solution.
Let P(n) = 1 + 2 + 2
2
+ + 2
n
. We will show, by induction on n 0 that
P(n) = 2
n+1
1.
(i) (Basis of induction) P(0) = 1 = 2
0+1
1. That is, P(1)is true.
(ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) = 2
n+1
1.
(iii) (Induction step) We must show that P(n + 1) = 2
n+2
1. Indeed,
P(n + 1) = 1 + 2 + + 2
n
+ 2
n+1
= P(n) + 2
n+1
= 2
n+1
1 + 2
n+1
= 2.2
n+1
1
= 2
n+2
1
41
Problem 11.3
Use mathematical induction to show that
1
2
+ 2
2
+ +n
2
=
n(n + 1)(2n + 1)
6
for all integers n 1.
Solution.
Let P(n) = 1
2
+2
2
+ +n
2
. We will show by mathematical induction that
P(n) =
n(n+1)(2n+1)
6
for all integers n 1.
(i) (Basis of induction) P(1) = 1 =
1(1+1)(2+1)
6
. That is, P(1)is true.
(ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) =
n(n+1)(2n+1)
6
.
(iii) (Induction step) We must show that P(n + 1) =
n(n+1)(2n+1)
6
. Indeed,
P(n + 1) = 1
2
+ 2
2
+ + (n + 1)
2
= P(n) + (n + 1)
2
=
n(n+1)(2n+1)
6
+ (n + 1)
2
=
(n+1)(n+2)(2n+3)
6
Problem 11.4
Use mathematical induction to show that
1
3
+ 2
3
+ +n
3
= (
n(n + 1)
2
)
2
for all integers n 1.
Solution.
Let P(n) = 1
3
+2
3
+ +n
3
. We will show by mathematical induction that
P(n) = (
n(n+1)
2
)
2
for all integers n 1.
(i) (Basis of induction) P(1) = 1 = (
1(1+1)
2
)
2
. That is, P(1)is true.
(ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) = (
n(n+1)
2
)
2
.
(iii) (Induction step) We must show that P(n + 1) = (
(n+1)(n+2)
2
)
2
. Indeed,
P(n + 1) = 1
3
+ 2
3
+ + (n + 1)
3
= P(n) + (n + 1)
3
= (
n(n+1)
2
)
2
+ (n + 1)
3
= (
(n+1)(n+2)
2
)
2
42
Problem 11.5
Use mathematical induction to show that
1
1 2
+
1
2 3
+ +
1
n(n + 1)
=
n
n + 1
for all integers n 1.
Solution.
Let P(n) =
1
12
+
1
23
+ +
1
n(n+1)
. We will show by mathematical induction
that P(n) =
n
n+1
for all integers n 1.
(i) (Basis of induction) P(1) =
1
12
=
1
1+1
. That is, P(1)is true.
(ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) =
n
n+1
.
(iii) (Induction step) We must show that P(n + 1) =
n+1
n+2
. Indeed,
P(n + 1) =
1
12
+
1
23
+ +
1
n(n+1)
+
1
(n+1)(n+2)
= P(n) +
1
(n+1)(n+2)
=
n
n+1
+
1
(n+1)(n+2)
=
n(n+2)+1
(n+1)(n+2)
=
(n+1)
2
(n+1)(n+2)
=
n+1
n+2
Problem 11.6
Use the formula
1 + 2 + +n =
n(n + 1)
2
to nd the value of the sum
3 + 4 + + 1, 000.
Solution.
Indeed,
3 + 4 + + 1, 000 = (1 + 2 + + 1, 000) 3
=
1,000(1,000+1)
2
3
= 500, 497
43
Problem 11.7
Find the value of the geometric sum
1 +
1
2
+
1
2
2
+ +
1
2
n
Solution.
Indeed,
1 +
1
2
+
1
2
2
+ +
1
2
n
=
1(
1
2
)
n+1
1
1
2
= 2
1
2
n
Problem 11.8
Let S(n) =

n
k=1
k
(k+1)!
. Evaluate S(1), S(2), S(3), S(4), and S(5). Make a
conjecture about a formula for this sum for general n, and prove your con-
jecture by mathematical induction.
Solution.
By substitution we nd S(1) =
1
2
, S(2) =
5
6
, S(3) =
23
24
, S(4) =
119
120
, S(5) =
719
720
. We claim that P(n) : S(n) = 1
1
(n+1)!
. We will prove this formula by
induction on n 1.
(i) (Basis of induction) S(1) =
1
12
= 1
1
(1+1)!
. That is, P(1)is true.
(ii) (Induction hypothesis) Assume P(n) is true. That is, S(n) = 1
1
(n+1)!
.
(iii) (Induction step) We must show that P(n + 1) : S(n + 1) = 1
1
(n+2)!
.
Indeed,
n+1

k=1
k
k(k + 1)!
=
n

k=1
k
k(k + 1)!
+
n + 1
(n + 2)!
=1
1
(n + 1)!
+
n + 1
(n + 1)!(n + 2)
=1 (
n + 2 n 1
(n + 2)(n + 1)!
=1
1
(n + 2)!
44
Problem 11.9
For each positive integer n let P(n) be the proposition 4
n
1 is divisible by 3.
a. Write P(1). Is P(1) true?
b. Write P(k).
c. Write P(k + 1).
d. In a proof by mathematical induction that this divisibility property holds
for all integers n 1, what must be shown in the induction step?
Solution.
a. P(1) : 4
1
1 is divisible by 3. P(1) is true.
b. P(k) : 4
k
1 is divisible by 3.
c. P(k + 1) : 4
k+1
1 is divisible by 3.
d. We must show that if 4
k
1 is divisible by 3 then 4
k+1
1 is divisible by
3.
Problem 11.10
For each positive integer n let P(n) be the proposition 2
3n
1 is divisible by
7. Prove this property by mathematical induction.
Solution.
(i) (Basis of induction) P(1) : 2
3
1. P(1)is true since 7 is divisible by 7.
(ii) (Induction hypothesis) Assume P(n) is true. That is, 2
3n
1 is divisible
by 7.
(iii) (Induction step) We must show that P(n+1) is true. That is, 2
3n+3
1
is divisible by 7. Indeed,
2
3n+3
1 = (1 + 7) 2
3n
1
= 2
3n
1 + 7 2
3n
Since 7[(2
3n
1) and 7[7 2
3n
then 7 divides the sum. that is, 7 divides
2
3n+3
1.
Problem 11.11
Show that 2
n
< (n + 2)! for all integers n 0.
Solution.
Let P(n) = (n + 2)! 2
n
. We use mathematical induction to show that
P(n) > 0 for all n 0.
45
(i) (Basis of induction) P(0) = 2! 1 = 1 > 0 so that P(1) is true.
(ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) = (n + 2)!
2
n
> 0.
(iii) (Induction step) We must show that P(n + 1) = (n + 3)! 2
n+1
> 0.
Indeed,
P(n + 1) = (n + 3)! 2
n+1
= (n + 3)(n + 2)! 2
n+1
2(n + 2)! 2 2
n
= 2((n + 2)! 2
n
)
> 0
Problem 11.12
a. Use mathematical induction to show that n
3
> 2n + 1 for all integers
n 2.
b. Use mathematical induction to show that n! > n
2
for all integers n 4.
Solution.
a. Let P(n) = n
3
2n 1. We want to show that P(n) > 0 for all integers
n 2.
(i) (Basis of induction) P(2) = 2
3
4 1 = 3 > 0 so that P(1) is true.
(ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) = n
3
2n
1 > 0.
(iii) (Induction step) We must show that P(n + 1) > 0. Indeed,
P(n + 1) = (n + 1)
3
2(n + 1) 1
= n
3
+ 3n
2
+ 3n + 1 2n 3
= n
3
2n 1 + 3n
2
+ 3n 1
> 3n
2
+ 3n 1
> 0
note that for n 2, 3n
2
+ 3n 1 15
b. Let P(n) = n! n
2
. We want to show that P(n) > 0 for all integers
n 4.
46
(i) (Basis of induction) P(4) = 4! 4
2
= 8 > 0 so that P(1) is true.
(ii) (Induction hypothesis) Assume P(n) is true. That is, P(n) > 0.
(iii) (Induction step) We must show that P(n + 1) > 0. Indeed,
P(n + 1) = (n + 1)! (n + 1)
2
= (n + 1)n! n
2
2n 1
> n! n
2
+nn! 2n 1
> nn! 2n 1
= n(n! 2) 1 > 0
note that for n 4, n! 24 so that n(n! 2) 1 87
Problem 11.13
A sequence a
1
, a
2
, is dened by a
1
= 3 and a
n
= 7a
n1
for n 2. Show
that a
n
= 3 7
n1
for all integers n 1.
Solution.
Listing the rst few terms of the sequence we nd, a
1
= 3 = 3 7
11
, a
2
=
3 7
21
, etc. We will use induction on n 1 to show that the formula for a
n
is valid for all n 1.
(i) (Basis of induction) a
1
= 3 = 3 7
11
so that the formula is true for
n = 1.
(ii) (Induction hypothesis) Assume that a
n
= 3 7
n1
(iii) (Induction step) We must show that a
n+1
= 3 7
n
.
a
n+1
= 7a
n
= 7 3 7
n1
= 3 7
n
.
47
Problem 12.1
Let m and n be two integers.
a. Is 6m+ 8n an even integer?
b. Is 6m+ 4n
2
+ 3 odd?
Solution.
a. Since 6m+ 8n = 2(3m+ 4n) and 3m+ 4n Z we have 6m+ 8n is even.
b. Since 6m+4n
2
+3 = 2(3m+2n
2
+2)+1 = 2k+1 where k = 3m+2n
2
+2,
we have 6m+ 4n
2
+ 3 is odd
Problem 12.2
Prove the following theorem.
Theorem 12.1
Let a ,= 0, b ,= 0, and c be integers. Prove that
(i) If a[b and a[c then a[(b c).
(ii) If a[b then a[bc.
(iii) If a[b and b[c then a[c.
Solution.
(i) If a[b and a[c then there exist integers k
1
and k
2
such that b = k
1
a and
c = k
2
a. In this case, b c = (k
1
k
2
)a. This says that a[(b c).
(ii) If a[b then there is an integer k such that b = ka. Multiply both sides of
this equality by c to obtain bc = (kc)a. Thus, a[bc.
(iii) Suppose that a[b and b[c. Then there exist integers k
1
and k
2
such that
b = k
1
a and c = k
2
b. Thus, c = (k
2
k
1
)a. That is, a[c
Problem 12.3
Let m and n be positive integers with m > n. Is m
2
n
2
composite?
Solution.
If m = 2 and n = 1 then m
2
n
2
= 3 which is prime. Depending on m and
n the number m
2
n
2
can be either prime or composite
Problem 12.4
Write the rst 7 prime numbers.
48
Solution.
The numbers are : 2, 3, 5, 7, 11, 13, 17
Problem 12.5
If a positive number p is composite then one can always write p as the product
of primes, where the prime factors are written in increasing order. This result
is known as the Fundamental Theorem of Arithmetic or the Unique
Factorization Theorem. Write the prime factorization of 180.
Solution.
180 = 2
2
3
2
5.
Problem 12.6
Use the previous theorem to show that the number 101 is prime.
Solution.
The prime numbers less than or equal to

101 are: 2, 3, 5, 7. Since none of


them divided 101, by the previous theorem, 101 is prime.
49
Problem 13.1
(i) Find gcd(120, 500).
(ii) Show that 17 and 22 are relatively prime.
Solution.
(i) Since 120 = 2
3
3 5 and 500 = 2
2
3
0
5
3
gcd(120, 500) = 2
2
3
0
5 = 20.
(ii) Since 17 = 2
0
11
0
17
1
and 22 = 2 11 17
0
, gcd(17, 22) = 2
0
11
0
17
0
= 1.
Hence, 17 and 22 are relatively prime.
Problem 13.2
Find lcm(120, 500).
Solution.
m = lcm(120, 500) = 2
3
3 5
3
= 3000.
Problem 13.3
Recall that a b mod n if and only if a b = kn for some integer k.
(i) Show that if a b mod n and c d mod n then a +c b +d mod n.
(ii) Show that if a b mod n and c d mod n then ac bd mod n.
(iii) What are the solutions of the linear congruences 3x 4(mod7)?
Solution.
(i) If a b mod n and c d mod n then there exist integers k
1
and k
2
such that a b = k
1
n and c d = k
2
n. Adding these equations we nd
(a +c) (b +d) = kn where k = k
1
+k
2
Z. Hence, a +c b +d mod n.
(ii) Using the notation of (i) we he ac bc = k
1
cn and cb bd = k
2
bn.
Adding these equations we nd ac bd = kn where k = k
1
c + k
2
b Z.
Hence, ac bd mod n.
(iii) By (ii) we have 9x 12 mod 7. Since 7x 0 mod 7 then by (i) we have
2x 12 mod 7. This, the given equation, and (i) lead to x 8 mod 7.
Hence, x = 7k 8 where k Z.
Problem 13.4
a. Use the Euclidean algorithm to nd gcd(414, 662).
b. Use the Euclidean algorithm to nd gcd(287, 91).
50
Solution.
a. Using the division algorithm we have
662 = 414 1 + 248
414 = 248 1 + 164
248 = 164 1 + 84
164 = 84 1 + 80
84 = 80 1 + 4
80 = 20 4 + 0
Hence, gcd(414, 662) = 20.
b. Similar to a. we nd gcd(287, 91) = 2.
51
Problem 14.1
Find x
1
, x
2
and x
3
such that
_
_
x
1
+x
2
+ 2x
3
0 1
2 3 2x
1
+ 4x
2
3x
3
4 3x
1
+ 6x
2
5x
3
5
_
_
=
_
_
9 0 1
2 3 1
4 0 5
_
_
Solution.
Because corresponding entries must be equal, this gives the following linear
system
_
_
_
x
1
+ x
2
+ 2x
3
= 9
2x
1
+ 4x
2
3x
3
= 1
3x
1
+ 6x
2
5x
3
= 0
From the rst equation we see that x
1
= 9 x
2
2x
3
. Substituting this into
the second and the third equation we nd
_
2x
2
7x
3
= 17
3x
2
11x
3
= 27
Solving this system by elimination or substitution give x
2
= 2, x
3
= 3. Thus,
x
1
= 1.
Problem 14.2
Solve the following matrix equation for a, b, c, and d
_
a b b +c
3d +c 2a 4d
_
=
_
8 1
7 6
_
Solution.
Equating corresponding entries we get the system
_

_
a b = 8
b + c = 1
c + 3d = 7
2a 4d = 6
The rst two equations give a = 8 + b and c = 1 b. Substituting these
expressions in the last two equations lead to the system
_
b + 3d = 6
b 2d = 5
Solving this system we nd d = 1 and b = 3. Hence, a = 8 + b = 5 and
c = 1 b = 4.
52
Problem 14.3
Consider the matrices
A =
_
2 1
3 4
_
, B =
_
2 1
3 5
_
, C =
_
2 1 0
3 4 0
_
Compute, if possible, A +B, A +C and B +C.
Solution.
We have
A +B =
_
4 2
6 10
_
A + B and B + C are undened since A and B are of dierent sizes as well
as A and C
Problem 14.4
Consider the matrices
A =
_
2 3 4
1 2 1
_
, B =
_
0 2 7
1 3 5
_
Compute A 3B.
Solution.
Using the above denitions we have
A 3B =
_
2 3 17
2 11 14
_
Problem 14.5
Let A be an mn matrix. The transpose of A, denote by A
T
, is the nm
whose columns are the rows of A. Find the transpose of the matrix
A =
_
2 3 4
1 2 1
_
,
Solution.
By the denition of transpose, the transpose of A is the matrix
A
T
=
_
_
2 1
3 2
4 1
_
_
53
Problem 14.6
Consider the matrices
A =
_
1 2 4
2 6 0
_
, B =
_
_
4 1 4 3
0 1 3 1
2 7 5 2
_
_
Compute, if possible, AB and BA.
Solution.
We have
AB =
_
1 2 4
2 6 0
_
_
_
4 1 4 3
0 1 3 1
2 7 5 2
_
_
=
_
4 + 8 1 2 + 28 4 + 6 + 20 3 + 2 + 8
8 2 6 8 + 18 6 + 6
_
=
_
12 27 30 13
8 4 26 12
_
BA is not dened since the number of columns of B is not equal to the
number of rows of A
Problem 14.7
Prove by induction on n 1 that
_
2 1
0 2
_
n
=
_
2
n
n2
n1
0 2
n
_
Solution.
Basis of induction:
_
2 1
0 2
_
1
=
_
2
1
12
11
0 2
1
_
so the result holds for n = 1.
Induction hypothesis: Suppose that
_
2 1
0 2
_
n
=
_
2
n
n2
n1
0 2
n
_
Induction Step: We must show that
_
2 1
0 2
_
n+1
=
_
2
n+1
n + 12
n
0 2
n+1
_
54
Indeed,
_
2 1
0 2
_
n+1
=
_
2 1
0 2
_
n
_
2 1
0 2
_
=
_
2
n
n2
n1
0 2
n
__
2 1
0 2
_
=
_
2
n+1
n + 12
n
0 2
n+1
_
55
Problem 15.1
Which of the following sets are equal?
a. a, b, c, d
b. d, e, a, c
c. d, b, a, c
d. a, a, d, e, c, e
Solution.
a, b, c, d = d, b, a, c and d, e, a, c = a, a, d, e, c, e
Problem 15.2
Let A = c, d, f, g, B = f, j, and C = d, g. Answer each of the following
questions. Give reasons for your answers.
a. Is B A?
b. Is C A?
c. Is C C?
d. Is C is a proper subset of A?
Solution.
a. B is not a subset of A since j B but j , A.
b. C A.
c. C C.
d. C is a proper subset of A since C A and c A but c , C.
Problem 15.3
a. Is 3 1, 2, 3?
b. Is 1 1?
c. Is 2 1, 2?
d. Is 3 1, 2, 3?
e. Is 1 1?
f. Is 2 1, 2, 3?
g. Is 1 1, 2?
h. Is 1 1, 2?
i. Is 1 1, 2?
j. Is 1 1?
Solution.
a. 3 1, 2, 3.
b. 1 , 1.
56
c. 2 1, 2
d. 3 1, 2, 3
e. 1 1
f. 2 1, 2, 3
g. 1 1, 2
h. 1 , 1, 2
i. 1 1, 2
j. 1 1
Problem 15.4
Let A = b, c, d, f, g and B = a, b, c. Find each of the following:
a. A B.
b. A B.
c. A B.
d. B A.
Solution.
a. A B = a, b, c, d, f, g.
b. A B = b, c.
c. A B = d, f, g.
d. B A = a
Problem 15.5
Indicate which of the following relationships are true and which are false:
a. Z
+
Q.
b. R

Q.
c. Q Z.
d. Z
+
Z

= Z.
e. Q R = Q.
f. Q Z = Z.
g. Z
+
R = Z
+
h. Z Q = Q.
Solution.
a. True b. False c. False d. False e. True f.False g.True h. True.
Problem 15.6
Let A = x, y, z, w and B = a, b. List the elements of each of the following
sets:
57
a. A B
b. B A
c. A A
d. B B.
Solution.
a. A B = (x, a), (x, b), (y, a), (y, b), (z, a), (z, b), (w, a), (w, b).
b. B A = (a, x), (b, x), (a, y), (b, y), (a, z), (b, z), (a, w), (b, w).
c. A A = (x, x), (x, y), (x, z), (x, w), (y, x), (y, y), (y, z), (y, w),
(z, x), (z, y), (z, z), (z, w), (w, x), (w, y), (w, z), (w, w).
d. B B = (a, a), (a, b), (b, a), (b, b).
Problem 15.7
Let = x, y be an alphabet.
a. Let L
1
be the language consisting of all strings over that are palindromes
and have length 4. List the elements L
1
.
b. Let L
2
be the language consisting of all strings over that begins with x
and have length 3. List the elements L
2
.
c. Let L
3
be the language consisting of all strings over with length 3
and for which all the x

s appear to the left of all the y

s. List the elements


L
3
.
d. List the elements of
4
, the set of all strings of length 4 over .
e. Let A =
3

4
. Describe A, B, and A B in words.
Solution.
a. L
1
= , x, y, xx, yy, xxx, xyx, yxy, yyy, xxxx, xyyx, yxxy, yyyy.
b. L
2
= , x, xx, xxx, xy, xyy, xyx, xxy.
c. L
3
= , x, y, xx, xy, yy, xxx, xxy, xyy, yyy.
d.
4
= xxxx, xxxy, xxyx, xxyy, xyxx, xyxy, xyyx, xyyy, yxxx, yxxy,
yxyx, yxyy, yyxx, yyxy, yyyx, yyyy.
e. A is the set of all strings over of length 1 or 2. B is the set of all strings
over of length 3 or 4. AB is the set of all strings over of length between
1 and 4.
58
Problem 16.1
Let A, B, and C be sets. Prove that if A B then A C B C.
Solution.
Let x A C. Then x A and x C. Since A B then x B. Thus,
x B and x C so that x B C.
Problem 16.2
Find sets A, B, and C such that A C = B C but A ,= B.
Solution.
Let A = 1, B = 2, and C = 3. Then A C = B C = and A ,= B.
Problem 16.3
Find sets A, B, and C such that A C B C and A C B C but
A ,= B.
Solution.
Let A be a proper subset of a set B and let C = . Then = A C
B C = and A = A C B C. However, A ,= B.
Problem 16.4
Let A and B be two sets. Prove that if A B then B
c
A
c
.
Solution.
Let x B
c
. If x , A
c
then x A. Since A B then x B. That is, x , B
c
.
This contradicts our assumption that x B
c
. Hence, x A
c
.
Problem 16.5
Let A, B, and C be sets. Prove that if A C and B C then A B C.
Solution.
Let x A B. Then either x A or x B. In either case we have x C
since both A and B are subsets of C. This shows that A B C.
Problem 16.6
Let A, B, and C be sets. Show that A (B C) = (A B) (A C).
59
Solution.
We rst show that A(BC) (AB)(AC). Let (x, y) A(BC).
Then x A and y B C. So either y B or y C. Hence, we have either
(x, y) A B or (x, y) A C. Thus, (x, y) (A B) (A C).
Next we show that (AB) (AC) A(BC). Let (x, y) (AB)
(A C). Then either (x, y) A B or (x, y) A C. If (x, y) A B
then x A and y B. This implies that x A and y B C and so
(x, y) A (B C). Similar argument if (x, y) A C.
Problem 16.7
Let A, B, and C be sets. Show that A (B C) = (A B) (A C).
Solution.
Let (x, y) A(BC). Then x A, y B, and y C. Thus, (x, y) AB
and (x, y) A C. It follows that (x, y) (A B) (A C). This shows
that A (B C) (A B) (A C).
Conversely, let (x, y) (AB) (AC). Then (x, y) AB and (x, y)
A C. Thus, x A, y B and y C. That is, (x, y) A (B C).
Problem 16.8
a. Is the number 0 in ? Why?
b. Is = ? Why?
c. Is ? Why?
Solution.
a. The empty set contains no elements. Thus 0 , .
b. The set has one element, namely , whereas contains no elements.
Thus , = .
c. The set has one element, namely . That is, .
Problem 16.9
Let A and B be two sets. Prove that (A B) (A B) = .
Solution.
Suppose not. Then there is an x (A B) (A B). This implies that
x AB, x A, and x B. But x AB implies that x A and x , B.
So we have x B and x , B a contradiction. Hence, (AB) (AB) = .
60
Problem 16.10
Let A and B be two sets. Show that if A B then A B
c
= .
Solution.
Suppose that A B
c
,= . Then there is an x A B
c
. This implies that
x A and x B
c
. Thus, x A and x , B. Since A B and x A then
x B. It follows that x B and x , B which is impossible.
Problem 16.11
Let A, B and C be three sets. Prove that if A B and B C = then
A C = .
Solution.
Suppose the contrary. That is, A C ,= . Then there is an element x A
and x C. Since A B then x B. So we have that x B and x C.
This yields that x B C which contradicts the fact that B C = .
Problem 16.12
Find two sets A and B such that A B = but A B ,= .
Solution.
Let A = 1 and B = 2. Then A B = and A B = (1, 2) , = .
Problem 16.13
Suppose that A = 1, 2 and B = 2, 3. Find each of the following:
a. T(A B).
b. T(A).
c. T(A B).
d. T(A B).
Solution.
a. Since A B = 2 then T(A) = , 2.
b. T(A) = , 1, 2, A.
c. Since A B = 1, 2, 3 then
T(A B) = , 1, 2, 3, 1, 2, 1, 3, 2, 3, 1, 2, 3.
61
d. Since A B = (1, 2), (1, 3), (2, 2), (2, 3) then
T(A B) = , (1, 2), (1, 3), (2, 2), (2, 3), (1, 2), (1, 3),
(1, 2), (2, 2), (1, 2), (2, 3), (1, 3), (2, 2), (1, 3), (2, 3),
(2, 2), (2, 3), (1, 2), (1, 3), (2, 2), (1, 2), (1, 3), (2, 3),
(1, 2), (1, 3), (2, 3), (1, 3), (2, 2), (2, 3), A B
Problem 16.14
a. Find T().
b. Find T(T()).
c. Find T(T(T())).
Solution.
a. T() = .
b. T(T()) = , .
c. T(T(T())) = , , , , .
Problem 16.15
Determine which of the following statements are true and which are false.
Prove each statement that is true and give a counterexample for each state-
ment that is false.
a. T(A B) = T(A) T(B).
b. T(A B) = T(A) T(B).
c. T(A) T(B) T(A B).
d. T(A B) = T(A) T(B).
Solution.
a. Let A = 1, 2 and B = 1, 3. Then A B = 1, 2, 3 and
T(A B) = , 1, 2, 3, 1, 2, 1, 3, 2, 3, 1, 2, 3 whereas
T(A) T(B) = , 1, 2, 1, 2, 3, 1, 3.
b. Let X T(A B). Then X A B and therefore X A and X B.
This implies that X T(A) and X T(B) and hence X is in the intersec-
tion. This completes a proof of T(A B) T(A) T(B).
Conversely, let X T(A) T(B). Then X T(A) and X T(B). Hence,
X A and X B. It follows that X AB and therefore X T(A B).
This ends a proof for T(A) T(B) T(A B).
62
c. Let X T(A) T(B). Then X A and X B. Thus, X A B and
this implies that X T(A B).
d. Let A = 1 and B = 2. Then A B = (1, 2). So we have
T(A B) = , (1, 2)
whereas
T(A) T(B) = (, ), (, 2), (1, ), (1, 2).
63
Problem 17.1
Show that if S is a collection of propositions with nite propositional variables
then (S, , ) is a Boolean algebra.
Solution.
Let p, q, r S. Then (1) p q S and p q S.
(2) p q q p and p q q p.
(3) p (q r) (p q) r and p (q r) (p q) r.
(4) p (q r) (p q) (p r) and p (q r) (p q) (p r).
(5) Let c be a contradiction and t a tautology then p c p and p t p.
(6) If p S then p S is such that p p t and p p c.
Problem 17.2
Show that for a given nonempty set S, (T(S), , ) is a Boolean algebra.
Solution.
Let A, B, C T(S). Then
(1) A B T(S) and A B T(S).
(2) A B = B A and A B = B A.
(3) (A B) C = A (B C) and (A B) C = A (B C).
(4) A(B C) = (AB) (AC) and A(B C) = (AB) (AC).
(5) A = A and A S = A.
(6) A A
c
= S and A A
c
= .
64
Problem 18.1
Let X = a, b, c. Recall that T(X) is the power set of X. Dene a binary
relation 1 on T(X) as follows:
A, B T(x), A 1 B [A[ = [B[.
a. Is a, b1b, c?
b. Is a1a, b?
c. Is c1b?
Solution.
a. a, b1b, c since [a, b[ = [b, c[ = 2.
b. Since 1 = [a[ , = 2 = [a, b[ then a ,1a, b.
c. Since [c[ = [b[ then c1b.
Problem 18.2
Let = a, b. Then
4
is the set of all strings over of length 4. Dene a
relation R on
4
as follows:
s, t
4
, s R t s has the same rst two characters as t.
a. Is abaa R abba?
b. Is aabb R bbaa?
c. Is aaaa R aaab?
Solution.
a. abaa R abba.
b. aabb ,R bbaa.
c. aaaa R aaab.
Problem 18.3
Let A = 4, 5, 6 and B = 5, 6, 7 and dene the binary relations R, S, and
T from A to B as follows:
(x, y) A B, (x, y) R x y.
(x, y) A B, x S y 2[(x y).
T = (4, 7), (6, 5), (6, 7).
a. Draw arrow diagrams for R, S, and T.
b. Indicate whether any of the relations S, R, or T are functions.
65
Solution.
a.
b. R is not a function since (4, y) , R for any y B. S denes a function
since it satises the denition of a function. Finally, T is not a function since
(6, 5) R and (6, 7) R but 5 ,= 7.
Problem 18.4
Let A = 3, 4, 5 and B = 4, 5, 6 and dene the binary relation R as
follows:
(x, y) A B, (x, y) R x < y.
List the elements of the sets R and R
1
.
Solution.
R = (3, 4), (3, 5), (3, 6), (4, 5), (4, 6), (5, 6)
R
1
= (4, 3), (5, 3), (6, 3), (5, 4), (6, 4), (6, 5)
Problem 18.5
Let A = 2, 4 and B = 6, 8, 10 and dene the binary relations R, S, and
66
T from A to B as follows:
(x, y) A B, (x, y) R x[y.
(x, y) A B, x S y y 4 = x.
List the elements of A B, R, S, R S, and R S.
Solution.
A B = (2, 6), (2, 8), (2, 10), (4, 6), (4, 8), (4, 10)
R = (2, 6), (2, 8), (2, 10), (4, 8)
S = (2, 6), (4, 8)
R S = R
R S = S
Problem 18.6
Consider the binary relation on R dened as follows:
x, y R, x R y x y.
Is R reexive? symmetric? transitive?
Solution.
Since x x for any number x R then R is reexive. R is not symmetric
since 2 1 but 1 ,> 2. Finally, R is transitive because if x y and y z
then x z.
Problem 18.7
Consider the binary relation on R dened as follows:
x, y R, x R y xy 0.
Is R reexive? symmetric? transitive?
67
Solution.
Since xx 0 for all x R then R is reexive. If x, y R are such that
xy 0 then yx 0 since multiplication of real numbers is commutative.
Thus, R is symmetric. Finally, R is transitive for if xy 0 then x and y
have the same sign. Similarly, if yz 0 then y and z have the same sign. It
follows that all three numbers x, y, and z have the same sign.
Problem 18.8
Let = 0, 1 and A =

. Consider the binary relation on A dened as


follows:
x, y A, x R y [x[ < [y[,
where [x[ denotes the length of the string x. Is R reexive? symmetric?
transitive?
Solution.
R is not reexive since [x[ = [x[ for x A. Now since [10[ = 2 < 3 = [111[
and [111[ , < [10[ then R is not symmetric. Finally, since < is transitive in R
then it is transitive in A
Problem 18.9
Let A ,= and T(A) be the power set of A. Consider the binary relation on
T(A) dened as follows:
X, Y T(A), X R Y X Y.
Is R reexive? symmetric? transitive?
Solution.
Since every set is a subset of itself then R is reexive. However, R is not
symmetric since it is possible to nd two subsets X and Y of T(A) such that
X Y. Finally, for A B and B C then A C. That is, R is transitive.
Problem 18.10
Let E be the binary relation on Z dened as follows:
a E b m n (mod 2).
Show that E is an equivalence relation on Z and nd the dierent equivalence
classes.
68
Solution.
R is reexive: For all m Z, m m (mod 2) since mm = 2 0.
R is symmetric: If m, n Z are such that m n(mod 2) then there is an
integer k such that m n = 2k. Multiplying this equation by 1 to obtain
n m = 2(k) so that n m (mod 2). That is, n R m.
R is transitive: Let m, n, p Z be such that m n (mod 2) and n
p (mod 2). Then there exist integers k
1
and k
2
such that m n = 2k
1
and
n p = 2k
2
. Add these equalities to obtain mp = 2(k
1
+k
2
) which means
that m p (mod 2).
If x [a] then x = 2k +a so that a is the remainder of the division of x by 2.
Thus the only possible values of a are 0 and 1 and so the equivalence classes
are [0] and [1].
Problem 18.11
Let I be the binary relation on R dened as follows:
a I b a b Z.
Show that I is an equivalence relation on R and nd the dierent equivalence
classes.
Solution.
R is reexive: For all a R we have a I a since a a = 0 Z.
R is symmetric: If a, b R are such that a I b then a b Z. But then
b a = (a b) Z. That is, b I a.
R is transitive: If a, b, c R are such that a I b and b I c then a b Z and
b c Z. Adding to obtain a c Z that is a I c.
For a R, [a] = b R[a = b +n, for some n Z.
Problem 18.12
Let A be the set all straight lines in the cartesian plane. Let [[ be the binary
relation on A dened as follows:
l
1
[[l
2
l
1
is parallel to l
2
.
Show that [[ is an equivalence relation on A and nd the dierent equivalence
classes.
Solution.
[[ is reexive: Any line is parallel to itself.
69
[[ is symmetric: If l
1
is parallel to l
2
then l
2
is parallel to l
1
.
[[ is transitive: If l
1
is parallel to l
2
and l
2
is parallel to l
3
then l
1
is parallel
to l
3
.
If l A then [l] = l

A[l

[[l.
Problem 18.13
Let A = N N. Dene the binary relation R on A as follows:
(a, b) R (c, d) a +d = b +c.
a. Show that R is reexive.
b. Show that R is symmetric.
c. Show that R is transitive.
d. List ve elements in [(1, 1)].
e. List ve elements in [(3, 1)].
f. List ve elements in [(1, 2)].
g. Describe the distinct equivalence classes of R.
Solution.
a. R is reexive since a +a = a +a, i.e. (a, a) R (a, a).
b. R is symmetric: If (a, b) R (c, d) then a + d = b + c which implies that
c +b = d +a. That is, (c, d) R (a, b).
c. R is transitive: Suppose (a, b) R (c, d) and (c, d) R (e, f). Then a+d = b+c
and c + f = d + e. Multiply the rst equation by -1 and add to the second
to obtain a +f = d +e. That is, (a, b) R (e, f).
d. (1, 1), (2, 2), (3, 3), (4, 4), (5, 5) [(1, 1)].
e. (3, 1), (4, 2), (5, 3), (6, 4), (7, 5) [(3, 1)].
f. (0, 1), (1, 2), (2, 3), (3, 4), (4, 5) [(1, 2)].
g. [(a, b)] = (c, d)[d c = b a.
Problem 18.14
Let R be a binary relation on a set A and suppose that R is symmetric and
transitive. Prove the following: If for every x A there is a y A such that
x R y then R is reexive and hence an equivalence relation on A.
Solution.
We must show that x R x for all x A. Let x A. Then there is a y A
such that x R y. Since R is symmetric then y R x. The facts that x R y, y R x
and R transitive imply that x R x.
70
Problem 19.1
Let = a, b and let

be the set of all strings over . Dene the relation


R on

as follows: for all s, t

,
s R t l(s) l(t),
where l(x) denotes the length of the word x. Is R antisymmetric? Prove or
give a counterexample.
Solution.
R is not antisymmetric since aab R baa and baa R aab but aab and baa are
two dierent words.
Problem 19.2
Dene a relation R on Z as follows: for all m, n Z
m R n m+n is even.
Is R a partial order? Prove or give a counterexample.
Solution.
For all m Z we have that m+m is even and so m R m. This shows that R
is reexive. R is not antisymmetric sine 2 R 4 and 4 R 2 but 2 ,= 4. Hence,
R is not a partial order relation
Problem 19.3
Dene a relation R on R as follows: for all m, n R
m R n m
2
n
2
.
Is R a partial order? Prove or give a counterexample.
Solution.
R is not antisymmetric since 2 R (2) and (2) R 2 but 2 ,= 2. Hence, R
is not a partial order relation
Problem 19.4
Let S = 0, 1 and consider the partial order relation R dened on S S as
follows: for all ordered pairs (a, b) and (c, d) in S S
(a, b) R (c, d) a c and b d.
Draw the Hasse diagram for R.
71
Solution.
Problem 19.5
Consider the divides relation dened on the set A = 1, 2, 2
2
, , 2
n
,
where n is a nonnegative integer.
a. Prove that this relation is a total order on A.
b. Draw the Hasse diagram for this relation when n = 3.
Solution.
a. Reexivity: for all 0 i n, we have 2
i
[2
i
.
Antisymmetry: Suppose that 2
i
[2
j
and 2
j
[2
i
. Then i j and j i. Since the
relation is antisymmetric on N we conclude that i = j. That is 2
i
= 2
j
.
Transitivity: Suppose that 2
i
[2
j
and 2
j
[2
k
. Then i j and j k. Since is
transitive on N we conclude that i k. Hence, 2
i
[2
k
.
Now, if 2
i
and 2
j
are element of A then either i j or j i. That is, either
2
i
[2
j
or 2
j
[2
i
. So A is a totally ordered set.
b.
72
Problem 20.1
Let f, g : R R be the functions f(x) = 2x and g(x) =
2x
3
+2x
2
x
2
+1
. Show that
f = g.
Solution.
Since x
2
+ 1 ,= 0 for all x R we have
g(x) =
2x(x
2
+ 1)
x
2
+ 1
= 2x = f(x).
Problem 20.2
Let H, K : R R be the functions H(x) = x| + 1 and K(x) = ,x|. Does
H = K? Explain.
Solution.
H ,= K since H(1) = 0 ,= 1 = K(1).
Problem 20.3
Find functions dened on the set of nonnegative integers that dene the
sequences whose rst six terms are given below.
a. 1,
1
3
,
1
5
,
1
7
,
1
9
,
1
11
.
b. 0, 2, 4, 6, 8, 10.
Solution.
a. f(n) =
(1)
n
2n+1
.
b. f(n) = (1)
n
(2n).
Problem 20.4
Let A = 1, 2, 3, 4, 5 and let F : T(A) Z be dened as follows:
F(X) =
_
0 if X has an even number of elements
1 if X has an odd number of elements
Find the following
a. F(1, 3, 4)
b. F().
c. F(2, 3).
d. F(2, 3, 4, 5).
73
Solution.
a. F(1, 3, 4) = 1
b. F() = 0.
c. F(2, 3) = 0.
d. F(2, 3, 4, 5) = 0.
Problem 20.5
Let = a, b and

be the set of all strings over .


a. Dene f :

Z as follows:
f(s) =
_
the number of b

s to the left of the left most a in s


0 if s contains no a

s
Find f(aba), f(bbab), and f(b). What is the range of f?
b. Dene g :

as follows:
g(s) = the string obtained by writing the characters of s in reverse order.
Find g(aba), g(bbab), and g(b). What is the range of g?
Solution.
a. f(aba) = 0, f(bbab) = 2, f(b) = 0. Range(f) = N.
b. g(aba) = aba, g(bbab) = babb, g(b) = b. Range(g) =

.
Problem 20.6
Let E and D be the encoding and decoding functions.
a. Find E(0110) and D(111111000111).
b. Find E(1010) and D(000000111111).
Solution.
a. E(0110) = 000111111000 and D(111111000111) = 1101.
b. E(1010) = 111000111000 and D(000000111111) = 0011.
Problem 20.7
Let H denote the Hamming distance function on
5
.
a. Find H(10101, 00011).
b. Find H(00110, 10111).
Solution.
a. H(10101, 00011) = 3.
b. H(00110, 10111) = 2.
74
Problem 20.8
Consider the three-place Boolean function f : 0, 1
3
0, 1 dened as
follows:
f(x
1
, x
2
, x
3
) = (3x
1
+x
2
+ 2x
3
) mod 2
a. Find f(1, 1, 1) and f(0, 1, 1).
b. Describe f using an input/output table.
Solution.
a. f(1, 1, 1) = 6 mod 2 = 0 and f(0, 1, 1) = 3 mod 2 = 1.
b.
x
1
x
2
x
3
f(x
1
, x
2
, x
3
)
1 1 1 0
1 1 0 0
1 0 1 1
1 0 0 1
0 1 1 1
0 1 0 1
0 0 1 0
0 0 0 0
Problem 20.9
Draw the graphs of the power functions f1
3
(x) and f1
4
(x) on the same set of
axes. When, 0 < x < 1, which is greater: x
1
3
or x
1
4
? When x > 1, which is
greater s
1
3
or x
1
4
.
Solution.
When 0 < x < 1, x
1
3
< x
1
4
. When x > 1, x
1
3
> x
1
4
.
75
Problem 20.10
Graph the function f(x) = ,x| x| on the interval (, ).
Solution.
Problem 20.11
Graph the function f(x) = x x| on the inerval (, ).
Solution.
Problem 20.12
Graph the function h : N R dened by h(n) =
n
2
|.
Solution.
76
Problem 20.13
Let k : R R be the function dened by the formula k(x) =
x1
x
for all
nonzero real numbers x.
a. Show that k is increasing on (0, ).
b. Is k increasing or decreasing on (, 0)? Prove your answer.
Solution.
a. Note rst that k(x) = 1
1
x
. Suppose that 0 < x
1
< x
2
. Then
1
x
1
<
1
x
2
.
Adding this inequality to the inequality x
1
< x
2
to obtain k(x
1
) < k(x
2
).
This shows that k is increasing on (0, ).
b. Suppose that x
1
< x
2
< 0. Then 0 < x
2
< x
1
and therefore
1
x
1
<
1
x
2
.
Adding this inequality to the inequality x
1
< x
2
to obtain k(x
1
) < k(x
2
).
That is, k is increasing on (, 0).
77
Problem 21.1
a. Dene g : Z Z by g(n) = 3n 2..
(i) Is g one-to-one? Prove or give a counterexample.
(ii) Is g onto? Prove or give a counterexample.
b. Dene G : R R by G(x) = 3x 2. Is G onto? Prove or give a
counterexample.
Solution.
a. (i) Suppose that g(n
1
) = g(n
2
). Then 3n
1
2 = 3n
2
2. This implies
that n
1
= n
2
so that g is one-to-one.
(ii) g is not onto because there is no integer n such that g(n) = 2.
b. Let y R such that G(x) = y. That is, 3x 2 = y. Solving for x we nd
x =
y+2
3
R. Moreover, G(
y+2
3
) = y. So G is onto.
Problem 21.2
Determine whether the function f : R R given by f(x) =
x+1
x
is one-to-one
or not.
Solution.
Suppose that f(x
1
) = f(x
2
). Then
x
1
+1
x
1
=
x
2
+1
x
2
. Cross multiply to obtain
x
1
x
2
+x
1
= x
1
x
2
+x
2
. That is, x
1
= x
2
so that f is one-to-one.
Problem 21.3
Determine whether the function f : R R given by f(x) =
x
x
2
+1
is one-to-
one or not.
Solution.
Suppose that f(x
1
) = f(x
2
). Then
x
1
x
2
1
+1
=
x
2
x
2
2
+1
. Cross multiply to obtain
x
1
x
2
2
+x
1
= x
2
1
x
2
+x
2
. That is, (x
1
x
2
)(x
1
x
2
1) = 0. This is satised for
example for x
1
= 2 and x
1
=
1
2
. Thus, f(2) = f(
1
2
) with 2 ,=
1
2
. Thus, f is
not one-to-one.
Problem 21.4
Let f : R Z be the oor function f(x) = x|.
a. Is f one-to-one? Prove or give a counterexample.
b. Is f onto? Prove or give a counterexample.
Solution.
a. Since f(0.2) = f(0.3) = 0 with 0.2 ,= 0.3, f is not one-to-one.
b. f is onto since for any x Z, x R and f(x) = x.
78
Problem 21.5
Let = 0, 1 and let l :

N denote the length function.


a. Is l one-to-one? Prove or give a counterexample.
b. Is l onto? Prove or give a counterexample.
Solution.
a. l(10) = l(11) but 10 ,= 11 so that l is not one-to-one.
b. Given any nonnegative integer n we can always construct a string of length
n from the alphabet . So l is onto.
Problem 21.6
If : R R and g : R R are one-to-one functions, is f +g also one-to-one?
Justify your answer.
Solution.
The answer is no. Let f(x) = x1 and g(x) = x+1. Then both functions
are one-to-one but f +g = 0 is not one-to-one.
Problem 21.7
Dene F : Ta, b, c N to be the number of elements of a subset of
Ta, b, c.
a. Is F one-to-one? Prove or give a counterexample.
b. Is F onto? Prove or give a counterexample.
Solution.
a. Since F(a) = F(b) = 1 and a , = b, F is not one-to-one.
b. Since Range(F) = 0, 1, 2, 3 , = N, F is not onto.
Problem 21.8
If : R R and g : R R are onto functions, is f + g also onto? Justify
your answer.
Solution.
The answer is no. The functions f, g : Z Z dened by f(n) = n + 2 and
g(n) = n + 3 are both onto but (f + g)(n) = 2n + 5 is not onto since there
is no integer n such that (f +g)(n) = 2.
Problem 21.9
Let = a, b and let l :

N be the length function. Let f : N


0, 1, 2 be the hash function f(n) = n mod 3. Find (fl)(abaa), (fl)(baaab),
and (f l)(aaa).
79
Solution.
(f l)(abaa) = f(l(abaa)) = f(4) = 1.
(f l)(baaab) = f(l(baaab)) = f(5) = 2.
(f l)(aaa) = f(l(aaa)) = f(3) = 0.
Problem 21.10
Show that the function F
1
: R R given by F
1
(y) =
y2
3
is the inverse
of the function F(x) = 3x + 2.
Solution.
We have (F F
1
)(y) = F(F
1
(y)) = F(
y2
3
) = 3(
y2
3
) + 2 = y. This shows
that F F
1
= I
R
. Similarly, (F
1
F)(x) = F
1
(F(x)) = F
1
(3x + 2) =
3x+22
3
= x. Hence, F
1
F = I
R
.
Problem 21.11
If f : X Y and g : Y Z are functions and g f : X Z is one-to-one,
must both f and g be one-to-one? Prove or give a counterexample.
Solution.
Let f : a, b 1, 2, 3 be the function given by f(a) = 2, f(b) = 3.
Then f is one-to-one. Let g : 1, 2, 3 0, 1 be the function given by
g(1) = g(2) = 0 and g(3) = 1. Then g is not one-to-one. However, the
composition function g f : a, b 0, 1 given by (g f)(a) = 0 and
(g f)(b) = 1 is one-to-one.
Problem 21.12
If f : X Y and g : Y Z are functions and g f : X Z is onto, must
both f and g be onto? Prove or give a counterexample.
Solution.
Let f : a, b 1, 2, 3 be the function given by f(a) = 2, f(b) = 3.
Then f is not onto. Let g : 1, 2, 3 0, 1 be the function given by
g(1) = g(2) = 0 and g(3) = 1. Then g is onto. However, the composition
function g f : a, b 0, 1 given by (g f)(a) = 0 and (g f)(b) = 1 is
onto.
Problem 21.13
If f : X Y and g : Y Z are functions and g f : X Z is one-to-one,
must f be one-to-one? Prove or give a counterexample.
80
Solution.
Let x
1
, x
2
X such that f(x
1
) = f(x
2
). Then g(f(x
1
)) = g(f(x
2
)). That
is, (g f)(x
1
) = (g f)(x
2
). Since g f is one-to-one then x
1
= x
2
. This
argument shows that f must be one-to-one.
Problem 21.14
If f : X Y and g : Y Z are functions and g f : X Z is onto, must
g be onto? Prove or give a counterexample.
Solution.
Let z Z. Since g f is onto there is an x X such that (g f)(x) = z.
That is, there is a y = f(x) Y such that g(y) = z. This shows that g is
onto.
Problem 21.15
Let f : W X, g : X Y and h : Y Z be functions. Must h (g f) =
(h g) f? Prove or give a counterexample.
Solution.
Let w W. Then (h (g f))(w) = h((g f)(w)) = h(g(f(w))). Similarly,
((h g) f)(w) = (h g)(f(w)) = h(g(f(w))). It follows that h (g f) =
(h g) f.
Problem 21.16
Let f : X Y and g : Y Z be two bijective functions. Show that (gf)
1
exists and (g f)
1
= f
1
g
1
.
Solution.
By problem ??, g f is bijective. Hence, by Theorem ?? (g f)
1
exists.
Since (f
1
g
1
) (g f) = f
1
(g
1
g) f = f
1
(I
Y
f) = f
1
f = I
X
and similalrly (g f) (f
1
g
1
) = I
Y
then (g f)
1
= f
1
g
1
by the
uniqueness of the inverse function.
81
Problem 22.1
Find the rst four terms of the following recursively dened sequence:
_
v
1
= 1, v
2
= 2
v
n
= v
n1
+v
n2
+ 1, n 3
Solution.
The rst four terms are:
v
1
= 1
v
2
= 2
v
3
= 4
v
4
= 7
Problem 22.2
Prove each of the following for the Fibonacci sequence:
a. F
2
k
F
2
k1
= F
k
F
k+1
F
k+1
F
k1
, k 1.
b. F
2
k+1
F
2
k
F
2
k1
= 2F
k
F
k1
, k 1.
c. F
2
k+1
F
2
k
= F
k1
F
k+2
, k 1.
d. F
n+2
F
n
F
2
n+1
= (1)
n
for all n 0.
Solution.
a. We have
F
2
k
F
2
k1
= (F
k+1
F
k1
)
2
F
2
k1
= F
2
k+1
2F
k+1
F
k1
= F
k+1
(F
k+1
2F
k1
)
= F
k+1
(F
k
+F
k1
2F
k1
)
= F
k+1
(F
k
F
k1
)
= F
k+1
F
k
F
k+1
F
k1
b.
F
2
k+1
F
2
k
F
2
k1
= (F
k
+F
k1
)
2
F
2
k
F
2
k1
= 2F
k
F
k1
c.
F
2
k+1
F
2
k
= (F
k+1
F
k
)(F
k+1
+F
k
)
= (F
k
+F
k1
F
k
)F
k+2
= F
k1
F
k+2
d. The proof is by induction on n 0.
82
Basis of induction: F
2
F
0
F
2
1
= (2)(1) 1 = 1 = (1)
0
.
Induction hypothesis: Suppose that F
n+2
F
n
F
2
n+1
= (1)
n
.
Induction step: We must show that F
n+3
F
n+1
F
2
n+2
= (1)
n+1
. Indeed,
F
n+3
F
n+1
F
2
n+2
= (F
n+2
+F
n+1
)F
n+1
F
2
n+2
= F
n+2
F
n+1
+F
2
n+1
F
2
n+2
= F
n+2
(F
n+1
F
n+2
) +F
2
n+1
= F
n+2
F
n
+F
2
n+1
= (1)
n
= (1)
n+1
Problem 22.3
Find lim
n
F
n+1
Fn
where F
0
, F
1
, F
2
, is the Fibonacci sequence. (Assume
that the limit exists.)
Solution.
Suppose that lim
n
F
n+1
Fn
= L. Since
F
n+1
Fn
> 1 then L 1.
On the other hand, we have
L = lim
n
Fn+F
n1
Fn
= lim
n
(
F
n1
Fn
+ 1)
= lim
n
(
1
Fn
F
n1
+ 1)
=
1
L
+ 1
Multiply both sides by L to obtain
L
2
L 1 = 0.
Solving we nd L =
1

5
2
< 1 and L =
1+

5
2
> 1.
Problem 22.4
Dene x
0
, x
1
, x
2
, as follows:
x
n
=
_
2 +x
n1
, x
0
= 0.
Find lim
n
x
n
.
Solution.
Suppose that L = lim
n
x
n
. Then L =

2 +L. Squaring both sides we


obtain L
2
= L + 2. Solving this equation for L we nd L = 1 and L = 2.
Since L 0 we see that L = 2.
83
Problem 22.5
a. Make a list of all bit strings of lengths zero, one, two, three, and four that
do not contain the pattern 111.
b. For each n 0 let d
n
= the number of bit strings of length n that do not
contain the bit pattern 111. Find d
0
, d
1
, d
2
, d
3
, and d
4
.
c. Find a recurrence relation for d
0
, d
1
, d
2
,
d. Use the results of (b) of (c) to nd the number of bit strings of length ve
that do not contain the pattern 111.
Solution.
a. length 0:
length 1: 0, 1
length 2: 00, 10, 01, 11
length 3: 000, 001, 010, 100, 111, 110, 101
length 4: 0000, 0001, 0010, 0011, 0100, 0101, 0110
1000, 1001, 1010, 1011, 1100, 1101.
b. d
0
= 1, d
1
= 2, d
2
= 4, d
3
= 7, d
4
= 13.
c. Let n 3. Any string of length n that does not contain the pattern 111
either starts with 0 or with 1. If it starts with a 0, this can be followed by
any string of n 1 bits that does not contain the pattern 111. There are
d
n1
of these. If it starts with a 1, then the rst two are either 10 or 11, If
the rst two bits are 10, then these can be followed by any string of n 2
bits that does not contain the pattern 111. There are d
n2
of these. If the
rst two bits is 11, then the third must be 0, and these are followed by n3
bits of 0s and 1s that does not contain 111. There are d
n3
of these. Hence,
d
n
= d
n1
+d
n2
+d
n3
, n 3.
d. d
5
= d
4
+d
3
+d
2
= 24.
Problem 22.6
Find a formula for each of the following sums:
a. 1 + 2 + + (n 1), n 2.
b. 3 + 2 + 4 + 6 + 8 + + 2n, n 1.
c. 3 1 + 3 2 + 3 3 + 3 n, n 1.
Solution.
a. 1 + 2 + + (n 1) =
n(n1)
2
.
b. 3 + 2 + 4 + 6 + 8 + + 2n = 3 + 2(1 + 2 + n) = 3 +n(n + 1).
c. 3 1 + 3 2 + 3 3 + + 3 n =
3n(n+1)
2
.
84
Problem 22.7
Find a formula for each of the following sums:
a. 1 + 2 + 2
2
+ + 2
n1
, n 1.
b. 3
n1
+ 3
n2
+ + 3
2
+ 3 + 1, n 1.
c. 2
n
+ 3 2
n2
+ 3 2
n3
+ + 3 2
2
+ 3 2 + 3, n 1.
d. 2
n
2
n1
+ 2
n2
2
n3
+ + (1)
n1
2 + (1)
n
, n 1.
Solution.
a. 1 + 2 + 2
2
+ + 2
n1
=
2
n
1
21
= 2
n
1.
b. 3
n1
+ 3
n2
+ + 3
2
+ 3 + 1 =
3
n
1
2
.
c. 2
n
+ 3 2
n2
+ 3 2
n3
+ + 3 2
2
+ 3 2 + 3 = 2
n+1
3.
d. 2
n
2
n1
+ 2
n2
2
n3
+ + (1)
n1
2 + (1)
n
= 2
n

n
k=0
(
1
2
)
k
=
2
n+1
3
(1 (
1
2
)
n+1
).
Problem 22.8
Use iteration to guess a formula for the following recusively dened sequence
and then use mathematical induction to prove the validity of your formula:
c
1
= 1, c
n
= 3c
n1
+ 1, for all n 2.
Solution.
Listing the rst ve terms of the sequence we nd:
c
1
= 1
c
2
= 1 + 3
1
c
3
= 1 + 3
1
+ 3
2
c
4
= 1 + 3
1
+ 3
2
+ 3
3
c
5
= 1 + 3
1
+ 3
2
+ 3
3
+ 3
4
Our guess is c
n
= 1+3+3
2
+ +3
n1
=
3
n
1
2
. Next, we prove by induction
the validity of this formula.
Basis of induction: c
1
= 1 =
3
1
1
2
.
Induction hypothesis: Suppose that c
n
=
3
n
1
2
.
Induction step: We must show that c
n+1
=
3
n+1
1
2
. Indeed,
c
n+1
= 3c
n
+ 1
=
3(3
n
1)
2
+ 1
=
3
n+1
3
2
+ 1
=
3
n+1
1
2
85
Problem 22.9
Use iteration to guess a formula for the following recusively dened sequence
and then use mathematical induction to prove the validity of your formula:
w
0
= 1, w
n
= 2
n
w
n1
, for all n 2.
Solution.
Listing the rst ve terms of the sequence we nd:
w
0
= 1
w
1
= 2 1
w
2
= 2
2
2 + 1
w
3
= 2
3
2
2
+ 2 1
w
4
= 2
4
2
3
+ 2
2
2 + 1
Our guess is w
n
=

n
k=0
(1)
k
2
nk
=
2
n+1
(1(
1
2
)
n+1
)
3
. Next, we prove the
validity of this formula by mathematical induction.
Basis of induction: w
0
= 1 =
2
0+1
(1(
1
2
)
0+1
)
3
.
Induction hypothesis: Suppose that w
n
=
2
n+1
(1(
1
2
)
n+1
)
3
.
Induction step: We must show that w
n+1
=
2
n+2
(1(
1
2
)
n+2
)
3
. Indeed,
w
n+1
= 2
n+1
w
n
= 2
n+1

2
n+1
(1(
1
2
)
n+1
)
3
=
2
n+2
(1(
1
2
)
n+2
)
3
Problem 22.10
Determine whether the recursively dened sequence: a
1
= 0 and a
n
= 2a
n1
+
n 1 satises the explicit formula a
n
= (n 1)
2
, n 1.
Solution.
If the given formula is the correcto one then it must satisfy the mathematical
induction argument.
Basis of induction: a
1
= 0(1 1)
2
.
86
Induction hypothesis: Suppose that a
n
= (n 1)
2
.
Induction step: We must then have a
n+1
= n
2
. This implies 2a
n
+n1 = n
2
and by the induction hypothesis we have 2(n1)
2
+n1 = n
2
. Simplifying
to obtain n
2
3n + 1 = 0 and this equation has no integer solutions.
Problem 22.11
Which of the following are second-order homogeneous recurrence relations
with constant coecients?
a. a
n
= 2a
n1
5a
n2
.
b. b
n
= nb
n1
+b
n2
.
c. c
n
= 3c
n1
c
2
n2
.
d. d
n
= 3d
n1
+d
n2
.
e. r
n
= r
n1
r
n2
2.
f. s
n
= 10s
n2
.
Solution.
a. Yes. A = 2 and B = 5.
b. No. A = n depends on n.
c. No. Degree of c
n2
is 2.
d. Yes. A = 3, B = 1.
e. No because of the -2.
f. Yes. A = 0, B = 10.
Problem 22.12
Let a
0
, a
1
, a
2
, be the sequence dened by the explicit formula
a
n
= C 2
n
+D, n 0
where C and D are real numbers.
a. Find C and D so that a
0
= 1 and a
1
= 3. What is a
2
in this case?
b. Find C and D so that a
0
= 0 and a
1
= 2. What is a
2
in this case?
Solution.
a. We have the following system
_
C +D = 1
2C +D = 3
87
Solving this system we nd C = 2 and D = 1. Hence, a
n
= 2
n+1
1. In
particular, a
2
= 7.
b. We have the following system
_
C +D = 0
2C +D = 2
Solving this system we nd C = 2 and D = 2. Hence, a
n
= 2
n+1
2. In
particular, a
2
= 6.
Problem 22.13
Let a
0
, a
1
, a
2
, be the sequence dened by the explicit formula
a
n
= C 2
n
+D, n 0
where C and D are real numbers. Show that for any choice of C and D,
a
n
= 3a
n1
2a
n2
, n 2.
Solution.
Indeed,
3a
n1
2a
n2
= 3(C 2
n1
+D) 2(C 2
n2
+D)
= 3C 2
n1
C 2
n1
+D
= 2C 2
n1
+D
= C 2
n
+D = a
n
Problem 22.14
Let a
0
, a
1
, a
2
, be the sequence dened by the explicit formula
_
a
0
= 1, a
1
= 2
a
n
= 2a
n1
+ 3a
n2
, n 2
Find an explicit formula for the sequence.
Solution.
The roots of the characteristic equation
t
2
2t 3 = 0
88
are t = 1 and t = 3. Thus,
a
n
= C(1)
n
+D3
n
is a solution to
a
n
= 2a
n1
+ 3a
n2
.
Using the values of a
0
and a
1
we obtain the system
_
C +D = 1
C + 3D = 2.
Solving this system to obtain C =
1
4
and D =
3
4
. Hence,
a
n
=
(1)
n
4
+
3
n+1
4
.
Problem 22.15
Let a
0
, a
1
, a
2
, be the sequence dened by the explicit formula
_
a
0
= 1, a
1
= 4
a
n
= 2a
n1
a
n2
, n 2
Find an explicit formula for the sequence.
Solution.
The single root of the characteristic equation
t
2
2t + 1 = 0
is t = 1. Thus,
a
n
= C +Dn
is a solution to
a
n
= 2a
n1
a
n2
.
Using the values of a
0
and a
1
we obtain the system
_
C = 1
C +D = 4.
Solving this system to obtain C = 1 and D = 3. Hence,
a
n
= 3n + 1.
89
Problem 22.16
The triangle inequality for absolute value states that for all real numbers a
and b, [a+b[ [a[+[b[. Use the recursive denition of summation, the triangle
inequality, the denition of absolute value, and mathematical induction to
prove that for all positive integers n, if a
1
, a
2
, , a
n
are real numbers then
[
n

k=1
a
k
[
n

k=1
[a
k
[.
Solution.
The proof is by mathematical induction.
Basis of induction: The formula holds for n = 1. Suppose that a
1
is a real
number. Then
[
1

k=1
a
k
[
1

k=1
[a
k
[.
Induction hypothesis: Suppose that the formula holds up to n, i.e.
[
n

k=1
a
k
[
n

k=1
[a
k
[.
Induction step: We must show that
[
n+1

k=1
a
k
[
n+1

k=1
[a
k
[[.
Indeed,
[

n+1
k=1
a
k
[ = [(

n
k=1
a
k
) +a
n+1
[
[

n
k=1
a
k
[ +[a
n+1
[


n
k=1
[a
k
[ +[a
n
[
=

n+1
k=1
[a
k
[
Problem 22.17
Use the recursive denition of union and intersection to prove the following
general distributive law: For all positive integers n, if A and B
1
, B
2
, , B
n
are sets then
A (
n
k=1
B
k
) =
n
k=1
(A B
k
).
90
Solution.
The proof is by mathematical induction.
Basis of induction: The property holds for n = 1. Let A and B
1
be sets. By
the recursive denition of the union,
1
k=1
B
k
= B
1
and
1
k=1
(AB
k
) = AB
1
.
Hence,
A (
1
k=1
B
k
) =
n
k=1
(A B
k
).
Induction hypothesis: Suppose the property holds up to n, i.e.
A (
n
k=1
B
k
) =
n
k=1
(A B
k
).
Induction step: We must show that
A (
n+1
k=1
B
k
) =
n+1
k=1
(A B
k
).
Indeed,
A (
n
k=1
B
k
) = A [(
n
k=1
B
k
) A
n+1
]
= (A (
n
k=1
B
k
) (A A
n+1
= (
n
k=1
(A B
k
)) (A B
n+1
)
=
n+1
k=1
(A B
k
)
Problem 22.18
Use mathematical induction to prove the following generalized De Morgans
law.
(
n
i=1
A
i
)
c
=
n
i=1
A
c
i
Solution.
The proof is by mathematical induction.
Basis of induction. The formula holds for n = 1 since
(
1
k=1
A
k
)
c
= (A
1
)
c
=
1
k=1
A
c
k
.
Induction hypothesis: Suppose that the formula holds up to n. That is
(
n
k=1
A
k
)
c
=
n
k=1
A
c
k
.
Induction step: We must show that
(
n+1
k=1
A
k
)
c
=
n+1
k=1
A
c
k
.
91
Indeed,
(
n+1
k=1
A
k
)
c
= ((
n
k=1
A
k
) A
n+1
)
c
= (
n
k=1
A
k
)
c
A
c
n+1
= (
n
k=1
A
c
k
) A
c
n+1
=
n+1
k=1
A
c
k
Problem 22.19
Show that the relation F : N Z given by the rule
F(n) =
_
_
_
1 if n = 1.
F(
n
2
) if n is even
1 F(5n 9) if n is odd and n > 1
does not dene a function.
Solution.
If we assume that F is a function then the number F(3) exists. But F(3) =
1 +F(6) = 1 +F(3). This implies that 1 = 0 which is impossible. Hence, F
does not dene a function.
92
Problem 23.1
a. Express the above 4-ary as a set of 4-tuples.
b. Answer the query: PLAYER[Name]
c. Answer the query: PLAYER[Name, Position]
Solution.
a. (22012, Johnsonbaugh, c, 22), (93831, Glover, of, 24), (58199, Battey, p, 18),
(84341, Cage, c, 30), (01180, Homer, 1b, 37), (26710, Score, p, 22),
(61049, Johnsonbaugh, of, 30), (39826, Singleton, 2b, 31).
b. Johnsonbaugh, Glover, Battey, Cage, Homer, Score, Johnsonbaugh, Sin-
gleton.
c. (Johnsonbaugh, c), (Glover, of), (Battey, p), (Cage, c), (Homer, 1b), (Score, p),
(Johnsonbaugh, of), (Singleton, 2b).
Problem 23.2
Let A = 1, 2, 3 and R = (1, 1), (1, 2), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3).
Find M(R) and use it to determine if the relation R is reexive, symmetric
or antisymmetric.
Solution.
M(R) =
_
_
1 1 0
0 1 1
1 1 1
_
_
Since m
11
= m
22
= m
33
= 1, R is reexive. Since m
12
= 1 and m
21
= 0, R is
not symmetric. Since m
23
= m
32
= 1, R is not antisymmetric.
Problem 23.3
What is the encrypted message produced from the message MEET YOU
IN THE PARK?
Solution.
PHHW BRX LQ WKH SDUN.
Problem 23.4
What is the message produced from the encrypted message PHHW BRX LQ
WKH SDUN?
Solution.
MEET ME IN THE PARK
93
Problem 24.1
Consider the set N with the inequality relation . Let B = 2, 4, 5, 6, 7, 8, 9.
What is the least element of B? What is the greatest element of B?
Solution.
The least element is 2 and the greatest element is 9
Problem 24.2
a. Show that (N, ) is well-ordered.
b. Show that (Z, ) is not well-ordered.
Solution.
a. Any subset B of N is of the form B = n
1
, n
2
, . Thus, B has a least
element so that N is well-ordered.
b. If 2Z denotes the set of even integers then 2Z has no least element and
therefore Z is not well-ordered.
Problem 24.3
Consider the poset [N, ]. Let B = 2, 4, 8, 10. Find a lower bound of B as
well as an upper bound.
Solution.
A lower bound of B is 1 and an upper bound of B is 11.
Problem 24.4
Consider the poset [R, ] and B = (1, 1). Find g.l.b(B) and l.u.b(B).
Solution.
l.u.b(B) = 1 and g.l.b(B) = 1.
Problem 24.5
Show that [R, ] is a lattice.
Solution.
For any two real numbers a and b we have l.u.b(a, b) = maxa, b and
g.l.b(a, b) = mina, b.
Problem 24.6
Let A = 2, 3, 4, 9, 12, 18 and R be the binary relation divides on A. Show
that [A, R] is not a lattice.
Solution.
The set 2, 3 has no least elements and therefore no g.l.b so that A is not a
lattice.
94
Problem 25.1
Ten persons have rst names George, William, and Laura and last names
Bush, Perry, and Gramm. Show that at least two persons have the same
rst and last names.
Solution.
The pigeons are the ten persons and a hole is an ordered pair (First Name,
Last Name). Since there are at most nine holes then according to the pi-
geonhole principle there exist at leat two persons with the same rst and last
name.
Problem 25.2
Let S be a nite set and A
1
, A
2
, , A
n
be a partition of S. Use the method
of contradiction to show that there is an index 1 i n such that [A
i
[
|S|
n
.
Solution.
Suppose that [A
i
[ <
|S|
n
for all 1 i n. Since A
1
, A
2
, , A
n
is a partition
of S we have
[S[ = [A
1
[ +[A
2
[ + +[A
n
[
<
|S|
n
+
|S|
n
+ +
|S|
n
= [S[
and this is a contradiction.
Problem 25.3
Let S and T be two nite sets such that [S[ > k[T[ where k is a positive
integer. Show that for any function f : S T there is a t T such that the
set s S : f(s) = t has more than k elements.
Hint: Show that the family A
t
= s S : f(s) = t, where t T, partitions
S into n sets with n [T[. Then apply the previous problem.
Solution.
For each t T the set A
t
is a subset of S. Moreover, if t
1
and t
2
are two
dierent elements of T and s A
t
1
A
t
2
then f(s) = t
1
and f(s) = t
2
and
this contradicts the denition of a function. Hence, A
t
1
A
t
2
= . Finally,
if s S then f(s) = t T so that s A
t
. Hence, S =
tT
A
t
. It follows
that A
t

tT
is a partition of S. By the previous problem, there is a t T
such that[A
t
[
|S|
n
, where n [T[. Since [S[ > k[T[ then [S[ > kn. Thus,
[A
t
[ > k so that A
t
has at least k elements
95
Problem 25.4
If S and T are nite sets such that [S[ > [T[ then any function f : S T is
not one-to-one.
Solution.
Let k = 1 in the previous problem. Then there is a set s S : f(s) = t
with more than one element. Say, s
1
, s
2
are such that f(s
1
) = f(s
2
) = t with
s
1
,= s
2
. But this says that f is not one-to-one.
96
Problem 26.1
Show that the function f : N

N given by f(n) = n 1 is a bijective


function. Thus, N is countably innite.
Solution.
We rst show that f is one-to-one. Suppose that n
1
, n
2
N

are such that


f(n
1
) = f(n
2
). Then n
1
1 = n
2
1. Adding 1 to both sides we nd n
1
= n
2
.
Next, we show that f is onto. Let n N. Then m = n+1 N

and f(m) = n.
That is f is onto.
Problem 26.2
Show that the function f : N

Z dened by
f(n) =
_
n
2
if n is even
1n
2
if n is odd
is bijective. Hence, Z is countably innite.
Solution.
First we show that f is one-to-one. Let n
1
and n
2
be two positive integers
such that f(n
1
) = f(n
2
). If n
1
and n
2
have dierent parity, say for example
n
1
is even and n
2
is odd, then
n
1
2
=
1n
2
2
and this leads to n
1
+ n
2
= 1
which is impossible since n
1
+n
2
2. Thus, either both numbers are even or
both are odd. If both numbers are even then we will have
n
1
2
=
n
2
2
and this
implies n
1
= n
2
. Similar argument holds if both numbers are odd. Hence, f
is one-to-one.
Next we show that f is onto. Let m Z. If m > 0 then 2m N

and
f(2m) = m. If m < 0 then 1 2m N

and f(1 2m) =


11+2m
2
= m.
Finally, if m = 0 then f(1) = 0.
Problem 26.3
Show that the function f : Z 2Z dened by f(n) = 2n is a bijective
function. Hence, the set of even integers is countably innite.
Solution.
f is one-to-one: Suppose that f(n
1
) = f(n
2
). Then 2n
1
= 2n
2
and this
implies that n
1
= n
2
.
f is onto: Let m = 2k 2Z. Then k Z and f(k) = m.
97
Problem 26.4
Show that the set of rational numbers Q is countably innite.
Solution.
Let f : N

Q be the function given by the following picture.


Thus, f is obtained by following the arrows and skipping over repetitions.
Thus, f(1) = 0, f(2) = 1, f(3) =
1
2
, f(4) =
1
2
, f(5) = 1, f(6) = 2, f(7) =

2
3
, etc.
98
Problem 27.1
Consider the nite-state machine dened by the transition diagram
a. What are the elements of S?
b. What are the input symbols?
c. What is the initial state?
d. What are the accepting states?
e. Find N(s
3
, 1) and N(s
3
, 0).
Solution.
a. S = s
0
, s
1
, s
2
, s
3
, s
4
.
b. I = 0, 1.
c. s
0
.
d. s
2
, s
3
.
e. N(s
3
, 1) = s
4
and N(s
3
, 0) = s
3
.
Problem 27.2
Consider the nite-state machine dened by the following transition diagram
99
a. To what states does A go if the symbols of the following words are input
to A in sequence starting from the initial state?
(i) 1101 (ii) 0011 (iii) 0101010.
b. Which of the words in part (a) send A to an accepting state?
c. Show that L(A) = 0(10)
n
: n 0 where (10)
n
= 1010 with n copies
of 10 juxtaposed into one word.
Solution.
a. (i) s
2
, (ii) s
2
, (iii) s
1
.
b. 0101010.
c. The proof is by double inclusion. Let L

= 0(10)
n
: n 0. Let x L

.
Then x = 0(10)
n
for some n 0. 0 goes to s
1
and each 10 goes back to s
1
so
that x L(A). Conversely, let x L(A). Then x = 0y with y a word that
takes A from s
1
to s
1
. If y is nonempty then y must start with 1 and cannot
start with 11, otherwise A would go to the dead end state s
2
. So y = 0y
1
where y
1
is another word taking A from s
1
to s
1
. Now the same reasoning
applies to y
1
.
Problem 27.3
A nite-state machine A, given by the transition diagram below, has transi-
tion function N and eventual-state functioin N

.
100
a. Find N(s
2
, 0) and N(s
1
, 0).
b. Find N

(s
2
, 11010) and N

(s
0
, 01000).
Solution.
a. N(s
2
, 0) = s
3
and N(s
1
, 0) = s
3
.
b. N

(s
2
, 11010) = s
3
since
Similarly, N

(s
0
, 01000) = s
3
.
Problem 27.4
Design a nite-state machine that recognizes words of the form 01, 011, 0111, 01111, .
Solution.
101
102
Problem 28.1
Find the worst case running time of the following segment of an algorithm:
for i := 1 to n
for j := 1 to
i+1
2
|
a := (n i) (n j)
next j
next i
Solution.
There are two subtractions, one multiplication, and one assignment state-
ment for each iteration of the inner loop. If n is even, the number of iterations
of the inner loop is
(1 + 1) + (2 + 2) + + (
n
2
+
n
2
) = 2 (1 + 2 + +
n
2
)
= 2(
n
2
(
n
2
+1)
2
)
=
n
2
4
+
n
2
If n is odd, the number of iterations of the inner loop is
(1 + 1) + (2 + 2) + + (
n1
2
+
n1
2
) +
n+1
2
= 2 (1 + 2 + +
n1
2
) +
n+1
2
= 2(
n1
2
(
n1
2
+1)
2
) +
n+1
2
=
n
2
4
+
n
2
+
1
4
Thus,
T(n) =
_
4(
n
2
4
+
n
2
) if n is even
4(
n
2
4
+
n
2
+
1
4
) if n is odd
Thus, T(n) 4n
2
for n 1 so that C = 4 and n
0
= 1. Hence, T(n) O(n
2
).
Problem 28.2
Find the worst case running time of the following segment of an algorithm:
for i := 1 to n
for j := 1 to 2n
for k := 1 to n
x := i j k
next k
next j
next i
103
Solution.
The number of operations in the most inner loop is 3. The total number of
operations is T(n) = n 2n n 3 = 6n
3
. It follows that C = 6 and n
0
= 1 so
that T(n) O(n
3
).
Problem 28.3
Construct a table showing the result of each step when insertion sort is
applied to the array a[1] = 6, a[2] = 2, a[3] = 1, a[4] = 8, a[5] = 4.
Solution.
a[1] a[2] a[3] a[4] a[5] # of comparisons
initial order 6 2 1 8 4
result of step 1 2 6 1 8 4 1
result of step 2 1 2 6 8 4 1
result of step 3 1 2 6 8 4 3
nal order 1 2 4 6 8 3
Problem 28.4
How many comparisons actually occur when insertion sort is applied to the
array of the previous problem?
Solution.
The total number of comparison is :1 + 1 + 3 + 3 = 8.
Problem 28.5
Selection sort is another algorithm for arranging the elements of a one-
dimensional array a[1], a[2], , a[n] in increasing order. The sorting works
by selecting the smallest item in the list, moving it to the front of the list,
and then nding the smallest of the remaining items and moving it to the
second position in the list, and so on. When two items in the list, say a[k]
and a[m], have to be interchanged, we write switch(a[k], a[m]). The following
is the selection algorithm:
for i := 1 to n 1
min := i
for j := i + 1 to n
104
if a[min] > a[j] then
switch(a[min], a[i])
next j
next i
Construct a table showing the result of each step when selection sort is ap-
plied to the array a[1] = 5, a[2] = 3, a[3] = 4, a[4] = 6, a[5] = 2.
Solution.
a[1] a[2] a[3] a[4] a[5] # of interchanges
initial order 5 3 4 6 2
result of step 1 2 5 4 6 3 2
result of step 2 2 3 5 6 4 2
result of step 3 2 3 4 6 5 1
nal order 2 3 4 5 6 1
Problem 28.6
How many comparisons actually occur when selection sort is applied to the
array of the previous problem?
Solution.
From the chart above we see that the total number of camparisons is 6
Problem 28.7
Show that

n| O(

n).
Solution.
Since

n|

n we have C = 1 and n
0
= 1 so that

n| O(

n).
Problem 28.8
Show that
1
2
+ 2
2
+ +n
2
O(n
3
).
Solution.
We have for n 1 that
1
2
+ 2
2
+ +n
2
=
n(n + 1)(2n + 1)
6
=
n
3
3
+
n
2
2
+
n
6
.
105
Letting C = 1 and n
0
= 1 then
1
2
+ 2
2
+ +n
2
O(n
3
).
Problem 28.9
Show that
1
3
+ 2
3
+ +n
3
O(n
4
).
Solution.
For n 1 we have that
1
3
+ 2
3
+ +n
3
=
n
2
(n + 1)
2
4
n
4
.
Letting C = 1 and n
0
= 1 then
1
3
+ 2
3
+ +n
3
O(n
4
).
Problem 28.10
a. Use mathematical induction to show that
1
1
3
+ 2
1
3
+ +n
1
3
n
4
3
for all n 1.
b. What can you conclude from part (a) about the order of the above sum?
Solution.
(a) Basis of induction: The formula holds for n = 1 since 1
1
3
= 1
4
3
.
Induction hypothesis: Suppose that
1
1
3
+ 2
1
3
+ +n
1
3
n
4
3
Induction step: We must show that
1
1
3
+ 2
1
3
+ + (n + 1)
1
3
(n + 1)
4
3
Indeed,
1
1
3
+ 2
1
3
+ + (n + 1)
1
3
= 1
1
3
+ 2
1
3
+ +n
1
3
+ (n + 1)
1
3
n
4
3
+ (n + 1)
1
3
106
We will show that n
4
3
+ (n + 1)
1
3
(n + 1)
4
3
. Indeed, since
n+1
n
> 1 we have
n
1
3
< (n +1)
1
3
and this implies that n
4
3
< n(n +1)
1
3
= (n +1 1)(n +1)
1
3
=
(n + 1)
4
3
(n + 1)
1
3
. Hence,
n
4
3
+ (n + 1)
1
3
(n + 1)
4
3
.
It follows that
1
1
3
+ 2
1
3
+ +n
1
3
n
4
3
for all n 1.
b. Letting n
0
= 1 and C = 1 we see that
1
1
3
+ 2
1
3
+ +n
1
3
O(n
4
3
)
107
Problem 29.1
Show that 1 + 2 + 2
2
+ + 2
n
O(2
n+1
).
Solution.
This is a geometric sequence whose sum is given by
1 + 2 + 2
2
+ + 2
n
= 2
n+1
1 < 2
n+1
, n 1.
Hence, 1 + 2 + 2
2
+ + 2
n
O(2
n+1
).
Problem 29.2
Show that
2n
3
+
2n
3
2
+
2n
3
3
+ +
2n
3
n
O(n).
Solution.
Indeed, we have the following
2n
3
+
2n
3
2
+
2n
3
3
+ +
2n
3
n
= 2n(
1
3
+
1
3
2
+
1
3
3
+ +
1
3
n
)
= 2n
1(
1
3
)
n+1
1
1
3
= 3n(1 (
1
3
)
n+1
)
< 3n
for n 1. This says that
2n
3
+
2n
3
2
+
2n
3
3
+ +
2n
3
n
O(n).
Problem 29.3
Show that n
2
+ 2n O(2
n
).
Solution.
Using LHopitals rule twice we nd
lim
x
x
2
2
x
= lim
x
2x
2
x
ln 2
= lim
x
2
2
x
(ln 2)
2
= 0
Thus, there is a positive integer k such that for n k, n
2
< 2
n
. Thus, for
n k we have n
2
+ 2
n
< 2 2
n
. That is, n
2
+ 2
n
O(2
n
).
108
Problem 29.4
a. Show that
1
2
+
1
3
+ +
1
n
ln n, n 2.
b. Use part a. to show that for n 3
1 +
1
2
+ +
1
n
ln n.
c. Use b. to show that n +
n
2
+
n
3
+ +
n
n
O(nln n).
Solution.
a. Consider the graph of the function f(x) =
1
x
on the interval [1, n]. Divides
this interval into n equal subintervals by means of the partition points x
i
=
1+
i(n1)
n
where 0 i n. On each interval [x
i
, x
i+1
] the area of the rectangle
with sides [x
i
, x
i+1
] and [f(x
i
), f(x
i+1
)] is f(x
i+1
). Thus, using integration we
see that
1
2
+
1
3
+ +
1
n
<
_
n
1
1
x
dx = ln n.
b. Since for n 3, ln n 1, using part a. we see that
1 +
1
2
+
1
3
+ +
1
n
< 1 + ln n
2 ln n
This shows that
1 +
1
2
+
1
3
+ +
1
n
O(ln n).
c. From part b. we have for n 3,
n +
n
2
+
n
3
+ +
n
n
= n(1 +
1
2
+
1
3
+ +
1
n
)
< nln n
This shows that
n +
n
2
+
n
3
+ +
n
n
O(nln n).
Problem 29.5
Show that 2
n
O(n!).
Solution.
We prove by mathematical induction on n 4 that 2
n
n!.
109
Basis of induction: For n = 4, 2
4
= 16 < 24 = 4!.
Induction hypothesis: Suppose that 2
n
< n!
Induction step: We must show that 2
n+1
< (n + 1)!. Indeed, for n 4
2
n+1
= 2 2
n
< (n + 1) 2
n
< (n + 1)n! = (n + 1)!
Thus, we have shown that for n 4, 2
n
< n!. This shows that 2
n
O(n!).
110
Problem 31.1
(a) How many ways can we get a sum of 4 or a sum of 8 when two distin-
guishable dice are rolled?
(b) How many ways can we get a sum of 8 when two undistinguishable dice
are rolled?
Solution.
(a) Let S
4
= sum of 4 and S
8
= sum of 8. Then
S
4
= (1, 3), (3, 1), (2, 2)
S
8
= (2, 6), (6, 2), (3, 5), (5, 3), (4, 4)
Thus, [S
4
S
8
[ = [S
4
[ +[S
8
[ [S
4
S
8
[ = 8.
(b) S
8
= 2, 6), (3, 5), (4, 4) so that there are 3 dierent ways.
Problem 31.2
(a) How many 4-digit numbers can be formed using the digits, 1, 2, , 9
(with repetitions)? How many can be formed if no digit can be repeated?
(b) How many dierent license plates are there that involve 1, 2, or 3 letters
followed by 4 digits (with repetitions)?
Solution.
(a) With repetitions, there are 9 9 9 9 numbers. Without repetitions,
there are 9 8 7 6 dierent numbers.
(b) By the multiplication rule there are
26(10)
4
+ (26)
2
(10)
4
+ (26)
3
(10)
4
dierent plates.
Problem 31.3
a. In how many ways can 4 cards be drawn, with replacement, from a deck
of 52 cards?
b. In how many ways can 4 cards be drawn, without replacement, from a
deck of 52 cards?
Solution.
a. By the multiplication rule there are 52
4
possible combinations.
b. Again by the multiplication rule there are 52515049 possible ways.
111
Problem 31.4
In how many ways can 7 women and 3 men be arranged in a row if the three
men must always stand next to each other.
Solution.
P(3, 3) P(8, 8) = 3!8!
Problem 31.5
A menu in a Chinese restaurant allows you to order exactly two of eight
main dishes as part of the dinner special. How many dierent combinations
of main dishes could you order?
Solution.
There are C(8, 2) combinations of the eight main dishes taken two at a time.
Thus, you could choose one of
C(8, 2) =
8!
2!6!
= 28
dierent combinations.
Problem 31.6
Find the coecient of a
5
b
7
in the binomial expansion of (1 2b)
12
.
Solution.
The coecient is (2)
7
C(12, 7) = 101, 376.
Problem 31.7
Use the binomial theorem to prove that
3
n
=
n

k=0
2
k
C(n, k).
Solution.
The identity follows from the binomial theorem with x = 1 and y = 2.
112
Problem 32.1
What is the probability of drawing a red card from a well- shued deck of
52 playing cards?
Solution.
The probability is
13
52
=
1
4
.
Problem 32.2
If we roll a fair die, what are the probabilities of getting
(a) a 1 or a 6;
(b) an even number?
Solution.
(a)
2
6
=
1
3
.
(b)
3
6
=
1
2
.
Problem 32.3
A department stores records show that 782 of 920 women who entered the
store on a saturday afternoon made at least one purchase. Estimate the
probability that a woman who enters the store on a Saturday afternoon will
make at least one purchase.
Solution.
782
920
=
391
460
.
Problem 32.4
Which of the following are mutually exclusive? Explain your answers.
(a) A driver getting a ticket for speeding and a ticket for going through
a red light.
(b) Being foreign-born and being President of the United States.
Solution.
(a) The events are not mutually exclusive since a person can get a ticket for
both speeding and going through a red light.
(b) The events are mutually exclusive since the president of the United States
cannot be a foreign born person.
113
Problem 32.5
If A and B are the events that a consumer testing service will rate a given
stereo system very good or good, P(A) = 0.22, P(B) = 0.35. Find
(a) P(A
c
);
(b) P(A B);
(c) P(A B).
Solution.
(a) P(A
c
) = 1 P(A) = 1 .22 = .78 = 78%
(b) P(A B) = P(A) +P(B) = .22 +.35 = .57 = 57%
(c) P(A B) = 0.
Problem 32.6
If the probabilities are 0.20, 0.15, and 0.03 that a student will get a failing
grade in Statistics, in English, or in both, what is the probability that the
student will get a failing grade in at least one of these subjects?
Solution.
P(failing grade in Stat or in English) = P(failing grade in Stat) + P(failing
grade in English) - P(failing grade in stat and English) = .20 + .15 .03 =
.32 = 32%
Problem 32.7
If the probability that a research project will be well planned is 0.60 and the
probability that it will be well planned and well executed is 0.54, what is the
probability that a well planned research project will be well executed?
Solution.
Let A = research project well planned, B = research project executed. Then
P(B[A) =
P(A B)
P(A)
=
.54
.60
= .9 = 9%
Problem 32.8
Given three events A, B, and C such that P(A)=0.50, P(B)=0.30, and P(A
B) = 0.15. Show that the events A and B are independent.
114
Solution.
Indeed,
P(A[B) =
P(A B)
P(B)
=
.15
.30
= .5 = P(A).
So A and B are independent.
Problem 32.9
There are 16 equally likely outcomes by ipping four coins. Let f represent
the number of heads. Find the probability distribution.
Solution.
P(f = 0) = P((T, T, T, T) =
1
16
,
P(f = 1) = P((H, T, T, T), (T, H, T, T), (T, T, H, T), (T, T, T, H) =
4
16
,
P(f = 2) = P((H, H, T, T), (H, T, H, T), (H, T, T, H), (T, H, H, T), (T, H, T, H), (T, T, H, H) =
6
16
,
P(f = 3) = P((H, H, H, T), (H, T, H, H), (T, H, H, H), (H, H, T, H) =
4
16
,
P(f = 4) = P((H, H, H, H) =
1
16
.
115
Problem 33.1
At Community Hospital, the nursing sta is large enough so that 80% of the
time a nurse can respond to a room call within 3 minutes. Last night there
were 73 room calls. We wish to nd the probability nurses responded to 62
of them within 3 minutes.
(a) What makes a trial?
(b) What is a success? a failure?
(c) What are the values of n, p, q, r?
Solution.
(a) A trial is a room call.
(b) S = response to a call within 3 minutes, F = response to a call in more
than 3 minutes.
(c) n = 73, p = .8, q = .2, r = 62.
Problem 33.2
Find the probability that in a family of 4 children there will be (a) at least 1
boy and (b) at least 1 boy and 1 girl. Assume that the probability of a male
birth is
1
2
.
Solution.
(a) P(r 1) = P(1) +P(2) +P(3) +P(4) = 1 P(no boy) = 1 (.5)
4
=
15
16
.
(b) 1 P(no boy) P(no girl) = 1
1
16

1
16
=
7
8
.
Problem 33.3
An insurance salesperson sells policies to 5 men, all of identical age and in
good health. According to the actuarial tables, the probability that a man
of this particular age will be alive 30 years is
2
3
. Find the probability that in
30 years (a) all 5 men, (b) at least 3 men, (c) only 2 men, (d) none will be
alive.
Solution.
(a) P(r = 5) = C(5, 5)(
2
3
)
5
.
(b) P(r 3) = P(3) +P(4) +P(5).
(c) P(r = 2) = C(5, 2)(
2
3
)
2
(
1
3
)
3
.
(d) P(r = 0) = C(5, 0)(
1
3
)
5
.
116
Problem 34.1
The union of two graphs G
1
= (V
1
, E
1
) and G
2
= (V
2
, E
2
) is the graph
G
1
G
2
= (V
1
V
2
, E
1
E
2
). The intersection of two graphs G
1
= (V
1
, E
1
)
and G
2
= (V
2
, E
2
) is the graph G
1
G
2
= (V
1
V
2
, E
1
E
2
).
Find the union and the intersection of the graphs
Solution.
117
Problem 34.2
Graphs can be represented using matrices. The adjacency matrix of a graph
G with n vertices is an nn matrix A
G
such that each entry a
ij
is the number
of edges connecting v
i
and v
j
. Thus, a
ij
= 0 if there is no edge from v
i
to v
j
.
a. Draw a graph with the adjacency matrix
_

_
0 1 1 0
1 0 0 1
1 0 0 1
0 1 1 0
_

_
b. Use an adjacency matrix to represent the graph
Solution.
a.
118
b.
_

_
0 2 0 2
2 0 2 1
0 2 0 1
2 1 1 0
_

_
Problem 34.3
A graph H = (V
H
, E
H
) is a subgraph of G = (V
G
, E
G
) if and only if V
H
V
G
and E
H
E
G
.
Find all nonempty subgraphs of the graph
Solution.
119
Problem 34.4
Find the in-degree and out-degree of each of the vertices in the graph G with
directed edges.
Solution.
vertex in degree out degree
v
1
3 3
v
2
2 4
v
3
2 0
v
4
2 2
v
5
1 1
Problem 34.5
Show that for a digraph G = (V
G
, E
G
) we have
[E
G
[ =

vV (G)
deg

(v) =

vV (G)
deg
+
(v).
Solution.
Each edge contributes 1 to the indegree of one vertex, so contributes 1 to the
sum

vV
G
deg

(v). Thus, the sum

vV
G
deg

(v) is just the total number


of edges. Similarly for the outdegrees
120
Problem 34.6
Find the incidence matrix of the graph
Solution.
_

_
e
1
e
2
e
3
e
4
e
5
e
6
v
1
1 0 0 0 0 0
v
2
0 1 1 0 0 0
v
3
0 1 1 1 0 0
v
4
1 0 0 1 2 0
v
5
0 0 0 0 0 0
v
6
0 0 0 0 0 1
v
7
0 0 0 0 0 1
_

_
Problem 34.7
If each vertex of an undirected graph has degree k then the graph is called a
regular graph of degree k.
How many edges are there in a graph with 10 vertices each of degree 6?
Solution.
Since 2[E
G
[ = 60, [E
G
[ = 30. So the graph has 30 edges.
Problem 34.8
Two simple graphs G
1
and G
2
are isomorphic, in symbol, G
1
G
2
, if there
is one-to-one onto function, f : V (G
1
) V (G
2
) such that (u, v) E
G
1
if and
121
only if (f(u), f(v)) E
G
2
. Show that the following graphs are isomorphic.
Solution.
Let f : V
G
1
V
G
2
be dened as follows: f(v
1
) = u
1
, f(v
2
) = u
4
.f(v
3
) = u
3
,
and f(v
4
) = u
2
. It is easy to see that f is a bijection function. On the other
hand, the following table shows the correspondence between edges.
(u, v) (f(u), f(v))
(v
1
, v
2
) (u
1
, u
4
)
(v
1
, v
3
) (u
1
, u
3
)
(v
3
, v
4
) (u
3
, u
2
)
(v
2
, v
4
) (u
2
, u
4
)
Problem 34.9
Show that the following graphs are not isomorphic.
122
Solution.
An isomorphism between two graphs has the property that it preserves the
degrees of the vetices. The degree of each vertex of the rst vertex is at least
2 whereas deg(u
1
) = 1. Thus, the two graphs cannot be isomorphic
Problem 34.10
Show that the following graph has no Hamiltonian path.
Solution.
There is no path that visits every vertex of the graph exactly once
123
Problem 35.1
Find the level of each vertex and the height of the following rooted tree.
Solution.
The root is a.
vertex level
b 1
c 2
d 2
e 3
f 4
g 3
h 1
i 2
j 2
k 2
The height of the tree is 4.
Problem 35.2
Consider the rooted tree
124
a. Find the parent of v
6
.
b. Find the ancestors of v
10
.
c. Find the children of v
4
.
d. Find the descendants of v
1
.
e. Find all the siblings.
f. Find the leaves.
g. Construct the subtree rooted at v
1
.
Solution.
a. v
3
.
b. v
0
, v
3
, v
5
.
c. v
7
, v
8
, v
9
.
d. v
4
, v
7
, v
8
, v
9
.
e. v
1
, v
2
, v
3
, v
5
, v
6
, v
7
, v
8
, v
9
.
f. v
2
, v
6
, v
7
, v
8
, v
9
, v
10
.
g.
125
Problem 35.3
The binary tree below gives an algorithm for choosing a restaurant. Each
internal vertex asks a question. If we begin at the root, answer each ques-
tion, and follow the appropriate edge, we will eventually arrive at a terminal
vertex that chooses a restaurant. Such a tree is called a decision tree.
Construct a decision tree that sorts three given numbers a
1
, a
2
, a
3
in as-
cending order.
Solution.
Problem 35.4
126
A binary search tree is a binary tree T in which data are associated with
the vertices. The data are arranged so that, for each vertex v in T, each data
item in the left subtree of v is less than the data item in v and each data item
in the right subtree of v is greater than the data item in v. Using numerical
order, form a binary search tree for a number in the set 1, 2, , 15.
Solution.
Given a number between 1 and 15, it is rst compared with 8; if it is less
than 8, proceed to key 4; if it greater than 8, proceed to key 12; if it is equal
to 8 the search is over. One proceeds down the tree in this manner until the
number is found
Problem 35.5
Procedures for systematically visiting every vertex of a tree are called traver-
sal algorithms. In the preorder traversal, the root r is listed rst and
then the subtrees T
1
, T
2
, , T
n
are listed, from left to right, in order of their
roots. The preorder traversal begins by visiting r. It continues by travers-
ing T
1
in preorder, thenT
2
in preorder, and so on, until T
n
is traversed in
preorder. In which order does a preorder traversal visit the vertices in the
127
following rooted tree?
Let T
s
, T
v
, and T
w
be the trees rooted at s, v, and w respectively. Applying
the preorder traversal algorithm we obtain the following listings:
T
w
: w, x, y, z.
T
v
: v, u, T
w
or v, u, w, x, y, z.
T
s
: s, p, q.
T : r, T
v
, T
s
or r, v, u, w, x, y, z, s, p, q.

Você também pode gostar