281
McGILL UNIVERSITY FACULTY OF SCIENCE DEPARTMENT OF MATHEMATICS AND STATISTICS MATHEMATICS 189–240A DISCRETE STRUCTURES AND COMPUTING Notes Distributed to Students (Fall Term, 2000/2001) W. G. Brown September 19, 2000

Notes Distributed to Students in Mathematics 189-240A (1999/2000)

  • Upload
    letu

  • View
    222

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

McGILL UNIVERSITY

FACULTY OF SCIENCE

DEPARTMENT OFMATHEMATICS AND STATISTICS

MATHEMATICS 189–240A

DISCRETE STRUCTURES ANDCOMPUTING

Notes Distributed to Students(Fall Term, 2000/2001)

W. G. Brown

September 19, 2000

Page 2: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) i

(Items marked ‡ not distributed in hardcopy)

Contents

1 General Information 11.1 Instructor, Tutors, and Times . 11.2 Calendar Description . . . . . . 11.3 Class Quiz . . . . . . . . . . . . 11.4 Term Test . . . . . . . . . . . . 11.5 Homework . . . . . . . . . . . . 21.6 Term Mark . . . . . . . . . . . 21.7 Calculators . . . . . . . . . . . 31.8 Final Grade . . . . . . . . . . . 31.9 Text-Book . . . . . . . . . . . . 31.10 Tutorials . . . . . . . . . . . . . 31.11 Homework Grader . . . . . . . 31.12 Supplementary Materials . . . 3

1.12.1 Printed Notes . . . . . . 31.12.2 Notes and Examinations

from Previous Years . . 41.13 Examination information . . . 4

2 Timetable 5

3 Syllabus 73.1 Chapter 1. The Foundations:

Logic, Sets, and Functions . . . 73.2 Chapter 2. The Fundamentals:

Algorithms, the Integers, and Ma-trices . . . . . . . . . . . . . . . 8

3.3 Chapter 6. Relations (first part) 8

4 First Problem Assignment 9

5 Class Quiz 14

6 Solutions to Problems on the ClassQuiz 17

7 Second Problem Assignment 21

8 References 901

A Problems on Term Tests of Previ-ous Years ‡ 1001A.1 1991 Term Test . . . . . . . . . 1001

A.1.1 First Version . . . . . . 1001A.1.2 Second Version . . . . . 1002

A.2 1994 Term Test . . . . . . . . . 1003A.2.1 First Version . . . . . . 1003A.2.2 Second Version . . . . . 1003

A.3 1995 Term Test . . . . . . . . . 1004A.3.1 First Version . . . . . . 1004A.3.2 Second Version . . . . . 1004A.3.3 Third Version . . . . . . 1005A.3.4 Fourth Version . . . . . 1005

A.4 1996 Term Test . . . . . . . . . 1006A.5 1997 Term Test . . . . . . . . . 1013A.6 1998 Term Test . . . . . . . . . 1020

A.6.1 Problems on the count-ing of relations . . . . . 1020

A.6.2 Solution of linear homo-geneous recurrences withconstant coefficients . . 1022

A.6.3 Use of ordinary generat-ing functions to count or-dered additive partitionsof integers . . . . . . . . 1024

A.6.4 Logic and induction . . 1027A.6.5 Prove or disprove . . . . 1030

A.7 Solutions to Problems on the 1999Class Tests . . . . . . . . . . . 1032A.7.1 Proving or disproving the

validity of a rule of infer-ence . . . . . . . . . . . 1033

A.7.2 Injective and surjectivefunctions . . . . . . . . 1035

A.7.3 Particular solutions of in-homogeneous recurrences 1037

A.7.4 Pigeonhole principle . . 1041A.7.5 Permutations . . . . . . 1042A.7.6 Ordered partitions of an

integer . . . . . . . . . . 1045

Page 3: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) ii

B Problems on 1995 — 1999 exami-nations ‡ 1048B.1 1995 Final Examination . . . . 1048B.2 1995 Supplemental/Deferred Ex-

amination . . . . . . . . . . . . 1049B.3 1996 Final Examination . . . . 1051B.4 1997 Final Examination . . . . 1052B.5 1997 Supplemental/Deferred Ex-

amination . . . . . . . . . . . . 1054B.6 1998 Final Examination . . . . 1055B.7 1998 Supplemental/Deferred Ex-

amination . . . . . . . . . . . . 1058B.8 1999 Final Examination . . . . 1059B.9 1999 Supplemental/Deferred Ex-

amination . . . . . . . . . . . . 1061

C Solutions to 1996 Assignment Prob-lems ‡ 1064C.1 Solved Problems from the First

1996 Problem Assignment . . . 1064C.2 Solved Problems from the Sec-

ond 1996 Problem Assignment 1069C.3 Solved Problems from the Third

1996 Problem Assignment . . . 1077C.4 Solved Problems from the Fourth

1996 Problem Assignment . . . 1088C.5 Solved Problems from the Fifth

1996 Problem Assignment . . . 1097

D Solutions to 1997 Assignment Prob-lems ‡ 1104D.1 Solved Problems from the First

1997 Problem Assignment . . . 1104D.2 Solved Problems from the Sec-

ond 1997 Problem Assignment 1112D.3 Solved Problems from the Third

1997 Problem Assignment . . . 1121D.4 Solved Problems from the Fourth

1997 Problem Assignment . . . 1129D.5 Solved Problems from the Fifth

1997 Problem Assignment . . . 1137

E Solutions to 1998 Assignment Prob-lems ‡ 1146E.1 Solved Problems from the First

1998 Problem Assignment . . . 1146E.2 Solved Problems from the Sec-

ond 1998 Problem Assignment 1152E.3 Solved Problems from the Third

1998 Problem Assignment . . . 1161E.4 Solved Problems from the Fourth

1998 Problem Assignment . . . 1172E.5 Solved Problems from the Fifth

1998 Problem Assignment . . . 1179

F Solutions to 1999 Assignment Prob-lems ‡ 1183F.1 First 1999 Problem Assignment,

with Solutions . . . . . . . . . . 1183F.2 Second 1999 Problem Assignment,

with Solutions . . . . . . . . . . 1194F.3 Third 1999 Problem Assignment,

with Solutions . . . . . . . . . . 1203F.4 Fourth 1999 Problem Assignment,

with Solutions . . . . . . . . . . 1211F.5 Fifth 1999 Problem Assignment,

with Solutions . . . . . . . . . . 1224

G Solved Combinatorial Problems‡1232G.1 Counting words formed from a

given population of letters, notnecessarily all different . . . . . 1232

G.2 Problems on inclusion-exclusion 1239G.3 A combinatorial identity . . . . 1241G.4 Lattice paths . . . . . . . . . . 1242G.5 Partitions of labelled objects into

labelled boxes . . . . . . . . . . 1243G.6 Circular permutations . . . . . 1245G.7 Counting ordered partitions of

a positive integer . . . . . . . . 1246G.8 Counting vertex-labelled graphs 1250

Page 4: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1

1 General Information

Distribution Date: Wednesday, September 6th, 2000(all information is subject to change)

1.1 Instructor, Tutors, and Times

INSTRUCTOR TUTORS

Professor W. G. Brown I. Dechene L. Dembele

OFFICE: BURN 1224 BURN 1017 BURN 1029OFFICE HOURS W 14:30→15:20; Th 114:00→16:00(subject to change): F 10:00→11:00

or by appointment

OFFICE PHONE: 398–3836

E-MAIL: BROWN DECHENE [email protected] @MATH.MCGILL.CA @MATH.MCGILL.CA

CLASSROOM: MAASS 112 ARTS W-120 ENGMC 122CLASS HOURS: MWF 15:30–16:30 W 16:30–18:00 T 14:30–16:00

1.2 Calendar Description

(3 credits) (Corequisites 189-133 (or 189-121 or CEGEP 201-105) and 189-222. For Major and Honours students in Computer Science only. Others only with theInstructor’s permission.) Abstractly defined mathematical structures. Mathematicalinduction. Sets, relations and functions. Combinatorics; graphs; recurrences; generatingfunctions. Lattices, Boolean algebras.

1.3 Class Quiz

A quiz will be administered in class on Friday, September 15th, 2000. This quiz doesnot count in the computation of the term mark, and is intended as a diagnostic aid. Itwill be based on the material covered in the course during the first 4 lectures. Answerswill be distributed, so that students may check their own performance. (Note that thisis the last lecture before the end of the Course Change Period.)

1.4 Term Test

A term test will be administered during the regular class hour on Wednesday, October25th, 2000. No provision is planned for a “make-up” test for a student absent duringthe test. Any change in this date will be announced in the lectures.

UPDATED TO September 19, 2000

Page 5: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 2

In your instructor’s eyes the main purpose of the test is as a “dry run” for the finalexamination.1

1.5 Homework

There will be approximately 5 or 6 homework assignments. The material on these as-signments forms an integral part of the course; it may happen that an assignment isconcerned with material (from the textbook or self-contained in the assignment) whichhas not been explicitly discussed in the lectures. An assignment is not a test: it shouldbe viewed as a learning experience, and as a preparation for reading the solutions, whichwill normally be circulated in print. The numerical grade recorded for the assignments isrelatively insignificant; but students should be sure that they understand the problemsand their solutions.

It should not be assumed that every type of problem that a student will be expectedto be able to solve will appear on an assignment; nor that all topics which appear onassignments are equally significant. In addition to completing the assignments, studentsare encouraged to attempt problems in the text-book, particularly low odd-numberedproblems in each set of exercises, for which there will usually be answers in the text-book,and solutions in the solutions manual.

While students are not discouraged from discussing assignment problems with theircolleagues, the written solutions that are handed in should be each student’s own work.2

Submitted homework should be stapled with a cover page that contains your NAME,STUDENT NUMBER, the COURSE NUMBER, and the ASSIGNMENT NUMBER.Other pages should always include your student number. You can minimize the possi-bility that your assignment is lost or fragmented.

1.6 Term Mark

Graded out of 30, the TERM MARK will be the sum of the HOMEWORK GRADE(out of 10) and the TERM TEST GRADE (out of 20).

1Notwithstanding the minimal contribution of the test grade to the student’s final grade (cf. §1.6below), the test is to be considered an “examination” in the sense of the Handbook of Student Rightsand Responsibilities (http://blizzard.cc.mcgill.ca/Secretariat/Students/index.html).

2From the Handbook on Student Rights and Responsibilities:

“No student shall, with intent to deceive, represent the work of another person as his orher own in any...assignment submitted in a course or program of study or represent ashis or her own an entire essay or work of another, whether the material so representedconstitutes a part or the entirety of the work submitted.”

Page 6: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 3

1.7 Calculators

The use of calculators, computers, notes, or other aids will not be permitted at the testor examination.

1.8 Final Grade

The final grade will be a letter grade, computed from the maximum of

• the Examination Mark (out of 100); and

• the sum of the Term Mark (out of 30) and 0.7 times the examination mark (out of100).

1.9 Text-Book

The primary textbook for the course will be: Discrete Mathematics and its Applications ,by K. H. Rosen, 4th Edition, (McGraw-Hill, Inc., 1999), ISBN 0-07-289905-0 [19]. Anoptional reference book is Student Solutions Guide for Discrete Mathematics andits Applications , by K. H. Rosen, 4th Edition, (McGraw-Hill, Inc., 1995), ISBN 0-07-289906-9 [20]3. This book contains, inter alia, solutions to odd-numbered exercises inthe text-book.

1.10 Tutorials

There will be two optional weekly tutorials; the intention is that any student shouldattend one of these. However, classroom space permitting, students may attend both ifthey wish, although there could be considerable duplication.

1.11 Homework Grader

Some of the assignments may be graded by the tutors; others will be graded by theHomework Grader, who does not keep office hours. Questions concerning the grading ofassignments should normally be brought to the tutor.

1.12 Supplementary Materials

1.12.1 Printed Notes

Printed notes will be distributed from time to time to supplement material in the text-book or lectures. Any such material should be treated as an integral part of the syllabus.

3Do not confuse this Guide with the Guide for the 3rd edition [18].

Page 7: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 4

1.12.2 Notes and Examinations from Previous Years

These materials are not required, but are available to interested students at the followingURL:

http://www.math.mcgill.ca/brown/math240a.html

Of particular interest may be the large numbers of worked problems. Solved problemsfrom the assignments in the course during the last four years — the years when this andthe previous edition of the present textbook was used — are collected into an appendixto the current year’s notes; these will probably not be distributed to the class, but willbe available in the above location on the Web.

It is hoped to mount these files in “pdf” format (· · · .pdf), which can be read byAdobe “Acrobat”. Some older files on the Website are presently in “PostScript” format,(· · · .ps), for which an appropriate viewer is required (e.g. ghostview). Some of these filesare very long.

1.13 Examination information

1. “Will there be a supplemental examination in this course.” Yes.

2. “Will students with marks of D, F, or J have the option of doing additional workto upgrade their mark?” No.

3. “Will the final examination be machine scored?” No.

Page 8: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 5

2 Timetable

Distribution Date: (Original version) Wednesday, September 6th, 2000(All information is subject to change.)4

MONDAY WEDNESDAY FRIDAY

SEPTEMBER4 LABOUR DAY 6 §1.1 1 8 §1.2

Tutorials begin in the week of September 11th11 §1.3, §1.4 13 §1.4, §1.5; Prof.

Brown’s Friday officehour advanced to to-day.

15 CLASS QUIZ;Prof. Brown’s Officehour advanced to 13Sept.

Course changes must be completed by September 1718 §1.6 20 §1.6, §1.7(pp. 76–

78)22 §2.3 2

Deadline for withdrawal with fee refund = September 2425 §6.1 27 §3.1 29 §3.1 1

∑OCTOBER

2 §3.2, §3.3 4 §4.1, §4.2 6 §4.1, §4.2 3

Verification Period (Graduating Students): October 10–139 THANKSGIVING

DAY11 §4.3 13 §4.3

Deadline for withdrawal (with W) from course via MARS = Oct. 1516 §4.3, §4.6 18 §4.6 20 X 2

∑23 §5.4,§5.1 4 25 CLASS TEST

(tentative)27 §5.2

30 §5.2, §5.4, N

The next page will not be distributed until the syllabus has been revised.

4Notation: # = distribution of assignment #

n∑

= assignment #n due

R© = Read Only

X = reserved for eXpansion or review

N = distributed notes

Section numbers refer to the text-book.

Page 9: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 6

MONDAY WEDNESDAY FRIDAYNOVEMBER

1 §5.2, §5.4, N 3 §5.4, N 3

∑6 §5.4, §5.5, N 8 §5.5 10 §5.6 5

13 X 15 §6.2 (brief), §6.3,§6.4

17 §6.4, §6.5 4

∑20 §6.6 22 §7.1, §7.2, §7.3 24 §7.427 §7.5 29 §7.7

DECEMBER1 §7.8 5

∑4 §8.1 6 X

(This timetable could be subject to additional revisions.)

Page 10: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 7

3 Syllabus

Distribution Date: Wednesday, September 6th, 2000This 0th version of the syllabus is subject to revision.

3.1 Chapter 1. The Foundations: Logic, Sets, and Functions

§ Section Name Comments Time

§1.1§1.2§1.3

LogicPropositional EquivalencesPredicates and Quantifiers

212

§1.4§1.5

SetsSet Operations

Review of elementary set theory(Note that the author uses the term naturalnumbers for the nonnegative integers; i.e. heincludes 0.)

112

§1.6 Functions While students will be expected to befamiliar with the function concept fromCalculus I, II (and are reminded thatCalculus III is a corequisite of thiscourse), emphasis will be placed on thespecial types of functions discussed —injective, surjective, bijective, etc.

112

§1.7 Sequences andSummations

Students should have met/be meetingthese concepts in their calculus and othercourses. However, the optional materialon Cardinality (pp. 76–78) will be dis-cussed.

12

§1.8 The Growth of Functions This important material will be met inother courses. It forms part of the syl-labus only to the extent to which it isdiscussed in the lectures, assignments, orprinted notes.

0

Page 11: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 8

3.2 Chapter 2. The Fundamentals: Algorithms, the Integers,and Matrices

§ Section Name Comments Time

§2.1§2.2

AlgorithmsComplexity of Algorithms

These sections contain material that stu-dents will meet elsewhere. It is recom-mended that students peruse this mate-rial, but it will not form part of the syl-labus of this course.

0

§2.3 The Integers and Division This material is also in the syllabus ofcourse 189-340B; it will be discussedbriefly here to maintain the integrity ofthe present text-book. We will avoid theauthor’s use of the modulus as a unaryfunction [19, Definition 8, §2.3].

1

§2.4§2.5

Integers and AlgorithmsApplications ofNumber Theory

As much of this material is in the syl-labus of course 189-340B, these conceptswill be examination material only to theextent that they are applied in other sec-tions of the syllabus.

ε

§2.6 Matrices Most of this material will have been metin pre- or corequesite courses in linear al-gebra. Algorithms for matrix operationsmay be met in computer science courses.Pages 157-159 may be studied in connec-tion with Chapter 6.

0

3.3 Chapter 6. Relations (first part)

§ Section Name Comments Time

§6.1 Relationsand Their Properties

1-ε

§6.2 n-ary Relations and TheirApplications

The database application will be dis-cussed very briefly, as students will meetthis in their computer science courses.Other mathematical examples should besupplied.

ε

(to be continued in §?? of these notes)

Page 12: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 9

4 First Problem Assignment

Distribution Date: Wednesday, September 6th, 2000Solutions are to be submitted by Friday, September 29th, 2000

1. Determine whether each of the following is true or false, giving a precise explanationin each case.

(a) 1 + 1 = 3 if and only if 2 + 2 = 3.

(b) If it is raining, then it is raining.

(c) If 2 + 1 = 3, then 2 = 3− 1.

2. [THIS PROBLEM SHOULD BE OMITTED FROM THE ASSIGNMENT; THEORIGINAL VERSION, CIRCULATED ON 6 SEPTEMBER, CONTAINED AMISPRINT.]

(a) Suppose that ϕ is a compound proposition that is expressible in terms ofprimitive propositions p1, p2, ..., pn, using logical connectives, ¬, ∨, ∧, →,and ↔. Describe informally a procedure (algorithm) by which a truth tablemay be used to find a proposition ψ which is logically equivalent to ϕ, inwhich ψ uses only the connectives ¬, ∧ and ∨ (at most).

(b) Illustrate your algorithm by finding ψ, where φ = (p→ q)→ ¬(r → p).

3. Write the following compound statements in symbols. Use the following letters torepresent the statements:

c : It is cold.d : It is dry.r : It is rainy.w : It is warm.

(a) It is neither cold nor dry.

(b) It is rainy if it is not dry.

(c) To be warm it is necessary that it be dry.

(d) It is cold or dry, but not both.

4. Determine whether or not the two propositions are logically equivalent:

p ∨ (q ∧ r), (p ∧ q) ∨ (p ∧ r) .

UPDATED TO September 19, 2000

Page 13: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 10

5. Determine whether the following proposition is a tautology:

((p→ ¬q) ∧ q)→ ¬p .

6. Write the contrapositive, converse, and inverse of the following statement:

You sleep late if it is Saturday.

(Inverse = converse of contrapositive.)

7. Suppose P (x, y) is the statement x + 2y = xy, where x and y are integers. Whatare the truth values of

(a) P (0, 0)

(b) ∀x∃yP (x, y)

(c) ∀y∃xP (x, y)

(d) ¬∀x∃y¬P (x, y)

8. Suppose the variable x represents students, y represents courses and T (x, y) means”x is taking y”. Match each of the following symbolic statements with all itsequivalent English statements in the second list:

(a) ∃y∀xT (x, y)

(b) ¬∃x∃yT (x, y)

(c) ∀y∃xT (x, y)

(d) ¬∀x∃yT (x, y)

(e) ¬∀x∃y¬T (x, y)

(f) ¬∀x¬∀y¬T (x, y)

(g) ∀x∃y¬T (x, y)

The English statements are

(A) Every course is being taken by at least one student.

(B) Some student is taking every course.

(C) No student is taking all courses.

(D) There is a course that all students are taking.

(E) Every student is taking at least one course.

Page 14: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 11

(F) There is a course that no students are taking.

(G) Some students are taking no courses.

(H) No course is being taken by all students.

(I) Some courses are being taken by no students.

(J) No student is taking any course.

9. Suppose A = a, b, c. Determine the truth value of each of the following state-ments. Justify your answers.

(a) a ⊆ P (A)

(b) ? ⊆ P (A)

(c) a, c ∈ A(d) (c, c) ∈ A× A

10. Suppose A = a, b, c and B = b, c. For each of the following statements,determine whether it is true or false.

(a) |P (A×B)| = 64

(b) B ⊆ A

(c) a, b ∈ A× A(d) b, c ∈ P (B)

(e) c ⊆ P (B)

11. Determine, for each of the following sets A, whether it is the power set of some setB. If that is so, give B.

(a) A = ? , ? , a, a, a, ? , a, ? , a, ? , a, a, a,

a, a, a, a, ? , a, a, ? , a, a, ? , a, a,

a, a, a, ? , a, a, a

(b) A = ? , a(c) A = ? , a, ? , a(d) A = ? , a, ? , a,? (e) A = ? , a,? (f) A = ? , ? , a

Page 15: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 12

12. Prove or disprove the identity A ∩B = A∪B using each of the following methods:

(a) By using a “containment” proof or disproof. (Prove or disprove that the leftside is a subset of the right, and that the right side is a subset of the left.)

(b) By using a membership table

(c) By proving that two propositions are logically equivalent or inequivalent.

(d) By using a Venn diagram.

13. Suppose that A = 1, 2, 3, 4, B = a, b, c, C = 2, 8, 10, and g : A → Band f : B → C are functions defined by g = (1, b), (2, a), (3, b), (4, a), f =(a, 8), (b, 10), (c, 2).

(a) Determine f g.(b) Determine f−1. (Here, and in the following parts, we are not assuming that

f−1 is a function, but are following the generalization introduced in [19, p.68, following Exercise 27.], where f−1 denotes the set of preimages of pointsin the set S. Where S consists of but a single point, s, we may write f−1(s)instead of f−1(s); where f−1(s) is a single point for every s in the codomainof f , we may interpret f−1 to be a function from the codomain of f to thedomain of f .)

(c) Determine f f−1.

(d) Explain why g−1 is not a function. (Use the interpretation discussed in #13b.)

14. Determine which of the following proposed definitions actually define a function.If the definition is defective, explain precisely what has gone wrong.

(a) f : N→ N, defined by f(n) =√n.

(b) h : R→ R, defined by h(x) =√x.

(c) F : R→ R, where F (x) =1

x− 5.

(d) φ : R→ R, where φ(x) =

x+ 2 if x ≥ 0x− 1 if x ≤ 4

(e) ψ : R→ R, where ψ(x) =

x2 if x ≤ 2

x− 1 if x ≥ 4

(f) λ : Q→ Q, where λ

(p

q

)= q.

15. None of the following statements is true for all sets. In each case give a counterex-ample to demonstrate this failure.

Page 16: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 13

(a) A− (B − C) = (A−B)− C(b) (A− C)− (B − C) = A−B(c) A ∩ (B ∪ C) = (A ∪B) ∩ (A ∪ C)

(d) If A ∪ C = B ∪ C, then A = B.

(e) If A ∩ C = B ∩ C, then A = B.

Page 17: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 14

5 Class Quiz

Distribution Date: 15 September, 2000

• This quiz is based on [19, §§1.1 – 1.4 and part of §1.5].

• No books, notes, calculators, or other aids may be used.

• THIS QUIZ DOES NOT COUNT IN THE COMPUTATION OF YOURTERM MARK!

• All answers must be thoroughly justified. Unless you are instructed tothe contrary, it is never sufficient to simply state a one-word answer.

• For the purpose of assigning a numerical grade, the questions numberedwith Arabic numberals (1, 2, 3,...) may be taken to be of equal value,although they are not equally difficult.

• A sketch of solutions will be provided at the end of the hour. It issuggested that you exchange papers with another student, and eachgrade the other’s paper, referring to the sketch of solutions.

1. Determine whether each of the following is true or false, giving a precise explanationin each case.

(a) If 1 < 0, then 3 = 4.

(b) If 1 + 1 = 2 or (inclusive) 1 + 1 = 3, then 2 + 2 = 3 and 2 + 2 = 4.

2. Determine whether or not the following two propositions are logically equivalent:

p→ (¬q ∧ r), ¬p ∨ ¬(r → q) .

3. Determine whether the following proposition is a tautology:

((p→ q) ∧ ¬p)→ ¬q .

4. Write the contrapositive, converse, and inverse of the following statements:

If you try hard, then you will win.

(Inverse = converse of contrapositive.)

5. Suppose P (x, y) is the statement x + 2y = xy, where x and y are integers. Whatare the truth values of

Page 18: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 15

(a) P (1,−1)

(b) ∃yP (3, y)

(c) ∃x∀yP (x, y)

(d) ∃y∀xP (x, y)

6. Suppose the variable x represents students, y represents courses and T (x, y) means”x is taking y”. Match each of the following symbolic statements with all itsequivalent English statements in the second list:

(a) ∃x∀yT (x, y)

(b) ∀x∃yT (x, y)

(c) ∃x∀y¬T (x, y)

(d) ∃y∀x¬T (x, y)

(e) ¬∃y∀xT (x, y)

The English statements are

(A) Every course is being taken by at least one student.

(B) Some student is taking every course.

(C) No student is taking all courses.

(D) There is a course that all students are taking.

(E) Every student is taking at least one course.

(F) There is a course that no students are taking.

(G) Some students are taking no courses.

(H) No course is being taken by all students.

(I) Some courses are being taken by no students.

(J) No student is taking any course.

7. Suppose A = a, b, c. Determine the truth value of each of the following state-ments. (Because of time limitations no justification is requested.)

(a) b, c ∈ P (A)

(b) ? ⊆ A

(c) ? ⊆ A× A(d) a, b ∈ A× A

Page 19: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 16

8. Suppose A = a, b, c and B = b, c. For each of the following statements,determine whether it is true or false. (Because of time limitations no justificationis requested.)

(a) c ∈ A−B(b) ? ∈ P (B)

(c) c ⊆ B

(d) b, c ∈ P (A)

(e) ? ⊆ A× A

9. Suppose D = x, y and E = x, x, where x 6= y. For each of the followingstatements, determine whether it is true or false. (Because of time limitations nojustification is requested.)

(a) x ⊆ E.

(b) ? ∈ P (E).

(c) x ⊆ D − E.

(d) |P (D)| = 4.

10. Find three subsets of 1, 2, 3, 4, 5, 6, 7, 8, 9 such that the intersection of any twohas cardinality 2 and the intersection of all three has cardinality 1.

Page 20: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 17

6 Solutions to Problems on the Class Quiz

which was administered on 15th September, 2000.

Distribution Date: 15 September, 2000

1. Determine whether each of the following is true or false, giving a precise explanationin each case.

(a) If 1 < 0, then 3 = 4.

(b) If 1 + 1 = 2 or (inclusive) 1 + 1 = 3, then 2 + 2 = 3 and 2 + 2 = 4.

Solution:

(a) Here the premise, 1 < 0, is false; any conditional statement with a falsepremise must be true.

(b) The premise is true, as it is the disjunction of two statements which are notboth false. For the conditional to be true we require that the conjuction(2 + 2 = 3) ∧ (2 + 2 = 4) be true, i.e. that both of the conjuncts be true. Butthe first conjunct, 2+2 = 3, is false. Hence the conditional statement is false.

2. Determine whether or not the following two propositions are logically equivalent:

p→ (¬q ∧ r), ¬p ∨ ¬(r → q) .

Solution: This case could be proved using a truth table, where the columns cor-responding to the two given formulæ would be seen to have identical entries. An-other way of proving this equivalence would be as follows, using laws of logic andan equivalence proved in the textbook.

p→ (¬q ∧ r)⇔ ¬p ∨ (¬q ∧ r) [19, Example 1.2.3, p. 16]

⇔ ¬p ∨ (¬q ∧ ¬¬r) double negation law

⇔ ¬p ∨ ¬(q ∨ ¬r) de Morgan law

⇔ ¬p ∨ ¬(¬r ∨ q) commutativity of ∨⇔ ¬p ∨ ¬(r → q) [19, Example 1.2.3, p. 16]

3. Determine whether the following proposition is a tautology:

((p→ q) ∧ ¬p)→ ¬q .

Solution: By using a truth table, or otherwise, we can discover the interpretation(truth assignment) (p, q) = (F, T ) under which the given proposition is false.

Page 21: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 18

4. Write the contrapositive, converse, and inverse of the following statements:

If you try hard, then you will win.

(Inverse = converse of contrapositive.)

Solution:

Contrapositive: If you will not win, then you do not try hard.

Converse: If you will win, then you try hard.

Inverse: If you do not try hard, then you will not win.

5. Suppose P (x, y) is the statement x + 2y = xy, where x and y are integers. Whatare the truth values of

(a) P (1,−1)

(b) ∃yP (3, y)

(c) ∃x∀yP (x, y)

(d) ∃y∀xP (x, y)

Solution:

(a) 1 + 2(−1) = 1(−1) is True.

(b) True. 3 + 2y = 3y ⇔ y = 3. (There is only one solution.)

(c) False. If we attempt to solve the equation for y in terms of x, we find that

y =x

x− 2= 1 +

2

x− 2, when x 6= 2. Thus, for every value of x distinct from

2 there is at most one value of y that makes P (x, y) true; indeed, there will beexactly one value precisely when x is one of 0, 1, 3, 4, since it is necessary thatx− 2 divide x — or, equivalently, that x− 2 be a divisor of 2. But, for x = 2,there exists no such value of y; that is, there is no solution to 2 + 2y = 2y.

(d) False. For y 6= 1 P (x, y) ⇔ x =2y

y − 1. Thus no y other than possibly y = 1

could be such that ∀xP (x, y). But P (x, 1)⇔ x+ 2 = x, which is true for nox.

6. Suppose the variable x represents students, y represents courses and T (x, y) means”x is taking y”. Match each of the following symbolic statements with all itsequivalent English statements in the second list:

(a) ∃x∀yT (x, y)

UPDATED TO September 19, 2000

Page 22: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 19

(b) ∀x∃yT (x, y)

(c) ∃x∀y¬T (x, y)

(d) ∃y∀x¬T (x, y)

(e) ¬∃y∀xT (x, y)

The English statements are

(A) Every course is being taken by at least one student.

(B) Some student is taking every course.

(C) No student is taking all courses.

(D) There is a course that all students are taking.

(E) Every student is taking at least one course.

(F) There is a course that no students are taking.

(G) Some students are taking no courses.

(H) No course is being taken by all students.

(I) Some courses are being taken by no students.

(J) No student is taking any course.

Solution: aB bE cG dI dF eH

7. Suppose A = a, b, c. Determine the truth value of each of the following state-ments. (Because of time limitations no justification is requested.)

(a) b, c ∈ P (A)

(b) ? ⊆ A

(c) ? ⊆ A× A(d) a, b ∈ A× A

Solution: TTTF

8. Suppose A = a, b, c and B = b, c. For each of the following statements,determine whether it is true or false. (Because of time limitations no justificationis requested.)

(a) c ∈ A−B(b) ? ∈ P (B)

(c) c ⊆ B

Page 23: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 20

(d) b, c ∈ P (A)

(e) ? ⊆ A× A

Solution: TTFTT

9. Suppose D = x, y and E = x, x, where x 6= y. For each of the followingstatements, determine whether it is true or false. (Because of time limitations nojustification is requested.)

(a) x ⊆ E.

(b) ? ∈ P (E).

(c) x ⊆ D − E.

(d) |P (D)| = 4.

Solution: FTFT

10. Find three subsets of 1, 2, 3, 4, 5, 6, 7, 8, 9 such that the intersection of any twohas cardinality 2 and the intersection of all three has cardinality 1.

Solution: One example is 1, 2, 3, 2, 3, 4, 1, 3, 4. We can determine whetherthis example is unique up to labelling.

If we assume that subsets A and B intersect in elements 2 and 3 only, then A =2, 3 ∪ D and B = 2, 3 ∪ E, where D and E are disjoint sets whose union is1, 4, 5, 6, 7, 8, 9. The 3rd subset must meet A∩B in one point in 2, 3; withoutlimiting generality, suppose it is 3. C will then contain just one point from D —say the point 1 — and just one point from E — say the point 4. But we could stilltake the remaining points — 5, 6, 7, 8, 9 — and partition them among the threesets without violating the intersection conditions. Thus the example given is farfrom unique, even if we disregard labelling considerations.

Page 24: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 21

7 Second Problem Assignment

Distribution Date: Friday, September 22nd, 2000Solutions are to be submitted on Friday, October 20th, 2000

1. Prove or disprove each of the following statements about integers. Proofs shouldbe rigorous, referring to the textbook definition [19, Definition 2.3.1, p. 113]. Todisprove a statement a counterexample should be provided. (In each case youshould assume that all of the integer variables referred to have been universallyquantified over the set of non-zero integers.)5

(a) If a|b and c|d, then (a+ c)|(b+ d).

(b) If a|b and b|c, then a|c.(c) If a|c and b|c, then (a+ b)|c.(d) If a|b and c|d, then (ac)|(b+ d).

(e) If a|b and b|a, then a|b.(f) If a|(b+ c), then a|b and a|c.(g) If a|bc then a|b or a|c.(h) If a|b and b|c, then ab|c2.

2. For each of the following binary relations, determine whether or not it has each ofthe following properties:

• reflexivity

• symmetry

• antisymmetry

• transitivity

All negative statements should be justified by a counterexample.

(a) The relation R1 on N, where aR1b means a|b.(b) On the set w, x, y, z, the relation R2 = (w,w), (w, x), (x,w), (x, x), (x, z),

(y, y), (z, y), (z, z).(c) The relation R3 on Z, where aR3b means |a− b| ≤ 1.

5We are restricting to nonzero integers to avoid technical problems resulting from the fact that thetextbook definition of a|b requires that a 6= 0. Some authors define the concept differently, and permita = 0; of course, the only case that can then occur is 0|0; but the author of your textbook does notinclude this possibility in his definition of divisibility.

Page 25: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 22

(d) The relation R4 on Z, where aR4b means a2 = b2.

(e) The relation R5 = (a, a), (b, b), (c, c), (a, b), (a, c), (c, b) on the set a, b, c.(f) The relation R6 = (x, x), (y, z), (z, y) on the set A = x, y, z.(g) The relation R7 on Z defined by aR7b⇔ a 6= b.

(h) The relation R8 on Z, where aR8b means that the units digit of the decimalrepresentation of a is equal to the units digit of the decimal representation ofb.

(i) The relation R9 on N, where aR9b means that the binary representation of ahas the same number of digits as the binary representation of b.

(j) The relation R10 on the set of all subsets of 1, 2, 3, 4, where SR10T meansS ⊆ T .

(k) The relation R11 on the set of all subsets of 1, 2, 3, 4, where SR11T means(S ⊆ T ) ∧ (S 6= T ).

(l) The relation R12 on the set of all people, where aR12b means that a is youngerthan b.

(m) The relation R13 on the set (a, b)|a ∈ Z, b ∈ Z, where (a, b)R13(c, d) means(a = c) ∨ (b = d).

(n) The relation R14 on R, where aR14b means a− b ∈ Z.

3. Determine whether the following is a valid rule of inference:

p → rq → r¬(p ∨ q)) ¬r

4. Recall that the Rule of Inference called Modus Tollens infers from the truth of bothpropositions ¬q and p → q, the truth of the proposition ¬p. Use MathematicalInduction to prove the validity of the following Rule of Inference for all integersn > 1:

p1 → p2

p2 → p3

. . . . . . . . .pn−1 → pn

¬pn

) ¬p1

(1)

You may need to use Modus Tollens at some stage(s) of your proof. [Note: Theproposed Rule of Inference has been stated informally, using “. . .”. We could haveavoided the “. . .” by recursively defining the conjunction of the implications.]

Page 26: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 23

5. Read the solution to [19, Example 14, pp. 198-199]. Then use the same techniquesto prove that every positive integer n ≥ 14 is expressible in the form

n = 5a+ 7b+ 9c

where a, b, c are non-negative integers. Give two proofs, one using the (“First”)Principle of Mathematical Induction, and the other using the Second Principle.[The solution to this problem can be expected to be longer than the solution in thecited example. You should expect to have to consider various cases.]

6. Suppose that a “word” is any string of letters of the (26-letter) English alpha-bet, with repeated letters allowed. Justify your answers to each of the followingquestions.

(a) How many words are there?

(b) How many 7-letter words end with the letter T?

(c) How many 7-letter words begin with R and end with T?

(d) How many 7-letter words begin with A or B?

(e) How many 7-letter words have no vowels? [We consider the vowels to be A,E, I, O, U.]

(f) How many 7-letter words have exactly one vowel?

(g) How many 7-letter words have exactly two vowels, where the vowels are notside-by-side? [The 2 vowels may be the same letter.]

(h) How many 7-letter words consist of an alternation of consonants and vowels,and begin with a consonent?

You are not required to multiply out large integers that are expressed as a product.

7. Observe that the set S = 11, 17, 20, 22, 23, 24 has the property that all subsetsof its elements have different sums. Use the Pigeonhole Principle to prove thatthere cannot exist a set of 7 (distinct) positive integers, none exceeding 24, withthe property that all sums of its subsets are different. [Hints: (1) It suffices toconsider subsets of cardinality not exceeding 4. (2) Students may wish to make useof the following fact which appears in [19, §4.3]: The number of r-element subsets

of a set of n elements isn(n− 1) . . . (n− r + 1)

r!.]

Page 27: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 901

8 References

[1] I. Anderson, Combinatorics of Finite Sets . Clarendon Press, (Oxford, 1987). ISBN0-19-853367-5.

[2] N. L. Biggs, E. K. Lloyd, R. J. Wilson, Graph Theory, 1736–1936. Clarendon Press,Oxford (1976).

[3] J. A. Bondy and U. S. R. Murty, Graph Theory with Applications , Macmillan(London, 1976). ISBN 333-17791-6.

[4] Lewis Carroll [Charles Lutwidge Dodgson]Through the Looking-Glass .

[5] L. Euler, Solutio problematis ad geometriam situs pertinentis . Reprinted from Com-mentarii academiæ scientiarum Petropolitanæ 8 (1736), 1741, pp. 128–140. Printedas an appendix to [10].

[6] R. P. Grimaldi, Discrete and Combinatorial Mathematics, An Applied Introduction(Third Edition), Addison-Wesley Publishing Company (1994). ISBN 0–201–54983–2.

[7] G. Haggard, J. Schlipf, and S. Whitesides, Discrete Mathematical Structures forComputer Science, Preliminary edition.

[8] F. Harary (editor), Proof Techniques in Graph Theory. Proceedings of the SecondAnn Arbor Graph Theory Conference, February, 1968 . Academic Press, New Yorkand London (1969).

[9] D. E. Knuth, The Art of Computer Programming, Volume 1/Fundamental Algo-rithms. Addison-Wesley Publishing Company, Reading, Mass., Don Mills, Ontario,etc. (1968).

[10] D. Konig, Theorie der endlichen und unendlichen Graphen. KombinatorischeTopologie der Streckenkomplexe. (Theory of finite and infinite graphs. Combinato-rial topology of 1-dimensional complexes.) Akademische Verlagsgesellschaft M. B.H., Leipzig (1936); Chelsea Publishing Company, New York (1950). A translationinto English has been published by Birkhauser Verlag (1990), ISBN 0–8176–3389–8.Another reprint of the original version, published by Teubner Verlagsgesellschaft,Leipzig (1986), ISBN 3-211-95830-4, has Euler’s paper as an appendix (cf. [5]).

[11] C. L. Liu, Introduction to Combinatorial Mathematics . McGraw-Hill Book Com-pany, New York, etc. (1968). PSEAL Library, QA164 L58.

Page 28: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 902

[12] C. L. Liu, Elements of Discrete Mathematics, 2nd Edition. McGraw-Hill BookCompany, New York, etc. (1985). ISBN 9009700938133–X.

[13] L. Lovasz, Combinatorial Problems and Exercises . North-Holland Publishing Com-pany, Amsterdam, etc. (1979). ISBN 0–444–85219–0.

[14] R. J. McEliece, R. B. Ash, C. Ash, Introduction to Discrete Mathematics RandomHouse (New York, 1989). ISBN 0-394-35819-8.

[15] J. W. Moon, Topics on Tournaments . Holt, Rinehart and Winston, New York, etc.(1968).

[16] Moser, Leo Problem E 1062 . American Mathematical Monthly 60 (1953), pp. 262,713–714.

[17] K. H. Rosen Discrete Mathematics and its Applications, 3rd Edition, (McGraw-Hill, Inc., 1995), ISBN 0–07-853965-0.

[18] K. H. Rosen Student Solutions Guide for Discrete Mathematics and its Applica-tions, 3rd Edition, (McGraw-Hill, Inc., 1995), ISBN 0–07-853966-9.

[19] K. H. Rosen Discrete Mathematics and its Applications, 4th Edition, (McGraw-Hill, Inc., 1999), ISBN 0–07-289905-0.

[20] K. H. Rosen Student Solutions Guide for Discrete Mathematics and its Applica-tions, 4th Edition, (McGraw-Hill, Inc., 1999), ISBN 0–07-289906-9.

[21] K. H. Rosen, Elementary Number Theory and its Applications, Third Edition,(Addison Wesley, 1993), ISBN 0-201-57889-1.

[22] J. Rotman, A First Course in Abstract Algebra, (Prentice Hall, 1996), ISBN 0-13-311374-4.

[23] W. Sierpinski, Cardinal and Ordinal Numbers, Second Edition Revised . Polish Sci-entific Publishers (Warsaw, 1965).

[24] W. A. Whitworth, Choice and Chance, (Hafner Purlishing Company, New York,1965). (Enlarged reprint of the original edition, published in 1901)

[25] P. Erdos, The Art of Counting, Selected Writings , edited by J. Spencer. MIT Press(Cambridge, 1973). ISBN 0-262-19116-4.

[26] P. Erdos, Gy. Szekeres, A combinatorial problem in geometry , Compositio Math.2 (1935), 463–470.

Page 29: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1001

A Problems on Term Tests of Previous Years

Students are cautioned not to make inferences about course content from the followingtests, since both the syllabus and the text-books that were followed closely have changed.All tests were administered in a printed booklet into which all solutions were to bewritten.

A.1 1991 Term Test

A.1.1 First Version

1. [5 MARKS EACH] Give an example of each of the following, if one exists. If noneexists, prove that fact.

(a) a non-empty binary relation R1 which is both symmetric and antisymmetric.

(b) a partial ordering R2 on N such that R2 = R−12

(c) an equivalence relation on 1, 2, 3, 4, 5, 6 whose equivalence classes are 1, 2,3, 4, 5, 6

(d) a set which is not an element of its power set

(e) a relation R3 on Z such that |R3| = 5 and |R∗3| = 6

(f) a partial ordering R4 on a set S containing elements x, y such that x isminimal, y is minimum, and x 6= y

(g) two non-isomorphic graphs with vertex set a, b, c, d, e, f, g and all degreesequal to 2

(h) two non-isomorphic graphs with vertex set a, b, c, d, e and all degrees equalto 3

2. [5 MARKS EACH] For each of the following assertions, either prove it, if it is true;or provide a counterexample, if it is false.

(a) If f : A −→ A is onto then f f is onto.

(b) If the edges of a complete graph with vertices 1, 2, 3, 4, 5 are coloured withcolours red and blue, there will always exist either a red triangle, or a bluetriangle, or both.

(c) If a1, a2, ..., a5 are distinct integers, there must exist integers α, β, γ in5, 4, 3, 2, 1 such that α < β < γ and aα > aβ > aγ.

3. [15 MARKS] Showing all your work, determine the number of solutions to theequation y1 + y2 + y3 + y4 = n with the properties that

Page 30: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1002

(a) y1, y2, y3, y4 are positive integers

(b) y1 > 1, y2 > 2, y3 > 3, y4 > 4

4. [15 MARKS] Showing all your work, determine the number of ways of forming a4-letter word from the letters of the word CHARACTER.

A.1.2 Second Version

1. [5 MARKS EACH] Give an example of each of the following, if one exists. If noneexists, prove that fact.

(a) two non-isomorphic graphs with vertex set t, u, v, w, x, y, z and all degreesequal to 2

(b) two non-isomorphic graphs with vertex set t, u, v, w, x and all degrees equalto 3

(c) a partial ordering R1 on N such that R1 = R−11

(d) an equivalence relation on a, b, c, d, e, f whose equivalence classes are a, b,c, d, e, f

(e) a set which is not an element of its power set

(f) a relation R2 on Z such that |R2| = 4 and |R∗2| = 4

(g) a partial ordering R3 on a set A containing distinct elements a and b suchthat a is minimum and b is minimal

(h) a non-empty binary relation R3 which is both symmetric and antisymmetric.

2. [5 MARKS EACH] For each of the following assertions, either prove it, if it is true;or provide a counterexample, if it is false.

(a) If the edges of a complete graph with vertices c, d, e, f, g are coloured withcolours green and red , there will always exist either a green triangle, or a redtriangle, or both.

(b) If g : X −→ X is onto then g g is onto.

(c) If n1, n2, ..., n5 are distinct integers, there must exist integers i, j, k in5, 4, 3, 2, 1 such that i < j < k and ni < nj < nk

3. [15 MARKS] Showing all your work, determine the number of ways of forming a4-letter word from the letters of the word HARRASSOR.

4. [15 MARKS] Showing all your work, determine the number of solutions to theequation x1 + x2 + x3 + x4 = n with the properties that

Page 31: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1003

(a) x1, x2, x3, x4 are positive integers

(b) x1 > 1, x2 > 2, x3 > 3, x4 > 4.

A.2 1994 Term Test

A.2.1 First Version

1. [10 MARKS] Showing all your work , determine the number of permutations ofthe letters of the word DIGITAL in which at least one of the following conditionsoccurs:

• D precedes G

• G precedes T

• T precedes L

(Here precedes means “appears before”, but is not intended to imply that the twoletters should necessarily be adjacent; adjacency is not excluded, however.)

2. [10 MARKS]Use a membership table — no other method will be acceptable — toprove that, for any subsets A, B, C of a universal set U ,

(A ∩B) ∪ (A ∩ C) = (A ∩B) ∪ (A ∩ C)

3. [10 MARKS] Give an example of the following, or prove that none exists: |A| = 5;u ∈ A; v ∈ A; u 6= v; g : A × A → A is an operation such that each of u and v isan identity for g.

4. [10 MARKS] Prove that√

3 is irrational.

A.2.2 Second Version

1. [10 MARKS] A quaternary sequence is one whose elements are each an elementof the set 0, 1, 2, 3. Let n, r be integers, n ≥ r. Explaining your reasoning,determine the number of quaternary sequences of length n which contain exactlyr 1’s.

2. [10 MARKS] Using a truth table, or otherwise — but showing all your work —determine the truth values of p, q, r, s for which the following formula is true:

[(p→ q) ∧ [(q ∧ r)→ s] ∧ r]→ (p→ r)

Page 32: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1004

3. [10 MARKS] Give an example of the following, or prove that none exists: |B| = 4;x ∈ B; y ∈ B; x 6= y; f : B × B → B is an operation such that each of x and y isan identity for f .

4. [10 MARKS] Prove that√

5 is irrational.

A.3 1995 Term Test

A.3.1 First Version

1. [10 MARKS] Demonstrate your knowledge of the Principle of Induction by provingthat 3n ≥ n + 2 for all integers n ≥ 1. (Only a fully documented induction proofis acceptable here. Show all your work, and do not use any other method to provethis theorem.)

2. Let f : X → Y and g : Y → Z be two given functions.

(a) [2 MARKS] Define precisely what is meant by the composite function gf .

(b) [8 MARKS] Showing all your work, prove that if f and g are both surjective,then gf is also surjective.

3. [10 MARKS] Showing all your work, determine whether or not it is possible to finda collection of subsets of N9 such that each one has exactly 4 members, and eachmember of N9 belongs to exactly 6 of the subsets.

4. [10 MARKS] Showing all your work, determine a formula in disjunctive normalform that is logically equivalent to the formula

p ∧ (((¬r)⇒ (((p ∨ q)⇒ r)⇒ (¬q))))

A.3.2 Second Version

1. Let g : A→ B and f : B → C be two given functions.

(a) [2 MARKS] Define precisely what is meant by the composite function fg.

(b) [8 MARKS] Showing all your work, prove that if f and g are both injective,then gf is also injective.

2. [10 MARKS] Showing all your work, determine whether or not it is possible to finda collection of subsets of N9 such that each one has exactly 12 members, and eachmember of N9 belongs to exactly 10 of the subsets.

Page 33: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1005

3. [10 MARKS] Showing all your work, determine a formula in disjunctive normalform that is logically equivalent to the formula

q ∧ (((¬s)⇒ (((r ∨ q)⇒ s)⇒ (¬q))))

4. [10 MARKS] Demonstrate your knowledge of the Principle of Induction by provingthat 4n ≥ 2n+ 2 for all integers n ≥ 1. (Only a fully documented induction proofis acceptable here. Show all your work, and do not use any other method to provethis theorem.)

A.3.3 Third Version

1. [10 MARKS] Showing all your work, determine whether or not it is possible to finda collection of subsets of N9 such that each one has exactly 6 members, and eachmember of N9 belongs to exactly 3 of the subsets.

2. [10 MARKS] Demonstrate your knowledge of the Principle of Induction by provingthat 2n ≥ 2n+ 2 for all integers n ≥ 3. (Only a fully documented induction proofis acceptable here. Show all your work, and do not use any other method to provethis theorem.)

3. Let f : U → V and g : V →W be two given functions.

(a) [2 MARKS] Define precisely what is meant by the composite function gf .

(b) [8 MARKS] Showing all your work, construct an example to show that it ispossible for f to be injective and g surjective, while gf is not injective.

4. [10 MARKS] Showing all your work, determine a formula in conjunctive normalform that is logically equivalent to the formula

s ∧ (((¬t)⇒ (((s ∨ q)⇒ t)⇒ (¬q))))

A.3.4 Fourth Version

1. [10 MARKS] Showing all your work, determine a formula in conjunctive normalform that is logically equivalent to the formula

q ∧ (((¬r)⇒ (((q ∨ p)⇒ r)⇒ (¬p))))

2. [10 MARKS] Demonstrate your knowledge of the Principle of Induction by provingthat 3n ≥ 2n+ 5 for all integers n ≥ 2. (Only a fully documented induction proofis acceptable here. Show all your work, and do not use any other method to provethis theorem.)

Page 34: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1006

3. Let f : W → X and g : X → Y be two given functions.

(a) [2 MARKS] Define precisely what is meant by the composite function gf .

(b) [8 MARKS] Showing all your work, construct an example to show that it ispossible for f to be surjective, g to be injective, while gf is not surjective.

4. [10 MARKS] Showing all your work, determine whether or not it is possible to finda collection of subsets of N9 such that each one has exactly 10 members, and eachmember of N9 belongs to exactly 5 of the subsets.

A.4 1996 Term Test

There were four versions, each containing 3 questions worth 10 marks each, and 2 ques-tions worth 5 marks each.

The following are solutions to the problems on the various tests, or to variations ofthose problems: in some cases symbols and data were changed in superficial ways.

A. [10 MARKS] Using any method discussed in the lectures, solve the recurrencebn+2 = −6bn+1 − 9bn (n ≥ 0), subject to the initial conditions b0 = 1 and b1 = 6.

Solution:

Using the characteristic equation: The characteristic polynomial is r2 + 6r+9 = (r + 3)2, so the characteristic roots are −3 (twice) (cf. [17, Example 5,p. 322]). Assuming a general solution of the form bn = (An + B)(−3)n, weimpose the initial conditions, to obtain equations

1 = B

6 = (A+B)(−3)

whose solution is A = −3, B = 1. Thus the solution to the recurrence whichsatisfies the initial conditions is an = (1− 3n)(−3)n (n ≥ 0).

Using ordinary generating functions: Define b(t) =∞∑

n=0

bntn to be the ordi-

nary generating function of the sequence bnn=0,1,.... Multiplying the recur-rence by tn+2 and summing over the range t = 0, 1, ... yields

∞∑n=0

bn+2tn+2 = −6t

∞∑n=0

bn+1tn+1 − 9t2

∞∑n=0

bntn

which reduces, after changes of variables of summation, to

∞∑k=2

bktk = −6t

∞∑`=1

b`t` − 9t2

∞∑n=0

bntn ,

Page 35: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1007

which can be rewritten in terms of the generating function as

b(t)− b0t0 − b1t1 = −6t(b(t)− b0t0)− 9t2b(t) ,

which can be solved for b(t) to yield

b(t) =b0 + (b1 + 6b0)t

1 + 6t+ 9t2

=1 + 12t

(1 + 3t)2= (1 + 12t)(1 + 3t)−2

= (1 + 12t)∞∑

m=0

(m+ 2− 1

2− 1

)(−3)mtm

=∞∑

m=0

(m+ 1)(−3)mtm − 4∞∑

m=0

(m+ 1)(−3)m+1tm+1

=∞∑

n=0

(n+ 1)(−3)ntn − 4∞∑

n=1

n(−3)ntn

=∞∑

n=0

(n+ 1)(−3)ntn − 4∞∑

n=0

n(−3)ntn

=∞∑

n=0

(1− 3n)(−3)ntn

so bn = (1− 3n)(−3)n (n ≥ 0).

B. [10 MARKS] Showing all your work, determine the number of solutions to theequation

x1 + x2 + x3 + x4 = 12

in nonnegative integers x1, x2, x3, x4 such that x1 ≥ 2, x2 ≤ 4, 1 ≤ x3 ≤ 4.

Solution:

Using inclusion-exclusion: It is convenient to change the variables so that theyall range over an interval of non-negative integers whose left end-point is zero.This we achieve by defining

y1 = x1 − 2

y2 = x2

y3 = x3 − 1

y4 = x4

Page 36: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1008

The equation transforms to

y1 + y2 + y3 + y4 = 9 (2)

The constraints that must be satisfied simultaneously transform into

0 ≤ y1 (3)

0 ≤ y2 ≤ 4 (4)

0 ≤ y3 ≤ 3 (5)

0 ≤ y4 (6)

The number of solutions to (2) in non-negative integers, i.e. possibly failingto satisfy either or both of the right inequalities of constraints (4) and (5),is(9+33

). Those solutions which violate the right inequality of constraint (4)

satisfy, after a change of variable (z1, z2, z3, z4) = (y1, y2−5, y3, y4), z1+z2+z3+z4 = 4, with constraints 0 ≤ z1; 0 ≤ z2; 0 ≤ z3 ≤ 3; 0 ≤ z4; and their numberis(5+33

). Those solutions which violate the right inequality of (5) satisfy, after

a change of variable (z1, z2, z3, z4) = (y1, y2, y3 − 4, y4), z1 + z2 + z3 + z4 = 5,with constraints 0 ≤ z1; 0 ≤ z2 ≤ 4; 0 ≤ z3; 0 ≤ z4; their number is

(4+33

). The

solutions which violate the right inequalities of both (4) and (5) satisfy, after achange of variable (z1, z2, z3, z4) = (y1, y2−5, y3−4, y4), z1+z2+z3+z4 = 0, andthere is just one such solution. Applying the Inclusion-Exclusion Principle,we find that the number of solutions to (2) satisfying the given constraints is(123

)−(83

)−(73

)+(33

)= 130.

Remember that the Principle of Inclusion-Exclusion serves to express the car-dinality of a union in terms of the cardinalities of certain intersections. Intypical applications the sets whose union we consider represent certain forbid-den configurations. Here we transformed the problem so that the forbiddenconfigurations corresponded to y2 ≥ 5 and y3 ≥ 4. Computing the numberof points in the union allowed us, by complementation, to find the number ofpoints in the total population not in that union, etc. If we wished to use thisanalysis for the problem as originally stated in terms of the xi, we would havehad four prohibitions, say

A1 = (x1, x2, x3, x4)|x1 + x2 + x3 + x4 = 12;∀i[xi ≥ 0]; x1 ≤ 1A2 = (x1, x2, x3, x4)|x1 + x2 + x3 + x4 = 12;∀i[xi ≥ 0]; x2 ≥ 5A3 = (x1, x2, x3, x4)|x1 + x2 + x3 + x4 = 12;∀i[xi ≥ 0]; x3 = 0A4 = (x1, x2, x3, x4)|x1 + x2 + x3 + x4 = 12;∀i[xi ≥ 0]; x3 ≥ 5

Then |A1| =(12+2

2

)+(11+2

2

), etc. This approach would be very tedious, as it

requires looking at 6 intersections of 2 sets and 4 intersections of 3 sets.

Page 37: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1009

Using ordinary generating functions:

(t2 + t3 + ...)(1 + t+ ...+ t4)(t+ t2 + ...+ t4)(1 + t+ t2 + ...)

=t2

1− t· 1− t

5

1− t· t (1− t

4)

1− t· 1

1− t

=t3(1− t4 − t5 + t9)

(1− t)4

= (t3 − t7 − t8 + t12)∞∑

m=0

(m+ 3

3

)tm

in which the coefficient of t12 is(123

)−(83

)−(73

)+(33

), as before.

C. [10 MARKS] Use the Euclidean algorithm — no other method will be acceptable— to determine integers m and n such that

gcd(341, 527) = 341m+ 527n

Solution: We apply the Eulidean algorithm:

527 = 1 · 341 + 186

341 = 1 · 186 + 155

186 = 1 · 155 + 31

155 = 5 · 31 + 0

Hence

gcd(341, 527) = 31 = 1 · 186− 155 = 1 · 186− 1 · (341− 1 · 186)

= (−1) · 341 + 2 · 186 = (−1) · 341 + 2(527− 1 · 341)

= 2 · 527− 3 · 341

D. [5 MARKS] Showing all your work, determine the number of binary relations onthe set 1, 2, ..., n which are not symmetric.

Solution: We shall count the symmetric relations first. Consider the n×n adjacencymatrix. There is no restriction on the diagonal entries: there are n of these, andthey may be chosen independently; by the Product Rule the number of possiblemain diagonals is 2n.

The off-diagonal entries are restricted in pairs. For any symmetrically positionedpair, say in positions (i, j) and (j, i) (where i 6= j) there are only two possible

Page 38: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1010

configurations of entries: either both entries are 0, or both entries are 1. Thusthere are 2 choices for any such pair; and there are 1

2(n2−n) such pairs. It follows

that the total number of symmetric relations is 2n · 2n2−n2 = 2

12(n2+n). The total

number of binary relations is 2n2; hence the number of binary relations that are

not symmetric is 2n2 − 212(n2+n).

E. [5 MARKS] Showing all your work, determine the number of binary relations onthe set 1, 2, ..., n which are antisymmetric.

Solution: Antisymmetry constrains off-diagonal symmetric pairs of entries in theadjacency matrix to be anything except both 1: thus there are 3 acceptable val-ues that the pair may take, corresponding to the three possible cases for i 6= j:

(i, j) ∈ R(j, i) /∈ R

,

(i, j) /∈ R(j, i) ∈ R

,

(i, j) /∈ R(j, i) /∈ R

. Antisymmetry does not constrain

in any way the main diagonal entries of the adjacency matrix: for any i (i, i) mayor may not be present in an antisymmetric relation R. Thus there are 2 choicesfor each of the main diagonal entries, and 3 choices for each of the off-diagonal

symmetric pairs. The total number of antisymmetric relations is 2n3n2−n

2 .

F. [5 MARKS] Prove or disprove: Let f : A → B be injective, and g : B → C besurjective. Then g f is always surjective.

Solution: The statement is false. Consider the following counterexample: A = a,B = b, c = C; f is given by f(a) = b; g = ιB, the identity function. Then f isevidently injective, and g is surjective; g f is the “constant” mapping on to b: nopoint of A is mapped on to c.

G. [5 MARKS] Prove or disprove: Let f : A → B be injective, and g : B → C besurjective. Then g f is always injective.

Solution: The statement is false. Consider the following counterexample: A =a, b = B, C = c; f = ιA, the identity function; g is the “constant” mappingon to c. For the composition to be injective it is necessary and sufficient that g fmap a and b on to distinct points of C. But C possesses only one point. From thiscontradiction we conclude that the composition is not injective.

H. [10 MARKS] The Fibonacci numbers are defined recursively by f0 = 0, f1 = 1,

fn+2 = fn+1 + fn (n ≥ 0) . (7)

After observing that f2 = 1, prove the following property of these numbers byinduction for all integers n ≥ 1. Only a proof by induction will be accepted. Do not

Page 39: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1011

use or determine a formula for the Fibonacci numbers!

n∑i=1

f 2i = fn · fn+1 (8)

Solution: Let P (n) denote statement (8).

Basis Step: P (1) states that f 21 = f1 · f2. We know this to be true, since f2 =

f1 + f0 = 1 + 0 = 1, so f 21 = 12 = 1 = 1 · 1 = f1 · f2.

Induction Step: Suppose that P (n) is true. Then

n+1∑i=1

f 2i =

n∑i=1

f 2i + f 2

n+1 by definition ofn+1∑i=1

= fnfn+1 + f 2n+1 by the induction hypothesis

= fn+1 (fn + fn+1)

= fn+1 · fn+2 by (7)

= fn+1 · f(n+1)+1 ,

which is P (n+ 1).

It follows by the Principle of Induction that P (n) is true for all positive integers n.

I. [10 MARKS] The Fibonacci numbers are defined recursively by f0 = 0, f1 = 1,

fn+2 = fn+1 + fn (n ≥ 0) . (9)

After observing that f2 = 1, prove the following property of these numbers byinduction for all integers n ≥ 1. Only a proof by induction will be accepted. Do notuse or determine a formula for the Fibonacci numbers!

n∑i=1

f2i−1 = f2n (10)

Solution: Let Q(n) denote statement (10).

Basis Step: Q(1) states that f1 = f2. We know this to be true, since f2 =f1 + f0 = 1 + 0 = 1 = f1.

Page 40: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1012

Induction Step: Suppose that Q(n) is true. Then

n+1∑i=1

f2i−1 =n∑

i=1

f2i−1 + f2n+1 by definition ofn+1∑i=1

= f2n + f2n+1 by the induction hypothesis

= f2n+2 by (9)

= f2(n+1) ,

which is Q(n+ 1).

It follows by the Principle of Induction that Q(n) is true for all positive integers n.

J. [5 MARKS] Let A = 1, 2, 3. Determine all the equivalence relations R on A. Foreach of these list all ordered pairs in the relation R. (No other representation ofthe relation will be accepted.)

Solution: We can classify these relations by finding the various possible partitionsof A. There are exactly 5 equivalence relations.

3 equivalence classes: Here each of the points of A lies alone in an equivalenceclass. The equivalence classes are, therefore, 1 , 2 , 3 so

R = (1, 1), (2, 2), (3, 3) .

2 equivalence classes: One class must have one point, and the other the remain-ing 2 points. There are 3 =

(31

)ways of partitioning a set of 3 into 2 sets of

these sizes. The class with one point gives rise to just one element of R; theclass with 2 points gives rise to 4 points — two of the form (n, n), and two ofthe form (m,n), (n,m), where m 6= n. The three possible relations are

(1, 1), (2, 2), (3, 3), (2, 3), (3, 2)

(2, 2), (3, 3), (1, 1), (3, 1), (1, 3)

(3, 3), (1, 1), (2, 2), (1, 2), (2, 1)

1 equivalence class: Here all points of A are in the same equivalence class, i.e.1, 2, 3. R must, therefore, contain all 9 of the ordered pairs in A × A.Consequently,

R = (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)

Page 41: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1013

K. [5 MARKS] Let B = 4, 5, 6. Determine all the equivalence relations R on B. Foreach of these equivalence relations, draw the digraph. (No other representation ofthe relation will be accepted.)

Solution: We can classify these relations by finding the various possible partitionsof B. There are exactly 5 equivalence relations.

3 equivalence classes: Here each of the points of B lies alone in an equivalenceclass. The equivalence classes are, therefore,

4 , 5 , 6

There is only one possible digraph: it has a loop at each of the vertices 4, 5,6, and no other directed edges.

2 equivalence classes: One class must have one point, and the other the remain-ing 2 points. There are 3 =

(31

)ways of partitioning a set of 3 into 2 sets of

these sizes. The class with 1 point gives rise to just one directed edge — aloop; the class with 2 points gives rise to 4 directed edges — two loops, anda pair of oppositely directed edges between the points.

1 equivalence class: Here all points of B are in the same equivalence class. Thedigraph of this relation has a loop at every vertex, and a pair of oppositelydirected edges between each of the

(32

)pairs of distinct vertices.

A.5 1997 Term Test

The test was administered on Wednesday, November 12th, 1997. Studentswere allowed 60 minutes on each of the following 4 versions:

Version 1 2 3 4 5 6Marks 5 5 10 10 10 10 50Version 1 I VIII III IV VII XIVersion 2 II IX III IV VI XVersion 3 I VIII III IV VII XIVersion 4 II IX III IV VI X

Problem V. was not used on any version of the test.

In some questions part marks were accorded for partial progress towards a solution.These were usually not “generous” unless the progress was substantial. Students areexpected to budget part of their time to verifying the correctness of their solutions; errors

Page 42: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1014

that could easily have been detected by verification6 procedures may have been takenmore seriously than other errors. It is particularly important to implement verificationprocedures in problems where you invest a substantial amount of time, for sometimes anearly error renders the rest of a solution useless.

I. [5 MARKS] Prove or disprove: On the 4-element set A = a, b, c, d the followingrelation is symmetric:

R = (a, b), (b, c), (a, c), (a, a), (c, b), (c, a) .

Solution: FALSE, since (a, b) ∈ R but (b, a) /∈ R.

II. [5 MARKS] Prove or disprove: On the 4-element set B = a, b, c, d the followingrelation is transitive:

S = (a, b), (b, c), (a, c), (c, a), (c, b), (b, a), (c, c) .

Solution: FALSE: while (a, c) ∈ S and (c, a) ∈ S, (a, a) /∈ S; for similar reasons,(b, b) must be, but is not present. The word transitive is used in other ways in othercontexts. Some students attributed to the word meanings closer to those seen inother contexts. Mathematical terminology is not always well chosen, cf. §??.

III. [10 MARKS] Using a truth table, or otherwise, determine whether or not thefollowing argument is a valid rule of inference.

p→ rq → r

(¬p ∧ ¬q) ∨ (¬q ∧ r)

Solution:

α := β :=p q r ¬p ¬q p→ r q → r ¬p ∧ ¬q ¬q ∧ r α ∨ βF F F T T T T T F TF F T T T T T T T TF T F T F T F F F FF T T T F T T F F FT F F F T T T F F FT F T F T T T F T TT T F F F T F F F FT T T F F T T F F F

6For example, the solution found to the homogeneous linear recurrence in the last question could besubstituted into the recurrence to check whether it did indeed satisfy the recurrence.

Page 43: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1015

Five lines of this table represent interpretations where both of the premisses aretrue: ll. ##1, 2, 4, 6, 8. In rows ##1, 2, 6 the conclusion is also true; but inrows ##4, 8 the conclusion is false. From these counterexamples we conclude thatthe argument is not universally true — i.e. that it is not a valid rule of inference.(It is not sufficient to compile the table and simply state a conclusion. You mustindicate how you are using information from the table. If you had some insight intodetecting the particular assignments of truth values which prove the claim invalid,you would not have needed the table at all.)

IV. [10 MARKS] Using generating functions — no other method will be accepted forthis problem — determine, for any integer n, the number of solutions in positiveintegers x1, x2 to the inequality x1 + x2 ≤ n.

Solution: Introduce a slack variable x3 = n−x1−x2, Then each solution to the giveninequality corresponds to a solution to the equation x1 + x2 + x3 = n. These areenumerated by the ordinary generating function (t+ t2 + t3 + ...)2(1+ t+ t2 + ...) =

t2(1 − t)3 =∞∑

m=0

(m+2

2

)tm+2 =

∞∑n=2

(n2

)tn. (The factor series begin with the term

t1 because the summands x1 and x2 were to be positive.) Hence the number ofsolutions for n is

(n2

); as the coefficients of powers of t lower than the 2nd are 0,

there are no solutions when n ≤ 1.

The purpose of this problem was to test the use of generating functions. We canverify the correctness of this solution by solving in another way. Define yi = xi− 1(i = 1, 2); y3 = x3; and count the number of solutions of the transformed equation,y1 + y2 + y3 = n − 2, in non-negative integers. These are equinumerous with thebinary strings of length (n − 2) + 2 with 2 1’s and n − 2 0’s, whose number isevidently

(n2

). Note that there are 0 solutions when n ≤ 1.

V. [10 MARKS] Using generating functions — no other method will be accepted forthis problem — determine, for any integer n, the number of nonnegative integersolutions to the equation x1 + x2 = n, where x1 is required to be even.

Solution: The enumerators for x1 and x2 will be, respectively, 1+t2+t4+...+t2m+...and 1 + t + t2 + ... + t` + ..., so the generating function for the numbers sought

is (1 − t2)−1(1 − t)−1 = 1+t(1−t2)2

= (1 + t)∞∑

m=0

(m+1

1

)(t2)m. The coefficient of t2m is

m + 1, so there are m + 1 solutions to x1 + x2 = 2m; the coefficient of t2m+1 ism+ 1, so there are m+ 1 solutions to x1 + x2 = 2m+ 1, in both cases x1 must beeven.

To verify this solution replace x1 by 2y1, and consider the equation x2 = n − 2y.When n = 2m, we are solving x2 = 2(m− y1) in non-negative integers: for each of

Page 44: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1016

the m + 1 values y1 = 0, 1, ...,m we have an admissible value for x2, and only forthese. When n = 2m + 1, we are solving x2 = 1 + 2(m − y1). Again, each of them+ 1 values y1 = 0, 1, ...,m yields an admissible value for x2.

We could combine the two solutions into a single statement: the number of solutionsto x1 + x2 = n in non-negative integers, where x1 is even, is dn+1

2e.

VI. [10 MARKS] Using the Principle of Inclusion-Exclusion — no other method will beaccepted for this problem — determine the number of strings x1x2x3x4 of length4 that can be formed from the digits 0, 1, ..., 9 if no digit appears exactly 2 timesin the string. Except for this type of restriction, any numbers of repetitions arepermitted.

Solution: The set of all strings, Ω, contains, by the Product Rule, 104 = 10, 000elements. Define the subset Ai to consist of all strings that contain exactly 2i’s (i = 0, 1, ..., 9). Then |Ai| =

(42

)92, since there are

(42

)ways of selecting the

locations for the prohibited i’s, after the placing of which there are exactly 9 waysof choosing the digits in each of the other 4 − 2 = 2 locations. For distinct i andj, |Ai ∩ Aj| =

(42

), the number of ways of choosing the locations for the i’s — after

which the j’s must be placed in the remaining two locations. By the Principle ofInclusion-Exclusion, the total number of strings is

104 −(

10

1

)(4

2

)92 +

(10

2

)(4

2

)= 10, 000− 4860 + 270 = 5410 ,

where(101

)counts the number of prohibited subsets, and

(102

)counts the number

of pairs of prohibited subsets.

Although it was required that students solve this problem using the Principle ofInclusion-Exclusion, we present, for verification purposes, a solution using expo-nential generating functions. The enumerator for each of the 10 possible digitsis

1 + x+ 0x2 +x3

3!+x4

4!+ ...

xn

n!+ ... = ex − x2

2

Raising to the 10th power yields, by the binomial theorem,(ex − x2

2

)10

= e10x − 5x2e9x +45

4x4e8x − ...

= ...+

(104

4!− 5 · 9

2

2!+

45

4

)x4 + ...

As the coefficient of x4 is 54104!

, the number of words is 5410, confirming the resultobtained using Inclusion-Exclusion.

Page 45: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1017

VII. [10 MARKS] Using the Principle of Inclusion-Exclusion — no other method willbe accepted for this problem — determine the number of strings y1y2y3y4y5y6 oflength 6 that can be formed from the digits 0, 1, ..., 9 if no digit appears exactly 3times in the string. Except for this type of restriction, any numbers of repetitionsare permitted.

Solution: The set of all strings, Ω, contains, by the Product Rule, 106 = 1, 000, 000elements. Define the subset Ai to consist of all strings that contain exactly 3i’s (i = 0, 1, ..., 9). Then |Ai| =

(63

)93, since there are

(63

)ways of selecting the

locations for the prohibited i’s, after the placing of which there are exactly 9 waysof choosing the digits in each of the other 6 − 3 = 3 locations. For distinct i andj, |Ai ∩ Aj| =

(63

), the number of ways of choosing the locations for the i’s — after

which the j’s must be placed in the remaining three locations. By the Principle ofInclusion-Exclusion, the total number of strings is

106 −(

10

1

)(6

3

)93 +

(10

2

)(6

3

)= 1, 000, 000− 145, 800 + 900 = 855, 100 ,

where(101

)counts the number of prohibited subsets, and

(102

)counts the number

of pairs of prohibited subsets.

Although it was required that students solve this problem using the Principle ofInclusion-Exclusion, we present, for verification purposes, a solution using expo-nential generating functions. The enumerator for each of the 10 possible digitsis

1 + x+x2

2!+ 0x3 +

x4

4!+ ...

xn

n!+ ... = ex − x3

6

Raising to the 10th power yields, by the binomial theorem,(ex − x3

6

)10

= e10x − 10

6x3e9x +

90

72x6e8x − ...

= ...+

(106

6!− 5

3· 9

3

3!+

5

4

)x6 + ...

As the coefficient of x4 is 8551006!

, the number of words is 855,100, confirming theresult obtained using Inclusion-Exclusion.

VIII. [5 MARKS] Using an incidence matrix, give an example of a graph on 4 verticeswhich is isomorphic to its complement, or prove that none can exist.

Solution: (cf. [17, Exercise 7.3.50]) The path of length 3 is such an example. Itsincidence matrix [17, p. 453] depends on the ordering of the vertices; it also requiresa labelling of the edges. An adjacency matrix [17, p. 451] requires only a labelling

Page 46: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1018

of the vertices. Had only an adjacency matrix been requested, one possible orderingwould give the matrix

0 1 0 01 0 1 00 1 0 10 0 1 0

.

However, it is an incidence matrix that is required here. If we retain the orderingof the vertices used in the preceding adjacency matrix, and label the edges so thate1 = 12, e2 = 23, e3 = 34, then the incidence matrix would be

1 0 01 1 00 1 10 0 1

.Had the graph in question not existed, there would have been an ambiguity in thequestion. It is not clear from the wording whether a non-existence proof wouldhave to “use” an incidence matrix. Since the graph does exist, this ambiguity isirrelevant.

IX. [5 MARKS] Using an incidence matrix, give an example of a graph on 5 verticeswhich is isomorphic to its complement, or prove that none can exist.

Solution: (cf. [17, Example 7.3.51]) The pentagon is such an example. Its incidencematrix [17, p. 453] depends on the ordering of the vertices; it also requires alabelling of the edges. An adjacency matrix [17, p. 451] requires only a labelling ofthe vertices. Had only an adjacency matrix been requested, one possible orderingwould give the matrix

0 1 0 0 11 0 1 0 00 1 0 1 00 0 1 0 11 0 0 1 0

.

However, it is an incidence matrix that is required here. If we retain the orderingof the vertices used in the preceding adjacency matrix, and label the edges so thate1 = 12, e2 = 23, e3 = 34, e4 = 45, e5 = 51, then the incidence matrix would be

1 0 0 0 11 1 0 0 00 1 1 0 00 0 1 1 00 0 0 1 1

.

Page 47: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1019

Had the graph in question not existed, there would have been an ambiguity in thequestion. It is not clear from the wording whether a non-existence proof wouldhave to “use” an incidence matrix. Since the graph does exist, this ambiguity isirrelevant.

X. [10 MARKS] Solve the recurrence 4an+2 − 12an+1 + 9an = 0 subject to the initialconditions a0 = 4, a1 = −2, and determine the value of a60. (The value of a60

should be expressed without Σ’s or ...’s, using not more than one + or − sign.)

Solution: The characteristic equation, 4r2 − 12r + 9 = 0, has a solution r = 32, 3

2,

of multiplicity 2. Hence the general solution is an = (α + βn)(

32

)n. Imposing the

initial conditions yields two equations,

α = 4

(α+ β)

(3

2

)= −2

from which we determine that β = −163. It follows that the particular solution is

an =

(4− 16n

3

)(3

2

)n

Thus a60 = −316(

32

)60.

XI. [10 MARKS] Solve the recurrence 25bn+2 + 10bn+1 + bn = 0 subject to the initialconditions b0 = −3, b1 = 1

2, and determine the value of b80. (The value of b80

should be expressed without Σ’s or ...’s, using not more than one + or − sign.)

Solution: The characteristic equation, 25r2+10r+1 = 0, has a solution r = −15,−1

5,

of multiplicity 2. Hence the general solution is bn = (α+βn)(−1

5

)n. Imposing the

initial conditions yields two equations,

α = −3

(α+ β)

(−1

5

)=

1

2

from which we determine that β = 12. It follows that the particular solution is

bn =(−3 +

n

2

)(−5)−n

Thus b80 = 37 · 5−80.

Page 48: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1020

A.6 1998 Term Test

There were four versions of this test. Each problem on each test was scored out of amaximum of 8. The selections of problems were as follows:

VersionsI, V 1 6 10 14 21

II, VI 2 7 11 17 18III, VII 3 8 13 15 19IV, VIII 5 9 12 16 20

Problem 4 was not used on any version of the test.

A.6.1 Problems on the counting of relations

1. Explaining your reasoning, determine the number of binary relations on the set1, 2, ..., n which are symmetric but not reflexive.

Solution: Represent each relation by a zero-one matrix M . There are(

n2

)off-

diagonal pairs of entries that must be filled alike: these pairs can be filled in 2(n2)

ways. The diagonal entries may be filled in any way save one — they cannot all be1, as then the relation would be reflexive; thus the diagonal entries may be filledin 2n − 1 ways. By the product rule, the number of symmetric relations that are

not reflexive is the product, 2(n2) · (2n − 1) = 2(

n+12 ) − 2(n

2).

2. Explaining your reasoning, determine the number of binary relations on the set1, 2, ..., n which are both antisymmetric and reflexive.

Solution: Represent each relation by a zero-one matrix M . There are(

n2

)off-

diagonal pairs of entries that may not both contain a 1: these pairs can be filled

in (2 · 2 − 1)(n2) ways. The diagonal entries may be filled in only one way each

— they must all be 1 for the relation to be reflexive. Accordingly, the number of

antisymmetric relations that are also reflexive is 3(n2).

3. Explaining your reasoning, determine the number of binary relations on the set1, 2, ..., n which are not both symmetric and reflexive.

Solution: Represent each relation by a zero-one matrix M . The total number ofbinary relations on the given set is 2n2

, since there are precisely n2 cells in thematrix, and each may be filled in 2 ways, independently of the others. We shallsubtract from this number the number of relations which are both symmetric andreflexive.

Page 49: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1021

For these, there are(

n2

)off-diagonal pairs of entries that must be filled alike: these

pairs can be filled in 2(n2) ways. The diagonal entries may be filled in only 1 way

— each must be a 1. Hence the number of binary relations that are not both

symmetric and reflexive is 2n2 − 2(n2).

4. Explaining your reasoning, determine the number of binary relations on the set1, 2, ..., n which are neither antisymmetric nor symmetric.

Solution: Represent each relation by a zero-one matrix M . We apply Inclusion-Exclusion. The total number of relations is 2n2

, as there are precisely n2 cells inthe matrix, which may be filled independently. From this we subtract

• the number of relations which are antisymmetric: the off-diagonal symmetri-cally located pairs may be filled in 22−1 ways each, since one of the 4 possiblecases — placing 1 in both locations — is forbidden; the diagonal entries maybe filled without any restriction. The number of these antisymmetric relations

is therefore, by the Product Rule, 3(n2) · 2n.

• the number of relations which are symmetric: the off-diagonal symmetricallylocated pairs may each be filled in 2 ways — either both are 0 or both are 1.Again, the diagonal entries are unrestricted. The number of these symmetric

relations is therefore, again by the Product Rule, 2(n2) · 2n.

Finally we must add the number of relations subtracted twice: those that are bothsymmetric and antisymmetric. In these the symmetrically located off-diagonalentries may only be filled with 0’s, so there is freedom only in the filling of thediagonal entries, which may be chosen arbitrarily. The number is therefore 2n.

By Inclusion-Exclusion, the number of relations that are neither antisymmetric norsymmetric is

2n2 − 3(n2) · 2n − 2(n

2) · 2n + 2n = 2n2 − 2n(3(n

2) + 2(n2) − 1

)5. Explaining your reasoning, determine the number of binary relations on the set1, 2, ..., n which are functions from the set 1, 2, ..., n to itself, but are not de-rangements.

Solution: Represent each relation by a zero-one matrix M . The functions haveexactly one 1 in each row of the matrix; there are n ways of filling each row — inall, nn functions. The number of derangements is, by Inclusion-Exclusion,

n!

(1− 1

1!+

1

2!+ ...+ (−1)r 1

r!+ ...+ (−1)n 1

n!

)

Page 50: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1022

so the number of functions which are not derangements is

nn − n!

(1− 1

1!+

1

2!+ ...+ (−1)r 1

r!+ ...+ (−1)n 1

n!

)

A.6.2 Solution of linear homogeneous recurrences with constant coef-ficients

For problems of this type the generating function approach is usually more difficult.We will give a sketch of a generating function solution only in the two cases werea student attempted one: neither student was successful.

6. Using any method, solve the following recurrence subject to the stated initial con-ditions:

4an+2 + 12an+1 + 5an = 0 (n ≥ 0)

a0 = 2

a1 = −7

Solution: The auxiliary polynomial is 4r2 + 12r + 5, whose roots are −52

and −12.

The general solution is of the form an = A(−5

2

)n+B

(−1

2

)n. Imposing the initial

conditions yields linear equations

2 = A+B

−7 = −5

2A− 1

2B

whose solution is A = 3, B = −1, so the particular solution which satisfies theinitial conditions is an = (3 · (−5)n − 1)

(−1

2

)n.

7. Using any method, solve the following recurrence subject to the stated initial con-ditions:

bn+2 − 14bn+1 + 49bn = 0 (n ≥ 0)

b0 = 4

b1 = 21

Solution: The auxiliary polynomial is r2 − 14r + 49 = (r − 7)2. As this has a root7 of multiplicity 2, the general solution is of the form bn = (C +Dn)7n. Imposingthe initial conditions yields linear equations

4 = C + 0

21 = (C +D)7

Page 51: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1023

whose solution is C = 4, D = −1, so the particular solution which satisfies theinitial conditions is bn = (4− n)7n.

8. Using any method, solve the following recurrence subject to the stated initial con-ditions:

9un + 9un−1 − 4un−2 = 0 (n ≥ 2)

u0 = −1

u1 = 3

Solution: The auxiliary polynomial is 9r2 + 9r − 4, whose roots are 13

and −43.

The general solution is of the form un = E(

13

)n+ F

(−4

3

)n. Imposing the initial

conditions yields linear equations

−1 = E + F

3 =1

3E − 4

3F

whose solution is E = 1, F = −2, so the particular solution which satisfies theinitial conditions is un = (1− 2(−4)n) ·

(13

)n.

Solution Using Generating Functions: Multiply the recurrence by xn and sum overall valid values, i.e. from n = 2 to ∞. If we define the generating function u(x) =∞∑

n=0

, we obtain, using the initial conditions, that

9(u(x)− (−1)− 3x) + 9x(u(x)− (−1))− 4x2u(x) = 0 ,

which reduces to u(x) = −9+18x9+9x−4x2 . Factorizing the denominator, and expanding by

partial fractions, we obtain u(x) = 11− 1

3x− 2

1+ 43x, whose MacLaurin expansion can

be found by combining the two geometric series expansions.

9. Using any method, solve the following recurrence subject to the stated initial con-ditions:

4gn − 12gn−1 + 9gn−2 = 0 (n ≥ 2)

g0 = −2

g1 = 3

Solution: The auxiliary polynomial is 4r2−12r+9 = (2r−3)2 = 4(r − 3

2

)2. As this

has a root 32

of multiplicity 2, the general solution is of the form gn = (G+Hn)(

32

)n.

Page 52: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1024

Imposing the initial conditions yields linear equations

−2 = G+ 0

3 = (G+H)3

2

whose solution is G = −2, H = 4, so the particular solution which satisfies theinitial conditions is gn = (−2 + 4n)

(32

)n.

Solution Using Generating Functions: Analogously to the solution to the preceding

problem, we can show that the generating function g(x) =∞∑

n=0

gnxn satisfies an

equation (4− 12x+ 9x2)g(x) = −8 + 36x, from which we can show that

g(x) =−2 + 9x

1− 3x+ 94x2

=−2 + 9x(1− 3

2x)2

and we know the expansions of all negative powers (1− y)−r.

A.6.3 Use of ordinary generating functions to count ordered additivepartitions of integers

10. Using ordinary generating functions — no other method will be accepted — deter-mine the number of solutions of the equation

x1 + x2 + x3 = n

in ordered triples (x1, x2, x3) of integers, subject to the conditions

1 ≤ x1

2 ≤ x2

3 ≤ x3

that must all be satisfied.

Solution: The number of solutions will be the coefficient of tn in the expansion of

(t+ t2 + t3 + ...)(t2 + t3 + t4 + ...)(t3 + t4 + t5 + ...)

=t

1− t· t2

1− t· t3

1− t

Page 53: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1025

= t6 · (1− t)−3

= t6 ·∞∑

m=0

(m+ 2

2

)tm

=∞∑

m=0

(m+ 2

2

)tm+6

=∞∑

n=6

(n− 4

2

)tn

i.e.(

n−42

).

11. Using ordinary generating functions — no other method will be accepted — deter-mine the number of solutions of the equation

y1 + y2 + y3 = m

in ordered triples (y1, y2, y3) of integers, subject to the conditions

0 ≤ y1

3 ≤ y2

4 ≤ y3

that must all be satisfied.

Solution: The number of solutions will be the coefficient of tn in the expansion of

(1 + t+ t2 + ...)(t3 + t4 + t5 + ...)(t4 + t5 + t6 + ...)

=1

1− t· t3

1− t· t4

1− t= t7 · (1− t)−3

= t7 ·∞∑

n=0

(n+ 2

2

)tn

=∞∑

n=0

(n+ 2

2

)tn+7

=∞∑

m=7

(m− 5

2

)tm

i.e.(

m−52

).

Page 54: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1026

12. Using ordinary generating functions — no other method will be accepted — deter-mine the number of solutions of the equation

z1 + z2 + z3 + z4 = n

in ordered triples (z1, z2, z3) of integers, subject to the conditions

1 ≤ z1

1 ≤ z2

1 ≤ z3

1 ≤ z4

that must all be satisfied.

Solution: The number of solutions will be the coefficient of tn in the expansion of

(t+ t2 + t3 + ...)4

=

(t

1− t

)4

= t4(1− t)−4

= t4 ·∞∑

m=0

(m+ 3

3

)tm

=∞∑

m=0

(m+ 3

3

)tm+4

=∞∑

n=4

(n− 1

3

)tn

i.e.(

n−13

).

13. Using ordinary generating functions — no other method will be accepted — deter-mine the number of solutions of the equation

w1 + w2 + w3 = n (n ≥ 3)

in ordered triples (w1, w2, w3) of integers, subject to the conditions

0 ≤ w1

0 ≤ w2

0 ≤ w3 ≤ 2

that must all be satisfied.

Page 55: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1027

Solution: The number of solutions will be the coefficient of tn in the expansion of

(1 + t+ t2 + t3 + ...)(1 + t1 + t2 + t3 + ...)(1 + t+ t2)

=1

1− t· 1

1− t· 1− t

3

1− t= (1− t3) · (1− t)−3

= (1− t3) ·∞∑

m=0

(m+ 2

2

)tm

=∞∑

m=0

(m+ 2

2

)tm −

∞∑m=0

(m+ 2

2

)tm+3

=∞∑

m=0

(m+ 2

2

)tm −

∞∑n=3

(n− 1

2

)tn

For n ≥ 3 the coefficient of tn is the difference(n+ 2

2

)−(n− 1

2

)= 3n .

Alternatively, one could proceed as follows:

(1 + t+ t2 + t3 + ...)(1 + t1 + t2 + t3 + ...)(1 + t+ t2)

= 1 + t+ t2(1− t)−2

=∞∑

m=0

(m+ 1

1

)tm +

∞∑n=1

(n

1

)tn +

∞∑n=2

(n− 1

1

)tn

=∞∑

n=0

3ntn

A.6.4 Logic and induction

(The form of an induction proof is important. Students should read their textbookor notes to see models of such proofs. Among other common defects was thefollowing: when you wish to prove, for example, that. as in the first problembelow, the proposition we have called P (1) is true, you need to prove that theinstance of the claimed formula, in this case 3·1·2

3is equal to the sum, in this case∑1

i=1 i(i + 1). Your proof could consist of evaluating the two expressions, andobserving that they are equal; or it could consist of a sequence of equations like

1∑i=1

i(i+ 1) = 1 · 2 = 2 =(1 + 2)1(1 + 1)

3.

Page 56: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1028

But it is very poor form to end your proof of this base case with a tautology like2 = 2. Such a tautology never contributes anything to a proof, and suggests thatyou have misunderstood the logic.)

14. Prove by induction — no other method will be accepted — that

n∑i=1

i(i+ 1) =(n+ 2)n(n+ 1)

3. (11)

Solution: Denote proposition (11) by P (n).

Base Case: By direct computation we find that

1∑i=1

i(i+ 1) = 1(1 + 1)

= 2 =(1 + 2)1(2)

3

establishing the truth of P (1).

Induction Step: Assume that P (N) is known to be true. Then

N+1∑i=1

i(i+ 1) =N∑

i=1

i(i+ 1) + (N + 1)(N + 2) by definition of∑

=(N + 2)N(N + 1)

3+ (N + 1)(N + 2)

by induction hypothesis

=(N + 3)(N + 1)(N + 2)

3=

(N + 1 + 2)(N + 1)(N + 1 + 1)

3

which is P (N + 1). It follows by the (First) Principle of Induction that P (n)is true for all n ≥ 1.

15. Prove by induction — no other method will be accepted — that

m∑j=1

j(j + 2) =(2m+ 7)m(m+ 1)

6. (12)

Solution: Denote proposition (12) by P (n).

Page 57: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1029

Base Case: By direct computation we find that

1∑j=1

j(j + 2) = 1(1 + 2)

= 3 =(2 + 7)1(2)

6

establishing the truth of P (1).

Induction Step: Assume that P (N) is known to be true. Then

N+1∑j=1

j(j + 2) =N∑

j=1

j(j + 2) + (N + 1)(N + 3) by definition of∑

=(2N + 7)N(N + 1)

6+ (N + 1)(N + 3)

by induction hypothesis

=(2 ·N + 1 + 7)(N + 1)(N + 1 + 1)

6

which is P (N + 1). It follows by the (First) Principle of Induction that P (n)is true for all n ≥ 1.

16. Use a truth table to determine whether or not the following argument is valid:

a→ b(b→ c)→ a

a ∨ c) a ∧ b

Solution: (Many students misunderstood the significance of the validity of theargument. What must be shown is that, whenever the three premises are true,the conclusion is true. We need not prove the converse, although many studentsbelieved that this was the meaning of validity. Nor must we prove that the con-clusion and the conjunction of the three hypothesis are logically equivalent. In thepresent case the last two alternatives happen to be true, but these are not what

Page 58: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1030

the problem asked to be proved.)

a b c a→ b b→ c (b→ c)→ a a ∨ c a ∧ b0 0 0 1 1 0 0 00 0 1 1 1 0 1 00 1 0 1 0 1 0 00 1 1 1 1 0 1 01 0 0 0 1 1 1 01 0 1 0 1 1 1 01 1 0 1 0 1 1 11 1 1 1 1 1 1 1

In the table, the only lines in which the three premises are all true are lines ##7,8; in both of these cases the conclusion a ∧ b is also true. Thus the argument isvalid.

17. Use a truth table to determine whether or not the following argument is valid:

u ∨ vw ∨ (¬u)

(w → v)→ u) v ∧ u

Solution:

u v w ¬u u ∨ v w ∨ ¬u w → v (w → v)→ u v ∧ u0 0 0 1 0 1 1 0 00 0 1 1 0 1 0 1 00 1 0 1 1 1 1 0 00 1 1 1 1 1 1 0 01 0 0 0 1 0 1 1 01 0 1 0 1 1 0 1 01 1 0 0 1 0 1 1 11 1 1 0 1 1 1 1 1

In the table, the only lines in which the three premises are all true are lines ##6,8; in line #6 the conclusion v ∧ u isfalse. From this failure, we assert that theargument is invalid.

A.6.5 Prove or disprove

(In problems of this type no marks were given if the incorrect choice was made:one cannot partially prove a statement which is false, or partially disprove a truestatement.)

Page 59: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1031

18. If the following statement is true, prove it; if it is false, provide a counterexample:

On the set R of real numbers, the relation R defined by

(x, y) ∈ R⇔ x 6= y

is an equivalence relation.

Solution: This relation is not transitive. For example, 1 6= 2 and 2 6= 1, but it isnot true that 1 6= 1. From this one instance of the failure of transitivity, we mayassert that the relation is not transitive, hence it is not an equivalence relation.

Ever more simply, we observe that this relation cannot be reflexive — indeed, it isirreflexive and R is non-empty. Hence again R cannot be an equivalence relation.

19. If the following statement is true, prove it; if it is false, provide a counterexample:

On the set Z of all integers, the relation S defined by

(a, b) ∈ S ⇔ a|b

is a partial ordering.

Solution: This relation was defined on all integers, positive and negative. Since−1 | 1 and 1 | −1, we would require, for antisymmetry, that −1 = 1. That is notthe case, so the relation is not intransitive, hence it is not a partial order. (Hadwe confined ourselves to the positive integers, the relation would then have been apartial order.)

20. If the following statement is true, prove it; if it is false, provide a counterexample:

The number of surjections from a set A = a, b, c, d of four elements toa set B = e, f, g of three elements is

34 − 3 · 24 + 3 = 36

Solution: The set Ω of all functions from A to B contains 34 elements. If wedenote respectively by U1, U2, U3 the subsets of functions which do not assumethe values e, f , g, then each of these subsets contains 24 functions, and there are 3such sets. The intersections of the

(32

)= 3 pairs of these sets each contains exactly

14 = 1 function; and the intersection of all three of these sets contains no functions.Accordingly, by the Inclusion-Exclusion Principle, the number of surjections is thealternating sum 34 − 3 · 24 + 3 · 1− 0 = 36, as claimed.

Page 60: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1032

Another Solution: One of the points of A will be the image of two points, and theothers will be the image of one point each. Choose the point which is the image oftwo points in

(31

)ways, and multiply by the number of ways in which the two points

mapped on to it may be chosen, i.e. by(42

). This leaves two points, each of which

is the image of one of the remaining points of the domain, and the assignment maybe made in 2! ways. In all we have(

3

1

)(4

2

)2! = 36

surjections.

At least one other correct solution was proposed by a student.

21. If the following statement is true, prove it; if it is false, provide a counterexample:

Among any set of 101 integers between 1 and 200 there must be twodistinct integers — call them m and n — such that (m+ 1)|(n+ 1).

Solution: We know by [17, Example 8, p. 246] that there must exist at least onepair of distinct integers a and b in the set of 101 integers such that a|b. This resultis so similar to the question, and had been discussed in the lectures, that it wasexpected to be the starting point in solving the problem. The claim would be trueprovided we could interpret m + 1 as a and n + 1 as b. Since b will be at least 2,there is no harm in defining n = b − 1. However, it could happen that we cannotdefine m = a− 1: that could occur if a− 1 is not in the set, for example, if a is thesmallest member of the set. One such example is in the set 100, 101, 102, ..., 200.For any distinct integers m and n In this set,

n+ 1

m+ 1≤ 200 + 1

m+ 1≤ 201

100 + 1< 2 ,

so (m + 1) - (n + 1). So, from this particular counterexample, we see that thestatement is not universally true: i.e. the claim is false.

A.7 Solutions to Problems on the 1999 Class Tests

The test was administered on Wednesday, November 10th, 1999, in four versions. Stu-dents were allowed about 45 minutes for each of the versions. Each examination had sixquestions, each marked out of 10.

Page 61: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1033

1 2 3 4 5 6Version

Version 1 A E I M Q UVersion 2 F V N R B JVersion 3 W K S C O GVersion 4 L H D X T P

Students are reminded that the instructions clearly stated that “you must indicate anycontinuation clearly on the page where the question is printed.” Since the examinationmay be graded question by question over the whole class (i.e. the grader may first gradequestion 3 for all the students, then go on to question 5 for all the students, etc.) thegrader may not know that you have continued a solution on some other page unlessyou specifically indicate where he should look. So you should write a clear messagelike “Continued on continuation page...” or “ Continued on the back of this page...” or“Continued facing page 3...”.

In many cases students received full marks even though answers were not reducedto simplest terms. For purposes of the final examination, let it now be understood thatsolutions should be in “simplest form” wherever the reduction involves integers or frac-tions that involve integers that are three decimal digits or less. Thus, you will be expectedto replace

(53

)by 10, but you will not be expected to evaluate

(104

). Where the reduction

requires little energy, you should carry it out in case the reduced final answer may lookwrong, and may indicate an earlier error.

A.7.1 Proving or disproving the validity of a rule of inference

Some students did not understand what was meant by a Rule of Inference. In such a rulewe claim that the truth of hypotheses φ1, φ2, ..., φm implies the truth of a conclusion ψ.In these problems there were two hypotheses: one needed to look only at those rows ofthe truth table in which both hypotheses were true, and to verify that the conclusion wastrue in every such line; equivalently, one had to prove that the proposition φ1 ∧ φ2 → ψwas true. This is not the same as proving that the propositions φ1 ∧ φ2 and ψ haveexactly the same truth values for all values of the elementary variables, as, in the caseswhere φ1 ∧ φ2 is false, the implication φ1 ∧ φ2 → ψ will be true even if ψ is false.

A Using a truth table — no other method will be accepted — prove or disprove the

validity of the following rule of inference:p→ q¬q) ¬p

. You are expected to indicate

unambiguously precisely which information in the truth table is being used to proveor disprove the validity.

Page 62: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1034

Solution: In the truth table

p q ¬q ¬p p→ qF F T T TF T F T TT F T F FT T F F T

We need only look at those rows in which both hypotheses, p→ q and ¬q are true;here the two hypotheses are true only in the first row. In that row we observethat the conclusion, ¬p is also true. That is all that is required to prove validityof the rule of inference. (Had there existed a row in the truth table in which thehypotheses were all true but the conclusion was false, we would have deduced thatthe proposed rule of inference was invalid.)

B Using a truth table — no other method will be accepted — prove or disprove the

validity of the following rule of inference:¬p→ ¬q

q) p

. You are expected to indicate

unambiguously precisely which information in the truth table is being used to proveor disprove the validity.

Solution: In the truth table

p q ¬p ¬q ¬p→ ¬qF F T T TF T T F FT F F T TT T F F T

We need only look at those rows in which both hypotheses, ¬p → ¬q and q aretrue; here the two hypotheses are true only in the fourth row. In that row weobserve that the conclusion, p is also true. That is all that is required to prove ordisprove the validity of the rule of inference. (Had there existed a row in the truthtable in which the hypotheses were all true but the conclusion was false, we wouldhave deduced that the proposed rule of inference was invalid.)

C Using a truth table — no other method will be accepted — prove or disprove the

validity of the following rule of inference:¬r

q → r) ¬q

. You are expected to indicate

unambiguously precisely which information in the truth table is being used to proveor disprove the validity.

Page 63: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1035

Solution: In the truth table

q r ¬r ¬q q → rF F T T TF T F T TT F T F FT T F F T

We need only look at those rows in which both hypotheses, q → r and ¬r are true;here the two hypotheses are true only in the first row. In that row we observe thatthe conclusion, ¬q is also true. That is all that is required to prove or disprovethe validity of the rule of inference. (Had there existed a row in the truth tablein which the hypotheses were all true but the conclusion was false, we would havededuced that the proposed rule of inference was invalid.)

D Using a truth table — no other method will be accepted — prove or disprove the

validity of the following rule of inference:s

¬p→ ¬s) p

. You are expected to indicate

unambiguously precisely which information in the truth table is being used to proveor disprove the validity.

Solution: In the truth table

p s ¬p ¬s ¬p→ ¬sF F T T TF T T F FT F F T TT T F F T

We need only look at those rows in which both hypotheses, ¬p → ¬s and s aretrue; here the two hypotheses are true only in the fourth row. In that row weobserve that the conclusion, p is also true. That is all that is resuired to provevalidity of the rule of inference. (Had there existed a row in the truth table inwhich the hypotheses were all true but the conclusion was false, we would havededuced that the proposed rule of inference was invalid.)

A.7.2 Injective and surjective functions

Some students inferred from the composition statements given in the followingproblems that the functions were mutual inverses. The definition of inverses re-quires two statements equating a composition to an identity; one such statement

Page 64: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1036

does not imply that the functions are inverses; (students should be able to manufac-ture a counterexample to show that the given composition does not imply that thefunctions are mutual inverses). Any “proof” based on such reasoning was defective.

Where a problem of this type appears difficult, a first attack would be to experimentwith “small” examples. This could lead both to a generalization which would yielda proof, if the statement is true; or to a simple counterexample, if the statementis false. In the four problems following, two involved true statements, and twofalse. One might have expected students who had done some experimentation tohave succeeded in finding counterexamples, as the examples we have presented aresmall; but the opposite was the case — on all the papers where the statement wasfalse, only one student was able to produce a counterexample (and his was not the“smallest”.) More students were successful in the problems where the statementwas true.

E Let f : B → A and g : A→ B be any functions, and suppose that f g = ιA, theidentity function on A. Prove or disprove: f must be surjective.

Solution: The statement is true. For any x ∈ A,

x = ιA(x) definition of ιA

= (f g)(x)= f(g(x))

Thus x is the image of the point g(x) in B under the function f .

F Let f : B → A and g : A→ B be any functions, and suppose that f g = ιA, theidentity function on A. Prove or disprove: f must be injective.

Solution: The statement is false. Here is a small counterexample. Let A = 1,B = 2, 3. here is only one possible function f : B → A, given by x 7→ 1(x = 2, 3). Let us define g to be the function 1 7→ 2. Then f g is the only possiblefunction from B to B, mapping 1 on to 1. But f is not injective, since two distinctpoints have the same image.

G Let f : B → A and g : A→ B be any functions, and suppose that f g = ιA, theidentity function on A. Prove or disprove: g must be surjective.

Solution: The statement is false. Here is a small counterexample. Let A = 1,B = 2, 3. here is only one possible function f : B → A, given by x 7→ 1(x = 2, 3). Let us define g to be the function 1 7→ 2. Then f g is the only possiblefunction from B to B, mapping 1 on to 1. But g is not surjective, since no pointis mapped on to 3.

Page 65: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1037

H Let f : B → A and g : A→ B be any functions, and suppose that f g = ιA, theidentity function on A. Prove or disprove: g must be injective.

Solution: The statement is true. For all a1, a2 ∈ A,

g(a1) = g(a1)

⇒ f(g(a1)) = f(g(a1))

⇒ (f g)(a1) = (f g)(a1) definition of f g⇒ a1 = a1 since ∀x[(f g)(x) = x] is true

A.7.3 Particular solutions of inhomogeneous recurrences

The general theory of inhomogeneous recurrences provides a form for a particularsolution, involving “undetermined coefficients”. These coefficients are determined,for example, by substituting the form into the recurrence and either comparingcoefficients of like powers of the variable, or by assigning “convenient” values tothe variable: in either case, or in a combination of these methods, equations may beobtained that can be solved for the coefficients. Many students failed to completethe solution by determining the coefficients.

Where this substitution leads to a system of solutions which admit no simultaneoussolution, that is an indication that an error has been made earlier in the formassumed for the particular solution.

I Showing all your work, determine a sequence a0, a1, ..., an, ... (i.e. a “particular”solution) which satisfies the inhomogeneous recurrence

an+2 − 4an+1 + 3an = n · 2n (n = 0, 1, ...) (13)

You are expected to solve this problem “systematically”: that is, your solutionshould demonstrate that you could solve any problem of this type, where the func-tion to the right of the equal sign is any product of the form polynomial × expo-nential.

Solution: The “characteristic” polynomial is x2 − 4x+ 3, whose roots are 1 and 3.As 2 is not one of these roots, we know by [19, Theorem 6, p. 328], that there is asolution of the form

an = (An+B)2n (n = 0, 1, 2, ...) , (14)

where A and B are constants to be determined. Substituting (14) in (13), we obtain(A(n+ 2) +B) · 2n+2 − 4(A(n+ 1) +B)2n+1 + 3(An+B)2n = n · 2n (n = 0, 1, ...),which implies that

4(A(n+ 2) +B)− 8(A(n+ 1) +B) + 3(An+B) = n (n = 0, 1, ...) . (15)

Page 66: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1038

Equating coefficients of like powers of n yields equations which can be solved toshow that A = −1, B = 0. This information could also be obtained by givingn “convenient” values in (15), and solving the resulting equations. For example,when n = 0, we obtain −B = 0; and, when n = −1, we obtain A−B = −1.7 Thusone “particular” solution is an = −n2n.8

The recurrence can be solved in general using generating functions, but this istechnically much more difficult than the preceding method. We define A(t) =∞∑

n=0

antn to be the generating function for the solution. Multiplying (13) by tn+2

and summing as t = 0, 1, ..., we obtain∞∑

n=0

an+2tn+2 − 4t

∞∑n=0

an+1tn+1 + 3t2

∞∑n=0

antn = t2

∞∑n=0

n(2t)n

⇒∞∑

m=2

amtm − 4t

∞∑m=1

amtm + 3t2

∞∑n=0

antn = t2

∞∑n=0

n(2t)n

⇒(A(t)− a0t

0 − a1t1)− 4t

(A(t)− a0t

0)

+ 3t2A(t)

= t2 · t∞∑

n=0

d

dt((2t)n) = t3

d

dt

(1

1− 2t

)⇒

(1− 4t+ 3t2

)A(t) = a0 + (a1 − 4a0)t+

2t3

(1− 2t)2

⇒ A(t) =a0 + (a1 − 4a0)t

(1− 3t)(1− t)+

2t3

(1− 3t)(1− t)(1− 2t)2

The following partial fraction expansions and MacLaurin expansions can be ob-tained in the usual ways:

1

(1− 3t)(1− t)=

32

1− 3t−

12

1− t

=3

2

∞∑n=0

3ntn − 1

2

∞∑n=0

tn

2t3

(1− 3t)(1− t)(1− 2t)2=

1

1− 3t− 1

1− t− 1

(1− 2t)2+

1

1− 2t

=∞∑

n=0

(3n − 1− (n+ 1)2n + 2n) tn

7The values taken for n need not be non-negative integers — any real value will do!8This is not the only possible “particular” solution. Since the general solution of the associated

homogeneous recurrence is ahomogn = C · 3n + D · 1n, i.e. ahomog

n = C · 3n + D, all particular solutionshave the form ahomog

n = C · 3n + D − n2n, where C and D are any real numbers.

Page 67: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1039

=∞∑

n=0

(3n − 1− n · 2n) tn

so the general solution is

A(t) = (a0 + (a1 − 4a0)t)∞∑

m=0

(3

2· 3m − 1

2· 1m

)tm +

∞∑m=0

(3m − 1−m · 2m) tm

= a0

∞∑m=0

(3

2· 3m − 1

2· 1m

)tm + (a1 − 4a0)

∞∑m=0

(3

2· 3m − 1

2· 1m

)tm+1

+∞∑

m=0

(3m − 1−m · 2m) tm

= a0

∞∑n=0

(3

2· 3n − 1

2

)tn + (a1 − 4a0)

∞∑n=1

(1

2· 3n − 1

2

)tn

+∞∑

n=0

(3n − 1− n · 2n) tn

=∞∑

n=0

(a0

(3

2· 3n − 1

2

)+ (a1 − 4a0)

(1

2· 3n − 1

2

)+ (3n − 1− n · 2n)

)tn

from which we conclude that

an =a1 − a0 + 2

2· 3n − n · 2n +

3a0 − a1 − 2

2

J Showing all your work, determine a sequence a0, a1, ..., an, ... (i.e. a “particular”solution) which satisfies the inhomogeneous recurrence

an+2 + 3an+1 − 4an = n− 1 (n = 0, 1, ...) (16)

You are expected to solve this problem “systematically”: that is, your solutionshould demonstrate that you could solve any problem of this type, where the func-tion to the right of the equal sign is any product of the form polynomial × expo-nential.

Solution: The “characteristic” polynomial is x2 + 3x − 4, whose roots are 1 and−4. As n− 1 = (n− 1) · 1n, and 1 is one of these roots, we know by [19, Theorem6, p. 328], that there is a solution of the form

an = n(An+B)1n = An2 +Bn (n = 0, 1, 2, ...) , (17)

Page 68: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1040

where A and B are constants to be determined. Substituting (17) in (16), weobtain (A(n+ 2)2 +B(n+ 2)) + 3(A(n+ 1)2 +B(n+ 1))− 4(An2 +Bn) = n− 1(n = 0, 1, ...). Equating coefficients of like powers of n yields equations as follows:

0 = 0

10A = 1

7A+ 5B = −1

which we may solve, to obtain A = 110

, B = −1750

. Hence one particular solution is

an = 5n2−1750

.

K Showing all your work, determine a sequence a0, a1, ..., an, ... (i.e. a “particular”solution) which satisfies the inhomogeneous recurrence

an+2 + 2an+1 + an = 6n− 3 (n = 0, 1, ...) (18)

You are expected to solve this problem “systematically”: that is, your solutionshould demonstrate that you could solve any problem of this type, where the func-tion to the right of the equal sign is any product of the form polynomial × expo-nential.

Solution: The “characteristic” polynomial is x2+2x+1, whose roots are −1 (twice).As 6n−3 = (6n−3) ·1n, and 1 is not one of these roots, we know by [19, Theorem6, p. 328], that there is a solution of the form

an = (An+B)1n (n = 0, 1, 2, ...) , (19)

where A and B are constants to be determined. Substituting (19) in (18), weobtain (A(n + 2) + B) + 2(A(n + 1) + B) + 1(An + B) = 6n − 3 (n = 0, 1, ...).Equating coefficients of like powers of n yields equations as follows:

4A = 6

4A+ 4B = −3

which we may solve, to obtain A = 32, B = −9

4. Hence one particular solution is

an = 34(2n− 3).

L Showing all your work, determine a sequence a0, a1, ..., an, ... (i.e. a “particular”solution) which satisfies the inhomogeneous recurrence

an+2 + 6an+1 + 9an = n · 3n (n = 0, 1, ...) (20)

Page 69: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1041

You are expected to solve this problem “systematically”: that is, your solutionshould demonstrate that you could solve any problem of this type, where the func-tion to the right of the equal sign is any product of the form polynomial × expo-nential.

Solution: The “characteristic” polynomial is x2+6x+9, whose roots are −3 (twice).As 3 is not one of these roots, we know by [19, Theorem 6, p. 328], that there is asolution of the form

an = (An+B)3n (n = 0, 1, 2, ...) , (21)

where A and B are constants to be determined. Substituting (20) in (21), we obtain(A(n + 2) + B)3n+2 + 6(A(n + 1) + B)3n+1 + 9(An + B)3n = n · 3n (n = 0, 1, ...),which simplifies to 9A(4n+ 4) + 36B = n (n = 0, 1, 2, ...).. Equating coefficients oflike powers of n yields equations as follows:

36A = 1

4A+ 4B = 0

which we may solve, to obtain A = 136

, B = − 136

. Hence one particular solution isan = n−1

4· 3n.

A.7.4 Pigeonhole principle

M Prove or disprove: Among any 1000 distinct integers chosen from the set n : (n ∈N) ∧ (1 ≤ n ≤ 2000) there must exist one integer that divides one of the others.

Solution: The statement is false. As a counterexample take the set 1001, 1002,..., 2000. Here the ratio of any elements of this set to any smaller element is≤ 2000

1001< 2.

N Prove or disprove: Among any 800 distinct integers chosen from the set n : (n ∈N) ∧ (1 ≤ n ≤ 1600) at least two must be consecutive.

Solution: The statement is false. One counterexample is the set 1, 3, 5, ..., 1599,which has 800 members, no two of which are consecutive.

O Prove or disprove: Among any 610 distinct integers chosen from the set A = n :(n ∈ N) ∧ (1 ≤ n ≤ 1200) at least two must be consecutive.

Solution: The statement is true. Consider the 600 sets of the form 2m+1, 2m+2(m = 0, 1, ..., 599). The union of these sets is the set A, so each of the 610 integerschosen is contained in one of these subsets; as the number of integers selected

Page 70: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1042

exceeds the number of subsets, one subset contains at least two of the selectedintegers. But each subset consists of a consecutive pair.

Where students applied the Pigeonhole Principle they were expected to be preciseabout the “pigeonholes”, and what determined whether a point was placed insuch a pigeonhole. It was not sufficient to observe, for example, that the integerd1200

610e = 2.

P Assume that “friendship” is a symmetric irreflexive relation: i.e. if x is a friend ofy, then y is a friend of x; and no person is consided a friend of herself. Prove ordisprove: In any group of five persons there will always exist either three persons,each of which is a friend of the other two; or three persons, each of which is not afriend of the other two.

Solution: The statement is false. If the persons are labelled 1, 2, 3, 4, 5, then acounterexample can occur when the only friendships are 1 and 2, 2 and 3, 3 and 4, 4and 5, 5 and 1. Here there are exactly 5 non-friendships, and they also do not yielda “monochromatic triangle”. (The terminology refers to a representation of therelation as a colouring of the edges of a complete graph on five vertices: friendshipsyields a pentagon with one colour, non-friendship is given by the remaining

(52

)−5 =

5 edges, bearing the other colour.)

The preceding is, except for the labelling of the persons, the only counterexample.Had there been six persons, rather than 5, the claim would have been true, as asimple case of Ramsey’s Theorem [19, Example 4.2.10], or of the theorem of P.Erdos and Gy. Szekeres [26], [25, p. 18].

A.7.5 Permutations

Q Showing all your work, determine the number of 4-letter words that can be formedfrom the letters of the word BANANAS. You are expected to solve this problem“systematically”: that is, your solution should demonstrate that you could solveany problem of this type, for any given collection of letters. You will not receiveany marks if you simply list the words.

Solution: The given population has 3 letters of one type (A), 2 letters of a secondtype (N), and 1 each of two other letters (B, S). We shall subdivide the set of 4-letter words according to the multiplicities of the letters chosen, classified accordingto partitions of 4 into sums of positive integers.

4 = 4: This case cannot occur, as none of the letters is available in 4 copies.

Page 71: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1043

4 = 3 + 1: We can choose a letter of multiplicity 3 in(11

)= 1 way, and the letter

of multiplicity 1 in(4−11

)= 3 ways. Each of these 3 choices can be arranged

in 4!3!1!

= 4 ways. Thus there are 3× 4 = 12 words of this type.

4 = 2 + 2: We can choose two letters of multiplicity 2 from two possible letterswhich are available in multiplicities of at least 2 in

(22

)= 1 way. The chosen

letters can be arranged in 4!2!2!

= 6 ways. There are 1 × 6 = 6 words of thistype.

4 = 2 + 1 + 1: We can choose the letter having multiplicity 2 in(21

)= 2 ways, and

the other two letters in(4−12

)= 3 ways. The chosen letters may be arranged

in 4!2!1!1!

= 12 ways. The number of these words is 2× 3× 12 = 72.

4 = 1 + 1 + 1 + 1: There are only 4 kinds of letters available, so they may be chosenin(44

)= 1 way. They may be arranged in 4! = 24 ways.

The number of words is therefore 12 + 6 + 72 + 24 = 114.

R Showing all your work, determine the number of 4-letter words that can be formedfrom the letters of the word MEMENTO. You are expected to solve this problem“systematically”: that is, your solution should demonstrate that you could solveany problem of this type, for any given collection of letters. You will not receiveany marks if you simply list the words.

Solution: The given population has 2 letters of two types (E, M), and 1 each ofthree other letters (N, O, T). We shall subdivide the set of 4-letter words accordingto the multiplicities of the letters chosen, classified according to partitions of 4 intosums of positive integers.

4 = 4: This case cannot occur, as none of the letters is available in 4 copies.

4 = 3 + 1: This case also cannot occur, as no letter is available in multiplicity 3.

4 = 2 + 2: We can choose two letters of multiplicity 2 from two possible letterswhich are available in multiplicities of at least 2 in

(22

)= 1 way. The chosen

letters can be arranged in 4!2!2!

= 6 ways. There are 1 × 6 = 6 words of thistype.

4 = 2 + 1 + 1: We can choose the letter having multiplicity 2 in(21

)= 2 ways, and

the other two letters in(5−12

)= 6 ways. The chosen letters may be arranged

in 4!2!1!1!

= 12 ways. The number of these words is 2× 6× 12 = 144.

4 = 1 + 1 + 1 + 1: There are 5 kinds of letters available, so 4 distinct letters maybe chosen in

(54

)= 5 ways. They may be arranged in 4! = 24 ways. Thus

there are 120 such words.

The number of words is therefore 6 + 144 + 120 = 270.

Page 72: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1044

S Showing all your work, determine the number of 4-letter words that can be formedfrom the letters A, A, B, B, C, C, D (in at most the given multiplicities). Youare expected to solve this problem “systematically”: that is, your solution shoulddemonstrate that you could solve any problem of this type, for any given collectionof letters. You will not receive any marks if you simply list the words.

Solution: The given population has 2 letters of each of three types (A, B, C), and1 of another type (D). We shall subdivide the set of 4-letter words according to themultiplicities of the letters chosen, classified according to partitions of 4 into sumsof positive integers.

4 = 4: This case cannot occur, as none of the letters is available in 4 copies.

4 = 3 + 1: This case also cannot occur, as no letter is available in multiplicity 3.

4 = 2 + 2: We can choose two letters of multiplicity 2 from two possible letterswhich are available in multiplicities of at least 2 in

(32

)= 3 ways. The chosen

letters can be arranged in 4!2!2!

= 6 ways. There are 3 × 6 = 18 words of thistype.

4 = 2 + 1 + 1: We can choose the letter having multiplicity 2 in(31

)= 3 ways, and

the other two letters in(4−12

)= 3 ways. The chosen letters may be arranged

in 4!2!1!1!

= 12 ways. The number of these words is 3× 3× 12 = 108.

4 = 1 + 1 + 1 + 1: There are 4 kinds of letters available, so 4 distinct letters maybe chosen in

(44

)= 1 way. They may be arranged in 4! = 24 ways. Thus there

are 24 such words.

The number of words is therefore 18 + 108 + 24 = 150.

T Showing all your work, determine the number of 5-letter words that can be formedfrom the letters A, A, A, B, B, B, C, C, C (in at most the given multiplicities). Youare expected to solve this problem “systematically”: that is, your solution shoulddemonstrate that you could solve any problem of this type, for any given collectionof letters. You will not receive any marks if you simply list the words.

Solution: We shall subdivide the set of 5-letter words according to the multiplicitiesof the letters chosen, classified according to partitions of 5 into sums of positiveintegers.

5 = 5: This case cannot occur, as none of the letters is available in 5 copies.

5 = 4 + 1: This case also cannot occur, as no letter is available in multiplicity 4.

5 = 3 + 2: We can choose the letters of multiplicity 3 from A,B,C in(31

)ways;

the letter of multiplicity two can then be chosen in(21

)ways. The chosen

Page 73: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1045

letters can be arranged in 5!3!2!

= 10 ways. There are 3× 2× 10 = 60 words ofthis type.

5 = 3 + 1 + 1: We can choose the letter having multiplicity 3 in(31

)= 3 ways, and

the other two letters in(3−12

)= 1 way. The chosen letters may be arranged

in 5!3!1!1!

= 20 ways. The number of these words is 3× 1× 20 = 60.

5 = 2 + 2 + 1: Choose the letters of multiplicity 2 in(32

)= 3 ways, and the letter

of multiplicity 1 in(3−21

)= 1 way. The letters may be arranged in 5!

2!2!1!= 30

ways. Thus there are 3× 1× 30 = 90 such words.

5 = 2 + 1 + 1 + 1: This case cannot occur, as there don’t exist as many as fourdifferent kinds of letters.

5 = 1 + 1 + 1 + 1 + 1: This case also cannot occur: there are only three differentkinds of letters.

The number of words is therefore 60 + 60 + 90 = 210.

A.7.6 Ordered partitions of an integer

Students were asked to solve the following problems using generating functions.You should also know how to solve them by counting certain binary words. Thusyou have a way of verifying your answer; you could also have verified small cases byactually counting the solutions and comparing their number with the number youhad computed. In such situations errors in a solution are considered more serious,as your verification should have indicated the presence of an error, and lead you torecheck your calculuations.

U Using t as the “indeterminate” (=variable), and showing your work, determinethe ordinary generating function for the number, bn, of solutions of the equationx1 + x2 + x3 = n, where x1, x2, x3 are integers satisfying the conditions x1 ≥ 1,x2 ≥ 0, x3 ≥ 3. Determine the value of bn by finding the MacLaurin expansion ofthis generating function. You are expected to solve this problem using the methodsindicated; no marks will be awarded for other types of solutions.

Solution: The “enumerator” for x1 is t1 + t2 + t3 + ... = t1−t

; the “enumerator”

for x2 is t0 + t1 + t2 + ... = 11−t

; the enumerator for x3 is t3 + t4 + t5 + ... =

t3

1−t. The generating function for the number of solutions

∞∑n=0

bntn is the product,

t1−t· 1

1−t· t3

1−t= t4

(1−t)3= t4

∞∑m=0

(m+2

2

)tm =

∞∑n=4

(n−2

2

)tn, so bn =

(n−2

2

).

Page 74: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1046

V Using y as the “indeterminate” (=variable), and showing your work, determinethe ordinary generating function for the number, cn, of solutions of the equationx1 + x2 + x3 ≤ n, where x1, x2, x3 are integers satisfying the conditions x1 ≥ 0,x2 ≥ 0, x3 ≥ 0. Determine the value of cn by finding the MacLaurin expansion ofthis generating function. You are expected to solve this problem using the methodsindicated; no marks will be awarded for other types of solutions.

Solution: (Many students failed to observe that the indeterminate to be used inthe generating function had been prescribed.) To convert the problem from thesolution of an inequality to that of an equation we introduce a “slack” variablex4 = n − x1 − x2 − x3, and require that x4 ≥ 0. The “enumerator” for x1 isy0 + y1 + y2 + ... = 1

1−y; the “enumerator” for x2 is y0 + y1 + y2 + ... = 1

1−y;

the enumerator for x3 is 1 + y + y2 + ... = 11−y

; the “enumerator” for x4 is also

11−y

. The generating function for the number of solutions∞∑

n=0

cnyn is the product,(

11−y

)4

=∞∑

n=0

(n+3

3

)yn, so cn =

(n+3

3

).

W Using t as the “indeterminate” (=variable), and showing your work, determinethe ordinary generating function for the number, bn, of solutions of the equationy1 + y2 + y3 = n, where y1, y2, y3 are integers satisfying the conditions y1 ≥ 3,y2 ≥ 2, y3 ≥ 1. Determine the value of bn by finding the MacLaurin expansion ofthis generating function. You are expected to solve this problem using the methodsindicated; no marks will be awarded for other types of solutions.

Solution: The “enumerator” for y1 is t3 +t4 +t5 + ... = t3

1−t; the “enumerator” for y2

is t2+t3+t4+... = t2

1−t; the enumerator for y3 is t+t2+t3+... = t

1−t. The generating

function for the number of solutions∞∑

n=0

bntn is the product, t3

1−t· t2

1−t· t

1−t= t6

(1−t)3=

t6∞∑

m=0

(m+2

2

)tm =

∞∑n=6

(n−4

2

)tn, so bn =

(n−4

2

).

X Using y as the “indeterminate” (=variable), and showing your work, determinethe ordinary generating function for the number, cn, of solutions of the equationy1 + y2 + y3 ≤ n, where y1, y2, y3 are integers satisfying the conditions y1 ≥ 0,y2 ≥ 0, y3 ≥ 0. Determine the value of cn by finding the MacLaurin expansion ofthis generating function. You are expected to solve this problem using the methodsindicated; no marks will be awarded for other types of solutions.

Solution: (Many students failed to observe that the indeterminate to be used inthe generating function had been prescribed.) To convert the problem from thesolution of an inequality to that of an equation we introduce a “slack” variable

Page 75: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1047

y4 = n − y1 − y2 − y3, and require that y4 ≥ 0. The “enumerator” for y1 isy0 + y1 + y2 + ... = 1

1−y; the “enumerator” for y2 is y0 + y1 + y2 + ... = 1

1−y;

the enumerator for y3 is 1 + y + y2 + ... = 11−y

; the “enumerator” for y4 is also

11−y

. The generating function for the number of solutions∞∑

n=0

cnyn is the product,(

11−y

)4

=∞∑

n=0

(n+3

3

)yn, so cn =

(n+3

3

).

Page 76: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1048

B Problems on 1995 — 1999 examinations

These examinations were printed in a book, size 812 inches ×14 inches, with adequate

space for students’ solutions to be written. They are being circulated for information

purposes only. Students should be aware that there are changes in syllabus and/or

textbook from year to year.

B.1 1995 Final Examination

1. Let α, β, γ be the permutations of N9 whose representations in (disjoint) cyclenotation are

α = (1237)(49)(58)(6) , β = (135)(246)(789) , γ = (1273)(59)(46)(8) .

(a) [10 MARKS] Showing all your work, determine disjoint cycle representationsfor each of the following permutations: αβ, βα, α2, β2, α−1, β−1.

(b) [5 MARKS] Determine a permutation σ ∈ S9 such that σασ−1 = γ. Expressσ in disjoint cycle notation.

2. You are to show that the set

S = ((¬p) ∨ (¬q) ∨ r), ((¬p) ∨ (¬q) ∨ s), ((¬r) ∨ (¬s) ∨ r)

logically implies the formula (¬(p ∧ q)). Use only the method requested; in eachcase no other method will be accepted.

(a) [6 MARKS] Prove the logical implication using a truth table.

(b) [9 MARKS] Provide a resolution proof.

3. (a) [1 MARKS] Give a precise definition for S(m, k), the Stirling number of thesecond kind .

(b) [2 MARKS] Prove that, for all m ≥ 1,

S(m,m) = 1 and S(m, 1) = 1 .

(c) [2 MARKS] State, without proof, an identity which relates S(m + 1, k) tocertain values S(m, r), (r = 1, 2, ..., k).

(d) [10 MARKS] Use the results you have stated and/or proved above in a careful

induction proof that S(m+1,m) =(m+ 1m− 1

)for all m ≥ 2. Only an induction

proof will be accepted.

Page 77: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1049

4. (a) [5 MARKS] Showing all your work, use the Euclidean algorithm — no othermethod is acceptable here — to determine the greatest common divisor of theintegers 243 and 198.

(b) [5 MARKS] Using your computations above, determine two integers, x and y,such that gcd(243, 198) = 243x+ 198y.

(c) [5 MARKS] Let m = 243gcd(243, 198)

. From your computations above, deter-

mine an inverse for 198gcd(243, 198)

in Zm.

5. (a) [5 MARKS] Prove or disprove: If f : A→ B and g : B → C are any functions,and the composite gf is surjective, then f must be surjective.

(b) [5 MARKS] Prove or disprove: Let k be a fixed integer, (k ≥ 5), and let arelation ∼ be defined on the set N× N by

(x, y) ∼ (u, v) iff (x ≡ u (mod k)) ∨ (y ≡ v (mod k))

Then ∼ is an equivalence relation.

6. (a) [5 MARKS] Using the Sieve Principle (no other method will be accepted)

determine the number of permtations

(1 2 3a b c

)in S3 with the property

that (a 6= 1) ∧ (b 6= 2) ∧ (c 6= 3).

(b) [5 MARKS] Showing all your work, determine all positive integers n with theproperty that φ(n) is odd, where φ is the Euler (totient) function. (You mayassume the formula for φ derived in the textbook and lectures.)

B.2 1995 Supplemental/Deferred Examination

(Note: Do not draw conclusion about the possible similarities of Final andSupplemental/Deferred Examinations; they can be very different, or verysimilar.)

1. The symbols x1, x2, ..., xm, y1, y2, ..., yn, z1, z2, ..., z` are all distinct. In each ofthe following problems you are to show all your work.

(a) [3 MARKS] Determine the number of ways of arranging the m+n+` symbolsin a row, so that x1, x2, ..., xm occupy m consecutive positions, in some order.

(b) [7 MARKS] Determine the number of ways of arranging the m+n+` symbolsin a row so that x1, x2, ..., xm do not occupy m consecutive positions, in anyorder, in the row; and neither do y1, y2, ..., yn occupy n consecutive positions,

Page 78: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1050

in any order, in the row; and neither do z1, z2, ..., z` occupy ` consecutivepositions, in any order, in the row.

(c) [5 MARKS] If we require that xi appear somewhere to the left of xi+1 (i =1, 2, ...,m − 1) — i.e., that x1, x2, ..., xm appear in the “natural” order (al-though there may be other symbols between them), what is the number ofarrangements of the m+ n+ ` symbols?

2. Let α, β, γ be the permutations of N9 whose representations in (disjoint) cyclenotation are

α = (12374)(958)(6) , β = (127)(594)(683) , γ = (135)(24678)(9) .

(a) [10 MARKS] Showing all your work, determine disjoint cycle representationsfor each of the following permutations:

αβ , βα , α2 , β2 , α−1 , β−1 .

(b) [5 MARKS] Determine a permutation σ ∈ S9 such that σασ−1 = γ. Expressσ in disjoint cycle notation.

3. [7 MARKS] Showing all your work, determine whether the following is a valid ruleof inference:

(p⇒ r)⇒ (q ⇒ r)(r ⇒ q) ∧ ((¬r) ∨ q)(¬(p ∨ r)) ∨ rr

4. [8 MARKS] Write a formula which “says” that the relation ∼, written a ∼ b, is anequivalence relation on a set S.

5. [10 MARKS] Prove that among 5 points in a square of side 1 there must exist two

that are not more than1√2

units apart.

6. [10 MARKS] Suppose that a sequence an (n = 0, 1, ...) is defined recursively bya0 = 1, a1 = 7, an+2 = 4an+1 − 4an (n ≥ 0). Prove by induction — no othermethod of proof will be accepted — that an = (5n+ 2)2n−1 for all n ≥ 0.

7. (a) [5 MARKS] Prove or disprove: If f : A→ B and g : B → C are any functions,and the composite gf is injective, then f must be injective.

(b) [5 MARKS] Prove or disprove: if a relation∼ is both symmetric and transitive,then ∼ must be reflexive.

Page 79: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1051

B.3 1996 Final Examination

1. (a) [7 MARKS] Let f : A → B be a function. Show carefully that, if f is aninjection, and S and T are subsets of A,

f(S ∩ T ) = f(S) ∩ f(T ) . (22)

(b) [3 MARKS] Show that (22) need not hold if f is not an injection.

2. [10 MARKS] A simple undirected graph G = (V,E) (i.e., an undirected graphG = (V,E) without loops or multiple edges) has the property that its chromaticnumber is 3; but that, after any edge is removed, the resulting graph has chromaticnumber 2. Showing all your work, determine all graphs G with this property.

3. [10 MARKS] An examination has 5 problems, on each of which a student canobtain a grade between 0 and 3 inclusive. Using generating functions — no othermethod will be accepted here — determine the number of different ways in whicha student can obtain a grade of 9.

4. [10 MARKS] Using any method studied in this course, solve the recurrencean+1 = 2an + 3an−1, (n ≥ 1), subject to initial conditions a0 = 1, a1 = 7.

5. (a) [5 MARKS] Determine the number of different strings that can be formedfrom all the letters of the word PEPPERCORN.

(b) [5 MARKS] Determine the number of different strings that can be formed fromall the letters of the word PEPPERCORN where the letters C and N cannotbe side by side (in either order), and where O cannot appear immediately tothe left of N.

(c) [5 MARKS] Determine the number of different strings that can be formedfrom all the letters of the word PEPPERCORN where no two P’s can appearside by side.

6. (a) [5 MARKS] Prove or disprove: If (P,R) and (Q,S) are posets with|P | = |Q| = 4, and if |R| = |S|, then there exists a bijection f : P → Qsuch that

∀p1 ∈ P[∀p2 ∈ P [((p1, p2) ∈ R)⇔ ((f(p1), f(p2)) ∈ S)]

](b) [5 MARKS] Prove or disprove: On the set 1, 2, 3 there is no equivalence

relation R for which |R| = 6 .

7. (a) [5 MARKS] Prove or disprove: There exist at least 2 non-isomorphic graphson 8 vertices whose degrees are 2, 2, 2, 2, 3, 3, 3, 3.

Page 80: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1052

(b) [5 MARKS] Prove or disprove: There exist at least 2 non-isomorphic trees on10 vertices whose degrees are 1, 1, 1, 1, 1, 2, 3, 3, 3, 4.

8. (a) [7 MARKS] Show that, if 5 distinct integers are selected from the set

1, 2, 3, 4, 5, 6, 7, 8 ,

then there must be a pair of these integers whose sum is equal to 9.

(b) [3 MARKS] Show that the preceding statement fails if only 4 distinct integersare selected from the set.

9. (a) [5 MARKS] Let p be a positive prime integer. Describe in detail an algorithmby which one can find, for each integer a which is not divisible by p, integersb and c such that

ab+ pc = 1 .

(b) [5 MARKS] Show that 127 is prime by dividing it by certain positive integersless than 12. Explain why your method works.

(c) [5 MARKS] Use the method you have described in (a) to determine, for theinteger 15, an integer ` such that

15 ` ≡ 0 (mod 127) .

B.4 1997 Final Examination

1. [10 MARKS] Using any method, but showing all your work, determine the numberof solutions (x1, x2, x3) to the inequality

x1 + x2 + x3 ≤ n

where x1, x2, x3 are integers such that

2 ≤ x1 ≤ 8

3 ≤ x2

0 ≤ x3 ≤ 6

2. (a) [5 MARKS] Using any method, but showing all your work, solve the recurrence

−an + 4an−1 − 4an−2 = 0

subject to the initial conditions a0 = 1, a1 = 3.

Page 81: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1053

(b) [5 MARKS] Prove carefully, by induction — no other method will be accepted— that

n∑i=0

ai =

1 n = 0

4an−1 n > 0.

3. [5 MARKS] Prove or disprove: For any positive integers m and n the graph Km,n

contains a Hamilton path.

4. [5 MARKS] Prove or disprove: If functions f : A → B and g : B → C aresurjective, then g f is surjective.

5. Prove or disprove: The number of total orders that can be defined on a set of nelements (n ≥ 2) is 2nn!.

6. [5 MARKS] Prove or disprove: A connected simple undirected graph with e edgesand v vertices such that v ≥ 3 and e ≤ 3v − 6 is planar.

7. [5 MARKS] Prove or disprove: A simple undirected graph with 9 vertices whoserespective degrees are 4, 4, 4, 4, 4, 3, 3, 2, 2 must have an Euler path.

8. [5 MARKS] Prove or disprove: For any propositional function P (x, y),

(∀y∃xP (x, y))⇒ (∃x∀yP (x, y))

9. [10 MARKS] Let A be a set. Define on the set P (A) a relation Q by

U Q V iff ((U ⊆ V ) ∨ (V ⊆ U))

Showing all your work, determine whether or not Q is a partial order.

10. [10 MARKS] Give an example of a graph G — different from K4 — with both thefollowing properties, or prove that no such graph exists:

(a) The chromatic number of G is 4.

(b) The graphs obtained by deleting any one edge of G are all 3-colourable.

If you are presenting an example, you are expected to prove that it has the prop-erties you claim.

11. You are to count, in two ways, the number of 3-letter words that can be formedfrom the letters of the words ALMA MATER:

(a) [5 MARKS] Using generating functions.

Page 82: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1054

(b) [5 MARKS] Without using generating functions.

(The intention is that each letter may be used at most the number of times itappears in the words ALMA MATER; i.e. you may use A at most three times, Lat most once twice, etc. The space between the two words is to be ignored.)

12. [10 MARKS] Determine whether or not the following is a valid argument:

p→ qp→ rt→ pt→ rr → st→ st→ p) p→ t

(Hint: While you may be able to attack this problem with a truth table, there maybe easier ways.)

13. [10 MARKS] For n = 1, 2, 3, 4, 5 determine the numbers of trees on n verticesa1, a2, ..., an. Sketch one tree from each equivalence class under isomorphism, anddetermine — showing your work — the number of trees in each equivalence class.

B.5 1997 Supplemental/Deferred Examination

1. [10 MARKS] Prove that the following argument is invalid.

p↔ q (23)

q → r (24)

r ∨ (¬s) (25)

(¬s)→ q (26)

) s (27)

2. (a) [6 MARKS] Give examples of two simple graphs, one with 4 vertices, and theother with 5 vertices, such that each of them is isomorphic to its complement.

(b) [4 MARKS] Prove that there is no graph G with exactly 99 vertices such thatG is isomorphic to its complement.

Page 83: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1055

3. [10 MARKS] An examination has 4 problems, on each of which a student canobtain a grade between 0 and 4 inclusive. Using generating functions — no othermethod will be accepted here — determine the number of different ways in whicha student can obtain a grade of 10.

4. [10 MARKS] Using any method studied in this course, solve the recurrence9an−1 = −6an − an+1, (n ≥ 1), subject to initial conditions a0 = 1, a1 = −3.

5. (a) [5 MARKS] Determine the number of different strings that can be formedfrom all 12 of the letters of the words FREEZING RAIN.

(b) [5 MARKS] Determine the number of different strings that can be formedfrom all 12 of the letters of the words FREEZING RAIN where the letters Fand G cannot be side by side (in either order), and where A cannot appearimmediately to the left of G.

(c) [5 MARKS] Determine the number of different strings that can be formedfrom all the letters of the words FREEZING RAIN where no two R’s canappear side by side.

6. (a) [5 MARKS] Prove or disprove: If S is a reflexive relation on a set A, thenS2 ⊆ S.

(b) [5 MARKS] Prove or disprove: On a set B with |B| = 4 there is no equivalencerelation R for which |R| = 6 .

7. (a) [5 MARKS] Prove or disprove: Every bipartite connected graph has a Hamil-ton path.

(b) [5 MARKS] Prove or disprove: Every bipartite connected graph has an Eulerpath.

8. (a) [5 MARKS] Prove or disprove: If functions f : A → B and g : B → C areinjective, then g f is injective.

(b) [5 MARKS] Prove or disprove: The number of antisymmetric relations on aset A which are not reflexive is

3(n2) × (2n − 1) .

B.6 1998 Final Examination

1. For a binary relation R on a set A, you are to consider the possibility that thereexists a relation R′ such that R ⊆ R′, where R′ is to have certain specified proper-ties. In each of the following separate cases either prove that, for any R, a relationR′ must always exist; or prove by a counterexample that it may happen that nosuch R′ exists.

Page 84: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1056

(a) [3 MARKS] R′ is reflexive.

(b) [3 MARKS] R′ is symmetric.

(c) [3 MARKS] R′ is a partial ordering.

2. [9 MARKS] Your are to solve this problem only by using exponential generatingfunctions – no other method will be accepted. You have a supply of 4 kinds ofletters from which n-letter words are to be formed, with the following restrictions:

• There are 2 A’s, and you may use any number of them.

• There are 3 B’s and you must use only an odd number of them.

• There are 4 C’s, and you must use only an positive, even number of them.

• There is 1 D, and you may use it if you wish.

Determine the exponential generating function for the number, an, of words thatcan be formed; and compute the value of a5.

3. (a) [4 MARKS] Find an example to prove that the statement

∀x[A(x) ∨B(x)]→ [(∀xA(x)) ∨ (∀yB(y))]

is not always true.

(b) [5 MARKS] The following argument claims to prove the preceding implication.Determine precisely where the argument is defective, and verify your claimwith the counterexample you presented in the preceding part of this question.

∀x[A(x) ∨B(x)] ⇔ ¬(∃x[¬(A(x) ∨B(x))])

⇔ ¬(∃x[(¬A(x)) ∧ (¬B(x))])

⇒ ¬((∃x[¬A(x)]) ∧ (∃x[¬B(x)]))

⇔ (¬(∃x[¬A(x)])) ∨ (¬(∃x[¬B(x)]))

⇔ (∀xA(x)) ∨ (∀yB(y))

4. [9 MARKS] Showing all your work, determine, for any integer n, a formula for thenumber of solutions (x1, x2, x3, x4) to the inequality

x1 + x2 + x3 + x4 ≤ n

in non-negative integers which satisfy all of the following constraints simultan-eously:

• x1 ≤ 5

Page 85: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1057

• x2 > 4

• x3 + x4 6= 3

(It is not necessary to simplify the formula.)

5. Suppose that f : A→ B is any injective function, and g : B → C is any surjectivefunction. Prove or disprove each of the following statements:

(a) [3 MARKS] g f must be surjective.

(b) [3 MARKS] g f must be injective.

(c) [3 MARKS] The relation R defined as follows on B is an equivalence relation:∀b1 ∈ B ∀b2 ∈ B[(b1, b2) ∈ R⇔ g(b1) = g(b2)]

6. (a) [5 MARKS] Using any method you have learned in this course, determinea formula for an, the general term in a sequence an which satisfies therecurrence

2an+2 = 3an+1 − an (n ≥ 0) (28)

subject to the initial conditions

a0 = 3 (29)

a1 = 11 (30)

(b) [4 MARKS] Using mathematical induction on n, verify carefully that thesequence you have found is indeed the unique solution to (28) subject to thegiven initial conditions.

7. (a) [2 MARKS] State Euler’s formula for maps on the plane or sphere (or forgraphs embedded in the plane or on the sphere).

(b) [7 MARKS] Apply Euler’s formula to prove that the complete bipartite graphK3,3 cannot be embedded in the plane or on the sphere.

8. (a) [5 MARKS] Prove or disprove: every tournament on 8 or more vertices con-tains a directed Hamilton circuit.

(b) [4 MARKS] Prove or disprove: every tournament on 8 or more vertices con-tains a directed Euler path.

Page 86: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1058

B.7 1998 Supplemental/Deferred Examination

1. You are to consider binary relations R on a finite set A, where |A| = n. Showingall your work, determine the number of such relations such that

(a) [3 MARKS] R is reflexive.

(b) [3 MARKS] R is symmetric and not reflexive.

(c) [3 MARKS] R is antisymmetric.

2. [9 MARKS] Your are to solve this problem only by using exponential generatingfunctions – no other method will be accepted. You have a supply of three kinds ofletters from which n-letter words are to be formed, with the following restrictions:

• There are 3 A’s, and you may use any number of them.

• There are 4 B’s, and you must use only a positive, odd number of them.

• There are 4 C’s, and you must use only a positive, even number of them.

Determine the exponential generating function for the number, an, of words thatcan be formed; and compute the value of a6.

3. [9 MARKS] Determine whether or not the following argument is valid:

(¬p) ∨ q(p→ q)→ r

((¬q)→ (¬p))→ (q ∨ (¬r))(¬q) ∨ ¬(s→ t)) s ∧ (¬t)

4. [9 MARKS] Showing all your work, determine, for any positive integer n, a formulafor the number of solutions (x1, x2, x3, x4) to the inequality

x1 + x2 + x3 + x4 < n

in positive integers which simultaneously satisfy all of the following constraintssimultaneously:

• x1 > 5

• x2 ≤ 4

• x2 + x3 + x4 6= 5

(It is not necessary to simplify the formula.)

Page 87: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1059

5. Suppose that f : A→ B is any surjective function, and g : B → C is any injectivefunction. Prove or disprove each of the following statements:

(a) [5 MARKS] g f must be injective.

(b) [4 MARKS] g f must be surjective.

6. (a) [5 MARKS] Using any method you have learned in this course, determinea formula for an, the general term in a sequence an which satisfies therecurrence

3an+2 = −2an+1 + an (n ≥ 0) (31)

subject to the initial conditions

a0 = 6 (32)

a1 = 6 (33)

(b) [4 MARKS] Using mathematical induction on n, verify carefully that thesequence you have found satisfies the recurrence

bn = bn+1 + 5bn+2 + 3bn+3 (n ≥ 0) .

7. (a) [2 MARKS] State Euler’s formula for maps on the plane or sphere (or forgraphs embedded in the plane or on the sphere).

(b) [4 MARKS] Apply Euler’s formula to prove that the complete graphK5 cannotbe embedded in the plane or sphere.

(c) [3 MARKS] Apply Kuratowski’s theorem — no other method will be accepted— to prove that any tree can be embedded in the plane or sphere.

8. (a) [5 MARKS] Prove or disprove: For every integer n ≥ 2, the n-cubeQn containsa Hamilton circuit.

(b) [4 MARKS] Prove or disprove: For every integer n ≥ 2, the n-cubeQn containsan Euler circuit.

B.8 1999 Final Examination

1. [10 MARKS] Using any method studied in this course, and showing all of yourwork, determine whether or not the following is a valid rule of inference:

¬p→ q¬q

p→ (r ∧ s)) r ∨ s

Page 88: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1060

2. (a) [2 MARKS] Define what is meant by an equivalence relation on a set.

(b) [3 MARKS] Showing all your work, determine, for any positive integer n,exactly how many (binary) relations there are on the set 1, 2, ..., n.

(c) [6 MARKS] Showing all your work, determine exactly how many equivalencerelations there are on the 4-element set S = a, b, c, d.

(d) [3 MARKS] Showing all your work, determine exactly how many total order-ings there are on the 4-element set S defined above.

3. [4 MARKS] Prove or disprove: Among any 101 integers in the set n|101 ≤ n ≤300, there must exist two integers a and b such that a|b.

4. [10 MARKS] Prove by induction, or disprove by providing a counterexample: Forall integers N ≥ 2,

N∑n=2

(n2 − n− 1

n2 − n

)=N3 −N

3− 1

N

5. [12 MARKS] Your are to solve this problem only by using exponential generatingfunctions – no other method will be accepted. You have a supply of 3 kinds of lettersfrom which n-letter words are to be formed, with no restrictions: you may use eachof the 3 letters any non-negative number of times in any word. Determine theexponential generating function for the number, an, of words that can be formed;and use this to determine an in “closed form” (without using any summation signs).

6. [12 MARKS] Showing all your work, determine, for any integer n, a formula forthe number of solutions (x1, x2, x3, x4) to the inequality

x1 + x2 + x3 + x4 ≤ n

in non-negative integers which satisfy all of the following constraints simultaneously:

• 3 ≤ x1 ≤ 6

• x2 > 2

• x3 > 4

• 0 ≤ x4 ≤ 3

Verify that your formula is correct for n ≤ 5. (It is not necessary to simplify theformula.)

Page 89: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1061

7. [12 MARKS] Showing all your work, determine the value of an, the general termin a sequence an which satisfies the recurrence

2an+2 − 3an+1 + an = 21−n (n ≥ 0) (34)

subject to the initial conditions

a0 = 0 (35)

a1 = 0 (36)

8. [12 MARKS] The Petersen graph has vertex-set

V = a, b, c, d, e, v, w, x, y, z ,

and edge-set

E = ab, bc, cd, de, ea, av, bw, cx, dy, ez, vx, xz, zw,wy, yv .

Use the Euler polyhedron formula (not the Kuratowski Theorem) to prove that thePetersen graph is not planar. (You may assume that it is known that the Petersongraph has no circuits of lengths 3 or 4.)

9. (a) [2 MARKS] For trees on more than 1 vertex the number of vertices of degree1 is bounded below. State the best bound.

(b) [6 MARKS] Proceeding systematically, develop a list of trees on n vertices,where n = 1, 2, ..., 6.

(c) [6 MARKS] For each of the trees listed in (b), determine the number of waysof labelling the vertices with distinct labels 1, 2, ..., n. Explain your reasoningin every case.

B.9 1999 Supplemental/Deferred Examination

1. [10 MARKS] Using any method studied in this course, and showing all of yourwork, determine whether or not the following is a valid rule of inference:

¬p→ q¬q

p→ (r ∨ s)) r ∧ s

2. Let S = a, b, c, d be a 4-element set.

Page 90: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1062

(a) [2 MARKS] Define what is meant by an partial ordering on S.

(b) [3 MARKS] Showing all your work, determine exactly how many reflexiverelations there are on the set S.

(c) [6 MARKS] Showing all your work, determine exactly all the partial orderingsof the set S that contain exactly 5 ordered pairs of elements of S.

(d) [3 MARKS] Showing all your work, determine exactly how many total order-ings of the set S are not symmetric.

3. [8 MARKS] Prove or disprove: Among any 501 integers n with the property that1 ≤ n ≤ 1000 there must exist two integers a and b such that a = b− 1.

4. [10 MARKS] If the following statement is true, prove it by induction; if it is false,provide a counterexample: For all positive integers N ,

N∑n=1

n(n− 1)(n− 2)(n− 3) =(N + 1)N(N − 1)(N − 2)(N − 3)

5

5. [12 MARKS] You have a supply of 3 kinds of letters from which n-letter words areto be formed, where you may use each of the 3 letters any positive number of timesin any word. Determine the exponential generating function for the number, an, ofwords that can be formed; and use this to determine an in “closed form” (withoutusing any summation signs).

6. [12 MARKS] You are to solve this problem only by using generating functions —no other type of solution will be accepted. Showing all your work, determine, forany integer n, a formula for the number of solutions (x1, x2, x3, x4) to the inequality

y1 + y2 + y3 + y4 ≤ n

in non-negative integers which satisfy all of the following constraints simultaneously:

• 3 ≤ y1 ≤ 7

• y2 > 2

• y3 > 4

• 0 ≤ y4 ≤ 4

Verify that your formula is correct for n ≤ 5. (It is not necessary to simplify theformula.)

Page 91: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1063

7. [12 MARKS] Showing all your work, determine one particular sequence an whichsatisfies the recurrence

an+2 − 2an+1 + an = n22−n (n ≥ 0) (37)

8. [12 MARKS] The Petersen graph has vertex-set

V = a, b, c, d, e, v, w, x, y, z ,

and edge-set

E = ab, bc, cd, de, ea, av, bw, cx, dy, ez, vx, xz, zw,wy, yv .

Use the Kuratowski Theorem — no other method will be accepted —to prove thatthe Petersen graph is not planar.

Page 92: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1064

C Solutions to 1996 Assignment Problems

C.1 Solved Problems from the First 1996 Problem Assignment

1. (a) [17, Supplementary Exercise 2, p. 93] Find the truth table of the compoundproposition (p ∨ q)→ (p ∧ ¬r).

(b) Is the given proposition a tautology or a contradiction? Explain.

Solution:

(a)

Truth table for (p ∨ q)→ (p ∧ ¬r)p q r p ∨ q ¬r p ∧ ¬r (p ∨ q)→ (p ∧ ¬r)T T T T F F FT T F T T T TT F T T F F FT F F T T T TF T T T F F FF T F T T F FF F T F F F TF F F F T F T

(b) A tautology has truth value T under all interpretations; a contradiction hastruth value F under all interpretations. The given proposition attains bothtruth values, so it is neither a tautology nor a contradiction.

2. [17, Exercise 1.2.16] Show that p→ q and ¬q → ¬p are logically equivalent.

Solution: This problem can be solved directly using a truth table:

Truth table for p→ q and ¬q → ¬pp q p→ q ¬p ¬q ¬q → ¬p (p→ q)↔ (¬q → ¬p)T T T F F T TT F F F T F TF T T T F T TF T T T F T T

The equivalence of the two given propositions follows from the last column; or,equivalently, from the identity of corresponding truth values in columns ##3 and6: if this latter observation is made, then the 7th column is redundant.

Alternatively, we may analyse the two given propositions as follows. p→ q is truefor all assignments of truth values to p and q, except (p, q) := (T, F ). If we negateboth sides of this assignment we find that it is equivalent to (¬p,¬q) := (¬T,¬F ) =

Page 93: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1065

(F, T ), which is precisely the interpretation under which the contrapositive ¬q →¬p is false.

3. [17, Exercise 1.2.24] Find a compound proposition involving the propositions p, q,and r that is true when p and q are true and r is false, but is false otherwise. (Hint:Use a conjunction of each proposition or its negation.)

Solution: There are 2 × 2 × 2 = 8 possible conjunctions of the type mentioned inthe hint. Of these 8, only 1 has the desired behavior, namely p ∧ q ∧ (¬r). This(compound) proposition has the desired set of truth values.

This is not the only solution to the problem, however. There are infinitely manyother propositions logically equivalent to this one, for example, (p∧ q∧ (¬r))∨ (p∧(¬p)), (p ∨ q ∨ r) ∧ (p ∨ q ∨ ¬r) ∧ (¬p ∨ q ∨ r) ∧ (¬p ∨ q ∨ ¬r) ∧ (p ∨ ¬q ∨ r) ∧ (p ∨¬q ∨ ¬r) ∧ (¬p ∨ ¬q ∨ ¬r).9

4. (a) [17, Supplementary Exercise 10, p. 94] If ∀y∃xP (x, y) is true, does it neces-sarily follow that ∃x∀yP (x, y) is true? If the answer is YES, prove it! If NO,give a specific counterexample.10

(b) If ∃x∀yP (x, y) is true, does it necessarily follow that ∀y∃xP (x, y) is true? Ifthe answer is YES, prove it! If NO, give a specific counterexample.

Solution:

(a) The claim is false. For example, let P (x, y) be the statement x > y, wherethe universe is R. As there is no largest real number, there exists, for everyy, a number x which is larger. However, there is no real number x which isgreater than all real numbers y.

(b) In this case the claim is correct. Suppose x0 is such that ∀yP (x0, y) is true.For any specific y it follows from the truth of P (x0, y) that ∃xP (x, y) is true.As y ranges over all propositions, this entails that ∀y∃xP (x, y) is true.

5. (cf. [17, Exercise 1.4.22]) Determine conditions on sets A and B that characterizewhen A×B = B × A.

Solution: First assume that A × B = B × A. Then, for any points a ∈ A, b ∈ B,(a, b) ∈ A×B = B×A, all of whose ordered pair members have their first elementin B and their second in A. It follows that a ∈ B and b ∈ A. As a and b werecompletely general, we have proved that A ⊆ B and that B ⊆ A, hence thatA = B. Thus, if both A and B are non-empty, A×B = B×A implies that A = B.

9The first solution we gave is in disjunctive normal form; the last is in conjunctive normal form.10A counterexample is an example used to prove that a statement is false.

Page 94: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1066

However, if either of A or B is empty, then the preceding argument breaks down,as the Cartesian products are also empty. More precisely, if, say, A is empty, thenthere do not exist any ordered pairs of the form (a, b) with a ∈ A and b ∈ B, sincethe condition a ∈ A is a contradiction; similarly if B is empty. So, if just one ofA and B is empty, the two Cartesian products are equal, even though the sets areunequal.

We have shown that if A×B = B×A and neither A nor B is empty , then A = B.Conversely, if A = B, then A×B = A× A = B ×B = B × A.

6. (cf. [17, Exercise 1.5.20]) Consider the following predicates (statements) aboutthree sets:

A ∪ C = B ∪ C (38)

A ∩ C = B ∩ C (39)

Prove or disprove each of the following statements.

(a) ∀A∀B(∃C(38)→ A = B)

(b) ∀A∀B(∃C(39)→ A = B)

(c) ∀A∀B(∀C(38)→ A = B)

(d) ∀A∀B(∀C(39)→ A = B)

Solution: Both with binary connectives and with quantifiers there are often sit-uations where the interpretation of a statement can be ambiguous. In the caseof quantifiers the usual convention is that the quantifier applies to the short-est possible formula. Thus, for example, in part 6a, the formula shown means∀A(∀B((∃C(38))→ (A = B))), not ∀A(∀B(∃C((38)→ (A = B)))).

(a) The statement is false: we give a counterexample, with specific choices of Aand B. Let A = 1, 2, B = 1, C = 2. Then A ∪ C = 1, 2 = B ∪ C,but A 6= B.

(b) The statement is false: we give a counterexample, with specific choices of Aand B. Simply take, for any distinct sets A and B, a set C consisting of somepoint which is neither in A nor in B. Then A∩C = ? = B∩C, but A 6= B.11

11We observe that, notwithstanding the two preceding results, ∀A∀B(∃C((38) ∧ (39)) → A = B)) istrue. We can express A ∪ C and B ∪ C as disjoint unions as follows;

A ∪ C = (A ∩ C) ∪ (A− C) ∪ (C −A)B ∪ C = (B ∩ C) ∪ (B − C) ∪ (C −B)

If these sets are equal, and if A ∩ C = B ∩ C, it follows that (A− C) ∪ (C − A) = (B − C) ∪ (C − B)

Page 95: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1067

(c) For given A and B assume that (38) holds for all choices of C. In particular,let C consist of a single point c lying outside of the union A∪B. Then anypoint x of A is in A ∪ C = B ∪ C; but x /∈ C; hence x ∈ B; as x ranges overall points of A, this implies that A ⊆ B. Similarly we may prove that B ⊆ A.It follows that A = B.

An even simpler counterexample can be constructed by taking C = ? .

(d) For given A and B, let C consist of any point x ∈ A. Then (39) ensures thatx = A ∩ C = B ∩ x, so x ∈ B; as x ranges over all points of A, thisimplies that A ⊆ B. Similarly, taking x ∈ B, we may conclude that B ⊆ A.We conclude that A = B.

An even simpler counterexample can be constructed by taking C = A ∪B.

7. Equality of Functions. We say that two functions f : A → B, g : C → D areequal and write f = g if all of the following conditions are satisfied:

F1. A = C, i.e. the domains are the same;

F2. B = D, i.e. the codomains are the same; and

F3. ∀a ∈ A(f(a) = g(a)), i.e. the functions have precisely the same action.

Composition of Functions. Let f : A → B and g : B → C be any functions.The function g f : A → C is defined by the action a 7→ g(f(a)), i.e. by(g f)(a) = g(f(a)) for all a ∈ A. (This is essentially [17, Definition 1.10,p. 66], except we emphasize that it is not sufficient to specify the action of afunction: both its domain and its codomain must be unambiguously specified,as well.)

Invertible Functions. If f : A→ B is a bijection, then [17, p. 67]

f f−1 = ιB and (40)

f−1 f = ιA (41)

(a) Show that, for any function f : A → B, f ιA = f and ιB f = f . (Thisserves as a second justification of the use of the word identity .)

(b) Show that, for any functions f : A→ B, ` : B → C, m : C → D, (m `)f =m (` f). (This is the property of associativity of function composition.)

(c) Show that a function f : A → B cannot have 2 different inverses. (Hint :Show that if g : B → A and h : B → A are such that f g = f h = ιB andg f = h f = ιA, then g = h.)

from which it may be shown that A−C = B −C and C −A = C −B. Then A = (A∩C)∪ (A−C) =(B ∩ C) ∪ (B − C) = B.

Page 96: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1068

Solution:

(a) Since the identity functions are ιA : A→ A and ιB : B → B, the compositionsf ιA and ιB f both have domain A and codomain B. Thus, to prove thedesired equality, it suffices to show that the two compositions both have thesame action as f on any point in A.

(f ιA)(a) = f(ιA(a)) by definition of = f(a) by definition of ιA; and

(ιB f)(a) = ιB(f(a)) by definition of = f(a) by definition of ιB

for any a ∈ A, proving that f ιA = f = ιB f .

The difficulty in this problem, if there is one, is in recognizing that the prop-erties you are being asked to prove appear obvious because of the suggestivenotation we are using. Just because we denote something by a symbol sug-gesting that it behaves like an “identity”, or use that word in describing it,does not imply that the property actually holds.

(b) As in the preceding part, the first step is to show that, by virtue of the defini-tion of composition of functions, the double compositions both have domainA and codomain C. Then, having shown that the domains and codomainsboth coincide, all that remains to prove is that the two compositions haveprecisely the same action on all points of A.

Since f : A → B and ` : B → C, the composition is ` f : A → C; since mhas domain C and codomain D, m (`f) has domain A and codomain C; ina similar way the same result can be proved for (m `) f . For every a ∈ A

(m (` f))(a) = m((` f)(a))) by definition of m · · ·= m(`(f(a))) by definition of ` f= (m `)(f(a)) by definition of m `= ((m `) f)(a) by definition of · · · f ;

hence m (` f) = (m `) f .

(c)

g = g ιB by part (a)

= g (f h) by the hypothesis that h is an inverse

= (g f) h by associativity, proved above

Page 97: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1069

= ιA h by the hypothesis that g is an inverse

= h by part (a)

8. ([17, Exercise 1.8.20(a)]) Let T denote the set of integers that are not divisible by3. Show carefully that T is countable.

Solution: We are interested in the set

...,−11,−10,−8,−7,−5,−4,−2,−1, 1, 2, 4, 5, 7, 8, 10, 11, ...

We have to prove the existence of a bijection between T and N. There are in-finitely many ways of doing this, since the order of the natural numbers does nothave to be considered; however, one wants a relatively simple enumeration so thatcountability is easily demonstrated. Had the set under consideration been onlythe non-negative integers not divisible by 3 — i.e. T ∩ N — we could simplyhave enumerated the members in increasing order, by a bijection f defined by

f(2n+ i) =

3n+ 1 i = 03n+ 2 i = 1

. One enumeration in the present, more complicated

case, is f(4n+ i) =

3n+ 1 i = 0−3n− 1 i = 1

3n+ 2 i = 2−3n− 2 i = 3

.

As mentioned, there are infinitely many other possible enumerations. The system-atic way in which we have, in effect, merged two countable sets into one, could berewritten to give a solution to the following problem in the textbook:

[17, Exercise 1.7.*24] Show that the union of two countable sets is count-able.

C.2 Solved Problems from the Second 1996 Problem Assign-ment

1. (cf. [17, Exercise 6.1.28]) Suppose that R and S are reflexive relations on a set A.Prove or disprove each of the following statements:

(a) R ∪ S is reflexive

(b) R− S is symmetric

(c) R⊕ S is irreflexive

Solution:

Page 98: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1070

(a) TRUE. By hypothesis the set (a, a)|a ∈ A is contained in both R and S.Hence it is contained in their union. (Indeed, it is even contained in theirintersection, which is, in turn, contained in the union.)

(b) FALSE; we construct a counterexample. Let S be the smallest possible re-flexive relation — i.e. just the “diagonal” elements (a, a)|a ∈ A. Let R bea reflextive relation which is not symmetric; for example, R could consists ofthe diagonal together with some element (a, b), where a 6= b and (b, a) /∈ R.Then R − S will contain only the element (a, b) and will not be symmetric,since the element (b, a) is not present.

(c) TRUE. R ⊕ S is the so-called symmetric difference (sometimes denoted byR∆S). Since the diagonal elements are present in both R and S, none ispresent in R⊕ S. This is precisely the definition of irreflexivity [17, p. 365].

2. (a) [17, Exercise 6.1.22] List all relations on the set 0, 1.(b) (cf. [17, Exercise 6.1.24]) Which of the relations listed above are

i. reflexive?

ii. irreflexive?

iii. symmetric?

iv. antisymmetric?

v. transitive?

vi. asymmetric?12

Solution:

(a) In tabular form, the 24 = 16 relations are

12Mathematicians usually try to choose terminology which is suggestive of the precise meaning in-tended. Occasionally this practice fails — either because of the choice of a word whose “normal” meaningis different from what is intended, or through the choice of an ambiguous word. One such case is theword asymmetric: a relation R is asymmetric iff ∀a∀b((a, b) ∈ R → (b, a) /∈ R) is true [17, precedingExercise 6.1.10]. Since the word symmetric entails a property that holds for all pairs of points, onemight have expected that the absence of symmetry would coincide with the negation of the symmetryproperty. That is, a relation R on A fails to be symmetric if ¬(∀a∀b((a, b) ∈ R → (b, a) ∈ R)) is true,i.e. if ∃a∃b(¬((a, b) ∈ R → (b, a) ∈ R)) is true, i.e. if ∃a∃b(((a, b) ∈ R) ∧ ((b, a) /∈ R)). Thus symmetryfails if at least one pair lacks its reversal. Note that asymmetry does not necessarily entail the absenceof symmetry!

Page 99: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1071

0 10 0 01 0 0

0 10 0 01 0 1

0 10 0 01 1 0

0 10 0 01 1 1

0 10 0 11 0 0

0 10 0 11 0 1

0 10 0 11 1 0

0 10 0 11 1 1

0 10 1 01 0 0

0 10 1 01 0 1

0 10 1 01 1 0

0 10 1 01 1 1

0 10 1 11 0 0

0 10 1 11 0 1

0 10 1 11 1 0

0 10 1 11 1 1

The relations can be represented by the 4-digit binary word obtained by read-ing the entries in locations (0, 0), (0, 1), (1, 0), (1, 1), i.e. by ordering the 4locations “lexicographically”.

i. Reflexive: The reflexive relations have a 1 in the diagonal entries in thetable: 1001, 1011, 1101, 1111

ii. Irreflexive: A relation is defined to be irreflexive if no element is relatedto itself [17, p. 365]. Thus the tables for these relations have zeroes in themain diagonal: 0000, 0010, 0100, 0110

iii. Symmetric: The tables for symmetric relations are symmetric in thesense in which this word is used for matrices — i.e. the matrix has re-flective symmetry in the main diagonal. There is no restriction on themain diagonal itself: only the pairs (1, 0) and (0, 1) must either both bepresent or neither be present. The symmetric relations are 0000, 0001,1000, 1001, 0110, 0111, 1110, 1111.

iv. Antisymmetric: For antisymmetric relations also there is no restrictionon the diagonal entries of the table. Symmetrically located off-diagonalentries (in the present case there is only one such pair) must be different.Thus, in the present case, every relation which is not symmetric is anti-symmetric. This is not true in general: on a set with more than 2 pointsthere are relations which are neither symmetric nor antisymmetric; for

example

0 1 20 0 1 11 1 0 02 0 0 0

.

Page 100: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1072

v. Transitive: While the preceding properties are easily described in matrixterms, the property of transitivity is relatively “difficult” to determinefrom the matrix. In this case the digraph notation is preferable. Wehave to check all possible sequences of ordered pairs (a, b), (b, c) in therelation. Most of the relations prove to be transitive. Those that are nottransitive are 0110, 0111, 1110. In each case the failure of transitivityoccurs because under transitivity, whenever we have directed edges (a, b)and (b, a) in the digraph, then we must also have both (a, a), and (b, b).Again, this case of only 2 points is somewhat “degenerate” in that thereare no instances of 3 distinct points under which transitivity could holdin its greatest generality.

vi. Asymmetric: While, as seen above, there are 16-8=8 relations that arenot symmetric, not all of these are asymmetric. Asymmetric relationsmust have zero diagonal. There are 3 asymmetric relations: 0010, 0100,0000, of which the last is both symmetric and asymmetric.

3. (a) Consider the ternary (3-ary) relation on R defined by

∀x∀y∀z((x, y, z) ∈ R⇔ x2 + y2 = z2) .

Describe the projections P1,2, P1,3, P1,2,3, P3 of R.

(b) Suppose that we have, for some set A, a function f : A × A → A. Wecan represent this function as a ternary relation on A — i.e. as a subset ofA×A×A; for example, we could use the “graph” (x, y, f(x, y))|x ∈ A, y ∈ A;when A = R this is the familiar graph of z = f(x, y). Explain why the ternaryrelation studied in part (3a) could not have been obtained in this way from areal function of 2 variables.

(c) Let S be a binary relation on a given set A. Show that the projection P1,3

of the join J1(S, S) ([17, Definition 6.2.3]) is the same as S2 ([17, Definition6.1.7]).13

Solution:

(a) P1,2 maps R on to the set of all points (x, y) ∈ R2 such that there exists a zfor which x2 + y2 = z2, i.e. on to all points in the xy-plane.

P1,3 maps R on to the set of points (x, z) in the xz-plane for which z2−x2 ≥ 0,equivalently, |z| ≥ |x|. This region consists of all points in the union of thetwo quarter-planes bounded by the lines z = ±x containing the z-axis.

13Proving that a relation S1 from B to C is equal to a relation S2 from D to E is similar to provingfunctions equal. You must show that A = C, that B = D, and that the relations are precisely the samesets of points.

UPDATED TO September 19, 2000

Page 101: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1073

P1,2,3 maps R on to R.

P3 maps R on to the entire z-axis.

(b) The surface x2 + y2 = z2 is not the graph of a function z = z(x, y), since, forall points P on the xy-plane except the origin there will be more than onepoint on the line through P parallel to the z-axis. For example, (3, 4, 5) and(3, 4,−5) both are contained in R.

(c) J1(S, S) consists of all (a, b, c) such that (a, b) ∈ S and (b, c) ∈ S. The actionof P1,3 on this relation yields the composite of S and S, which was defined tobe S2.

4. (a) The Sieve of Eratosthenes is an algorithm based on [17, Theorem 2.3.3] fordetermining all positive primes not exceeding an integer n. One first writesdown the positive integers 2, 3, 4, 5, ..., n. In the first pass one deletes fromthe list all multiples of 2, except 2 itself. Then one observes that the successorof 2 in the list is 3, and deletes from the list all multiples of 3 except 3 itself.The successor of 3 is 5, since 4 was deleted earlier as a multiple of 2. The listis now scanned for multiples of 5 and all except 5 itself are omitted. Next 7,etc.

Use the Sieve of Eratosthenes to determine all positive primes not exceed-ing 50. By virtue of [17, Theorem 2.3.3], we need not divide by any primeexceeding

√50 = 7.07...

(b) (cf. [17, Example 2.6, p. 114]) Showing all your work, determine the primefactorization of 10014. (cf. [17, Example 2.3.6]).

Solution:

(a) We have determined the first 4 members of the list above. Since 7 is thelargest prime not exceeding

√50 we know that all surviving members of the

list which exceed 7 must be prime. The list of primes less than 50 is therefore2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47

(b) We begin by dividing succesive primes into 10014. As evidently 2|10014, wehave 10014 = 21 · 5007. As 5007 is evidently not divisible by 2, we proceedto test divisibility by the next prime, 3: 5007 = 3 · 1669, and 3 - 1669,1669 is divisible only by primes exceeding 3. Unless it is prime, 1669 will bedivisible by one or more of 5, 7, 11, ..., where the largest prime considereddoes not exceed

√1669 = 40.85... The primes required were determined in

the preceding part, using the Sieve or Eratosthenes. We find that none ofthe primes 2, 3, 5, ..., 37 divides 1669. Hence 1669 is prime, and the primedecomposition of 5007 is 213116691.

Page 102: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1074

5. ([17, Exercise 2.3.30]) If the product of two integers m, n is 273852711, and theirgreatest common divisor is 23345, determine their least common multiple.

Solution: As the product of the two integers has been given, each can involveonly the primes 2, 3, 5, 7 in its prime decomposition. Suppose m = 2a3b5c7d andn = 2e3f5g7h. Then we have the following information about the exponents:

a+ e = 7 mina, e = 3

b+ f = 8 minb, f = 4

c+ g = 2 minc, d = 1

d+ h = 11 mind, h = 0

Given the sum of two integers, and their minimum, their maximum will be theother of the two. The maxima form the exponents of the primes in the least com-mon multiple. Alternatively, the least common multiple is the quotient mn

lcm(m,n)=

27−338−452−1711−0 = 243451711.

6. In [17, Exercise 2.3.19; Solution p. S-17] it is shown that 2n − 1 is prime only if nis prime. Such an integer, when prime is called a Mersenne prime.

Your task is to consider a similarly defined sequence, the Fermat primes — definedto be those primes of the form 2n + 1. You should be familiar with the identity

x2m+1 + 1 = (x+ 1)(x2m − x2m−1 + ...− x+ 1

); (42)

the simplest non-trivial instance is x3 + 1 = (x+ 1)(x2 − x+ 1). Use this identitywith x an appropriate odd power of 2 to show that 2n + 1 is prime only if n hasno odd factors other than ±1 — i.e. only if n is a power of 2. (Note: As with theMersenne sequence, not every integer of the form 22m

+ 1 is prime.)

Solution: Factorize n into a product of powers of primes [17, Fundamental Theoremof Arithmetic, p. 113]; suppose that n is not a power of 2 — i.e. that n has an oddfactor 2m+ 1 exceeding 1; let d = n

2m+1. Then, setting x = 2d in equation (42), we

have the factorization

2n + 1 = (2d + 1)(22md − 2(2m−1)d + ...− 2d + 1

).

The first factor, 2d + 1, is evidently greater than 1. The second factor may beexpressed as a sum

(22md − 2(2m−1)d) + (2(2m−2)d − 2(2m−3)d) + ...+ (22d − 2d) + 1

in which each of the summands preceding the last is greater than 1; as m ≥ 1 thetotal is surely greater than 1; thus we have shown that 2n + 1 is composite. Weconclude that, if 2n + 1 is prime, n cannot have an odd factor exceeding 1, i.e. nmust be a power of 2.

Page 103: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1075

7. [17, Exercise 2.4.8(d)] Showing all your work, convert the following integer frombinary notation to decimal notation, then from decimal notation to hexadecimalnotation — in that order: 11111 00000 11111.

Solution: (11111 00000 11111)2 = (20 + 21 + 22 + 23 + 24) + 0 + (210 + 211 + 212 +213 + 214) = (20 + 21 + 22 + 23 + 24)(1 + 0 + 210) = 31(1 + 0 + 1024) = 31775. Nowconverting to hexadecimal notation, we apply the division algorithm repeatedly:

31775 = 16 · 1985 + 15

1985 = 16 · 124 + 1

124 = 16 · 7 + 12

7 = 16 · 0 + 7

Hence (31775)10 = 15 + 1 · 16 + 12 · 162 + 7 · 163 = (7C1F )16. We can verifythis last computation by observing that (0111 1100 0001 1111)2 = (7C1F )16. (Thisgrouping of the binary digits in 4’s is the essence of the solution to [17, Exercise2.4.10].)

8. [17, Exercise 2.4.14] It can be shown that every integer admits a representation inthe form ek3

k +ek−13k−1 + ...+e13

1 +e030, where ej = −1, 0, or 1 for j = 0, 1, ..., k.

Expansions of this type are called balanced ternary expansions . In a systematic waywhich could be generalized into an algorithm, find the balanced ternary expansionof 79.

Solution: Students were not supplied with an algorithm for determining the bal-anced ternary expansion. So a reasonable starting place would be the (unbalanced)ternary expansion:

79 = 3 · 26 + 1

26 = 3 · 8 + 2

8 = 3 · 2 + 2

2 = 3 · 0 + 2

from which we conclude that 79 = 1 + 2 · 31 + 2 · 32 + 2 · 33. Now we progressivelyeliminate coefficients 2, by replacing them by 3−1, working down from the highestpowers. We begin with the term 2 · 33 = (3− 1)33 = −1 · 33 + 1 · 34; hence

79 = 1 + 2 · 31 + 2 · 32 − 33 + 34 .

Next 2 · 32 = (3− 1) · 32 = −32 + 33, so

79 = 1 + 2 · 31 − 32 + 34 .

Page 104: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1076

But 2 · 31 = (3− 1)31 = −31 + 32, so

79 = 1− 31 + 34 .

The decomposition can be obtained more directly by modifying the applications ofthe division algorithm: instead of repeatedly dividing by 3 and taking the smallestpositive remainder, take the remainder of smallest absolute value in every case —i.e. always take a remainder of 0 or ±1:

79 = 3 · 26 + 1

26 = 3 · 9− 1

9 = 3 · 3 + 0

3 = 3 · 1 + 0

1 = 3 · 0 + 1

from which we conclude that

79 = 1 · 30 − 1 · 31 + 0 · 32 + 0 · 33 + 1 · 34 .

This decomposition has the following interesting application. Suppose you aresupplied with a set of balances and with weights in the magnitudes 1, 3, 9, 27,... These weights suffice to weigh an object of integer weight: the negative signssignify weights to be placed in the same pan as the object; the positive signs signifyweights to be placed in the opposite pan. (Of course it is possible to weigh an objectwith integer weight if we have weights 1, 2, 4, 8, 16, ...; the weights — all placedin the opposite pan to the object — will correspond to the non-zero digits in thebinary expansion of the weight.)

9. (a) [17, Exercise 2.4.2(e)] Use the Euclidean algorithm to find gcd(1529,14038).

(b) Use the results of your computations to express gcd(1529,14038) as an integerlinear combination of 1529 and 14028.

Solution:

(a)

14038 = 1529 · 9 + 277

1529 = 277 · 5 + 144

277 = 144 · 1 + 133

144 = 133 · 1 + 11

133 = 11 · 12 + 1

11 = 11 · 1 + 0

From these computations we can conclude that gcd(1529,14038)=1.

Page 105: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1077

(b) Working upwards through the preceding computations we have

1 = 133 · 1− 11 · 12 = 133 · 1− (144− 133 · 1) · 12

= 144 · (−12) + 133 · 13 = 144 · (−12) + (277− 144 · 1) · 13

= 277 · 13 + 144 · (−25) = 277 · 13 + (1529− 277 · 5) · (−25)

= 1529 · (−25) + 277 · 138 = 1529 · (−25) + (14038− 1529 · 9) · 138

= 14038 · 138 + 1529 · (−1267)

This is not the only possible decomposition. It can be shown that all possibledecompositions are of the form

1 = 14038 · (138 + 1529t) + 1529 · (−1267− 14038t)

where t is any integer (positive, 0, or negative).

C.3 Solved Problems from the Third 1996 Problem Assignment

1. Dots. In practice mathematicians often indicate the presence of a proof by induc-tion by writing down the first few instances of the statement to be proved, thenwriting a few dots (. . .), then the general case, with an indication of how an in-duction proof could be completed. Mathematicians also use the “. . .” notation toindicate a sequence which is defined recursively; where the terms are separated bycommas, they are simply being listed (as in 1, 2, . . ., n, . . .). Where they are con-nected by plus signs, a sum is intended; for example, in 1+3+5+ . . .+(2n−1), the

notation is just an abbreviation for the finite sum normally denoted byn∑

i=1

(2i− 1),

which is defined recursively by1∑

i=1

(2i− 1) = 1,n+1∑i=1

(2i− 1) =n∑

i=1

(2i− 1) + (2n+ 1);

where the sum is infinite there may be questions of convergence involved, but weare not likely to consider such questions in this course.

In [17, §3.2] both uses of “. . .” may appear. Your assignment in this problem isto examine each use of “. . .” in [17, §3.2], explaining whether dots are being usedto indicate an induction proof, or to describe a sequence or series that could bedefined recursively.

For example, the first use of “. . .” appears in [17, p. 186, l. 2], in the sequence 1, 2,3, . . ., n. Here the dots connect the first terms of a sequence (the positive naturalnumbers) with the general term n.

Everything we have said concerning terms connected by plus signs applies equallywell to any associative binary operation. Thus, one might write, informally, 1 · 2 ·

Page 106: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1078

3 · . . . · n to mean n!; one could also use dots to connect logical propositions whereeither the conjunction or disjunction is intended, as, for example, in [P (1)∧P (2)∧· · · ∧ P (n)]→ P (n+ 1) .

Solution:

(a) [17, p. 187, Example 2] (3 times): Each of the uses here is as an “abbreviation”

for a sum of the formn∑

i=1

(2i− 1).

(b) [17, p. 189, Example 4]: The author writes n = k, k + 1, k + 2, . . . to refer tothe set n|n ∈ N ∩ (n ≥ k); later he writes n = 0, 1, 2, . . . where he meansN.

(c) [17, p. 189, Example 5]: Here there are 3 instances where dots are used toindicate the sum of a geometric progression, which could be rigorously definedinductively, even if we did not possess a compact formula for the sum of theprogression. Every one of these uses could be replaced by a sum using the Σ

notation. So we could represent 1 + 2 + 22 + . . .+ 2n + 2n+1 byn+1∑i=0

2i, which

can be defined recursively as a function of n.

(d) [17, p. 189, last 2 paragraphs]: Here there are several instances where dots areused to describe infinite sequences. In these cases the sum is not of interest;indeed, unless the common ratio of these geometric series is less than 1 inmodulus, there will be no sum.

(e) [17, p. 190, Example 6] (4 times): These uses are all to indicate the sum of a(finite) geometric progression.

(f) [17, p. 191, Example 7]: In k = 1, 2, 3, . . . the dots are used to indicate thesequence of positive natural numbers in their usual order. In the remaininguses except the sum in [17, p. 191, 3 lines from bottom of page], the dots areused in the description of a finite sum that could have been defined recursively.

The usage 3 lines from the bottom is to indicate the harmonic series, whichdoes not converge.

(g) [17, p. 192, Example 9]: There are 2 instances where dots are used to describethe sequence of positive integers (n = 1, 2, 3, . . .). There are four instanceswhere dots are used to indicate the sum of the first n or n + 1 terms of thissequence. These sums could be defined inductively without dots.

(h) [17, p. 196, 2nd Principle of Mathematical Induction]: The proposition [P (1)∧P (2) ∧ · · · ∧ P (n)]→ P (n+ 1) could have been written without dots. Definea sequence of statements Q(n) inductively as follows: Q(1) = P (1). If Q(r)

Page 107: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1079

has been defined, then Q(r+1) is defined to be the statement Q(r)∧P (r+1)(r ≥ 1).

(i) [17, p. 198 Remark]: Some of the uses are to represent sequences that arenot being summed. There are two statements where the use is as describedin connection with the theorem above — to describe a conjunction of a finitenumber of logical propositions.

2. [17, Exercise 3.2.16] Use mathematical induction to prove that

n∑i=1

i(i+ 1)(i+ 2) =1

4n(n+ 1)(n+ 2)(n+ 3) . (43)

Solution: Denote equation (43) by P (n).

BASIS STEP. P (1) states that 1 · 2 · 3 = 1 · 2 · 3 · 4/4, which is evidently true.

INDUCTIVE STEP. Assume that P (n) is true. Then

n+1∑i=1

i(i+ 1)(i+ 2)

=n∑

i=1

i(i+ 1)(i+ 2) + (n+ 1)(n+ 2)(n+ 3) by definition ofn+1∑

=1

4n(n+ 1)(n+ 2)(n+ 3) + (n+ 1)(n+ 2)(n+ 3) by P (n)

=(n+ 1)(n+ 2)(n+ 3)(n+ 4)

4,

which is P (n+ 1).

Truth of P (n) for all positive n follows by Mathematical Induction.

3. [17, Supplementary Exercise 36, p. 228] A set is well ordered if every nonemptysubset of this set has a least element. Determine which of the following sets S iswell ordered.

(a) the set of integers

(b) the set of integers greater than −100

(c) the set of positive rationals

(d) the set of positive rationals with denominator less than 100

Page 108: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1080

Solution:

(a) FALSE. While some nonempty subsets do indeed have a least element, thereexist subsets that do not, for example, the set Z itself. This set has no leastelement; for, if x were a least element, it would have to be no greater thanx − 1, which is also in Z. From this contradiction we conclude that thereexists no least element for Z (more precisely, for the structure (Z,≤).) Hencethis poset is not well ordered.

(b) TRUE. Every nonempty set of integers from this set has a least element whichwill not be less than −100. This is because we are working with integers; theset of rational numbers greater than −100 is not well ordered. For example,the subset consisting of all real numbers strictly greater than −100 — i.e. theset14 x ∈ Q|x > −100 with the usual order of the real numbers — has nominimum element; for, if one were to claim that some real number a in theset were the minimum, then a−100

2would be a smaller number in the set; from

this contradiction one concludes that this set has no least element.

(c) Reasoning as at the end of the preceding part, suppose that a is the smallestpositive rational number. Then a is expressible as a ratio b

cof positive integers.

But now the rational number b2c

is smaller than a and is still positive; so a is notthe smallest positive rational number. From this contradiction we concludethat the hypothesized existence of a is false: there exists no smallest positiverational. As we have exhibited a non-empty subset with no least element, wehave shown that the positive rationals are not well ordered (under the usualordering of the real numbers).

(d) In any subset of S the elements are never closer together than 11002 (since

the difference between two ratios that both have denominators less than 100is greater than a rational whose numerator is a non-zero integer, and whosedenominator is less than 992). Thus, if a subset T ⊆ S is given we havean algorithm to determine its minimum element: succesively examine eachinterval [10−4n, 10−4(n+ 1)) for n = 0, 1, ... — there will never be more thanone member of T in such an interval; stop when the examination yields anelement of T . If T 6= ? , this algorithm must terminate.

4. [17, Exercise 3.2.18] Prove that 1+ 14+ 1

9+ · · ·+ 1

n2 < 2− 1n

whenever n is a positiveinteger exceeding 1.

Solution: This is an example of an important activity in mathematical analysis,the estimation of a quantity whose exact value may be difficult to determine. Insuch situations we often do not require the “best” value, but merely a bound for

14Q denotes the set of rational numbers.

Page 109: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1081

the value. For example, it is known that∑∞

i=11i2

= π2

6= 1.64493.... which gives a

better bound than the one you are asked to prove, as soon as n ≥ 3.

Let P (n) denote the statement∑n

i=11i2< 2− 1

n. P (2) states that 5

4< 2− 1

2which

is evidently true. Suppose that P (n) has been proved. Then

n+1∑i=1

1

i2=

n∑i=1

1

i2+

1

(n+ 1)2by recursive definition of

n+1∑<

(2− 1

n

)+

1

(n+ 1)2by induction hypothesis

= 2−(− 1

(n+ 1)2+

1

n

)≤ 2−

(− 1

n(n+ 1)+

1

n

)Why?

=n

n(n+ 1)=

1

n+ 1

5. In the propositional calculus, the set WFF of well formed formulæ is definedrecursively as follows:

• BASE CASES:

– F ∈WFF and T ∈WFF

– every propositional variable belongs to WFF ;

• RECURSIVE STEP: if u and v are in WFF , then so also are each of (¬u),(u ∨ v), (u ∧ v), (u→ v), (u↔ v).

[17, Example 3.3.9] (cf. [17, Exercise 3.3.24]) Show that any element of WFFcontains equal numbers of left and right parentheses. Hint. Eventually we willhave a general procedure that could be applied here. For the present, we have onlythe two types of induction, both of which require a statement P (n), where n rangesover the positive integers. Thus, in order to solve this problem with tools availableto you at present, you will have to recast the statement into one of the form P (n)— that is, that depends on some positive integer variable. There are several waysin which this could be done. For example, you could take n to be the number oflogical connectives in the formula. These are the operators ¬, ∨, ∧, →, ↔. Theformulæ are strings of symbols from the alphabet

T,F ∪ all propositional variables ∪ ¬,∨,∧,→,↔, (, )

(Another approach would be to build the induction on the length of the formula— i.e. the total number of characters in the string, counting variables, connectives,and parentheses.)

Solution: Define P (n) to be the statement:

Page 110: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1082

All well formed formulæ having exactly n connectives contain equal num-bers of left and right parentheses.

BASIS STEP. The formulæ whose membership derives from the RECURSIVESTEP all contain at least one connective. The others are precisely the BASECASES, none of which contains any parentheses. Hence the numbers of paren-theses are equal (each to 0) when the number of connectives is 0; i.e. P (0) istrue.

INDUCTIVE STEP: Suppose that P (n) has been proved for all n ∈ N, andconsider P (n + 1). Any well formed formula with n + 1 connectives is con-structed by the RECURSIVE STEP either

(a) from a well formed formula u, by negation, to form (¬u); or

(b) from two well formed formulæ u, v, as (u∗ v) where ∗ is one of the binaryconnectives ∧, ∨, →, ↔.

But, if the numbers of left and right parentheses in u are equal (to someinteger m), then the numbers in (¬u) will also be equal (to m + 1). And, ifthe numbers of left and right parentheses of u are both equal to m, and thoseof v are both equal to `, then the numbers in (u ∗ v) will both be equal to`+m+ 1. This proves that P (n)→ P (n+ 1) is always true (n = 0, 1, ...).

6. [17, Exercise 4.1.18] Determine the numbers of positive integers between 1000 and9999 inclusive having each of the following properties. (Note that in the range wehave chosen there will be no “leading zeroes”.)

(a) Integers divisible by 9.

(b) Even integers.

(c) Integers in which all digits are distinct.

(d) Integers which are not divisible by 3.

(e) Integers which are divisible by 5 or 7 (or both).

(f) Integers which are not divisible by either 5 or 7.

(g) Integers which are divisible by 5 but not by 7.

(h) Integers which are divisible by both 5 and 7.

Solution:

(a) Integers divisible by 9. The first such integer will be 9 × d10009e = 1008;

the last is 9 × b99999c = 9999 The number of multiples of 9 in this interval is

1111− 112 + 1 = 1000.

Page 111: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1083

(b) Even integers. Exactly half of the integers in the range are even; theirnumber is 9000

2= 4500.

(c) Integers in which all digits are distinct. We have to choose 4-digitsequences of distinct integers in which the first digit is not a zero. The firstdigit may be chosen in 9 ways. Following that, the second may be chosenindependently of the first, from the residual population of 9 digits (excludingthe first digit chosen). The third digit is then chosen in 10−2 = 8 ways; thenthe fourth in 10− 3 = 7 ways. In all, by the Product Rule, the total numberof these integers is 9× 9× 8× 7 = 4536.

(d) Integers which are not divisible by 3. The integers which are divisible by3 are equally spaced, 3 units apart; starting at the largest, 9999 and descendingto the smallest, 3×d1000

3e = 1002. Their number is 9999−1002

3+1 = 3000. Hence

the number of integers which are not disible by 3 number 9000−3000 = 6000.

(e) Integers which are divisible by 5 or 7 (or both). We apply the Inclusion-Exclusion Principle, to be studied formally in [17, §§5.4]. Let A1 and A2

respectlvely denote the sets of integers in the given range that are divisible by 5and by 7. Then |A1| = 9000

5= 1800; |A2| = b9999

7c−b999

7c = 1428−142 = 1286.

By part (6h), |A1 ∩ A2| = 257.

|A1 ∪ A2| = |A1|+ |A2| − |A1 ∩ A2| = 1800 + 1286− 257 = 2829.

(f) Integers which are not divisible by either 5 or 7. This is the complementof the preceding case; the number of such integers is 9000− 2829 = 6171.

(g) Integers which are divisible by 5 but not by 7. The number of integersdivisible by 5 is 1800. From this set we delete those divisible by both 5 and7, numbering (by the next part) 257, leaving a balance of 1543.

(h) Integers which are divisible by both 5 and 7. The number of multiplesof 35 not exceeding 999 is b999

35c = 28; the number of such multiples not

exceeding 9999 is b999935c = 285; hence the number of multiples of 35 in the

desired range is 285− 28 = 257.

7. You are given a set A = a1, a2, a3, a4, a5 containing 5 elements, and a set B =b1, b2, b3 containing 3 elements. Showing all of your work, determine each of thefollowing:

(a) The number of functions f : A→ B.

(b) The number of bijections f : A→ A.

(c) The number of injections f : A→ B.

Page 112: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1084

(d) The number of injections f : B → A.

(e) The number of surjections f : A→ B.

Solution:

(a) The number of functions f : A → B. For each point of A there are |B|choices of image. Since the action of f on any point is not affected by itsaction on any other point, the Product Rule is applicable. The total numberof such functions is, therefore, |B||A| = 35 = 243.

(b) The number of bijections f : A → A. Map a1 in |A| ways, a2 in |A| − 1ways, etc. The Product Rule applies, yielding the number |A|! = 5! = 120such permutations in all.

(c) The number of injections f : A→ B. Since |B| is smaller than |A| therecan be no injection of A into B. Accordingly, the number of such functions is0.

(d) The number of injections f : B → A. Select the image points in(|A||B|

)=(

53

)= 10 ways. Then map the elements of B in |B|! ways. In all the number

of functions is P (5, 3) = 60.

(e) The number of surjections f : A→ B. The total number of functions fromB to A is |B||A| = 35 = 243. Denote by Si those functions for which bi is notin the image (i = 1, 2, 3). Then |Si| = 25 = 32 (i = 1, 2, 3). |S1∩S2| = 15 = 1,etc. |S1 ∩ S2 ∩ S3| = |? | = 0. By the Inclusion-Exclusion Principle, the totalnumber of mappings which are not surjective is 3 · 25− 3 · 1+1 · 0 = 93; hencethe number of surjective mappings is 243− 93 = 150.

We can enumerate these in other ways. For example, we could examine thepossible distributions of 5 points among 3 image points. The possible parti-tions of 5 into 3 positive parts are: 5 = 2 + 2 + 1 and 5 = 3 + 1 + 1. In thecase of 2 + 2 + 1 we can select the point of B which is to be the image of 1point in

(31

)= 3 ways, and the point of A to be mapped to it in

(51

)= 5 ways.

Then we can select the points of A to be mapped on to one of the remaining 2points of B in

(42

)= 6 ways; there is no choice for the action on the remaining

points. Applying the Product Rule we find that the total number of surjectivemappings associated with this partition to be 3× 5× 6 = 90.

In the case of partition 3 + 1 + 1, choose the point of B to receive 3 points in(31

)= 3 ways, and the points to be mapped on to it in

(53

)= 10 ways. Then

the remaining 2 points of B are assigned one to each of the remaining 2 pointsof B, in 2! = 2 ways. In all, the number of such mappings is 3× 10× 2 = 60.

Summing the numbers of surjections associated with the two partitions yields90 + 60 = 150, as computed earlier.

Page 113: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1085

(What we have computed here is 3! times the Stirling number of the SecondKind S(5, 3) = 25. This Stirling number is the number of ways of partition-ing a set of 5 distinguishable objects into 3 unlabelled sets, each of which isto contain a positive number of elements. The factor 3! by which we havemultiplied the Stirling number is to render the sets distinguishable.)

8. (a) [17, Exercise 3.3.30] Give a recursive definition of the set of bit strings thatare palindromes15 over some alphabet A.

(b) Determine a formula for the number of palindromes of length n over thealphabet 0, 1.

Solution:

(a) (There will be other ways of generating this set recursively.) Define a sequenceof sets Sn by

i. S0 = ? .

ii. S1 = A.

iii. Sn+2 = apa|(a ∈ A) ∧ (p ∈ Sn) (n ≥ 0)

Then the set of palindromes is ∪∞i=0Si.

A similar definition, which does not partition the set of palindromes into thoseof various lengths, is

i’. ? and all elements of A are palindromes.

ii’. If p is a palindrome, and if a ∈ A, then apa is a palindrome.

A palindrome of even length n = 2m can be obtained by concatenating anybinary word of length m with its “inverse” (i.e. reversal); and, conversely, anyword constructed in this way is a palindrome. The number of such wordsis 2m = 2

n+12 . A palindrome of odd length n = 2m + 1 can be obtained by

inserting either a 0 or a 1 into the centre of a palindrome of length 2m; andconversely. The number of such words is therefore 2 · 2m = 2m+1 = 2d

n+12e.

9. [17, Exercise 4.3.28] How many bit strings contain exactly five 0’s and 14 1’s, ifevery 0 must be immediately followed by 2 successive 1’s

Solution: Every 0 appears as the first members of a subsequence 011. Our wordscan be viewed as words in the alphabet 011, 1. Any permutation of repeatedcopies of these primitive words can be analyzied to determine uniquely the numbersof the two subwords used. In the present case we are permuting 5 copies of 011and (5 + 14)− 15 = 4 copies of 1. The number of permutations is

(5+45

)= 126.

15A palindrome is a string that is not changed under reversal, for example, the word “radar”; anotherpalindrome, supposedly recited by Napoleon is ABLE WAS I ERE I SAW ELBA.

Page 114: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1086

10. [17, Exercise 4.2.12]

(a) Show that if seven integers are selected from the first ten positive integers,there must be at least two pairs of these integers with sum 11.

(b) Is the conclusion in part (a) true if six integers are selected instead of seven?Explain.

Solution:

(a) Partition the set

1, 2, 3, 4, 5, 6, 7, 8, 9, 10 = 1, 10 ∪ 2, 9 ∪ 3, 8 ∪ 4, 7 ∪ 5, 6

Let xi denote the number of points selected from the pair i, 11 − i (i =1, 2, 3, 4, 5). Then

x1 + x2 + x3 + x4 + x5 = 7 (44)

The claim is that at least 2 of these xi which are ≥ 2. Let us consider thealternatives:

Just one xi is ≥ 2: As the maximum value of each xi is also 2, in this casethere would remain 7−2 = 5 to be partitioned amoung the remaining foursubsets; by the Pigeonhole Principle, at least one subset would contributemore than 1.

No xi is ≥ 2: This would imply that xi ≤ 1 for all i, contradicting thePigeonhole Principle.

We conclude that the claim is correct.

(b) The preceding result is “best possible” in the sense that a selection of sixintegers might not have the property claimed: select 2 points from one of thepairs, and 1 from each of the others.

11. (cf. [17, Exercise 4.6.16]) In each of the following cases determine the number ofsolutions to the equation

x1 + x2 + x3 + x4 + x5 + x6 = 29 (45)

in nonnegative integers such that

(a) xi > 1 (i = 1, 2, 3, 4, 5, 6)16.

(b) xi ≥ i (i = 1, 2, 3, 4, 6); x5 > 5.

16This part has been changed from the version in the textbook.

Page 115: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1087

(c) x1 ≤ 5.

(d) x1 < 8, x2 > 8.

Solution: Problems of this type, involving ordered partitions into non-negativeintegers, can be represented by binary integers. Represent part xi by a string of xi

1’s; follow each of these strings — except the last — by a 0, serving as a separator.Conversely, any binary integer in 29 1’s and 5 0’s can be interpreted as a partition.

(a) xi > 1 (i = 1, 2, 3, 4, 5, 6): We shall change the variables to convert thisproblem to one which can be represented by binary strings, where the only re-strictions are the numbers of 0’s and 1’s. Define yi = xi−2 (i = 1, 2, 3, 4, 5, 6).Equation (45) transforms to

y1 + y2 + y3 + y4 + y5 + y6 = 17, .

The number of binary words with 17 1’s and 5 0’s is(17+5

5

)= 26 334.

(b) xi ≥ i (i = 1, 2, 3, 4, 6); x5 > 5: We shall change the variables. Defineyi = xi − i (i = 1, 2, 3, 4, 6); y5 = x5 − 6. Then equation (45) is equivalent to

y1 + y2 + y3 + y4 + y5 + y6 = 7 ,

to be solved in non-negative integers. The number of binary words in 7 + 51’s and 5 0’s is

(7+55

)= 792.

(c) x1 ≤ 5: Changing the variables by yi = xi (i = 1, 2, 3, 4, 6); y5 = x5 − 6we can count the number of solutions to the preceding part that violate thepresent conditions. The new equation is

y1 + y2 + y3 + y4 + y5 + y6 = 23 ,

and the number of non-negative solutions is(285

)= 98 280. Hence the num-

ber of solutions satisfying the present condition is(29+5

5

)−(285

)= 278 256 −

98 280 = 179 976.

(d) x1 < 8, x2 > 8: By the methods used above, the number of solutions toequation (45) satisfying x2 ≥ 9 is the number of non-negative solutions to

y1 + y2 + y3 + y4 + y5 + y6 = 20 ,

i.e.(255

)= 53 130. From these we wish to exclude the solutions corresponding

to x1 ≥ 8, now y1 ≥ 8. We change the variable again: z1 = y1 − 8, zi = y1

(i = 2, 3, 4, 5, 6). The resulting equation is

z1 + z2 + z3 + z4 + z5 + z6 = 12 .

The number of inadmissible solutions is(12+5

5

)= 6 188. Subtracting yields

the number of admissible solutions, 53 130− 6 188 = 46 942.

Page 116: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1088

12. [17, Exercise 4.6.28] Determine how many different strings can be made from allthe letters in AARDVARK, subject to the condition that the three A’s must beconsecutive.

Solution: We count the number of permutations of 6 objects: one string AAA; twostrings R, R; and three other single letters, D, V, K. Had the R’s been distinguish-able, the number would have been 6!. Here, as the R’s are alike, the total numberof arrangements is 6!

2!= 360.

C.4 Solved Problems from the Fourth 1996 Problem Assign-ment

Note: Students had been advised that ‘There is no need to evaluate“large” binomial coefficients, unless knowing their values can help you verifyyour work.’

1. Showing all your work, determine the total17 coefficient of z7 in the expansion of(x− 2yz + 3z2)11.

Solution:

Using the Multinomial Theorem [17, Exercise 4.6.49]: The coefficient will

be the sum of all possible terms of type xn1(−2y)n23n311!

n1!n2!n3!where n1+n2+

n3 = 11 and n2 + 2n3 = 7. Since 0 ≤ n2 = 7− 2n3, we see that the followingare the only possible non-negative integer solutions of these equations:

(n1, n2, n3) ∈ (4, 7, 0), (5, 5, 1), (6, 3, 2), (7, 1, 3) .

Hence the total coefficient of z7 is

11!

4!7!0!(−2)730x4y7 +

11!

5!5!1!(−2)531x5y5

+11!

6!3!2!(−2)332x6y2 +

11!

7!1!3!(−2)133x7y1

= −42240x4y7 − 266112x5y5 − 332640x6y2 − 71280x7y1 .

Using the Binomial Theorem several times:

(x+ z(−2y + 3z))11

17By total we mean the polynomial in x and y which, when multiplied by z7, contains all terms ofthe form (constant)xiyjz7; had we suppressed the word total some readers might have assumed we wereinterested only in the term (constant)z7 in the expansion — whose coefficient is evidently 0.

Page 117: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1089

=

(11

7

)x4(−2y + 3z)7z7 +

(11

6

)x5(−2y + 3z)6z6

+

(11

5

)x6(−2y + 3z)5z5 +

(11

4

)x7(−2y + 3z)4z4 + irrelevant terms

=

(11

7

)x4

(7

0

)(−2)7y7z7 +

(11

6

)x5

(6

1

)(−2y)53zz6

+

(11

5

)x6

(5

2

)(−2y)3(3z)2z5 +

(11

4

)x7

(4

3

)(−2y)1(3z)3z4 + · · ·

2. Use exponential generating functions to determine, for any n, the number of ternarywords of length n having an even number of 0’s, an odd number of 1’s, and an

unrestricted number of 2’s. [Hint: ex− e−x = 2∞∑

n=0

x2n+1

(2n+1)!. A similar relation holds

for the sum of even powers.]

Solution: The enumerators for 0’s, 1’s, and 2’s respectively are ex+e−x

2, ex−e−x

2. ex.

Multiplying these three factors yields the exponential generating function for thenumbers under consideration in this problem: ex+e−x

2· ex−e−x

2· ex = 1

4(e3x − e−x) =

14

∞∑n=0

3n−(−1)n

n!. Hence the number of ternary words sought is n! times the preceding

nth degree coefficient, or 14(3n − (−1)n).

3. The proprietor of a book shop wishes to arrange 15 different books on five shelvesfor a window display. In how many ways can she arrange them so that each shelfhas at least one, but no more than four books?

Solution: [6, Exercise 8.1.7] We can think of this problem as having two phases:

• selecting the locations for books — i.e. determining the number of books tobe placed on each shelf; and

• determining the number of ways of placing the 15 distinct books in the deter-mined locations.

The second phase will always be independent of the first: there are 15! ways ofplacing the 15 books. Thus we need only solve the first phase and multiply by 15!— by the Product Rule.

The first phase of the problem is equivalent to solving the equation

x1 + x2 + x3 + x4 + x5 = 15 (46)

in non-negative integers xi subject to constraints 1 ≤ xi ≤ 4 (i = 1, ..., 5).

Page 118: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1090

Using Generating Functions The ordinary generating function for the admis-sible values of xi is t1 + t2 + t3 + t4. We seek the coefficient of t15 in theexpansion of (t+ t2 + t3 + t4)5 = t5(1− t4)5(1− t)−5, i.e. the coefficient of t10

in the expansion of

(1− t4)5(1− t)−5 = (1− 5t4 + 10t8 − ...) ·∞∑

n=0

(n+ 4

4

)tn

= (1− 5t4 + 10t8 − ...)

·(

1 + ...+

(6

4

)t2 + ...+

(10

4

)t6 + ...+

(14

4

)t10 + ...

)= ...+

((14

4

)− 5

(10

4

)+ 10

(6

4

))t10 + ...

Hence the number of arrangements of distinct books is((14

4

)− 5

(10

4

)+ 10

(6

4

))· 15!

Using the Principle of Inclusion-Exclusion We shall adopt a point of viewsuggested by the preceding solution. We will take as our underlying populationthe set S consisting of all integer solutions of (46) such that xi ≥ 1 (i =1, 2, ..., 5). Then we will define Ci to be the subset of S such that xi ≥ 5(i = 1, 2, ..., 5).

We shall determine the cardinalities of various intersections of sets from theone-to-one correspondence between the integer solutions to

x1 + x2 + ...+ xk = n

subject toxi ≥ 0 (i = 1, 2, ..., k)

and the binary words in n 0’s and k − 1 1’s, which serve as separators. Thatnumber is the number of ways of selecting positions for the k − 1 separatorsin the (n+ k − 1)-digit word, i.e.

(n+k−1

k−1

)or, equivalently,

(n+k−1

n

).

To determine |S|, we make a change of variables yi = xi − 1 (i = 1, 2, ..., 5):the number of non-negative integer solutions to y1 + y2 + y3 + y4 + y5 +5 = 15is(10+4

4

).

The number of solutions to (46) subject to 5 ≤ x1, 1 ≤ xi (i = 2, 3, 4, 5) is,after a change of variables y1 = x1− 5, yi = xi− 1 (i = 2, 3, 4, 5), the numberof non-negative integer solutions to y1 + y2 + y3 + y4 + y5 + 9 = 15, namely(6+44

)= |C1|. The same value holds for |Ci| (i = 2, 3, 4, 5).

Page 119: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1091

For the intersection of two of the sets of forbidden partitions, consider, forexample, C1 ∩ C2, the cardinality will be the number of integer solutions to(46) subject to 5 ≤ x1, 5 ≤ x2, 1 ≤ xi (i = 3, 4, 5); after the change ofvariables y1 = x1 − 5, y2 = x2 − 5, yi = xi − 1 (i = 3, 4, 5), this will be thenumber of non-negative integer solutions to y1 + y2 + y3 + y4 + y5 + 13 = 15,namely

(2+44

)= |C1 ∩ C2|. The same value holds for all

(52

)intersections of

pairs of the sets Ci (i = 1, 2, 3, 4, 5).

All intersections of more than two of these sets will be empty, since theyentail preassigning more books than we have available to place. Accordingly,the Principle of Inclusion-Exclusion yields the number of solutions to be thesame alternating sum determined before.

Another solution using Inclusion-Exclusion We give here a second solutionusing Inclusion-Exclusion. This solution has no redeeming features; it is pre-sented only to show that there are often several different points of view thatwill lead to the same numerical solution. This particular point of view leadsto very tedious computations.

We define S to be the set of all non-negative integer solutions to (46). LetCi be the subset of solutions for which xi = 0 (i = 1, 2, ..., 5), and let Di bethe subset of solutions for which xi ≥ 5 (i = 1, 2, ..., 5). There cannot be anynon-empty intersections with more than 3 of the Dj; the intersection of Di

with Ci is always empty (i = 1, 2, 3, 4, 5); and the intersection5∏

i=1

Ci = ? .

Then

|S| =

(15 + 4

4

)|Ci| =

(15 + 3

3

)|Ci1 ∩ Ci2| =

(15 + 2

2

)|Ci1 ∩ Ci2 ∩ Ci3| =

(15 + 1

1

)= 16

|Ci1 ∩ Ci2 ∩ Ci3 ∩ Ci4| =

(15 + 0

0

)= 1

|Dj| =

(10 + 4

4

)|Dj ∩ Ci| =

(10 + 3

3

)

Page 120: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1092

|Dj ∩ Ci1 ∩ Ci2| =

(10 + 2

2

)|Dj ∩ Ci1 ∩ Ci2 ∩ Ci3| =

(10 + 1

1

)= 11

|Dj ∩ Ci1 ∩ Ci2 ∩ Ci3 ∩ Ci4| =

(10 + 0

0

)= 1

|Dj1 ∩Dj2| =

(5 + 4

4

)|Dj1 ∩Dj2 ∩ Ci| =

(5 + 3

3

)|Dj1 ∩Dj2 ∩ Ci1 ∩ Ci2| =

(5 + 2

2

)|Dj1 ∩Dj2 ∩ Ci1 ∩ Ci2 ∩ Ci3| =

(5 + 1

1

)= 6

|Dj1 ∩Dj2 ∩Dj3| =

(4

4

)|Dj1 ∩Dj2 ∩Dj3 ∩ Ci| =

(3

3

)|Dj1 ∩Dj2 ∩Dj3 ∩ Ci1 ∩ Ci2| =

(2

2

)

We apply the Principle of Inclusion-Exclusion. The total number of arrange-ments is 15! times(

19

4

)−

((5

1

)(18

3

)+

(5

1

)(14

4

))+

((5

2

)(17

2

)+

(5

1

)(4

1

)(13

3

)+

(5

2

)(9

4

))−

((5

3

)(16

1

)+

(5

2

)(3

1

)(12

2

)+

(5

2

)(3

1

)(8

3

)+

(5

3

)(4

4

))+

((5

4

)(15

0

)+

(5

3

)(2

1

)(11

1

)+

(5

2

)(3

2

)(7

2

)+

(5

1

)(4

3

)(3

3

))−

((5

4

)+

(5

3

)(6

1

)+

(5

2

))This alternating sum can be shown to have the same value as that obtainedin the previous solution.

Page 121: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1093

4. [17, Exercise 5.2.12] Find the solution to an = 2an−1 + an−2 − 2an−3 for n =3, 4, 5, . . ., with initial conditions a0 = 3, a1 = 6, a2 = 0.

Solution: The characteristic polynomial of this equation is x3 − 2x2 − x + 2, i.e.(x+ 1)(x− 1)(x− 2), so the roots are −1, 1, 2, each of multiplicity 1. The generalsolution is an = A(−1)n +B1n +C2n. Imposing the three initial conditions yieldsthe 3 equations

A+B + C = 3

−A+B + 2C = 6

A+B + 4C = 0

having solution (A,B,C) = (−2, 6,−1), so the particular solution to the givenrecurrence satisfying the stated initial conditions is an = −2(−1)n + 6− 2n.

5. Let |A| = n. Showing all your work, determine the numbers of relations in A× A(i.e. binary relations on A) which have each of the following properties:

(a) symmetry

(b) reflexivity

(c) symmetry and reflexivity

(d) antisymmetry, and are not reflexive

(e) (for n = 4 only) reflexivity and symmetry and transitivity

(f) no restriction at all (i.e. count all relations)

Solution: We will solve this problem, where convenient, by referring to the matrixrepresentation.

(a) A relation is symmetric iff it adjacency matrix is symmetric. Pair off thecorresponding off-diagonal entries in an n× n-matrix. A relation is symmet-ric iff both members of each of these

(n2

)pairs are related, or both are not

related. We also may include or exclude each of the n diagonal entries. Thetotal number of inclusions and exclusions is n +

(n2

)=(

n+12

). These are all

independent, so, by the Product Rule, the number of relations is 2(n+12 ).

(b) Reflexivity corresponds to the presence of 1’s throughout the main diagonalof the adjacency matrix. All other entries are unconstrained, so the totalnumber of relations is 2n2−n.

(c) For symmetry and reflexivity both, the diagonal entries are now determined,and the off-diagonal entries are determined in pairs — either both are present,

or neither. The total number of relations, again by the Product Rule, is 2(n2).

UPDATED TO September 19, 2000

Page 122: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1094

(d) Antisymmetry is independent of reflexivity. The off-diagonal entries, consid-ered in symmetrically located pairs, must be either both 0, or just one 1 and

the other 0. There are thus 3 choices for each of these pairs, or 3(n2) choices in

all. For each of these choices the main diagonal of the matrix may be anythingexcept all 0’s: there are thus 2n − 1 choices for the main diagonal. By theproduct rule, the total number of antisymmetric but non-reflexive relations is

3(n2) (2n − 1).

(e) The three stated properties define an equivalence relation. We know that theequivalence classes partition the set A; and that, conversely, any partition ofA gives rise to an equivalence relation. Thus we need only count the partitions(cf. [17, Exercise 6.5.43]).

4 = 4. There is only one way to partition A into one subset. The number ofrelations is 1.

4 = 3 + 1. We can partition A into a 3-subset and a 1-subset in(43

)= 4 ways.

4 = 2 + 2. This case requires some thought. There are(42

)= 6 ways to choose

a subset of 2 elements from among the 4 elements of A. But this countseach partition twice: any 2 points can appear as members of the subset“selected”, or as members of the subset “discarded”; indeed, the multi-plicity of the count is 2! = 2; dividing by 2 yields 3 distinct partitions ofA into two subsets, each having 2 members.

4 = 2 + 1 + 1. Select the subset with 2 members in(42

)= 6 ways; then the

remaining 2 points must each be treated the same way. The total numberof partitions is 6.

4 = 1 + 1 + 1 + 1. All points are treated the same; the total number of par-titions is 1.

In all we have 1+4+3+6+1 = 15 distinct partitions of A, hence 15 distinctequivalence relations.

(f) This is simply the number of n× n 0− 1-matrices, i.e. 2n2.

6. [17, Exercise 6.3.8] Let R1 and R2 be relations on a set A, represented by thematrices

MR1 =

0 1 01 1 11 0 0

and MR2 =

0 1 00 1 11 1 1

.

Showing all your work, determine the matrices representing each of the followingrelations:

(a) R1 ∪R2.

Page 123: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1095

(b) R1 ∩R2.

(c) R1 R2.

(d) R2 ∪R1.

(e) R1 R1.

(f) R1 ⊕R2.

Solution:

(a) The entry in any specific location is found by taking the maximum of the

entries in that position in the given matrices. Hence MR1∪R2 =

0 1 01 1 11 1 1

.

(b) Analogously to the previous case, e take the minima of corresponding entries

in the two matrices, to obtain MR1∩R2 =

0 1 00 1 11 0 0

.

(c) MR1R2 =

1 1 11 1 11 1 1

.

(d) same as part (a)

(e) R1⊕R2. An entry is 1 iff the entries in that position in the two given matrices

are different. MR1⊕R2 =

0 0 01 0 00 1 1

.

7. (a) [17, Exercise 6.5.10] Let R be the relation on the set of ordered pairs of positiveintegers such that ((a, b), (c, d)) ∈ R iff ad = bc. Show that R is an equivalencerelation.

(b) For the relation induced by R on the set of pairs (a, b) where 1 ≤ a ≤ 3 and1 ≤ b ≤ 3, sketch the directed graph.

Solution:

(a) Reflexivity. For any ordered pair (a, b), since ab = ba, ((a, b), (a, b)) ∈ R.

Symmetry. ∀a∀b∀c∀d

((a, b), (c, d)) ∈ R⇔ ad = bc by definition of R

⇔ cb = da by commutativity of integer multiplication

⇔ ((c, d), (a, b)) ∈ R by definition of R

Page 124: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1096

Transitivity. Suppose that ((a, b), (c, d)) ∈ R and ((c, d), (e, f)) ∈ R. Thenad = bc, cf = de. Hence adf = bcf = bde, so af = be, implying that((a, b), (e, f)) ∈ R.

(b) The digraph has 9 points, at each of which there is a loop. In addition, thepoints (1, 1), (2, 2), (3, 3) are mutually adjacent by pairs of directed edges— as these three points constitute one equivalence class. There are no otherrelated pairs.

8. [17, Exercise 6.6.28]

(a) Show that there is exactly one greatest element of a poset, if such an elementexists.

(b) Show that there is exactly one least element of a poset, if such an elementexists.

Solution:

(a) For the poset (S,), suppose that both x and y are greatest elements. Then

∀a[a x] and ∀b[b y] (47)

Specializing a := y and b := x in (47) yields y x and x y; by theantisymmetry of , these statements imply x = y.

(b) The “dual” of the preceding result.

9. (cf. [17, Exercise 6.6.32]) Determine which of the following posets are lattices.

(a) 1, 3, 6, 9, 12, where the order relation is divisibility

(b) 1, 3, 6, 9, 12, where the order relation is the usual ordering ≤ of the realnumbers

(c) 1, 5, 25, 125, where the order relation is divisibility

(d) (Z,≥)

(e) (P (S),⊇). where P (S) is the power set of a set S.

Solution:

(a) This is not a lattice, since lcm(6, 9) is not present.

(b) This is a totally ordered set with 4 elements, hence a lattice (cf. [17, Exercise6.6.38]).

(c) as the preceding case

(d) again, a totally ordered set

(e) This is a lattice, cf. [17, Example 6.6.23].

Page 125: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1097

C.5 Solved Problems from the Fifth 1996 Problem Assignment

1. [17, Exercise 7.2.*36, p. 449] Using the calculus or otherwise show that, if G =(V,E) is a bipartite simple graph with |V | vertices and |E| edges, then |E| ≤ 1

4|V |2.

Solution: Since G is bipartite, we may assume that V = V1∪V2, where V1∩V2 = ? ,and every edge joins a vertex of V1 with a vertex of V2. Hence the maximum numberof edges is |V1| · |V2| = |V1|(|V | − |V1|). The problem reduces to determining themaximum value of the function f(x) = x(|V | − x) as x ranges over the integersbetween 0 and |V |, inclusive. We broaden the domain to permit x to be any realnumber. Then

f(x) =1

4|V |2 −

(x− 1

2|V |)2

≤ 1

4|V |2 .

This could also have been solved using the calculus. Since f ′(x) = |V | − 2x, andf ”(x) = −2 < 0, f attains a maximum at x = 1

2|V |; as f

(12|V |)

= 14|V |2, the

number of edges in a bipartite graph on |V | vertices cannot exceed 14|V |2.

[With greater care we could show that the maximum number of edges is⌊|V |2

4

⌋.]

2. (a) [17, Exercise 7.3.28] Showing all your work, determine the value of the sumof the entries in any row of the adjacency matrix of an undirected graph.

(b) [17, Exercise 7.3.28] Showing all your work, determine the value of the sumof the entries in any row of the adjacency matrix of a directed graph.

(c) [17, Exercise 7.3.30] Showing all your work, determine the value of the sumof the entries in a row of the incidence matrix of an undirected graph.

(d) Showing all your work, determine the value of the trace18 of the square of theadjacency matrix of an undirected graph.

Solution:

(a) The entries in the ith row of the adjacency matrix represent the numbers ofedges connecting the ith vertex to each vertex. The sum is the valency ordegree of the ith vertex. If there are loops at the ith vertex, each of themcontributes 2 to the degree.

(b) The sum of the entries in the ith row will be the out-degree of the ith vertex.

(c) Each 1 in the ith row of the incidence matrix represents incidence of the ithvertex with one edge; hence the sum of the entries is the degree of that vertex.Here again, each loop at the ith vertex contributes 2 to the degree.

18trace = sum of the entries in the main diagonal

Page 126: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1098

(d) By [17, Theorem 7.4.1, p. 468], the entry in position (i, i) of the square ofthe adjacency matrix gives the number of paths of length 2 originating andterminating at vertex i.

Where the graph is simple — i.e. has neither loops nor multiple edges —then each path of length 2 from i to i corresponds to an edge at i, which istraversed in both directions; and conversely. Thus, in such a case, the sum ofthe diagonal entries is just the sum of the degrees in the graph, i.e. twice thenumber of edges in the graph.

Where the graph has multiple edges and/or loops, the entry in position (i, i)of the square of the adjacency matrix is the sum of the squares of the numbersof edges joining i to each of the vertices (including the square of the numberof loops at i). Then the trace is the sum of these sums, i.e. the sum of thesquares of all entries in the adjacency matrix.

3. [17, Exercise 7.7.12] Suppose that a connected planar graph has 30 edges. If aplanar representation of this graph divides the plane into 20 regions, determinehow many vertices this graph has.

Solution: Let v be the number of vertices. By Euler’s formula [17, Theorem 7.7.1,p. 502], v− 30 + 20 = 2, hence v = 12. (One graph with this property is the graphformed by the vertices and edges of the icosahedron — the regular “Platonic” solidhaving 20 triangular faces, 5 meeting at each of the 12 vertices.)

4. [17, Exercise 7.7.28] Show that K3,3 has 2 as its thickness .19

Solution: First we observe [17, Example 7.7.6, p. 505]20 that K3,3 is not planar;hence the thickness is at least 2.

If K3,3 = (1, 2, 3, 4, 5, 6, (i, j)|1 ≤ i ≤ 3; 4 ≤ j ≤ 6), then the graph can bedecomposed into

G1 = (1, 2, 3, 4, 5, 6, (i, j)|1 ≤ i ≤ 3; 4 ≤ j ≤ 5)G2 = (1, 2, 3, 4, 5, 6, (1, 6), (2, 6), (3, 6))

The first of these graphs is surely planar, since it consists of three paths of length 2all joining vertex 4 to vertex 5; the second graph consists of some isolated vertices(whose presence does not affect planarity) and a star consisting of vertex 6 joinedto each of vertices 1, 2, 3.

19[17, p. 509] The thickness of a simple graph G is the smallest number of planar subgraphs of G thathave G as their union.

20The “proof” given in [17, Example 7.7.3, pp. 500–501], is not rigorous.

Page 127: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1099

5. [17, Supplementary Exercise *46, p. 527] Showing all your work, determine theindependence number 21 of each of the following graphs:

(a) Kn

(b) Cn

(c) Qn

(d) Km,n

Solution:

(a) As every pair of vertices are adjacent, no more than 1 vertex may be in anyindependent set. The independence number is 1.

(b) No 2 adjacent vertices in the cycle may be chosen; hence the indepence numberof Cn cannot exceed

⌊n2

⌋. When n is even, this is indeed attained: the graph

is bipartite. When n is odd, here again the number is attained: just omit onevertex and alternately choose half of the others.

(c) The vertices of Qn are [17, p. 441] the binary strings of length n; two verticesare adjacent if they differ in exactly one bit position. One independent setconsists of all vertices whose number of 1’s is even: this contains exactlyhalf of the 2n vertices. We prove by induction on n that this set attains themaximum cardinality for all independent sets of vertices.

Basis Step. Q1 = K2, which has, by a preceding part, independence numberequal to 1 = 21−1.

Inductive Step. An independent set will induce (by intersection) an inde-pendent set in any subgraph. Take as subgraphs of Qn+1 two copiesof Qn spanned respectively by the vertices with final coordinate 0, andthe vertices with final coordinate 1. By the induction hypothesis neitherof these independent sets can have more than 2n−1 vertices, hence theirunion cannot contain more than 2× 2n−1 = 2(n+1)−1 vertices, as claimed.

(d) We cannot choose vertices from both “colour classes” of the bipartite graph.Hence the independence number cannot exceed maxm,n. But all the ver-tices in one or other of these classes are independent, so this maximum issurely attained as the independence number.

6. (a) Determine, in a systematic way, all undirected graphs with vertex-set 1, 2, 3.These graphs may not have loops (edges whose ends coincide), nor multipleedges.

21independence number = maximum number of vertices in an independent22 set of vertices22[17, p. 527] independent set of vertices = a set of vertices in which no two are adjacent

Page 128: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1100

(b) Isomorphism of graphs is an equivalence relation. For graphs on 3 vertices, de-termine all equivalence classes under this equivalence relation. Again, graphsmay have neither loops nor multiple edges.

(c) Determine, all digraphs having the vertex set 1, 2, 3. Your digraphs musthave no loops, nor may two vertices be connected by directed edges in bothdirections.

(d) Determine all equivalence classes of digraphs having 3 vertices.

Solution:

(a) While these graphs could be represented in various ways, we shall use adja-cency matrices for the purpose. (Incidence matrices would not be ideal, sincein these the edges as well as the vertices are labelled. We would require someroutine to avoid counting the same graph twice because of a permutation ofthe columns.) The only entries that can be non-zero are the off-diagonal ones;and these must be 0 or 1 in symmetric pairs. There are thus 3 such pairs —corresponding to the possible edges 1, 2, 1, 3, 2, 3. Each of these edgesmay be present or absent, independently of the others. By the Product Rulethere will be 23 = 8 graphs on these labelled vertices. We could represent eachby the 3-digit binary word from positions (1, 2), (1, 3), (2, 3) in the adjacencymatrix. We list the adjacency matrices in that order below: 0 0 0

0 0 00 0 0

0 1 01 0 00 0 0

0 0 10 0 01 0 0

0 1 11 0 01 0 0

0 0 00 0 10 1 0

0 1 01 0 10 1 0

0 0 10 0 11 1 0

0 1 11 0 11 1 0

(b) There is just one graph above having 3 edges, namely, the graph having struc-

ture K3. There are 3 isomorphic graphs having 2 edges; all have the structureof a path of length 2. There are 3 isomorphic graphs having 1 edge and anisolated vertex; these are the complements of the paths of length 2. Finally,there is just one graph with 0 edges: having 3 isolated vertices.

(c) These digraphs could be determined by analysis of the adjacency matrices, aswe did above for undirected graphs. There would be, for each of the symmetricpairs of entries off the main diagonal, precisely 3 (i.e. 22 − 1) possible values— all except the presence of edges in both directions. Hence the total numberof such digraphs is 33 = 27. We describe them in terms of the isomorphismclasses enumerated below.

Page 129: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1101

The cyclic triangle23 may be labelled in (3− 1)! = 2! = 2 ways. The verticesof a transitive triangle24 may be labelled in 3! ways — the number of waysof selecting the ends of the path of length 2. There are thus 8 digraphs on 3vertices having three edges.

The consistently oriented path of length 2 may also be oriented in 3! ways.The digraph consisting of 2 edges directed into a single vertex may be orientedin 3 ways; likewise the digraph with 3 edges directed outward from a singlevertex. There are thus 6 + 3 + 3 = 12 digraphs on 2 edges.

For digraphs with just one edge there are 3! ways of orienting: choose theisolated vertex in 3 ways; then orient the edge joining the other vertices in 2!ways: 6 digraphs in all.

Finally, the digraph with no edges is unique.

Summming, we have 8 + 12 + 6 + 1 = 27 digraphs, as predicted.

(d) The undirected graphs on 3 vertices may be directed as follows. The completegraph, K3, may be oriented in just 2 ways: either all edges are consistentlyoriented — giving a cyclic triangle; or the direction reverses once — giving atransitive triangle.25

The path of length 2 may be oriented in 3 ways: as a consistently orientedpath of length 2; as a pair of directed edges both directed into one vertex; andas a pair of directed edges both directed out from one vertex.

There is only one way in which a graph on one edge may be oriented.

There is also only one way in which a graph with 0 edges may be oriented.

In all we have 2 + 3 + 1 + 1 = 7 equivalence classes of digraphs.

7. [17, Exercises 7.5.36, 7.3.54] Determine for which values of n the following graphshave

i. an Euler circuit

ii. a Hamilton circuit

iii. a colouring of the vertices in m colours

23The orientation of a triangle in which all directed edges are “consistently” oriented, so that there isa directed circuit of length 3.

24Any orientation of K3 in which there is no directed circuit; so named because there will be always bea directed path of length 2, and a third edge directed from the initial vertex of this path to its terminalvertex, as suggested by the property of transitivity of a binary relation.

25These digraphs which are orientations of a complete graph are called tournaments, after round robintournaments where each player in a 2-person game plays every other player, and a directed edge can beused to record the result of the match.

Page 130: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1102

(a) Kn

(b) Cn

(c) Wn

(d) Qn

Solution:

(a) i. Kn is a connected regular graph. It has an Euler circuit iff the commonvalency is even, i.e. iff n− 1 is even i.e. iff n is odd.

ii. Every permutation of the vertices gives rise to a Hamilton circuit of Kn.

iii. If m < n, the Pigeonhole Principle would ensure that two adjacent ver-tices had the same colour. Hence m ≥ n, For such values of n there willalways exist an m-colouring: just be sure never to use a colour on morethan one vertex.

(b) i. Cn is an Euler circuit

ii. Cn is a Hamilton circuit.

iii. If m ≤ 1 there can be no colouring, since the presence of edges entailshaving at least 2 colours. Cn will have an m-colouring iff n is even. Whenm ≥ 3 there always exists an m-colouring, (as we don’t have to use allthe colours available to us).

(c) i. For Wn to have an Euler circuit, all vertices must have even degree — inparticular the “hub” of the wheel, whose valency is n. Thus it is necessaryfor the existence of an Euler circuit that n be even. This, however, is notsufficient, as all vertices along the “rim” of the wheel have valency 3.Thus no wheel is Eulerian.

ii. An obvious Hamilton circuit in a wheel is obtained from a circuit aroundthe rim by deleting one rim edge and detouring through the hub.

iii. The wheel Wn consists of a single vertex — the hub — adjacent to allvertices of a circuit Cn. The hub must, therefore, have a colour differentfrom all the rim vertices. There can be no colourings of a wheel withfewer than 3 colours; and 3 colours suffice only when n is even. When nis odd, 4 colours are required, and suffice.

i. Qn has valency n. There cannot exist an Euler circuit unless n is even.Then, since Qn is connected, there will always exist an Euler circuit.

ii. The existence of a Hamilton circuit can be proved by induction (cf. [17,Exercise 7.5.*57, pp. 487, S–56].

Page 131: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1103

iii. Qn is bipartite: no two vertices whose weight26 is even are adjacent;likewise odd. Hence an m colouring exists when m ≥ 2n for all n. Nocolourings exist for m < 2.

26number of coordinates equal to 1

Page 132: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1104

D Solutions to 1997 Assignment Problems

D.1 Solved Problems from the First 1997 Problem Assignment

In all of the following problems, unless you are instructed otherwise, you are expectedto show your work and to prove every statement.

1. (a) [17, Exercise 1.2.24] Find a compound proposition involving the propositionsp, q, and r that is true when p and q are true and r is false — the threeconditions being satisfied simultaneously — but is false otherwise. (Hint :Use a conjunction of each proposition or its negation. [There are, however,other ways to attack this problem.])

(b) [17, Exercise 1.2.26] Suppose that a truth table in propositional variables pi

(i = 1, 2, ..., n) is specified; thus the table has 2n rows. Show that a compoundproposition with this truth table can be formed by taking the disjunction ofconjunctions of the variables or their negations, with one conjunction includedfor each combination of values for which the compound proposition is true.The resulting compound proposition is said to be in disjunctive normal form.

(c) Express in disjunctive normal form: φ = (¬p→ r)→ (q ↔ p).

(d) Find a conjunction of disjunctions that is logically equivalent to the proposi-tion φ defined above. (Hint: First apply the preceding method to ¬φ.)

Solution:

Many students may have found the second part of this problem difficult.That should not be surprising, since you were being asked to “discover” atheorem, based on some minimal evidence in the first part. The purpose ofthe problem was to expose those who ultimately solved the problem to theeuphoria of solution, and the others to the frustration of failure. These arenormal events in the learning of mathematics. These problems were intendedas a learning experience, not as a test!

(a) The proposition is logically equivalent to p ∧ q ∧ ¬r.(b) The rows of the truth table correspond to the 2n possible combinations of

truth values. We can express φ as a disjunction of propositions, each of whichis associated with one row of the table for which φ is true, in the sense that itis true precisely when the elementary variables have the values shown in thatrow. The proposition associated with a row in which pi is true will have aconjuncted factor pi; and, where pi is false, the conjuncted factor will be ¬pi.Thus the conjunction of these literals is true precisely when the elementarypropositions have the values of that row, and in no other case.

Page 133: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1105

(c) We set up a truth table:

p q r ¬p ¬p→ r q ↔ p (¬p→ r)→ (q ↔ p)T T T F T T TT T F F T T TT F T F T F FT F F F T F FF T T T T F FF T F T F F TF F T T T T TF F F T F T T

Rows ##1, 2, 6, 7, 8 of the table are the only ones where the proposition istrue: we associate with each a conjunction of “literals”, and form the disjunc-tion:

(p ∧ q ∧ r) ∨ (p ∧ q ∧ (¬r)) ∨ ((¬p) ∧ (¬q) ∧ r)∨((¬p) ∧ q ∧ (¬r)) ∨ ((¬p) ∧ (¬q) ∧ (¬r)) . (48)

(d) You are being asked to find an equivalent proposition in conjunctive normalform. One way to proceed is to apply the previous procedure to ¬φ; thennegate and apply the De Morgan and Double Negation Laws: what was adisjunction of conjunctions will become a conjunction of disjunctions.

The truth table for ¬φ will have 3 rows in which ¬φ is true, corresponding torows ##3, 4, 5 in the preceding table. This leads to the following expressionfor ¬φ: (p∧ (¬q)∧ r)∨ (¬p∧ q ∧ r)∨ (p∧¬q ∧¬r). Forming its complementyields

(¬p ∨ q ∨ ¬r) ∧ (p ∨ ¬q ∨ ¬r) ∧ (¬p ∨ q ∨ r) , (49)

which is logically equivalent to φ, and in the desired form. Note that, since r∧(¬r) is logically equivalent to F (sometimes called one of the ComplementationLaws), ((p∨¬q)∨ r)∧ ((p∨¬q)∨ (¬r)) is logically equivalent to (p∨¬q)∨F(by a Distributive Law), which is, in turn, logically equivalent to p ∨ ¬q, byan Identity Law. Thus an equivalent proposition to (49) is

(p ∨ ¬q) ∧ (¬p ∨ q ∨ r)

also in conjunctive normal form.

2. (a) [17, Supplementary Exercise 8, p. 94] Let P (x, y) be a propositional function.Show that the implication

(∃x∀yP (x, y))→ (∀y∃xP (x, y))

is a tautology.

Page 134: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1106

(b) [17, Supplementary Exercise 10, p. 94] If ∀y∃xP (x, y) is true, does it neces-sarily follow that ∃x∀yP (x, y) is true?

Solution:

(a) As a hypothesis, assume that ∃x∀yP (x, y) is true. That asserts the existenceof some x0 such that ∀yP (x0, y) is true. Hence, for any y, there does indeedexist an x (namely x0) such that P (x, y); i.e. ∀y∃xP (x, y).

(b) We are asked to investigate the converse of the preceding implication. Thehypothesis that for every y there should exist an x does not guarantee thatit is the same x for the various y’s. Here is a counterexample to the allegedimplication: In the universe R of all real numbers, define P (x, y) to meanx < y. Then the hypothesis states that for every real number y there existsa smaller number x. We cannot conclude, however, that there exists a realnumber x which is smaller than all real numbers. (For one thing, x could notbe smaller than x.)

3. A function f : R→ R is said to have limit27 A as the variable approaches infinity(written lim

x→∞f(x) = A) if, for every positive real number h, there exists a real

number N such that x > N ⇒ |f(x)−A| < h. Use the universal and/or existentialquantifiers, i.e. ∀ and ∃, to write symbolically the statement

The function f(x) has no limit as x→∞.

Take as universe for the quantifiers the set R.

Solution: The definition translates to

¬(∃A(∀h((h > 0)→ (∃N(∀x((x > N)→ (|f(x)− A| < h))))))) .

Other equivalent statements are possible; for example, the →’s can be replaced byequivalent formulations, also ¬ can be “pushed inside”.

∀A(¬(∀h((h > 0)→ (∃N(∀x((x > N)→ (|f(x)− A| < h))))))) ;

∀A(∃h(¬((h > 0)→ (∃N(∀x((x > N)→ (|f(x)− A| < h))))))) .

4. (a) [17, Exercise 1.4.18] Determine all possible ordered pairs of sets (A,B) suchthat A×B = ? .

27Remember, Calculus III is a corequisite for 189-240.

Page 135: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1107

(b) Determine all possible ordered triples of sets (A,B,C) such that

(A×B) ∪ (B × C) ∪ (C × A) = ? . (50)

Solution:

(a) The statement A × B = ? asserts that there can exist no a ∈ A, b ∈ Bsuch that there is an ordered pair (a, b). But any element a ∈ A may beassociated with any element b ∈ B to yield such an ordered pair. Thus, ifthe cartesian product is empty, it must be impossible to find both an elementof A and an element of B — i.e. at least one of A and B must be empty.And, as observed in [17, Exercise 1.4.19], this condition is also sufficient forthe cartesian product to be empty. The answer is therefore

Either A = ? and B is any set, or A is any set and B = ? .

(b) For a union to be empty each of the sets in the union must be empty. Hence,by the preceding part, the given condition implies that at least one of A, Bis empty and at least one of B, C is empty and at least one of C, A is empty.It is thus certainly necessary that at least one of A, B, C should be empty.This, however, would not be enough. For example, if A = ? and B 6= ? 6= C,the second condition above would not be satisfied. If follows that at at leasttwo of A, B, C must be empty. This condition, which we have proved to benecessary, would also be sufficient to make all three unions empty, hence tosatisfy (50).

5. (cf. [17, Exercises 1.5.11, 1.5.12]) Show that if A, B, C are sets, then

A ∪B ∪ C = A ∩B ∩ C (51)

(A−B)− C ⊆ A− C (52)

A⊕ (B ⊕ C) = (A⊕B)⊕ C (53)

(The symmetric difference [17, p. 56] A⊕ B of sets A and B is defined to consistof those elements in either A or B, but not in both.)

(a) by showing, as required, that one side is contained in the other; and

(b) by using a membership table.

While a proof using a membership table is staightforward, the type of proof envi-sioned in part (a) is technically more difficult, and you may not have the “machin-ery” to prove every step rigorously, so you will be permitted to rely on intuitivestatements here. Should you wish to prove it rigorously without a membership

Page 136: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1108

table, you may find it necessary to use, in the course of part of your solution, the“Rule of Inference” p ∧ q ⇒ p [17, Simplification Rule, Table 1, p. 170].

Solution:

(a) (51) Each of the following implications is, in fact, reversible. Thus, while weare proving

A ∪B ∪ C ⊆ A ∩B ∩ Cwe can obtain as a corollary to this proof the inclusion

A ∪B ∪ C ⊇ A ∩B ∩ C

Alternatively, we could combine the two proofs by replacing each ⇒ by⇔ in the following proof.

x ∈ A ∪B ∪ C⇒ ¬(x ∈ A ∪B ∪ C) definition of complementation

⇒ ¬((x ∈ A) ∨ (x ∈ B) ∨ (x ∈ C)) definition of ∪⇒ (¬(x ∈ A)) ∧ (¬(x ∈ B)) ∧ (¬(x ∈ C)) de Morgan Laws

⇒ (x ∈ A) ∧ (x ∈ B) ∧ (x ∈ C) definition of complementation

⇒ x ∈ A ∩B ∩ C definition of intersection

Hence A ∪B ∪ C ⊆ A ∩B ∩ C.

(52)

x ∈ (A−B)− C (54)

⇒ (x ∈ (A−B)) ∧ (¬(x ∈ C)) definition of (A-B)-C (55)

⇒ ((x ∈ A) ∧ (¬(x ∈ B))) ∧ (¬(x ∈ C)) definition of A-B (56)

⇒ (x ∈ A) ∧ (¬(x ∈ B)) ∧ ¬(x ∈ C)) associativity of ∧ (57)

⇒ (x ∈ A) ∧ (¬(x ∈ C)) ∧ ¬(x ∈ B)) commutativity of ∧ (58)

At this stage in the proof we would like to replace ¬(x ∈ C))∧¬(x ∈ B)by ¬(x ∈ C). If that can be justified, we will have the desired conclusion.But how can we justify this transformation? We do know that

(¬(x ∈ C)) ∧ (¬(x ∈ B)))⇒ (¬(x ∈ C)) ; (59)

this is an instance of the so-called Rule of (Conjunctive) Simplification28.To make our proof rigorous we have to apply this Rule of (Conjunctive)

28p ∧ q ⇒ p, i.e.p ∧ q

p.

Page 137: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1109

Simplification more carefully. We begin with statement (58) and firstapply the associativity of ∩:

((x ∈ A) ∧ ¬(x ∈ C)) ∧ ¬(x ∈ B) (60)

and then apply the Rule of (Conjunctive) Simplification to conclude that

(x ∈ A) ∧ (¬(x ∈ C))

which, by definition of −, is equivalent to x ∈ A−C. Thus (A−B)−C ⊆A− C.

(53) For any sets R, S,

R⊕ S = (R ∪ S)− (R ∩ S) definition of ⊕= (R ∪ S) ∩R ∩ S [17, Exercise 1.5.13] (61)

= (R ∪ S) ∩ (R ∪ S) de Morgan Laws

= (R ∩R) ∪ (R ∩ S) ∪ (S ∩R) ∪ (S ∩ S) by distributivity

= ? ∪ (R ∩ S) ∪ (R ∩ S) ∪ ?

= (R ∩ S) ∪ (R ∩ S) (62)

Applying the foregoing twice we have

A⊕ (B ⊕ C) (63)

= (A ∩B ⊕ C) ∪ (A ∩ (B ⊕ C)) (64)

= (A ∩ (B ∩ C) ∪ (B ∩ C)) ∪ (A ∩ ((B ∩ C) ∪ (B ∩ C))) (65)

= (A ∩ (B ∩ C) ∩ (B ∩ C)) ∪ (A ∩ ((B ∪ C) ∪ (B ∩ C))) (66)

= (A ∩ (B ∪ C) ∩ (B ∪ C)) ∪ (A ∩ ((B ∪ C) ∪ (B ∩ C))) (67)

= (A ∩ (B ∪ C) ∩ (B ∪ C)) ∪ ((A ∩ (B ∩ C) ∪ (A ∩B ∩ C)) (68)

= (A ∩ ((B ∩B) ∪ (C ∩B) ∪ (B ∩ C) ∩ (C ∩ C)))

∪(A ∩ (B ∩ C) ∪ (A ∩B ∩ C)) (69)

= (A ∩ (? ∪ (C ∩B) ∪ (B ∩ C) ∪ ? ))

∪(A ∩ (B ∩ C) ∪ (A ∩B ∩ C)) (70)

= (A ∩ ((C ∩B) ∪ (B ∩ C))) ∪ (A ∩ (B ∩ C) ∪ (A ∩B ∩ C)) (71)

= (A ∩ C ∩B) ∪ (A ∩B ∩ C) ∪ (A ∩B ∩ C) ∪ (A ∩B ∩ C) (72)

Thus we see that the set is expressed as the union of the 4 disjoint sets inwhich an element can be a member of precisely an odd number of A, B,C. By the symmetry of this expression, we can expect to obtain precisely

Page 138: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1110

the same list if we begin with C ⊕ (A ⊕ B), which, but for a change inorder, is the right side of the alleged set equation. But the change oforder can be seen to be irrelevant from (62) and the symmetry of ∩ and∪. This proves both set inclusions

A⊕ (B ⊕ C) ⊆ (A⊕B)⊕ CA⊕ (B ⊕ C) ⊇ (A⊕B)⊕ C

(b) (51)

A B C A B C A ∪B ∪ C A ∪B ∪ C A ∩B ∩ CF F F T T T F T TF F T T T F T F FF T F T F T T F FF T T T F F T F FT F F F T T T F FT F T F T F T F FT T F F F T T F FT T T F F F T F F

As the last two columns are identical, A ∪B ∪ C and A ∩ B ∩ C haveidentical memberships.

(52)A B C A−B (A−B)− C A− CF F F F F FF F T F F FF T F F F FF T T F F FT F F T T TT F T T F FT T F F F TT T T F F F

As there is a T in the last column whenever there is a T in the precedingcolumn, the desired inclusion must hold.

Page 139: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1111

(53)A B C B ⊕ C A⊕ (B ⊕ C) A⊕B (A⊕B)⊕ CF F F F F F FF F T T T F TF T F T T T TF T T F F T FT F F F T T TT F T T F T FT T F T F F FT T T F T F T

As columns ##5, 7 are identical, the desired identity must hold.

6. [17, Exercise 1.6.17] If g : A → B and f : B → C are given functions such that fand f g are injective, does it follow that g is injective? If your answer is YES,then prove it; if it is NO, give an example to prove that the statement is not alwaystrue.

Solution: The statement is TRUE.

g(x) = g(y) ⇒ f(g(x)) = f(g(y))

⇒ (f g)(x) = (f g)(y) by definition of composition f g⇒ x = y since f g is injectuve

Since the preceding implication is true for all x and for all y, g is injective (cf. [17,Definition 5, p. 61]). Note that the hypothesis that f be injective is not required!

7. Let f : B → C be any function from B to C. Prove or disprove the followingproperties of the identity functions [17, p. 64].

(a) ιC f = f = f ιB(b) The only function h : B → B with the property that f = f h for all functions

f : B → C is ιB.

[Note: To prove that functions λ : U → V , µ : W → X are equal (written simplyλ = µ) you must show

• that the domains are the same, i.e. U = W ;

• that the codomains are the same, i.e. V = X; and

• that the actions of the functions are the same, i.e. (∀x ∈ U)(λ(x) = µ(x)).]

Solution:

Page 140: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1112

(a) By definition, the composition f g of functions g : A → B and f : B → Chas domain A and codomain C. Thus all three of f , ιC f , and f ιB havedomain B and codomain C; to prove the three functions are equal we mustdemonstrate that they all act the same on a general point x ∈ B.

(ιC f)(x) = ιC(f(x)) definition of composition (73)

= f(x) definition of ιC (74)

= f(ιB(x)) definition of ιB (75)

= (f ιB)(x) definition of composition (76)

proving that the three functions act identically on any x ∈ B.

(b) The statement

((∀f : B → C)(f h = f))⇒ (h = ιB) (77)

need not be true. For example, suppose that B = a, b, C = c. Thenthere is only one possible function f : B → C, and f = f ιB = f h is justthe “constant” mapping on to c; this is true even if h is the function given byf(a) = b, h(b) = a, which is certainly not the identity function.

The preceding is all that was expected of students at this stage. However, we cancharacterize precisely when (77) is true. Suppose that for some function f it ispossible to find a function g : C → B such that f g = ιC , g f = ιB. Then it canbe shown easily that h = ιB. It can be shown that such a g exists precisely when f

is injective. So the question reduces to determining whether, for given sets B andC, there exists an injective function f : B → C. This can be seen to occur preciselywhen |B| ≤ |C|.

D.2 Solved Problems from the Second 1997 Problem Assign-ment

1. [The contents of [17, §§2.3, 2.4] form a part of the syllabus of the successor course to189-240A, namely 189-340B. For the purposes of this course you need to be familiarwith some of the concepts in these sections, only to the extent that they are appliedin subsequent sections. While some parts of [17, §§2.3, 2.4] will be discussed brieflyin the lectures, this relatively easy exercise is intended to be solved after reading[17, §2.3] on your own. It is not expected that your solutions should be elegant orshort; please do not use a calculator or computer.]

(a) [17, Exercise 2.3.14] For each of the positive integers n ≤ 12 determine allpositive integer divisors; based on this information, list the positive integersn ≤ 12 which are relatively prime to 12.

Page 141: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1113

(b) [17, Exercise 2.3.12] Determine the number of zeros at the end of the decimalrepresentation of the integer 100!.

(c) (cf. [17, Exercise 2.3.28]) Determine all integers n that are congruent to 4modulo 12; i.e. the set of all solutions to the congruence

n ≡ 4 (mod 12)

(d) [17, Exercise 2.3.32] Show that if a, b, c, d,m are integers such that

m ≥ 2 (78)

a ≡ b (mod m) (79)

c ≡ d (mod m) , (80)

thena− c ≡ b− d (mod m) . (81)

Solution:

(a) We can, by repeated attempted division, determine all the positive primefactors of 1, 2, ..., 12; these can then be combined to determine all the positivedivisors.

n prime factorization positive factors1 1 12 21 1, 21

3 31 1, 31

4 22 1, 21, 22

5 51 1, 56 2131 1, 21, 31, 2131

7 71 1, 71

8 23 1, 21, 22, 23

9 32 1, 31, 32

10 2151 1, 21, 51, 2151

11 111 1, 111

12 2231 1, 21, 22, 31, 2131, 2231

By comparing the lists of divisors of n with those of 12, or otherwise, we cansee that the integers relatively prime to 12 are 1,5, 7, 11.

(b) The number of zeros at the end of a decimal representation of an integer nis equal to the maximum integer m such that 10m divides n. If n = 2r3s5t...,m = minr, t. The exponents r and t will be respectively the sums of theexponents of 2 and 5 in the prime decompositions of 1, 2, ..., 100. In this list

Page 142: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1114

the multiples of 5 are 5, 10, 15, 20, ..., 95, 100; of these 25, 50, 75, 100 eachcontribute 2 factors, and the others contribute 1, so that the exponent of 5in 100! is precisely t = 20 + 4 = 24. For divisibility by 2 there are 50 evenintegers, each contributing at least 1 factor 2; 25 integers are divisible by 4,12 by 8, 6 by 16, 3 by 32, and 1 by 64: in general the number of integersbetween 1 and k divisible by ` is bk

`c. Thus the exponent of 2 in 100! is

r = 50 + 25 + 12 + 6 + 3 + 1 = 97. The maximum power of 10 dividing 100! istherefore min97, 24 = 24. (Note that it was not necessary to determine thevalue of r; it would have been sufficient to observe that r ≥ t.)

(c) We wish to determine the integers n such that 12 divides n− 4, i.e. such thatthere exists an integer k such that n − 4 = 12k, or n = 12k + 4. This isthe characterization sought. The set is infinite, since any integer k yields aninteger congruent to 4 modulo 12.

(d) By [17, Definition 9, p. 119],

(79) ⇒ ∃k(a− b = mk)

(80) ⇒ ∃`(c− d = m`)

Hence

m(k − `) = (a− b)− (c− d)= (a− c)− (b− d)

implying (81).

2. (a) Prove that the following argument is valid by using the logical equivalenceof an implication and its contrapositive, known logical equivalences from [17,Table 1.2.5, p. 17], and the rules of inference in these notes, §??.??, page ??.

p→ (q → r) (82)

p ∨ s (83)

t→ q (84)

¬s (85)

) ¬r → ¬t (86)

(b) This argument could also be proved using a truth table. Give such a proof.You may be able to reduce the number of truth values needed in this tablethrough some analysis of the specific statements in the argument.

Solution:

Page 143: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1115

(a) Following is one possible proof; there will certainly be others.

p→ (q → r) Premiss (87)

p ∨ s Premiss (88)

t→ q Premiss (89)

¬s Premiss (90)

p (88), (90), Disjunctive Syllogism (91)

q → r (87), (91), Modus Ponens (92)

t→ r (89), (92), Hypothetical Syllogism (93)

) ¬r → ¬t contrapositive of (93) (94)

(b) Since there are 5 primitive logical variables, the truth table needs 25 lines. Wedon’t need the whole table, however: only those lines in which all four of thehypotheses are true. To determine precisely the number of lines of the tablewhere all hypotheses are true may be complicated; however, any one of thesehypotheses restricts the number of lines. For example, ¬s is true in only halfof the lines — i.e. 16; t → q is true in precisely three-quarters of the lines,i.e. 24; p ∨ s also is true in precisely three-quarters of the lines: so one choicemay be better than another.

Another approach would be to consider the consequence, viz. ¬r → ¬t. Thiscould be false only in one-quarter of the lines, namely, where ¬r is true (i.e. ris false) and ¬t is false (i.e. t is true); so only 8 lines are required in this table,for the 23 possible truth values of the other three propositional variables.Moreover, ¬s is to be true, so s is false: this means we can investigate thisargument with a mere 4 lines:

p q r = F s = T t = T q → r p→ (q → r) t→ q p ∨ sF F T T F FF T F T T FT F T T F TT T F F T T

In none of the rows are all of the hypotheses true: and these rows are theonly ones where the consequence could fail to be true; hence the argument isestablished. (In effect this is a proof by contradiction.)

3. Prove that the following argument is invalid.

p↔ q (95)

q → r (96)

Page 144: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1116

r ∨ (¬s) (97)

(¬s)→ q (98)

) s (99)

Solution: One must prove the existence of an assignment of truth values underwhich the four hypotheses are true, but the alleged consequence is false. One way ofdoing this would be to exhibit an explicit counterexample. Such an example couldbe found by completing a truth table. However, as there are 4 variables, such anexample could require the completing of 24 = 16 rows in a truth table. Followingis an ad hoc attack which leads to the determination of all counterexamples. Inany counterexample all five statements (95), (96), (97), (98), and the negation of(99) (i.e. ¬s) must be true. From (98), q is true. From (96), r is true. From(95), p has the same truth value as q, so p is true. Finally, we observe that thesetruth values are consistent with the truth of (97). We have thus shown that thereis just one assignment of truth values which is a counterexample; as this numberof counterexamples is positive, the original argument is not valid.

4. You are presented below with all steps in an argument, but without the justifica-tions for the various steps. You are to supply valid justifications.

The object is to prove the validity of the following argument.

u→ r Premiss (100)

(r ∧ s)→ (p ∨ t) etc. (101)

q → (u ∧ s) (102)

¬t (103)

q (104)

) p (105)

You are to supply justifications for each of the steps in the following. (The orderingof the premisses (= hypotheses) is not relevant, and has been altered from the orderin which they were originally stated.)

q (106)

q → (u ∧ s) (107)

u ∧ s (108)

u (109)

Page 145: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1117

u→ r (110)

r (111)

s (112)

r ∧ s (113)

(r ∧ s)→ (p ∨ t) (114)

p ∨ t (115)

¬t (116)

) p (117)

Solution: (cf. [6, Example 2.34, p. 92])

q Premiss (118)

q → (u ∧ s) Premiss (119)

u ∧ s Modus Ponens applied to (118), (119) (120)

u Conjunctive Simplification of (120) (121)

u→ r Premiss (122)

r Modus Ponens applied to (121), (122) (123)

s Simplification of (120) (124)

r ∧ s Conjunction of (123), (124) (125)

(r ∧ s)→ (p ∨ t) Premiss (126)

p ∨ t Modus Ponens applied to (125), (126) (127)

¬t Premiss (128)

) p Disjunctive Syllogism applied to (127), (128) (129)

5. Prove by induction on N for integers N > 1 thatN∑

i=1

iN. i−1N−1

= N+13

. [Note: The

intention is that you should not convert this problem into an equivalent problem:prove it in its present form by induction.]

Solution:

Basis Step. When N = 2

2∑i=1

i

2.i− 1

2− 1=

1

2.1− 1

2− 1+

2

2.2− 1

2− 1

= 0 + 1 = 1

=2 + 1

3

Page 146: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1118

as claimed.

Inductive Step. Suppose thatN∑

i=1

iN. i−1N−1

= N+13

. Then

N+1∑i=1

i

N + 1.

i− 1

(N + 1)− 1

=N∑

i=1

i

N + 1.

i− 1

(N + 1)− 1+N + 1

N + 1.(N + 1)− 1

(N + 1)− 1

=N

N + 1.N − 1

N

N∑i=1

i

N.i− 1

N − 1+ 1

=N

N + 1.N − 1

N

(N + 1

3

)+ 1 by induction hypothesis

=N − 1

N + 1.N + 1

3+ 1 =

N + 2

3=

(N + 1) + 1

3,

completing the induction step.

6. You are asked to solve the following problem using the Second Principle of Math-ematical Induction. For any integer n ≥ 35 there exist nonnegative integers x andy such that

n = 5x+ 9y . (130)

[Hint: Consider two cases in the induction step:

(a) n is a multiple of 5.

(b) n is not a multiple of 5.

Use the fact that 9 = 2 · 5− 1.]

Solution: [14, Problem 1.5.21, pp 37, A-5].

Basis Step. Evidently 35 = 5 · 7 + 9 · 0. Thus (130) is true for n = 35, x = 7,y = 0.

Induction Step. Now assume that the statement is true for all integers n ≤ N ,where N is some integer ≥ 35.

(a) To say that N is a multiple of 5 is equivalent to stating that there is someinteger x such that N = x · 5; since N ≥ 35, x ≥ 35

5= 7. But then

N + 1 = x · 5 + 1

= (x− 7)5 + 4 · 9

Page 147: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1119

is a decomposition of N+1 of the desired type. (Note that the hypothesisN ≥ 35 ensures that x− 7 ≥ 0, as required. Note also that we have notneeded the full induction hypothesis in this subcase: divisibility by 5 is astronger condition than (130).)

(b) Assume that N = 5x + 9y, where 5 does not divide N . This impliesthat y is a non-negative integer greater than 0, i.e. that y ≥ 1. ThenN + 1 = 5x + 9y + 1 = (5x + 9y) + (2 · 5 − 1 · 9) = 5(x + 2) + 9(y − 1),which has the desired form since y ≥ 1.

7. Let f : R → R be any function which is “infinitely differentiable”: i.e. not onlydoes f ′ exist, but, the derivative of f ′ (denoted by f ′′) exists, and its derivativef ′′′, etc. We can define the r-times-iterated derivative f (r) recursively by

f (1) = f ′ (131)

f (r+1) =(f (r))′

(132)

r ≥ 1 . (133)

Prove by the Second Principle of Mathematical Induction that, for all positiveintegers r and s,

f (r+s) =(f (r))(s)

(134)

Although you are not being asked to do so here, this definition can be extendedby defining f (0) = f . Then it can be shown that (134) holds even when either orboth of r and s are zero.

[Hint: Define n = r + s, and prove by induction on n. The basis step willbe when n = 2, since neither r nor s can be less than 1.

The statement that is to be proved may appear to be “obvious”. Studentsshould analyze just what has been defined and precisely what is to be proved.Do not assume any properties of integration. While the mathematical resultis “trivial”, the procedure to be followed is a very common one that is oftenapplied in non-trivial situations. The purpose is to provide an exercise incareful use of induction.]

Solution: While students were asked to use the “Second” Principle, the followingproof uses the “First” Principle. Since the induction hypothesis of the SecondPrinciple implies the induction hypothesis of the First, the proof we give can beinterpreted as being an instance of the Second Principle as well.

Basis step (n=2). There is only one feasible set of values of r and s for whichr + s = 2, namely r = s = 1. Then

f (1+1) =(f (1))(1)

Page 148: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1120

by (132), which is precisely what is to be proved in (134) in this case.

Induction step. Now assume that (134) has been proved for all r and s whenr+ s = N ≥ 2. The rest of this proof could be proved with the same symbolsr and s, but we will introduce two new symbols to help clarify the reasoning.Let t and u be any two positive integers such that t+ u = N + 1.

Case 1. Suppose that u = 1. Then(f (t))(u)

=(f (t))′

by (131)

= f (t+1) by (132)

which is precisely what (134) says when r = t and s = u = 1.

Case 2. Suppose that u > 1. Then(f (t))(u)

=(f (t))(u−1+1)

=((f (t))(u−1)

)′by (132) applied to the function

(f (t))(u−1)

=(f (t+u−1)

)′by induction hypothesis

= f (t+u−1+1) by (132) applied to the function f (t+u−1)

= f (t+u)

q.e.d.29, proving (134) when r = t and s = u > 1.

This completes the proof of the induction step. The temporary change ofsymbols from r and s to t and u made it easier to describe how the inductionhypothesis was being applied. Since (134) is quantified ∀r∀s, we may replacethe symbols r and s everywhere by any symbols that are convenient.

(This problem could also be solved in another way, using “Double” Induction. Wecould first prove (134) — in the case s = 1 — by the First Principle (of “Simple”Induction). That would be the Base Case of the “outermost” induction. Then,assuming that (134) has been proved for s ≤ S, and for all r, we could prove —by the First Princple — the case s = S + 1 for all r. This is the induction step forthe outermost induction. We could then conclude the truth for all r and s. Themethod we have proposed, using r + s = n as the variable, is superior, in that itreduces the number of applications of induction from 2 to 1.)

29quad erat demonstrandum = what was to be proved. Nowadays mathematicians often replace thisLatin clause by the symbol .

Page 149: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1121

D.3 Solved Problems from the Third 1997 Problem Assign-ment

Distribution Date: Friday, November 7th, 1997Solutions were to be submitted by Monday, October 27th, 1997

1. [17, Exercise 4.1.*48, p. 243] Use the product rule to show that there are 22n

different truth tables for propositions in n variables. Illustrate by showing — in asingle truth table — the truth values of all possible propositions in 1 variable. (Thestatement is true even for 0 variables: there are precisely 2 = 21 = 220

constantfunctions — namely T and F . These are not the only propositions in 0 variables;but every function of 0 variables will be logically equivalent to one of them — i.e.every such function is either a tautology or a contradiction.)

[Hint: A proposition in n variables is a function from the Cartesian product of npropositional variables — call them p1, p2, ..., pn — to the set T, F.]Solution: There are, by the product rule, exactly 2n ways of assigning truth valuesto the n variables p1, p2, ..., pn; i.e. there are 2n points in the domain of the functiondefined by any such proposition, a function acting on the n− tuples (p1, p2, ..., pn)and taking its values in the set T, F; the action of the function is presentedin a truth table with 2n rows. For each of these 2n assignments of truth valuesthere are two choices for the value taken by the proposition; and these choices areindependent. In all there are 22n

different truth tables.

[Note that we are not claiming that there are only 22ndistinct propositions. Every

proposition will be logically equivalent to infinitely many others; all of these willcorrespond to one possible column of a truth table.]

The table for one variable is

p φ00 φ01 φ10 φ11

F F F T TT F T F T

(We have chosen to name the types of propositions according to the values in theirrespective columns, taking 0 to represent F and 1 to represent T .) Examples ofφ00 are the constant function F , p ∧ (¬p), ((¬p) ∨ p)→ (p↔ (¬p)).

2. (cf. [17, Exercise 4.2.26]) A computer network consists of n computers (n ≥ 2).Each computer is directly connected with at least one of the other computers. Showthat there are at least two computers in the network that are directly connectedwith the same number of other computers.

Page 150: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1122

Solution: Denote the computers by C1, C2, ..., Cn. Call the number of computersconnected to Ci the degree of Ci, and denoted it by deg(Ci). Then the degreefunction maps the n computers to a set with n− 1 values, 1, 2, ..., n− 1. By thePigeonhole Principle at least one of these values is realized at least twice.

3. (cf. [17, Exercise 4.3.24]) Determine how many strings of n lowercase letters fromthe English alphabet contain

(a) the letter a.

(b) the letters a and b.

(c) the letters a and b in consecutive positions with a preceding b, with all lettersof the string distinct.

(d) the letters a and b, where a is somewhere to the left of b in the string, withall letters distinct.

Solution:

(a) The total number of strings, without restriction, is 26n. We subtract fromthis number the number of strings constructed from the alphabet b, c, ..., z,i.e. 25n, leaving a balance of 26n − 25n.

(b) We first count the strings which do not contain both a and b. Those containingno a number 25n; the same is the number of strings containing no b. We canadd these two numbers, but the sum will count the strings containing neithera nor b — whose number is 24n — twice; hence the number of strings whichcontain both a and b is 26n − 2 · 25n + 24n.

(c) Consider the 2-letter string ab as one object, to be permuted with n− 2 otherobjects, all distinct. The n − 2 other objects may be chosen from the setof 24 letters c, d, ..., z; the number of choices is

(24

n−2

). We then permute

n objects: these n − 2 letters and the 2-letter object ab. The number ofsuch permutations is (n − 1)!. By the product rule, the number of strings is

(n− 1)!(

24n−2

)= (n−1)24!

(26−n)!

(d) The total number of n-letter words containing a and b, in which all lettersare distinct, is n!×

(24

n−2

): we apply the product rule after selecting the n− 2

letters distinct from a and b. Since there is no essential difference betweenthe objects a and b, half of these strings have a to the left of b.

Another approach. The number of words of length n − 2 containing neithera nor b is P (24, n− 2) = 24!

(26−n)!. Add the letter b, placing it in any one of 25

Page 151: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1123

positions. If it be placed between letters in positions i, i+1 (i = 0, 1, ..., n−2)30

then a can be placed in i + 1 ways to the left of b; by the product rule thereare (i+1)P (24, n− 2) strings of this type. By the sum rule, the total number

of strings isn∑

i=0

(i + 1)P (24, n − 2) =(

n2

)P (24, n − 2). From this expression

we can now see a shorter approach: every word of the type we wish to countmay be decomposed into an (n − 2)-letter word obtained by suppressing thea and b, and two distinct position numbers for a and b — chosen from 1, 2,..., n. Conversely, if we choose two positions, and place a in the left one, andb in the right, we may then place an (n − 2)-letter word into the remainingplaces.

4. [17, Exercise 4.6.20] Determine the number of solutions in non-negative integers tothe inequality x1 +x2 +x3 ≤ 11. [Hint: Introduce an auxiliary “slack” variable x4,such that x1 + x4 + x3 + x4 = 11.]

Solution: Corresponding to each solution to

x1 + x2 + x3 ≤ 11 (135)

we define x4 = 11 − x1 − x2 − x3. Thus x4 ≥ 0. Conversely, for every solutionx1, x2, x3, x4) to the equation

x1 + x2 + x3 + x4 = 11 (136)

the ordered triple (x1, x2, x3) is a solution to inequality (135). Thus we have abijection between solutions to the inequality and solution to the equation. Thenumber of solutions to the equation is the number of (11 + 3)-letter “words” in 110’s and 3 1’s: the 1’s can be viewed as separating 11 objects into 3 + 1 strings.This number is

(11+3

3

)= 364.

This problem can also be solved using ordinary generating functions. Each of x1,x2, x3 is enumerated by 1 + x + x2 + x3 + ... = (1 − x)−1. Multiplication by1+x+x2 + ...+x11 sums the coefficients of x up to the 11th power. The coefficientof x11 in the expansion of (1−x)−3 · (1−x12)(1−x11)−1 = (1−x)−4−x12(1−x)−4

is the same as the coefficient of x11 in the expansion of (1 − x)−4, i.e.(11+3

3

)as

before.

5. Determine the number of 4-letter words that can be formed from the letters of theword ASSOCIATIVITY.

Solution: The maximum multiplicities of letters available are as follows:

30When i = 0 this is intended to mean placing b at the beginning of the word; when i = n− 2, this isintended to mean placing b at the very end of the word.

Page 152: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1124

3 copies: I

2 copies: A, S, T

1 copy: C, O, V, Y

We present two, quite different, methods for solving this problem. Students wereexpected to provide one solution. For examination purposes students will be ex-pected to be able to use either method, although the actual computations in thesecond method shown are more difficult than might be expected on an examination.

(a) From first principles: By the sum rule we can count separately the wordshaving a given partition of multiplicities, and add. The partitions of 4 intounordered positive integer parts are 4 = 4, 4 = 3+1, 4 = 2+2, 4 = 2+1+1,4 = 1 + 1 + 1 + 1. Of these, the partition 4 = 4 is not applicable, as no letteris available in 4 copies. The others are all achievable.

4 = 3 + 1. The letter of multiplicity 3 can be chosen in(11

)= 1 way (as it

is uniquely I. The letter of multiplicity 1 may be chosen in(8−11

)= 7

ways. In all, the letters of the 4-letter word of this type will be chosenin 1 × 7 = 7 ways; and then arranged in 4!

3!1!= 4 ways. Thus the total

number of words of this type is 7× 4 = 28.

4 = 2 + 2. Choose the two letters of multiplicity 2 from the population of 4letters (A, I, S, T) available with this or greater multiplicity, in

(42

)= 6

ways; and arrange in 4!2!2!

= 6 ways. Thus there are 6× 6 = 36 words withthis partition.

4 = 2 + 1 + 1. Choose the letter which is to contribute 2 copies in(41

)= 4

ways; then choose the 2 other letters in(8−12

)= 21 ways. Order the

letters in 4!2!1!1!

= 12. The total number of words of this type is thus4× 21× 12 = 1008.

4 = 1 + 1 + 1 + 1. Choose the 4 letters in(84

)= 70 ways, and order in 4! = 24

ways. The number of words is 1680.

The total number of words will be 28 + 36 + 1008 + 1680 = 2752.

(b) Using exponential generating functions: The exponential generating functionis (

1 + x+x2

2!+x3

3!

)1(1 + x+

x2

2!

)3

(1 + x)4

=

(1 + x+

x2

2!+x3

3!

)1

×(

1 + 3x+9

2x2 + 4x3 +

9

4x4 + ...

)

Page 153: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1125

×(1 + 4x+ 6x2 + 4x3 + x4

)= 1 + 8x+ 30x2 +

421

6x3 +

344

3x4 + ...

where · · · represents terms in powers of x higher than the 4th. Hence 4! timesthe coefficient of x4 is 2752; this will be the number of 4-letter words from thegiven population of letters.

6. (a) Consider the set 0, 1n of strings of length n in the alphabet 0, 1. Amongthose strings we wish to select a subset S with the property that no stringx ∈ S can be transformed into a string y ∈ S by changing not more than 2tof its bits. Prove that the number of elements of S is not more than

2n(n0

)+(

n1

)+(

n2

)+ ...+

(nt

) .[Hint: Think of any element x ∈ S as being the centre of a “sphere of radiust”, consisting of those words that can be obtained from x by changing 0 bits,1 bit, ..., t bits. These spheres cannot overlap in 0, 1n, as an overlap pointwould indicate a method for changing one centre into another in at most t+ tsteps.]

(b) Show that it is possible to attain this bound in the case that n = 3 and t = 1

(c) Show that it is not possible to attain this bound in the case n = 4, t = 1.

Solution:

(a) The centre of the sphere is the word x itself — and is counted by(

n0

)= 1.

The number of words obtainable by changing precisely r digits is(

nr

). We

sum over the range r = 0, 1, ..., t. Since the spheres cannot overlap, and thetotal number of words in 0, 1n is 2n, we have the inequality

|S|t∑

r=0

(n

r

)≤ 2n .

(b) The bound is that no such “code” could have more than 23

1+3= 2 words. One

such example is S = 000, 111.(c) The bound is that no such “code” could have more than 24

1+4words, hence no

more than b165c = 3 words. Suppose that we have such a code, whose words

are a1a2a3a4, b1b2b3b4 and c1c2c3c4. Suppose first that two of these words,say a1a2a3a4 and b1b2b3b4, differ in all 4 digits. Then the 3rd word will differfrom a1a2a3a4 in at least 3 digits — so it will be the same as b1b2b3b4 in those

Page 154: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1126

3 digits, a contradiction. Hence no two of he words differ in 4 digits: soevery pair differ in exactly 3 digits. Suppose, without limiting generality, thata1 6= b1, a2 6= b2, a3 6= b3 and a4 = b4. Then c1c2c3c4 must differ from each ofa1a2a3a4, b1b2b3b4 in at least 2 of the first 3 digits: but that is impossible.

The case n = 7 corresponds to the “perfect single-error correcting code” called theHamming code of length 7, containing exactly 16 binary words of length 7. Thisset has the property that a single bit change (“error”) in one code word cannot beconfused with a bit change from another word: so the error can be unambiguously“corrected”.

7. (a) Using generating functions, determine for each non-negative integer n thenumber vn of n-letter words in the alphabet 0, 1, 2, 3 in which the num-ber of 0’s is even and the number of 1’s is odd — the 2 conditions to holdsimultaneously. There are to be no restrictions on the numbers of 2’s or thenumber of 3’s.

(b) Using generating functions, determine for each non-negative integer n thenumber wn of selections with repetitions of n objects from the alphabet0, 1, 2, 3 in which the number of 0’s is even and the number of 1’s is odd— the 2 conditions to hold simultaneously. There are to be no restrictions onthe numbers of 2’s or the number of 3’s.

[Hint: 1(1−x)2

= 1+2x+x2

(1−x2)2.]

Solution:

(a) We use exponential generating functions. The enumerator for the symbol 0,

which is selected an even number of times, is∞∑

n=0

x2n

(2n)!, which is equal to the

MacLaurin expansion of 12(ex + e−x). (This series is, in fact, the expansion of

cosh x; however, we shall not assume students to be familiar with the hyper-bolic functions.) Similarly, the enumerator for the symbol 1, which is selected

an odd number of times, is∞∑

n=0

x2n+1

(2n+1)!, which is equal to the MacLaurin expan-

sion of 12(ex − e−x). (This series is the expansion of sinhx.) The remaining

two symbols are enumerated each by ex. The generating function for thenumber of words is therefore

1

2

(ex + e−x

)· 12

(ex − e−x

)· ex · ex

=1

4

(e2x − e−2x

)· e2x

Page 155: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1127

=1

4

(e4x − 1

)=

1

4

∞∑n=1

4n

n!xn

from which it follows that vn = 4n−1 (n ≥ 1); v0 = 0.

(b) We use ordinary generating functions. The enumerator for 0 is

1 + x2 + x4 + x6 + ...+ x2n + ...

=1

1− x2;

the enumerator for 1 is

x+ x3 + x5 + x7 + ...+ x2n+1 + ...

=x

1− x2.

The enumerators for 2 and 3 are each

1 + x+ x2 + x3 + ...+ xn + ...

=1

1− x

Hence the ordinary generating function for selections of this type of length nis

1

1− x2· x

1− x2· 1

1− x· 1

1− x=

x

(1− x2)2(1− x)2

We need to find the MacLaurin expansion of this rational function. One way todo this — much longer than needed — would be to factorize the denominatorand expand the function into partial fractions:

x

(1 + x)2(1− x)4

=1

16· 1

(1 + x)2+

1

8· 1

1 + x+

1

4· 1

(1− x)4

+1

4· 1

(1− x)3+

3

16· 1

(1− x)2+

1

8· 1

1− x

A simpler method is to multiply numerator and denominator by a polynomialfactor which will convert the denominator into a power of a binomial; which

Page 156: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1128

function is relatively easy to expand:

x

(1− x2)2(1− x)2

=x(1 + x)2

(1− x2)4

= (x(1 + x)2) · 1

(1− x2)4

= (x+ 2x2 + x3) ·∞∑

n=0

(n+ 3

3

)(x2)n

= x ·∞∑

n=0

(n+ 3

3

)x2n + 2x2 ·

∞∑n=0

(n+ 3

3

)x2n + x3 ·

∞∑n=0

(n+ 3

3

)x2n

=∞∑

n=0

(n+ 3

3

)x2n+1 + 2

∞∑n=0

(n+ 3

3

)x2n+2 +

∞∑n=0

(n+ 3

3

)x2n+3

We will transform the sums through changes of variables: in the second sumdefine m = n + 1, in order to develop a formula for the coefficient of evenpowers of x; in the third sum define n′ = n+1 in order to eventually combinethe first and third sums, which both yield odd powers of x. The result is

x

(1− x2)2(1− x)2

=∞∑

n=0

(n+ 3

3

)x2n+1 + 2

∞∑m=1

(m+ 2

3

)x2m +

∞∑n′=1

(n′ + 2

3

)x2n′+1

=∞∑

n=0

(n+ 3

3

)x2n+1 + 2

∞∑m=1

(m+ 2

3

)x2m +

∞∑n=1

(n+ 2

3

)x2n+1

=∞∑

n=0

((n+ 3

3

)+

(n+ 2

3

))x2n+1 + 2

∞∑m=1

(m+ 2

3

)x2m

=∞∑

n=0

((n+ 3)(n+ 2)(n+ 1)

6+

(n+ 2)(n+ 1)n

6

)x2n+1

+2∞∑

m=1

(m+ 2

3

)x2m

=∞∑

n=0

(n+ 2)(n+ 1)(2n+ 3)

6x2n+1 + 2

∞∑m=1

(n+ 2

3

)x2m

Page 157: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1129

from which we conclude that

w2n+1 =(n+ 2)(n+ 1)(2n+ 3)

6for n ≥ 0

w2n =(n+ 2)(n+ 1)n

3for n ≥ 0

D.4 Solved Problems from the Fourth 1997 Problem Assign-ment

1. Consider the recurrence

an+4 − 18an+2 + 81an = 0 , (137)

subject to the initial conditions:

a0 = 6a1 = 18a2 = −54a3 = 0

(138)

(a) Solve the recurrence for n ≥ 0 using the methods of [17, §5.2].

(b) Solve the recurrence for n ≥ 0 using ordinary generating functions.

(c) Transform the recurrence into recurrences involving sequences bnn=0,1,2,...

and cnn=0,1,2,..., by defining

an =

bn

2if n is even

cbn2 c if n is odd

Then solve these recurrences for n ≥ 0 using the methods of [17, §5.2].

Solution:

(a) The characteristic equation of the homogeneous recurrence is r4−18r2 +81 =0, which is equivalent to (r2 − 9)2 = 0, and, in turn, to (r − 3)2(r + 3)2 = 0.The characteristic roots, 3 and −3, each have multiplicity 2. The generalsolution is, therefore, of the form

an = (A+Bn)(−3)n + (C +Dn)3n .

Imposing initial conditions (138) yields the system of linear equations

A+ C = 6−3A− 3B + 3C + 3D = 189A+ 18B + 9C + 18D = −54−27A− 81B + 27C + 81D = 0

(139)

Page 158: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1130

having a unique solution, (A,B,C,D) =(−3

2,−3

2, 15

2,−9

2

). Hence the partic-

ular solution to (137) satisfying the given initial conditions is

an = −3

2(1 + n)(−3)n +

(15− 9n

2

)3n . (140)

(b) Denote the ordinary generating function∑∞

n=0 antn by A(t). Multiplying

(137) by tn+4 and summing for n ≥ 0 yields

∞∑n=0

(an+4 − 18an+2 + 81an) tn+4 = 0

⇔∞∑

n=0

an+4tn+4 − 18

∞∑n=0

an+2tn+4 + 81

∞∑n=0

antn+4 = 0

⇔∞∑

m=4

amtm − 18t2

∞∑`=2

a`t` + 81t4

∞∑n=0

antn = 0

changing to new variables m = n+ 4, ` = n+ 2

⇔∞∑

n=4

antn − 18t2

∞∑n=2

antn + 81t4

∞∑n=0

antn = 0

renaming the bound variables m and ` both to be n

⇔ A(t)− a0 − a1t− a2t2 − a3t

3

−18t2A(t) + 18t2(a0 + a1t)

+81t4A(t) = 0

⇔(1− 18t2 + 81t4

)A(t)

= a0 + a1t+ (a2 − 18a0)t2 + (a3 − 18a1)t

3

= 6 + 18t− 162t2 − 324t3 from the initial data

⇔ A(t) =6 + 18t− 162t2 − 324t3

1− 18t2 + 81t4= 6 · 1 + 3t− 27t2 − 54t3

(1− 9t2)2

To determine the MacLaurin expansion of the last given ratio we could appealto the method of partial fractions. As the denominator factorizes into (1 −3t)2(1 + 3t)2, and the degree of the numerator is less than the degree of thedenominator, we know that there exist constants U, V,W,X such that

6(1 + 3t− 27t2 − 54t3)

(1− 9t2)2

=U

(1− 3t)2+

V

1− 3t+

W

(1 + 3t)2+

X

1 + 3t

Page 159: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1131

Taking both sides to a common denominator yields the identity

6(1 + 3t− 27t2 − 54t3) = U(1 + 3t)2 + V (1− 3t)(1 + 3t)2

+W (1− 3t)2 +X(1− 3t)2(1 + 3t)(141)

At this point students should know two methods of determining the constants:either by comparing coefficients of corresponding powers of t; or by assigning“convenient” values to t; and these methods may be combined. Two “con-venient” values of t are ±1

3, since these cause most of the terms of (141) to

vanish. We thus obtain U = −92, and W = −3

2. We need two more equa-

tions to determine the remaining constants. One or other of the methodsmentioned yields V = 12 and X = 0, from which we find the partial fractiondecomposition to be

A(t) = −9

2· 1

(1− 3t)2+

12

1− 3t− 3

2· 1

(1 + 3t)2

This may be expanded as follows:

A(t) = −9

2· 1

(1− 3t)2+

12

1− 3t− 3

2· 1

(1 + 3t)2

= −9

2

∞∑n=0

(n+ 1

1

)(3t)n + 12

∞∑n=0

(3t)n − 3

2

∞∑n=0

(n+ 1

1

)(−3t)n

= −9

2

∞∑n=0

(n+ 1)3ntn + 12∞∑

n=0

3ntn − 3

2

∞∑n=0

(n+ 1)(−3)ntn

= −3

2

∞∑n=0

((n+ 1)(−3)n + (3n− 5)3n) tn

We could avoid the use of partial fractions by rewriting in the form

A(t) =6 (1− 27t2)

(1− 9t2)2 +18t (1− 18t2)

(1− 9t2)2

= 6(1− 27t2

) ∞∑k=0

(k + 1

1

)(9t2)k + 18t

(1− 18t2

) ∞∑k=0

(k + 1

1

)(9t2)k

= 6∞∑

k=0

(k + 1)9kt2k − 162t2∞∑

k=0

(k + 1)9kt2k

+18t∞∑

k=0

(k + 1)9kt2k − 324t3∞∑

k=0

(k + 1)9kt2k

Page 160: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1132

= 6∞∑

k=0

(k + 1)9kt2k − 162∞∑

k=0

(k + 1)9kt2k+2

+18∞∑

k=0

(k + 1)9kt2k+1 − 324∞∑

k=0

(k + 1)9kt2k+3

= 6∞∑

k=0

(k + 1)9kt2k − 18∞∑

`=1

` 9`t2`

+18∞∑

k=0

(k + 1)9kt2k+1 − 36∞∑

`=1

` 9`t2`+1

= 6∞∑

k=0

(k + 1)9kt2k − 18∞∑

`=0

` 9`t2`

+18∞∑

k=0

(k + 1)9kt2k+1 − 36∞∑

`=0

` 9`t2`+1

= 6∞∑

k=0

(k + 1)9kt2k − 18∞∑

k=0

k 9kt2k

+18∞∑

k=0

(k + 1)9kt2k+1 − 36∞∑

`=0

k 9kt2k+1

extending 2 summations to include zero terms

=∞∑

k=0

6(k + 1)32kt2k −∞∑

k=0

18k · 32kt2k

+∞∑

k=0

6(k + 1)32k+1t2k+1 −∞∑

k=0

12k · 32k+1t2k+1

=∞∑

k=0

6(1− 2k)32kt2k +∞∑

k=0

(9− 3(2k + 1))32k+1t2k+1

from which we may read off the values

an =

6(1− n)3n if n is even(9− 3n)3n if n is odd

(142)

which agree with the values given by equation (140).

(c) When n = 2m, (137) becomes a2m+4−18a2m+2+81a2m = 0, which is equivalentto

bm+2 − 18bm+1 + 81bm = 0 (143)

Page 161: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1133

and is subject to two of the original four initial conditions, viz.

b0 = 6

b1 = −54

When n = 2m + 1, (137) becomes a2m+5 − 18a2m+3 + 81a2m+1 = 0, which isequivalent to

cm+2 − 18cm+1 + 81cm = 0 (144)

and is subject to two of the original four initial conditions, viz.

c0 = 18

c1 = 0

Thus both of the new sequences satisfy the same recurrence

dm+2 − 18dm+1 + 81dm = 0 (145)

but with different initial conditions. The general solution of (143) is of theform

bm = (K + Lm)9m ,

while the general solution of (144) is of the form

cm = (M +Nm)9m .

Imposing the initial conditions, we obtain

K = 6

(K + L)9 = −54

M = 18

(M +N)9 = 0

whose solution is (K,L,M,N) = (6,−12, 18,−18); hence

bm = (6− 12m)9m

cm = (18− 18m)9m

from which, by appropriate substitutions, we can recover (142).

2. In a certain course the 2n students (always an even number) are divided up inton pairs of “partners”. It is desired to seat the students around a round table for atest, with the restriction that no student sits beside her/his partner.

Page 162: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1134

(a) Using the Principle of Inclusion-Exclusion — no other method will be acceptedfor this part of the problem — determine a formula for the number an ofadmissible seatings of 2n students.

(b) Verify the correctness of your formula when n = 1, 2, 3 by some other method.

Solution:

(a) For (i = 1, 2, ..., n) denote by Ai the number of seatings of the 2n studentswhich violate the restrictions because the students in the ith pair are sittingside-by-side. Then with an exception in the case n = 1, for r distinct pairs,(1 ≤ r ≤ n), |Ai1 ∩ Ai2 ∩ . . . ∩ Air | is equal to 2r times the number of circulararrangements of (2n − 2r) + r objects — of which r are 2-person pairs; i.e.is equal to 2r(2n − r − 1)!. As there are

(nr

)ways of selecting r pairs, the

Principle of Inclusion-Exclusion gives

an = (2n− 1)!− 21

(n

1

)(2n− 2)! + 22

(n

2

)(2n− 3)!

+(−2)r

(n

r

)(2n− r − 1)! + ...+ (−2)n(n− 1)! (146)

When n = 1 the preceding reasoning breaks down: the 2-person object thatwe wish to arrange in A1 there has only one ordering; in that case we have toreplace (146) by

a1 = (2 · 1− 1)!−(

1

1

)(2 · 1− 2)! (147)

(b) Our preceding calculations give a1 = 0, a2 = 2, a3 = 32.

n = 1: It is not possible to seat members of only one pair without them beingside-by-side.

n = 2: Each of the pairs must separate the other. Once one pair has beenseated in opposite seats there are two ways to place the members of theother pair in the two separating seats.

n = 3: Let the pairs be a1, a2, b1, b2, c1, c2. Without limiting generality,let’s place pair a1, a2 first.

Case 1 — a1 and a2 are in opposite seats: In this case there are twoseats to be filled in each of the residual portions of the table. Eachof the seats in one portion must be filled with one member of eachof the remaining pairs — giving 2 × 2 choices, and 2 arrangementsof the selected members. In the other residual portion there are tworemaining persons to be placed — in either of 2 orders, independent

Page 163: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1135

of the previous count. In all we have (2×2×2)×2 = 16 arrangementsof this type.

Case 2 — a1 and a2 are in non-opposite seats: There are two waysin which this can happen — depending upon whether the residualportion to the left of a1 has 1 or 3 spaces. The portion having justone seat can be filled in 4 ways — just choose any of the 4 unseatedstudents. Then the partner of that student must be placed in themiddle of the 3-student string, in order to separate the members ofthe other pair. After that the other pair can be placed in either of 2orders. In all we have 4 × 2 = 8 seatings for either of the 2 ways —i.e. 16 in all.

The preceding computations applied the Product Rule. Now, by the SumRule, we have 16 + 16 = 32 seatings, as computed using our formula.

3. (cf. [17, Exercise 6.5.36]) Determine all equivalence relations on the 4-element setS = a, b, c, d. For each of these determine the number of ordered pairs in therelation.

Solution: By [17, Theorem 6.5.2, p. 399], there exists a one-to-one correspondencebetween equivalence relations on S and partitions of S (into mutually disjointnon-empty subsets). We will enumerate the partitions instead of the equivalencerelations. We consider the various partitions of 4 into positive integer parts.

4 = 4: There is just one way to partition S into one part — namely S = S.The corresponding relation is the “complete” relation, containing all 42 = 16ordered pairs.

4 = 3 + 1: We can partition S into parts of cardinalities 1 and 3 by selecting onepoint — in

(41

)= 4 ways. Each of the corresponding relations contains 32 +

12 = 10 ordered pairs.

4 = 2 + 2: The number of ways of dividing 4 elements into two distinguishable i.e.labelled parts, each containing 2 elements, is

(42

)= 6. If, however, we are

concerned only with the partition, and the parts are not labelled, then thenumber of partitions is 6

2!= 3 since there are 2! ways in which a partition

into unlabelled parts could be labelled to produce 6 ordered partitions. Thenumber of ordered pairs is 22 + 22 = 8.

4 = 2 + 1 + 1: Select the points for the part of size 2 in(42

)= 6 ways. The total

number of ordered pairs is 22 + 12 + 12 = 6.

4 = 1 + 1 + 1 + 1: There is just one relation of this type: it has 12+12+12+12 = 4ordered pairs.

Page 164: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1136

In all we have found 1 + 4 + 3 + 6 + 1 = 15 distinct equivalence relations on a setof 4 points.

4. Prove of disprove each of the following statements. To disprove, where applicable,one explicit counterexample is sufficient. But a proof, where applicable, must betotally general: you must not specialize the problem in any way.

(a) [17, Supplementary Exercises 6.8, p. 423] If R is a symmetric relation on a setA, then the complementary31 relation R is also symmetric.

(b) (cf. [17, Supplementary Exercises 6.5, p. 423]) If R is a reflexive relation on aset A, then R ⊇ R2.

(c) If R is a transitive relation on a set A, then R2 is also transitive.

(d) If R and S are total orders on a set A, then R S is also a total order.

(e) The number of symmetric relations on A which are neither reflexive nor ir-

reflexive32 is 2(n2) · (2n − 2).

Solution:

(a) We give a proof by contradiction that

∀(a, b) ∈ A× A[(a, b) ∈ R⇒ (b, a) ∈ R]

(a, b) ∈ R Premiss (148)

(b, a) /∈ R Premiss (149)

(b, a) ∈ R (149), definition of R (150)

(a, b) ∈ R (150), symmetry of R (151)

(a, b) /∈ R (151), definition of R (152)

) F (148), (152), ∀p[p ∧ ¬p⇔ F ][17, Table 6, p. 18] (153)

This proof is valid ∀a, b ∈ A. Hence R is symmetric.

(b) Define A = a, b, c, and let R be the reflexive relation

(a, a), (b, b), (c, c), (a, b), (b, c) .

Then R is not transitive. However R2 contains, in addition to R, the element(a, c). Thus R + R2. This counterexample disproves the claim. (Studentsshould try to convince themselves that this is the “smallest” counterexample.)

31[17, p. 365] For a relation R on a set A, R = (a, b) ∈ A×A : (a, b) /∈ R.32[17, p. 365] A relation on a set A is irreflexive if ∀a ∈ A[(a, a) /∈ R].

Page 165: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1137

(c) If R is transitive, then R2 ⊆ R (cf. [17, Theorem 6.1.1, p. 364]).

(a, b) ∈ R2 ⇒ (a, b) ∈ R(b, c) ∈ R2 ⇒ (b, c) ∈ R

These statements imply, by definition of R2, that (a, c) ∈ R2, As the precedingargument is valid ∀a, b, c ∈ A, R2 is transitive.

(d) This statement is false. Consider, for example, the total orderings R =(a, a), (b, b), (a, b) and S = R−1 = (a, a), (b, b), (b, a) on the 2-elementset a, b. R S = (a, a), (b, b), (a, b), (b, a). This relation is not antisym-metric, so it is not a partial order. (Try to convince yourself that there cannotbe a counterexample with fewer points — i.e. that this is the “best possible”counterexample.)

(e) To not be reflexive a relation cannot have loops at every point of its digraph;to not be irreflexive if cannot lack a loop at every point of its digraph. Thusthe relations we are considering have between 1 and n − 1 points which arerelated to themselves. The number of ways of selecting these self-relatedpoints is 2n − 2. The relations are to be symmetric. For any pair of distinctpoints a, b, we must select either both ordered pairs (a, b), (b, a), or neither

of them. This can be done in 2(n2) ways, independent of the selection of the

points which are related to themselves. By the Product Rule, the number of

relations is 2(n2) · (2n − 2), as claimed.

D.5 Solved Problems from the Fifth 1997 Problem Assignment

This version of the solutions, in preliminary form and awaiting proofreadingis posted for the benefit of students preparing for the examination. Caveatlector!33 There could be misprints and/or errors!

1. Isomorphism of undirected graphs is an equivalence relation ([17, Exercise 7.3.45]).(You should be able to prove this, but are not being asked to do so at this time.)Determine the isomorphism classes of undirected graphs with 4 vertices. That is,determine the various possible structures that a graph G = (a, b, c, d, E) on 4vertices can have. For each of the structures, give an incidence matrix for oneparticular labelling of the vertices, which you should show in a sketch (cf. [17,Exercises 7.3.54(c), 7.3.55]).

Solution: (We shall not show the sketches which were requested.) It is convenientto list the isomorphism classes according to the numbers of edges; (all the graphs

33Let the reader beware.

Page 166: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1138

have exactly four vertices). The mimimum is, of course, zero; the maximum is(42

)= 6.

(a) 0 edges. There is only one graph with 0 edges. Its incidence matrix is0 0 0 00 0 0 00 0 0 00 0 0 0

.

(b) 1 edge. There is only one graph with 1 edge. One incidence matrix is0 1 0 01 0 0 00 0 0 00 0 0 0

.

(c) 2 edges. There are two possible graphs with 2 edges.

i. The graph (a, b, c, d, ab, cd) has two disjoint edges. One incidence

matrix is

0 1 0 01 0 0 00 0 0 10 0 1 0

.

ii. The graph (a, b, c, d, ab, ac) has two edges that are not disjoint, i.e.that are incident with a common vertex. One incidence matrix is

0 1 1 01 0 0 01 0 0 00 0 0 0

.

(d) 3 edges. We can list the subgraphs formed by three edges in the order ofthe maximum degree of a vertex. The maximum degree in K4 is 3; were themaximum degree ≤ 1, the total number of edges would be at most 1

2×4×1 =

2 < 3.

i. Maximum degree = 3. This graph has the structure of (a, b, c, d,

ab, ac, ad). One incidence matrix is

0 1 1 11 0 0 01 0 0 01 0 0 0

.

ii. Maximum degree = 2. There are two possible cases:

A. The graph is a tree. This graph has the structure of (a, b, c, d,ab, bc, cd), a “path of length 3”. One incidence matrix is

Page 167: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1139

0 1 0 01 0 1 00 1 0 10 0 1 0

.

B. The graph has a circuit. This graph has the structure of (a, b, c, d,ab, bc, ca), a triangle and an isolated vertex. One incidence matrix is

0 1 1 01 0 1 01 1 0 00 0 0 0

.

(e) 4 edges. These graphs are the complements of the graphs with 6 − 4 =2 edges, so there are precisely 2 of them. Possible incidence matrices are

0 0 1 10 0 1 11 1 0 01 1 0 0

and

0 0 0 10 0 1 10 1 0 11 1 1 0

.

(f) 5 edges. This graph is the complement of the unique graph with 6 − 5 = 1

edge. One incidence matrix is

0 0 1 10 0 1 11 1 0 11 1 1 0

.

(g) 6 edges. This graph is the complement of the graph with 0 edges; that is, it

has the structure of K4. Its incidence matrix is

0 1 1 11 0 1 11 1 0 11 1 1 0

.

2. (a) The vertices of the 3-dimensional cube with vertices at the 23 points of R3

whose coordinates are all ±1 can be viewed as representing a graph whoseedges are given by the line segments which join these vertices parallel to thecoordinate axes (e.g. x = 1, y = −1,−1 ≤ z ≤ 1).

i. Show that this graph — often denoted by Q3 — is bipartite, and can beobtained from K4,4 by erasing 4 independent edges — i.e. 4 edges suchthat no two of them are incident with the same vertex.

ii. Project this graph on to the plane z = 0 from the point A(0, 0, 2). Thatis, replace each vertex P of the graph by the intersection with the planez = 0 of the line through A and P . The line segment joining any twovertices is projected in the same way. Sketch the graph, and explain whythe 3-cube is planar .

Page 168: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1140

(b) Now generalize the 3-cube to a 4-cube, whose vertices are all ordered 4-tupleswith each coordinate equal to ±1, 24 = 16 vertices in all; join two vertices ifthey differ in just one coordinate. For this graph

i. Show that the graph is regular, and determine the degree.

ii. Define a vertex to be red if an odd number of its coordinates are negative,and blue if the number of minuses is even; i.e. define the colour based onthe parity34 of the number of minus signs in the coordinates of a vertex.Show that the 4-cube — often denoted by Q4 — is bipartite.

iii. [Difficult] Show that the 4-cube may be viewed as obtained from a K8,8

by erasing from it a 4-cube; that is, that K8,8 may be viewed as the unionof 2 edge-disjoint copies of a 4-cube.Hence argue that K16 may be viewed as the edge-disjoint union of 2 4-cubes and 2 K8’s.

Solution:

(a) i. Each of the 23 vertices is adjacent to the 3 vertices that can be obtainedfrom it by reversing the sign of one of its 3 coordinates. Call a pointred if an odd number of its coordinates are negative, and blue if an evennumber of its coordinates are negative. Then the only edges in this graphconnect red points to blue points. There are exactly 4 points with evencoordinates, and 4 with odd, so the graph is bipartite, with red pointsconnected only to blue points. As each point is connected to all but one ofthe points in the opposite colour class, the graph has the desired property.(We call the 4 edges deleted from the K4,4 a 1-factor .)

ii. The line joining (a, b, 1) to (0, 0, 2) has direction numbers (−a,−b, 1), andparametric equations x = −at, y = −bt, z = 2 + t. This line meets theplane z = 0 in the point with parameter value t = −2, i.e. in the point(2a, 2b, 0). Similarly, the line joining (a, b,−1) to (0, 0, 2) has directionnumbers (−a,−b, 3), equations x = −au, y = −bu, z = 2 + 3u, andmeets the xy-plane in the point with parameter value u = −2

3, i.e. in the

point(

2a3, 2b

3, 0). The edges joining vertices in the plane z = 1 project

into a square, as do the edges joining the vertices in the plane z = −1.The edges passing between vertices in the two planes project on to edgeswith slopes ±1 in the xy-plane; for example, the images of (1, 1, 1) and(1, 1,−1) — i.e. (2, 2, 0) and

(23, 2

3, 0)

— are joined by a line segment withslope 1. The graph in the plane which is produced by projection hasno crossing edges. Thus the original graph was planar , since it is has aplanar representation.

34evenness or oddness

Page 169: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1141

(b) i. Let’s consider, with greater generality, the n-cube, whose vertices arestrings of 1’s and −1’s of length n, with two strings being adjacent iff theydiffer in precisely one location. Then each vertex is adjacent to preciselyn other vertices. As this degree is constant, the graph is regular .

ii. Since any vertex adjacent to a given vertex has either one more minusor one less, all edges connect vertices bearing different colours . Thus thegraph is bipartite.

iii. Pairs of vertices of opposite colours which are not adjacent must be pre-cisely those which differ by an odd number of minus different from theodd number 1, i.e. vertices whose coordinates differ in precisely 3 places.To see that this graph — the complement of the 4-cube in K8,8 — also hasthe structure of a 4-cube, we need only relabel each red vertex (a, b, c, d)by the new symbol [−a,−b,−c,−d]. In this new graph the red verticesare connected to points whose labels differ in exactly 1 place, so the graphis isomorphic to a 4-cube. Thus K8,8 is the edge-disjoint union of 2 copiesof the 4-cube. We may complete the K8,8 to form a K8+8 i.e. a K16, byjoining all the red vertices — to form a K8 — and, similarly, joining allthe blue vertices — to form a second, disjoint, copy of K8.

3. Show that, if A is the adjacency matrix of a graph with n vertices, then the trace35

of A3 is equal to 6 times the number of K3’s in G. Verify this for the graphG = (a, b, c, d, e, ab, bc, ca, de). [Hint: Use [17, Theorem 7.4.2, p. 468].]

Solution: By the theorem, the number of paths of length 3 from vertex v to itselfwill be the main diagonal entry in the vth row of the adjacency matrix. If we sumthe main diagonal entries we have the total number of paths of length 3, countedaccording to their starting vertex and according to the order in which the verticesare traversed. For any K3 there are three vertices that can serve as the initialvertex for the path, and two directions in which the vertices may be traversed;hence each K3 gives rise to 3× 2 closed paths; to find the number of K3’s we mustdivide the total number of closed paths of length 3 by 6.

For the given graph G, with the vertices labelled in the order a, b, c, d, e, the ad-

jacency matrix is A =

0 1 1 0 01 0 1 0 01 1 0 0 00 0 0 0 10 0 0 1 0

. Then A2 =

2 1 1 0 01 2 1 0 01 1 2 0 00 0 0 1 00 0 0 0 1

, and

35The trace of a square matrix is the sum of the main diagonal entries.

Page 170: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1142

A3 =

2 3 3 0 03 2 3 0 03 3 2 0 00 0 0 0 10 0 0 1 0

. The trace is 2 + 2 + 2 + 0 + 0 = 6, precisely 6 times the

number of K3’s — there is only one, with vertices a, b, c.

4. (a) Prove that a bipartite graph cannot have a Hamilton path unless the numbersof vertices in the two classes differ by at most one.

(b) [3, Exercise 4.2.2] “A mouse eats her way through a 3× 3× 3 cube of cheeseby tunnelling through all of the 27 1 × 1 × 1 subcubes. If she starts at onecorner, and always moves on to an uneaten subcube through a flat 1×1 side36,can she finish at the centre of the cube?” Set up a graph whose vertices arelocated at the centres of the 1×1×1 subcubes, and use the theory of bipartitegraphs to resolve this question.

(c) Does the graph of the preceding part have an Euler path or an Euler circuit?Explain.

Solution:

(a) The only possible paths in a bipartite graph oscillate between vertices ofone colour and vertices of the other colour, since all edges have one end ofeach colour. Hence non-self-intersecting paths connecting vertices of the samecolour will have one more vertex of that colour than those of the other colour;non-self-intersecting paths connecting vertices of different colours will havethe same numbers of vertices of the two colours.

(b) The degrees of the vertices of the graph are: 3, for each of the 8 corners; 4 forthe mid-points of each of the 12 sides, 5 for the mid-points of the 6 faces, and6 for the centre of the cube. One can colour the 8 + 6 + 1 vertices of degrees3, 5, 6 in one colour – say red — and no two of them will be adjacent; theother 12 vertices may be coloured blue. We seek a Hamilton path that beginsat one of the red vertices, and ends at a red vertex. Paths must oscillatebetween vertices which are red and those which are blue. Thus a path withtwo red ends must have precisely one more red vertex than blue vertices; but15− 12 6= 1.

(c) The graph has 8 + 6 = 14 vertices of odd degree, and 12 + 1 vertices of evendegree. Since the number of odd-degree vertices is positive, there cannot bean Euler circuit; since the number exceeds 2, there cannot be an Euler path.

36never through an edge or through a vertex

Page 171: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1143

5. (a) [17, Exercise 7.7.24, p. 508] Show that K3,3 has 1 as its crossing number37.

(b) [17, Exercise 7.7.28, p. 509] Show that K3,3 has 2 as its thickness38.

(c) Determine the thickness of K4,4.

Solution:

(a) By Kuratowski’s theorem [17, Theorem 7.7.2, p. 506] the deletion of one edgefrom a K3,3 renders it planar. Can we conclude that the crossing number ofK3,3 is therefore 1? Not without more careful reasoning: it is plausible thatany embedding of the K3,3 with an edge removed is such that the restorationof the edge would require more than one crossing. That this is not the case ismost easily shown by a sketch. (Since we cannot produce figures easily withthe software in which these notes are written, we describe a way of sketchingthe graph. Take the vertices of one class to be (2, 2), (−2,−2), (−1, 1), andthe vertices of the other class to be (2,−2), (−2, 2), (−1,−1), and join thevertices of each class to those of the other class by line segments. Then theonly crossing is of the edges (−1,−1)(2, 2) and (−1, 1)(2,−2), which occursat the origin.)

(b) As K3,3 is not planar, its thickness cannot be less than 2. But the graphobtained by deleting one edge — any one edge — from K3,3 is planar; andthe deleted edge itself, with 4 isolated vertices, constitutes another planarsubgraph. Thus the thickness of K3,3 is exactly 2.

(c) We have seen earlier in this assignment that the deletion of 4 “independent”edges from K4,4 yields the graph Q3, which is planar. These 4 independentedges together constitute one planar graph. Thus the thickness of K4,4 cannotexceed 2. But, as K4,4 contains K3,3 as a subgraph, and is therefore non-planar, its thickness cannot be less than 2; hence the thickness is exactly2.

6. (a) [17, Exercise 7.8.14] Show that a simple graph that has a circuit with an oddnumber of vertices in it cannot be coloured using two colours.

(b) The graph Wn has n + 1 vertices; it consists of a circuit Cn of n vertices(the “rim” of the wheel), to each of which is connected the (n + 1)th vertex— the “hub” of the wheel. (cf. [17, Exercise 7.8.13]) Show that, for n ≡ 1(mod 2), Wn has the property that χ(Wn) = 4; but that the deletion of any

37[17, p. 508] The crossing number of a simple graph is the minimum number of crossings that canoccur in a planar representation of this graph, where no three arcs representing edges can cross at thesame point.

38[17, p. 509] The thickness of a simple graph G is the smallest number of planar subgraphs of G thathave G as their union.

Page 172: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1144

edge renders the graph 3-colourable, indeed 3-chromatic (i.e. such that χ = 3).Discuss the case when n ≡ 0 (mod 2).

Solution:

(a) This is a simple consequence of [17, Example 7.8.4, p. 514], wherein it isshown that χ(Cn) = 3 when n ≡ 1 (mod 2). If a graph contains othervertices and/or edges than Cn, it surely cannot be coloured in fewer coloursthan are required for the Cn.

(b) When n is odd, the rim of a wheel Wn, being an odd circuit, requires, andcan be coloured in 3 colours. The hub, being connected to all vertices of therim, must bear a different colour from all of them, so Wn ≥ 4; moreover, anycolouring of the rim in 3 colours extends to a 4-colouring of Wn by addingone more colour; hence χ(Wn) ≤ 4. We have proved that χ(Wn) = 4 when nis odd.

The deletion of an edge from the hub to the rim creates an opportunity touse the same colour at the ends of the previous edge, and then to colourthe remainder of the rim in an alternation of 2 other colours; thus 3 colourssuffice. The deletion of an edge from the rim permits the colouring of therim in an alternation of 2 colours, which extends to a 3-colouring by usinganother colour for the hub. Thus, in either case, 3 colours suffice for colouringthe graph obtained by deleting one edge. We call a graph with this property(edge)-critical 4-chromatic.39

7. A tournament is a directed graph in which there is exactly one directed edgebetween any two distinct vertices (cf. [17, p. 526]).

(a) [17, Supplementary Exercise 32, p. 526] Determine the number of distincttournaments that can be constructed on the vertex set 1, 2, ..., n. (Youare not being asked to count isomorphism classses of tournaments, whichis a much more difficult problem. Thus, for example, there are 2 distincttournaments when n = 2.)

(b) Show that40 deg−(i) + deg+(i) = n − 1 for all i, and that∑n

i=1 deg−(i) =∑ni=1 deg+(i) =

(n2

).

(c) Show thatn∑

i=1

(deg+(i)

)2=

n∑i=1

(deg−(i)

)239The prefix edge- is often omitted. An analogous concept — vertex-critical involves the deletion of

a vertex and all its incident edges; we will not study that concept in this course.40We are using the notation of [17, Definition 7.2.4, p. 439].

Page 173: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1145

Show by a counterexample that this property need not hold for digraphs thatare not tournaments.

Solution:

(a) There are(

n2

)pairs of vertices. Each of these unordered pairs must be assigned

one of the two possible orders. Hence the number of tournaments is exactly

2(n2).

(b) Every vertex is connected with each of the other n− 1 vertices by an edge; itmatters not which direction is assigned to the edge, it is still counted preciselyonce in the sum deg−(i) + deg+(i).

Each of the(

n2

)directed edges contributes exactly 1 to the sum of in-degrees,

and exactly 1 to the sum of out-degrees. Hence the two sums are equal, andeach is equal to the total number of unordered pairs of vertices, viz.

(n2

).

(c) That this property may fail for digraphs that are not tournaments may beseen from the counterexample (1, 2, 3, (1, 2), (1, 3)), in which the sum ofthe squares of the out-degrees is 22 +02 +02 = 4, while the sum of the squaresof the in-degrees is 02 + 12 + 12 = 2 6= 4.

n∑i=1

(deg−(i)

)2=

n∑i=1

(n− 1− deg+(i)

)2=

n∑i=1

((n− 1)2 − 2(n− 1) deg+(i) +

(deg+(i)

)2)=

n∑i=1

(n− 1)2 − 2(n− 1)n∑

i=1

deg+(i) +n∑

i=1

(deg+(i)

)2= n(n− 1)2 − 2(n− 1)

(n

2

)+

n∑i=1

(deg+(i)

)2= n(n− 1)2 − n(n− 1)2 +

n∑i=1

(deg+(i)

)2=

n∑i=1

(deg+(i)

)2

When n ≡ 0 (mod 2), the rim of the wheel can be coloured in 2 colours, andthe hub requires an additional colour — so the wheel is 3-colourable, and,indeed, 3-chromatic. However, the deletion of any edge does not reduce thenumber of colours required, except for W2, which is 2-colourable.

Page 174: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1146

E Solutions to 1998 Assignment Problems

E.1 Solved Problems from the First 1998 Problem Assignment

1. For the four logical variables p, q, r, s, determine a proposition f which is trueprecisely when any two of these four are true and the other two are false: that is,f is true when p and q are true and r and s are false, when p and r are true and qand s are false, etc.; and is false in all other cases.

(a) Express f as a disjunction of conjunctions, each of which conjunctions is ofthe form a∧ b∧ c∧ d, where a is either p or ¬p, b is either q or ¬q, c is eitherr or ¬r, and d is either s or ¬s.

(b) Express f as a conjunction of disjunctions, each of which disjunctions is ofthe form a∨ b∨ c∨ d, where a is either p or ¬p, b is either q or ¬q, c is eitherr or ¬r, and d is either s or ¬s.

Solution:

(a) In the definition given f is expressed as a disjunction of the form u∨v∨ ...∨w,where u, v, ..., w are all the conjunctions of the logical variables or theirnegations in which eactly two negations appear. There are precisely 6 ways inwhich 2 of the 4 variables can be negated. This can be seen by “brute force”at this stage, but will be seen eventually to be

(42

)= 6. The disjunction of

these 6 terms is true precisely when at least one of the terms is true; and, anyone of the terms is true precisely when two of the variables are true and twoare false. Thus f is given by

(p ∧ q ∧ ((¬r) ∧ (¬s)) ∨ (p ∧ r ∧ (¬q) ∧ (¬s)) ∨ (p ∧ s ∧ (¬q) ∧ (¬r))

∨(q ∧ r ∧ (¬p) ∧ (¬s)) ∨ (q ∧ s ∧ (¬p) ∧ (¬r)) ∨ (r ∧ s ∧ (¬p) ∧ (¬q))

in which neither the order of the conjuncts in the conjunctions, nor the orderof the 6 terms is significant. This formula for f is said to be in disjunctivenormal form.

(b) There are 24 = 16 conjunctions that may be formed by the 4 variables and/ortheir negations. Of these, exactly 10 involve some number other than 2 nega-tions. Forming the disunction of these conjunctions, we have the formula

p ∧ q ∧ r ∧ s

Page 175: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1147

(¬p ∧ q ∧ r ∧ s) ∨ (p ∧ ¬q ∧ r ∧ s) ∨ (p ∧ q ∧ ¬r ∧ s) ∨ (p ∧ q ∧ r ∧ ¬s)∨

(p∧¬q∧¬r∧¬s)∨ (¬p∧ q∧¬r∧¬s)∨ (¬p∧¬q∧ r∧¬s)∨ (¬p∧¬q∧¬r∧ s)∨

¬p ∧ ¬q ∧ ¬r ∧ ¬sthat is true precisely when f is false. Its negation will be logically equivalentto f and will be, by the de Morgan laws, a conjunction of disjunctive clausesof the form sought. Thus f has the form

p ∨ q ∨ r ∨ s∧

(¬p ∨ q ∨ r ∨ s) ∧ (p ∨ ¬q ∨ r ∨ s) ∧ (p ∨ q ∨ ¬r ∨ s) ∧ (p ∨ q ∨ r ∨ ¬s)∧

(p∨¬q∨¬r∨¬s)∧ (¬p∨ q∨¬r∨¬s)∧ (¬p∨¬q∨ r∨¬s)∧ (¬p∨¬q∨¬r∨ s)∧

¬p ∨ ¬q ∨ ¬r ∨ ¬s

This formula for f is said to be in conjunctive normal form.

2. Showing all your work, determine all propositions which are logically equivalent totheir own negation.

Solution: For two propositions to be logically equivalent, they must always havethe same truth value. But any proposition has the opposite truth value from itsnegation. Thus no proposition can be logically equivalent to its negation. That is,the set

f : f ⇔ (¬f)is empty.

3. (a) (cf. [17, Ex. 1.2.11, p. 20]) Using a truth table, prove the absorption laws :(p ∨ (p ∧ q))⇔ p and (p ∧ (p ∨ q))⇔ p.

(b) Using a truth table, determine whether the following argument is valid:

p ∨ qq → rp→ m¬m

r ∧ (p ∨ q)

Page 176: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1148

(c) Using a truth table or otherwise, determine whether the following propositionis a tautology, a contradiction, or neither:

((p ∨ q) ∧ (q → r) ∧ (p→ m) ∧ (¬m))↔ (r ∧ (p ∨ q))

Solution:

(a) (A proof not using truth tables is given in [18, p. 7].)

p q p ∧ q p ∨ q p ∨ (p ∧ q) p ∧ (p ∨ q)F F F F F FF T F T F FT F F T T TT T T T T T

Since the last two columns always have precisely the same entry as the firstcolumn, the two formulæ which head them are both logically equivalent top. (If we had more space we could have included two additional columns,respectively headed by (p ∨ (p ∧ q)) ↔ p and (p ∧ (p ∨ q)) ↔ p, and thenproved that each of these formulæ is a tautology by showing that all entriesin each of these columns would be T .)

(b)p q r m ¬m p ∨ q q → r p→ m r ∧ (p ∨ q)F F F F T F T T FF F F T F F T T FF F T F T F T T FF F T T F F T T FF T F F T T F T FF T F T F T F T FF T T F T T T T TF T T T F T T T TT F F F T T T F FT F F T F T T T FT F T F T T T F TT F T T F T T T TT T F F T T F F FT T F T F T F T FT T T F T T T F TT T T T F T T T T

In this truth table there is only one line — the 7th — in which all the premisesare true. This is the only line of the table that is needed for this part of the

Page 177: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1149

problem: the validity of the argument follows from the presence of a T in thatline in the last column.

The validity of this argument could have been proved in other ways. Forexample, we could argue that ¬m is true only if m is false. Then the premisep→ m could be true only if p is false. Then the first premise, p ∨ q could betrue only if q is true; and finally, the premise q → r could be true only if r istrue. In this way we have determined the unique row of the truth table thatrepresents the one assignment of truth values under which all the premises aretrue. It remains only to test the conclusion and to observe that it is indeedtrue under that particular interpretation.

(c) In the preceding part of the problem we have, using a truth table, proved that

((p ∨ q) ∧ (q → r) ∧ (p→ m) ∧ (¬m))→ (r ∧ (p ∨ q))

is a tautology. However, there are five other rows of the table in which theentry in the last column is a T even though the entries for the four premisesare not all true. Any one of those five rows — for example row 16 — showsthat

((p ∨ q) ∧ (q → r) ∧ (p→ m) ∧ (¬m))← (r ∧ (p ∨ q))

is not always true. Hence the given proposition is not always true, i.e. is nota tautology. Row 7 shows that the given proposition is not a contradiction,either.

4. Give an example to show that, where P (x, y) is any propositional function, theequivalence

(∀y)(∃x)P (x, y)↔ (∃y)(∀x)P (y, x) (154)

is not a tautology.

Solution: (cf. [17, Example 1.3.17, pp. 29-30]) In [17, Exercise 8, p. 94] the implica-tion ← is proved. We shall produce a counterexample to the implication →. Suchan implication can fail only where (∀y)(∃x)P (x, y) is true while (∃y)(∀x)P (y, x) isfalse. Suppose that the universe consists of all positive integers, and that P (x, y)means that x > y. For every integer y there certainly exists an integer which islarger — for example, y + 1 is such an integer. However, there exists no integer ywhich is greater than all integers x; for, in particular, the statement P (y, y) failsfor all integers. Thus the implication (154) may fail to hold.

5. Prove the following results, for any nonempty sets A, B, C.

(a) A×B = C × C ⇔ A = B = C.

Page 178: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1150

(b) [More difficult!] (A×B) ∪ (B × A) = C × C ⇔ A = B = C.

(c) Show that neither of the preceding conclusions is valid when not all of thesets are non-empty.

Solution:

(a) If A = B = C then, evidently, A×B = C × C. It remains only to prove

A×B = C × C ⇒ A = B = C. (155)

We assume A×B = C × C, i.e.

A×B ⊆ C × C (156)

C × C ⊆ A×B (157)

Let a ∈ A and b ∈ B. Then, by virtue of (156), (a, b) ∈ C × C, so a ∈ Cand b ∈ C; thus we have shown that A ⊆ C and B ⊆ C. Conversely, supposec ∈ C. Then, by virtue of (157), (c, c) ∈ A× B, so c ∈ A and c ∈ B; here wehave shown that C ⊆ A and C ⊆ B. The two pairs of inclusions imply thatA = C and B = C, .

(b) (cf. [23, Exercise 7, p. 23]) Here again we wish to prove four inclusions:

A ⊆ C (158)

B ⊆ C (159)

C ⊆ A (160)

C ⊆ B (161)

from the hypotheses

(A×B) ∪ (B × A) ⊆ C × C (162)

(A×B) ∪ (B × A) ⊇ C × C (163)

If (a, b) is any point in A × B, then, by virtue of (162), (a, b) ∈ C × C, soa ∈ C and b ∈ C; this proves (158) and (159) respectively. Suppose thereexists b ∈ B − A. Then, as the point (b, b) is in C × C, by virtue of (159),we may apply (163): (b, b) ∈ A × B or (b, b) ∈ B × A. But each of thesealternatives implies that b ∈ A, which is contrary to hypothesis. From thiscontradiction we conclude that @b ∈ B − A, equivalently, that

B ⊆ A . (164)

Page 179: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1151

Similarly we may prove thatA ⊆ B , (165)

soA = B . (166)

But now (163) impliesA× A ⊇ C × C

and we may conclude A = C by virtue of the preceding problem.

(c) But the conclusions are not valid when, for example, A and C are empty andB is non-empty. In such a case the products A × B, B × A, and C × C areall empty; but B 6= C and B 6= A.

6. Suppose that a set A has precisely n > 0 elements, and let B be a set consisting ofsubsets of A with the property that no two of the members of B are disjoint. Provethat B cannot contain more than 2n−1 elements. Show also that this result is “bestpossible”, i.e. that the bound of 2n−1 cannot be improved. [Hint: Is it possible forB to contain a set and its complement?]

Solution: (cf. [1, Theorem 1.1.1]) Were there a pair C, C of complementary setsin B, then the condition of non-disjointness would be violated. The power setP(A) may be partitioned into 2n

2sets, each consisting of two complementary sets:

B cannot contain more than one member of each of these pairs, hence it cannotcontain more than 2n−1 elements.

The following example shows that 2n−1 is best possible: fix one element a0 ∈ A,and define B to consist of all subsets containing a0.

What happens when n = 0?

[While the theorem is “best possible” in one sense, it can be strengthened. It ispossible to show that, if |B| < 2n−1, it is possible to adjoin new sets to B until theresulting collection has precisely 2n−1 elements.]

7. [17, Problem 1.6.16] If f : B → C and f g : A → C are injective, does it followthat g : A→ B is injective? Justify your answer.

Solution:

g(a1) = g(a2)

⇒ f(g(a1)) = f(g(a2))

⇔ (f g)(a1) = (f g)(a2) by definition of ⇒ a1 = a2

Thus g is injective. Note that, for this proof, we did not require the hypothesisthat f should be injective!

Page 180: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1152

E.2 Solved Problems from the Second 1998 Problem Assign-ment

1. The contents of [17, §§2.3 – 2.5] form part of the syllabus of course 189-340B. Forthe purposes of the present course students should become minimally familiar withthe concepts of §§2.3–2.4 by reading [17, pp. 111–120; 126–130] and solving therelevant simple problems below. The concepts will be discussed in this course onlyto the extent that they are required.

(a) The parity of an integer describes its evenness or oddness : n is even if itis divisible by 2, and odd if it is not even. Evidently even integers n areexpressible in the form n = 2t, while odd integers are expressible in the formn = 2t+ 1. Show that the product of two consecutive integers, i.e. a productof the form n(n+ 1) is always even.

(b) (cf. [17, Exercise 3.2.22] Show that, for any integer n, the product n(n+1)(n+2) is always divisible by 3!.

Solution: The solutions given below are not intended to be elegant — just correct.We will write much more than is necessary in a correct proof in order to show thepitfalls in various approaches to the problems.

(a) i. Proof by cases: If n = 2t, then

n(n+ 1) = 2t(2t+ 1) = 2(t2 + t) ≡ 0 (mod 2)

If n = 2t+ 1, then

n(n+ 1) = (2t+ 1)(2t+ 2) = 2(2t2 + 3t+ 1) ≡ 0 (mod 2)

So, whatever the parity of n, the product n(n+ 1) is always even.

ii. A combinatorial proof, valid for positive n: The number of pairs of el-ements that may be chosen from a set of n + 1 distinct elements is(

n+12

)= (n+1)n

2. As this number must be an integer, and as the de-

nominator of the last mentioned fraction is 2, the numerator must beeven.

(b) i. Proof by cases: There are various possible approaches. We will beginwith the most naıve one. Any integer n is expressible in the form 6t+ u,where the least positive remainder u is one of 0, 1, 2, 3, 4, 5. The productn(n+ 1)(n+ 2) is then equal to (6n+ u)(6n+ u+ 1)(6n+ u+ 2) whichis congruent modulo 6 to u(u + 1)(u + 2). We wish to prove that this

Page 181: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1153

last product is a multiple of 6. The most naıve way is to consider the sixpossible values of u:

u u(u+ 1)(u+ 2)0 0 · 1 · 2 = 0 = 6 · 01 1 · 2 · 3 = 6 = 6 · 12 2 · 3 · 4 = 24 = 6 · 43 3 · 4 · 5 = 60 = 6 · 104 4 · 5 · 6 = 120 = 6 · 205 5 · 6 · 7 = 210 = 6 · 35

This totally unsophisticated proof is mathematically correct, but not veryinteresting.

ii. Proof by induction: An inductive proof could be based on the 6 casesconsidered above, (cf. [17, Example 3.4], where a weaker result is proved).Take n = 0 as the base case. Then, observe that

(n+ 1)[(n+ 1) + 1][(n+ 2) + 1] = n(n+ 1)(n+ 2) + 3(n+ 1)(n+ 2) .

We know from the preceding problem that (n + 1)(n + 2) is even, so3(n + 1)(n + 2) is a multiple of 3 · 2 = 6. The induction hypothesis thatn(n+1)(n+2) is also divisible by 6 will imply that the sum n(n+1)(n+2) + 3(n + 1)(n + 2) is also divisible by 6. This proof, however, appliesonly to non-negative n, and the claim was that the n(n + 1)(n + 2) ≡ 0(mod 6) for any integer 6. We can extend the result we have just provedby observing that, if n < 0, it is of the form n = −m, where m > 0;then n(n + 1)(n + 2) = (−m)(−m + 1)(−m + 2) = −(m− 2)((m− 2) +1)((m− 2) + 2), which we know to be divisible by 6 provided m− 2 ≥ 0,i.e. provided m ≥ 2. So we still have one case that has not been proved:m = 1 — i.e. n = −1. But then n(n+ 1)(n+ 2) = −1(0)1 = 0 = 0 · 6.

iii. Combinatorial proof, for n ≥ 3: Analogously to the preceding problem,we could consider the number of 3-subsets of a set of n + 2 elements.This number is known to be

(n3

)= (n+2)(n+1)n

3!; as the value is an integer,

the numerator in the last mentioned fraction must be divisible by thedenominator, which is 3! = 6.This proof could now be extended to n ≤ 2 by the methods used in thepreceding proof.

iv. By virtue of the preceding problem, n(n + 1) is divisible by 2. If we canshow that n(n + 1)(n + 2) is also divislble by 3, we can conclude — by

Page 182: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1154

virtue of the fact that 2 and 3 are relatively prime41 — that n(n+1)(n+2)is divisible by 2 · 3 = 6. We can assume that n = 3v + w, where w is 0or 1 or 2, and observe that n(n+ 1)(n+ 2) ≡ w(w+ 1)(w+ 2) (mod 3).When w = 0, 1, 2 the values of this product are, respectively, 0, 6, 24, allmultiples of 3. Indeed, from the fact that these values are all multiples of6 we see that we could have shortened the first proof we gave by lookingonly at the remainders of n modulo 3 — it was not necessary to considerremainders modulo 6. So the observation we made above that the productwas divisible by 2, and that 2 and 3 are relatively prime, was true, buttotally unnecessary.

2. (cf. [17, Exercise 2.3.20]) By using, where possible, what you know about factor-izations of the polynomial xn − yn, and/or [17, Theorem 2.3, p. 114], determinewhether each of the following integers is prime.

(a) 29 − 1

(b) 3165 − 711

(c) 27 − 1.

Solution:

(a) We know that x9 − 1 is (x− 1) (x8 + x7 + x6 + x5 + x4 + x3 + x2 + x1 + x0),which is not particularly interesting if x = 2, since the first factor is 2−1 = 1.However, taking x = z3, and n = 3, we have x9 − 1 = z3 − 1 = (x3 −1) ((x3)2 + x3 + 1), which yields, when x = 2,

29 − 1 = (8− 1)(64 + 8 + 1) = 7 · 73 ,

which is evidently composite.

(b) The numbers here are very large, so the problem is not easy to approach “bybrute force”. However, again we observe a factorization

3165 − 711

=(315)11 − 711

=(315 − 7

)×((

315)10

+(315)9

7 +(315)8

72 + ...+(315)2

78 +(315)1

79 + 710)

41But this naıve reasoning would not work if we wished to prove, for example, that n(n+1)(n+2)(n+3)is divisible by 24: we need the fact that 2 and 3 are relatively prime.

Page 183: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1155

which is the product of a large integer, 315 − 7 = 14, 348, 900 and anothermuch larger integer, and so is composite. (The fact that these integers arelarge is not relevant: what is important is that neither is ±1.)

This problem could, however, have been attacked in a much simpler way.Since both 3 and 7 are odd, their powers are all odd, and hence the differenceof two powers would be even. As it is evident that this difference is neither+2 nor −2, it is surely composite.

(c) In this case there is no useful factorization. 27 − 1 = 127. If it is not prime,it will have to have a factor between 2 and

√127, which is less than 12 [17,

Theorem 2.3, p. 114]. Thus, if 127 is composite, it must be divisible by one ofthe primes in this range, i.e. one or more of 2, 3, 5, 7, 11. It is easy to verifythat none of these primes divides 127.

3. (a) In another assignment we have considered the argument

p ∨ qq → rp→ m¬m

) r ∧ (p ∨ q)

which was proved (§E.1, Problem 3#3b) to be valid through the use of a truthtable. You are now asked to prove the validity of the same argument by using

• the logical equivalence of an implication and its contrapositive

• known logical equivalences from [17, Table 1.2.5, p. 17 and Table 1.2.6,p. 18]

• the rules of inference in these notes ??

You are expected to follow the style of proof shown in these notes in ??,numbering the lines in your proof, and carefully accounting for every line,beginning with the premisses and ending with the conclusion. There willbe many different correct derivations. You must not appeal to the earlierproof which involved a truth table. This proof should not be a proof bycontradiction.

(b) Now solve the same problem using a proof by contradiction.

Solution:

(a)

p ∨ q premiss (167)

Page 184: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1156

q → r premiss (168)

p→ m premiss (169)

¬m premiss (170)

¬p modus tollens from (170), (169) (171)

q disjunctive syllogism from (167), (171) (172)

r modus ponens from (172), (168) (173)

) r ∧ (p ∨ q) conjunction of (173) and (167) (174)

(b) While one could create a totally new proof, we will adapt a proof by negationfrom the preceding proof. We begin by adjoining to the premises the negationof the original conclusion.

p ∨ q premiss (175)

q → r premiss (176)

p→ m premiss (177)

¬m premiss (178)

¬(r ∧ (p ∨ q)) new premiss (179)

¬p modus tollens from (178), (177) (180)

q disjunctive syllogism from (175), (180)(181)

r modus ponens from (181), (176) (182)

r ∧ (p ∨ q) conjunction of (182) and (175) (183)

(r ∧ (p ∨ q)) ∧ (¬(r ∧ (p ∨ q))) Rule of Conjunction (184)

) F [17, Table 1.2.6] (185)

Since the negation of r ∧ (p∨ q), when adjoined to the other premisses, yieldsa contradiction, the other premisses imply r ∧ (p ∨ q).

4. You are given below the skeleton of a derivation of d∨ c from a∨ b and b→ d anda→ c. You are to supply the missing justifications.

a ∨ b Premiss (186)

b→ d Premiss (187)

a→ c Premiss (188)

¬(¬a) ∨ b By Law of Double Negation (189)

¬a→ b (190)

¬a→ d (191)

¬d→ a (192)

Page 185: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1157

¬d→ c (193)

) d ∨ c (194)

Solution:

a ∨ b Premiss (195)

b→ d Premiss (196)

a→ c Premiss (197)

¬a→ b [17, Table 1.2.6] (198)

¬a→ d By hypothetical syllogism from (198), (196) (199)

¬d→ a contrapositive of (199) (200)

¬d→ c By hypothetical syllogism from (200), (197) (201)

) d ∨ c [17, Table 1.2.6] (202)

5. Let pi (i = 1, 2, ...) be an infinite set of proposition letters. Define the formulæn∧

i=1

pi recursively for all n ≥ 0 as follows:

•0∧

i=1

pi is defined to be T.

• Ifn∧

i=1

pi has been defined, thenn+1∧i=1

pi is defined to be

(n∧

i=1

pi

)∧ pn+1.

(a) Show that, according to this definition,1∧

i=1

pi ⇔ p1.

(b) Show that, according to this definition,2∧

i=1

pi ⇔ p1 ∧ p2

(c) Define, for any integer n ≥ 0,n∨

i=1

pi to be the formula ¬(

n∧i=1

¬pi

). Prove that

i.0∨

i=1

pi ⇔ F.

ii.n+1∨i=1

pi ⇔(

n∨i=1

pi

)∨ pn+1.

(d) Prove that, for all n ≥ 0,(n∧

i=1

pi

)∨ pn+1 ⇔

n∧i=1

(pi ∨ pn+1)

Page 186: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1158

Solution:

(a)

1∧i=1

pi ⇔(

0∧i=1

pi

)∧ p1

⇔ T ∧ p1 by base case

⇔ p1 ∧T by commutativity of ∧⇔ p1 by Domination Law

(b)

2∧i=1

pi ⇔(

1∧i=1

pi

)∧ p2 by recursive definition

⇔ p1 ∧ p2 by preceding proof

(c) i.

0∨i=1

pi

⇔ ¬(

0∧i=1

¬pi

)⇔ ¬T⇔ F

ii. For n ≥ 0,

n+1∨i=1

pi

⇔ ¬(

n+1∧i=1

¬pi

)

⇔ ¬(

n∧i=1

¬pi

)∧ ¬pn+1

⇔ ¬(

n∧i=1

¬pi

)∨ ¬ (¬pn+1) by De Morgan Law

Page 187: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1159

⇔ ¬(

n∧i=1

¬pi

)∨ pn+1 by Double Negation

⇔(

n∨i=1

pi

)∨ pn+1 by definition of

n∨i=1

(d) Our proof is by induction on n.

Case n = 0:(0∧

i=1

pi

)∨ p1 ⇔ T ∨ p1 by definition

⇔ T by Domination Law

⇔0∧

i=1

(pi ∨ p1) by definition for n = 0

Cases n ≥ 1: Now assume that the equivalence has been proved for n = n0,where n0 ≥ 0. We wish to prove the case n = n0 + 1.(

n0+1∧i=1

pi

)∨ pn0+2

⇔((

n0∧i=1

pi

)∧ pn0+1

)∨ pn0+2 by definition of

∧⇔

((n0∧i=1

pi

)∨ pn0+2

)∧ (pn0+1 ∨ pn0+2)

by distributivity of ∧ over ∨

⇔(

n0∧i=1

(pi ∨ pn0+2)

)∧ (pn0+1 ∨ pn0+2) by induction hypothesis

⇔(

n0+1∧i=1

(pi ∨ pn0+2)

)by definition of

(Note that two applications of the definition of∧

are used above, overdifferent sequences of formulæ.) This completes the proof of the inductionstep.

6. Suppose that a sequence ann=0,1,2,... of integers is defined recursively by

a0 = 1 (203)

Page 188: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1160

a1 = 0 (204)

an = (−3)n − 6an−1 − 9an−2 (n ≥ 2) (205)

Prove, using the “Second Principle of Mathematical Induction”, that

(∀n)

(an =

1

2(n− 1)(n− 2)(−3)n

). (206)

Solution:

Base Case: Since, by one of the given “initial conditions”, a0 = 1 = 12(0− 1)(0−

2)(−3)0, (206) is true for n = 0.

Induction Step: Suppose it has been proved that (206) is true for all n ≤ n0,where n0 ≥ 0. We will show that the claim holds for n = n0 + 1.

Subcase n0 = 0: By the second of the given initial conditions, a1 = 0 =(1−1)(1−2)

2(−3)1, as required, when n0 = 0.

Subcase n0 ≥ 2: Only now are we able to provide a “general” argument,since only for n0 +1 ≥ 2 can we be certain that (205) is applicable. Then

an0+1 = (−3)n0+1 − 6an0 − 9an0−1

= (−3)n0+1 − 6 · 12(n0 − 1)(n0 − 2)(−3)n0

−9 · 12(n0 − 2)(n0 − 3)(−3)n0−1

=

(1 + (n0 − 1)(n0 − 2)− 1

2(n0 − 2)(n0 − 3)

)(−3)n0+1

=1

2((n0 + 1)− 1)((n0 + 1)− 2)(−3)n0+1

proving (206) for n = n0 + 1. It follows by the Second Principle of MathematicalInduction that (206) is true for all n ≥ 0, as claimed.

(Note: This problem is not concerned with how the conjecture above was developed.It could have been found by experimentation. However, there is a systematicmethod for solving inhomogeneous linear recurrences of this type; that method is,however, beyond the scope of this course. We shall, however, consider the solutionof a related, but simpler type of recurrence — homogeneous linear recurrences. Forthe general solution of inhomogeneous linear recurrences, the reader is referred to[11, §3.2].)

Page 189: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1161

E.3 Solved Problems from the Third 1998 Problem Assignment

1. [17, Exercise 4.1.38] Determine the number of binary strings (strings of 0’s and 1’s)of length 10 which contain either a substring consisting of at least five consecutive0’s or a substring consisting of at least five consecutive 1’s, or both. [Hint: Oneway of attacking this problem is to consider cases, according to where the string oflength at least 5 begins.]

Solution:

An ad hoc solution. (a) First consider the cases where strings of length 5 occurwith both 0’s and with 1’s. In such a case 5+5 = 10 symbols are accountedfor, so there are no symbols other than those in the two strings of length5. There are 2! = 2 ways of forming such a string out of the two substringsof length 5.

(b) Now suppose that there is a string of 1’s of length ≥ 5, but no such stringof 0’s. The first member of this string may be any any one of the positions##1,2,3,4,5,6. If the string is at the beginning of the word, we can fixthe first 5 symbols in the word, and then choose the remaining 5 in 25−1ways, since we have to exclude the case where the last 5 symbols are 0’sas this was counted above.

(c) If the string begins anywhere past position #1, it must be immediatelypreceded by a 0. The digits before that 0 are arbitrary, as are the digitsafter the 5th 1; except that we cannot permit a string of 5 0’s to precede,as we already counted it. Thus the number of strings of this type is thenumber of possible locations for that preceding 0 — 5 — multiplied bythe number of ways of filling the positions before that 0 and the positionsafter the 5th 1 — 24; from which 1 must be subtracted, to account forthe string 0000011111. We have (5× 16)− 1 = 79 strings.

(d) Analogously to the foregoing, if there is only a string of 0’s, the totalnumber of words is also 31 + 79 = 110.

(e) Summing, we obtain 2 + (2× 110) = 222 strings.

A more systematic solution. With one type of exception that will be notedbelow, every admissible binary string can be uniquely characterized as follows:

(a) It is an alternating concatenation of m strings where the first consists ofx1 1’s (respectively, of x1 0’s), the next consists of x2 0’s (respectively, ofx2 1’s), etc.,

x1 + x2 + ... = 10 , (207)

(m = 1, 2, ...).

Page 190: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1162

(b) With the exception of the case where m = 2 and x1 = x2 = 5, there isexactly one xi which is at least 5, the other xi being at least 1.

By a change of variable we can convert the problem to considering variablesy1 = x1 − 1, y2 = x2 − 1, ..., yi = xi − 5, yi+1 = xi+1 − 1, ..., ym = xm − 1.Here (207) is replaced by

y1 + y2 + ...+ ym = 10− (m− 1)− 5 . (208)

These solutions can be represented by strings in 2 characters — 6−m copiesof a, and m−1 copies of b, where the length of the first string of a’s is y1, of thesecond string is y2, etc., and where the b’s serve as separators. The numberof such strings is

((6−m)+(m−1)

m−1

)=(

5m−1

). We must multiply this binomial

coefficient by 2 for the number of choices of the first character — is it a 0 ora 1. We must also multiply by the number of different ways of positioningthe string whose length is at least 5. With one exception, this is preciselym. However, in the case m = 2, this leads to double counting, so we mustsubtract 1 before multiplying by 2. The resulting sum is

26∑

m=1

m ·(

5

m− 1

)− 2 = 222 .

Although it was not required, we do know how to evaluate such a sum ingeneral. For an indeterminate x we have

(1 + x)5 =5∑

i=0

(5

i

)xi .

This can be rewritten, through the change of variable m = i+ 1, as

(1 + x)5 =6∑

m=1

(5

m− 1

)xm−1 .

If we multiply by 2x, we obtain

2x(1 + x)5 = 26∑

m=1

(5

m− 1

)xm .

Differentiation with respect to x yields

2(1 + x)5 + 10x(1 + x)4 = 26∑

m=1

m ·(

5

m− 1

)xm−1 ,

an identity which is valid for all x. Giving x the value 1 yields (2·32)+(10·1·16)as the value of the desired sum, from which 2 must be subtracted.

Page 191: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1163

2. [Students were notified that this problem would not be graded.] We wish to countall words of length n formed from an alphabet containing only the symbols a, b, cin the following way:

• There is no restriction on the a’s – an a may appear at any place in a word,without restriction on its precedessors or successors.

• b’s may appear in substrings of even length.

• c’s may also appear only in substrings of even length.

Thus the words of lengths 0 through 4 are as shown below:

Length 0: The “empty” word, which we may denote by ∅.Length 1: Only a.

Length 2: aa, bb, cc.

Length 3: aaa, abb, bba, acc, cca.

Length 4: aaaa, aabb, abba, bbaa, aacc, acca, ccaa, bbcc, ccbb, bbbb, cccc.

(a) Determine a generating function for the number of words of length n. [Hint:One approach — surely not the only one — is to consider the words as beingbuilt up of components a, bb, cc.]

(b) By expanding the generating function determine a general formula for thenumber of words of length n.

Solution:

(a) If we follow the hint, the generating function for words of length n will be

∞∑r=0

(x+ 2x2

)r=

1

1− (x+ 2x2)

(b) The generating function factorizes, and may then be expanded into partialfractions as

1

1− (x+ 2x2)=

1

(1− 2x)(1 + x)

=1

3

(2

1− 2x+

1

1 + x

)

Page 192: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1164

=1

3

(2

∞∑n=0

2nxn +∞∑

n=0

(−1)nxn

)

=∞∑

n=0

2n+1 + (−1)n

3xn

so that the number of words of length n is 2n+1+(−1)n

3, which agrees with the

“experimental” data given above.

3. In [17, Example 4.2.7] you have seen a solution to the following problem:

“During a month with 30 days a baseball team plays at least 1 game aday, but no more than 45 games (in the month). Show that there mustbe a period of some number of consecutive days during which the teammust play exactly 14 games.”

Suppose that a team plays bi games on day #i where bi ≥ 1 (i = 1, 2, ..., 30), and30∑i=1

bi ≤ 45 as before. Show carefully that there is no way in which the team may

avoid playing exactly 15 games in a period of consecutive days.

Solution: We follow the notation of the solution in [17, Example 4.2.7], defining

ai =i∑

k=1

bk (i = 1, 2, ..., 30). Here again the sequence a1, a2, ..., a30 is strictly

increasing, as is the sequence a1 + 15, a2 + 15, ..., a30 + 15. If, for some i and j,aj + 15 = ai, then exactly 15 games will be played on successive days ## j + 1,j + 2, ..., i. Suppose that this never happens for any i, j, i.e. that the two 30-member sequences are disjoint. As all 60 members of these sequences lie between1 and 45 + 15 = 60 inclusive, we conclude that every integer between 1 and 60 isattained exactly once — some in the sequence S = aii, and some in the sequenceT = aj + 15j. As all members of T are ≥ 16, we know that 1, 2, ..., 15 areattained only as elements of S, so ai = i (i = 1, 2, ..., 15), and b1 = b2 = ... = b15.Thus the hypothesis that there is no period of consecutive days in which exactly15 games are played implies its own contradiction, as there will then be exactly15 games played in the first 15 days! From this contradiction we infer that thehypothesis is invalid: there will always be a period of consecutive days in whichexactly 15 games are played.

4. (cf. [17, Exercise 4.3.42]) Determine a general formula for the coefficient of xk in theexpansion of

(2x− 3 1

x

)n, where n is any integer. [Hint: The answer may depend

upon the parity of n. You could begin by bringing the expression to a commondenominator.]

Page 193: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1165

Solution: (2x− 3

1

x

)n

=(2x2 − 3

)nx−n

=n∑

i=0

(n

i

)2i(−3)n−ix2i−n

It follows that, when2i− n = 2j , (209)

soi = j +

n

2, (210)

the coefficient of x2j is(

nj+n

2

)(−3)−j+ n

2 2j+n2 if n is even; and 0 if n is odd. And,

when2i− n = 2j + 1 , (211)

so

i = j +n+ 1

2, (212)

the coefficient of x2j+1 is(

nj+n+1

2

)(−3)−j+n−1

2 2j+n+12 if n is odd; and 0 if n is even.

5. [17, Exercise 4.3.50] Let n be a positive integer. Prove the identity(2n

2

)= 2

(n

2

)+ n2

in each of the following ways:

(a) By applying the general formula(m

s

)=

m!

s!(m− s)!.

(b) By a combinatorial argument — i.e. by interpreting the two sides of the equa-tion as representing two ways of counting the same set of objects. [Hint:Count the subsets of cardinality 2 of a set of 2n elements. Aside from theobvious way of counting these sets, one could proceed as follows. First dividethe set up into two parts — you could call them A and B. Then there arethree different types of subsets of cardinality 2: those contained entirely inA, those contained entirely in B, and those with one member in A and onemember in B. Each subset of cardinality 2 is of precisely one of these types,so the total number can be expressed as a sum.

Page 194: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1166

(c) By working with power series. For example, you could compute, in two ways,the coefficient of x2 in the expansion of (1 + x)2n.

Solution:

(a) We use the fact that (m

2

)=

m!

2!(m− 2)!=m(m− 1)

2.

Thus

(2n

2

)=

(2n)(2n− 1)

2

= n(n− 1 + n) = n(n− 1) + n2

= 2

(n

2

)+ n2 .

(In the foregoing we have used an old equivalent of parentheses, called a vin-culum; by n− 1 we mean (n− 1). This notation was discouraged by printers,who found it was difficult to set into type. It is convenient in situations wherethe overline does not have other meanings.)

(b) We will prove a more general result. Suppose that |A| = a, |B| = 2n− a, andA ∩B = ? . Then there are three types of sets of cardinality 2 in A ∪B:

Sets contained entirely in A. Their number is(

a2

).

Sets contained entirely in B. Their number is(2n−a

2

).

Sets having one element in A and one element in B. The element inA may be selected in a ways, and any one of these may be associatedwith any element from B, which may be selected in 2n− a ways. In all,by the Rule of Product, the number of subsets of this type is a(2n− a).

Summing, we obtain(

a2

)+(2n−a

2

)+ a(2n − a) , which must be equal to the

number of distinct unordered pairs in A ∪ B, which is(2n2

). The special case

a = n is the one that interests us.

(c) We may compute the coefficient of x2 in (1 + x)2n in several ways. By theBinomial Theorem, the coefficient is

(2n2

). But we may also express the poly-

nomial as a product, (1 + x)n · (1 + x)n, and expand each of the binomialpowers separately, ignoring terms which cannot contribute to the term in x2,i.e. terms in powers greater than the second. This yields

(1 + x)2n = (1 + x)n · (1 + x)n

=

((n

0

)x0 +

(n

1

)x1 +

(n

2

)x2 + ...

)

Page 195: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1167

·((

n

0

)x0 +

(n

1

)x1 +

(n

2

)x2 + ...

)=

(n

0

)2

x0 +

((n

0

)(n

1

)+

(n

1

)(n

0

))x1

+

((n

0

)(n

2

)+

(n

1

)(n

1

)+

(n

2

)(n

0

))x2

+terms in higher powers

Equating coefficients of x2 yields(2n

2

)=

(n

0

)(n

2

)+

(n

1

)(n

1

)+

(n

2

)(n

0

)= 2

(n

2

)+

(n

1

)2

6. We wish to count the non-negative integer solutions to the following inequality,

x1 + x2 + x3 + x4 ≤ 15 (213)

possibly subject to additional constraints.

(a) Determine the number of solutions in non-negative integers, without addi-tional constraints.

(b) Determine the number of solutions in non-negative integers to the strict in-equality

x1 + x2 + x3 + x4 < 15 (214)

such that

1 ≤ x1 ≤ 5 (215)

3 ≤ x2 (216)

0 ≤ x3 (217)

1 ≤ x4 (218)

(c) Determine the number of solutions to (213) in non-negative integers such thatx1 is odd and x3 is even.

[Hint: It is usually easier to work with equations than inequalities. Inequality (214)may be transformed into an inequality by defining a new “slack variable” x5 by

x5 = 15− (x1 + x2 + x3 + x4) , (219)

and imposing the constraint that x5 ≥ 1; as x1, ..., x4 are integers, x5 will alsobe an integer. Then the inequality is equivalent to the equation (219). That is,

UPDATED TO September 19, 2000

Page 196: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1168

any solution (x1, x2, ..., x4) to the inequality gives rise to precisely one solution(x1, x2, x3, x4, x5) to the equation; and, conversely, any solution to the equationcorresponds to precisely one solution to the inequality.]

Solution:

(a) Introduce a slack variable as suggested in the hint. We can set up a corre-spondence between solutions to this equation and binary words in 15 1’s and4 0’s, where the 0’s serve as separators, and the lengths of the strings of 1’sare, respectively, x1, ..., x5. The number of such words is

(15+4

4

)= 3876.

(b) This problem could be solved using ordinary generating functions, however, wewill present a solution along the lines of the preceding problem, by changingvariables. We will introduce new variables, so that the lower constraint oneach of the new variables will be ≥ 0. (The strict inequality is replaced by theconstraint x5 ≥ 1, which is then transformed as below. Specifically, we define

y1 = x1 − 1

y2 = x2 − 3

y3 = x3

y4 = x4 − 1

y5 = x5 − 1

so the equation transforms to

y1 + y2 + y3 + y4 + y5 = 9 (220)

which is to be solved in non-negative integers, subject only to the one addi-tional constraint

y1 ≤ 4 . (221)

We can then count the number of solutions without considering (221) andsubtract the number of solutions that violate (221). The number of non-negative solutions to (220) is the number of binary words in 9 1’s and 4 0’s,i.e.

(9+44

)= 715. The solutions which violate (221) can be counted by changing

the variables a second time: define z1 = y1− 5 and zi = yi (i = 2, 3, 4, 5), andcount the non-negative solutions to the equation

z1 + z2 + z3 + z4 + z5 = 4 .

These are equinumerous with the binary words in 4 1’s and 4 0’s, i.e.(4+44

)=

70. It follows that the number of solutions to the original problem is 715−70 =645.

Page 197: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1169

To solve this problem using ordinary generating functions, we would havesought the coefficient of t15 in the expansion of

t(1− t5)1− t

· t3

1− t· 1

1− t·(

t

1− t

)2

which is the coefficient of t15−6 in the expansion of (1− t)−5 minus the coeffi-cient of t15−11 in the same expansion, i.e.

(4+94

)−(4+44

)= 715− 70 = 645, as

before.

(c) This problem is easily solved using ordinary generating functions. Interpretx1 as the exponent of a power of a variable t in the power series t + t3 +t5 + ... + tx1 + ..., and x3 as the exponent of a power of t in the power series1 + t2 + t4 + ... + tx3 + .... The other three variables may be interpreted asexponents of general powers of t in the power series 1 + t+ t2 + .... Thus weare interested in determining the number of ways in which a term t15 arisesin the expansion

t(1 + t2 + t4 + ...)2(1 + t+ t2 + ...)3

where we need not be concerned about the maximum powers of t in theparenthesized power series, as the only constraint is on the total. (Had therebeen an additional constraint that, for example, x1 ≤ 12, we would have hadto be more careful.) This expansion is also the Maclaurin expansion of

t · 1

(1− t2)2· 1

(1− t)3

which we now determine:

t · 1

(1− t2)2· 1

(1− t)3=

t

(1− t2)2(1− t)3

=t(1 + t)3

(1− t2)5

= (t+ 3t2 + 3t3 + t4)∞∑i=0

(4 + i

i

)t2i

= ...+

(1 ·(

4 + 7

7

)+ 3 ·

(4 + 6

6

))t15 + ...

= 960 ,

where only the values i = 7 and i = 6 yield terms that contribute to thecoefficient of t15.

Page 198: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1170

[Note: The version of the problem that was first circulated in print wasambiguous, and some students could have assumed it referred to inequal-ity (214) instead of to (213). In that case we would be seeking the coefficientof t14, which by similar computations to the foregoing, could be shown to be1 ·(5+66

)+ 3 ·

(5+55

)= 29·10!

6!5!= 1218.]

7. You have a supply of 5 1’s, 4 2’s, 3 3’s, and 2 4’s. Determine the number of 5-digit strings that can be formed from these symbols, where you may not use morethan the stated multiplicities in any string. (The strings are not to be formedsimultaneously. The problem is to determine which 5-digit strings can be formedfrom the given population; for example, 44433 is not permitted, as you have onlytwo 4’s available; 11224 is permitted.) Solve the problem in two ways:

(a) By dividing the problem up into disjoint cases, counting the numbers of stringsof each type separately, and adding.

(b) By using exponential generating functions.

Solution:

(a) There are different ways in which the problem can be decomposed into disjointcases. One way is to subdivide according to the non-ordered partitions of 5into sums of positive integers; then count the numbers of ways of selectingsymbols with those multiplicities, and multiplying by the numbers of waysof ordering those symbols. We will list the cases in order of the maximumsummand size.

5 = 5. There is only one symbol that is available in at least 5 copies: thesymbol 1 is available in exactly 5 copies. Thus the number of ways inwhich to choose 5 symbols, all of the same type, is

(11

)= 1. These 5

symbols, once chosen, may be arranged in 5!5!

= 1 way. That is, there isprecisely 1× 1 = 1 word of this type. In fact, this is the word 11111.

5 = 4 + 1. The symbol to have multiplicity 4 may be selected in(21

)= 2 ways

— it must be either of 1 or 2, since 1 is available in multiplicities up to 5,and 2 in multiplicities up to 4. That symbol having been chosen, we maychoose a (different) symbol to have multiplicity 1 in

(4−11

)= 3 ways: it

cannot be the symbol chosen in multiplicity ≥ 4 — hence the subtracted1 — but it may be any of the others, as all have multiplicity at least 1;(in fact, all have multiplicity at least 2. Thus the symbols for these wordsmay be selected in 2× 3 = 6 ways. Once the symbols have been chosen,they may be arranged in 5!

4!1!= 5 ways. Thus the total number of words

of this type is 6× 5 = 30.

Page 199: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1171

5 = 3 + 2. Choose the symbol of to have multiplicity 3 in(31

)= 3 ways — as

it must be one of 1, 2, 3. Then choose the symbol to have multiplicity 2in(4−11

)= 3 ways — it may be any of the three symbols not yet used.

In all there are 3× 3 = 9 ways to choose the symbols for the string, and5!

3!2!= 10 ways in which to order them; so there are 9× 10 = 90 words of

this type.

5 = 3 + 1 + 1. Choose the letters in(31

)(32

)= 9 ways, and order them in

5!3!1!1!

= 20 ways; the total number of words of this type is 9× 20 = 180.

5 = 2 + 2 + 1. Choose the letters in(42

)(21

)= 12 ways, and order them in

5!2!2!1!

= 30 ways; the number of strings is 12× 30 = 360.

5 = 2 + 1 + 1 + 1. Choose the letters in(41

)(33

)= 4 ways, and order them in

5!2!1!1!1!

= 60 ways, for a total number of words of 4× 60 = 240.

5 = 1 + 1 + 1 + 1 + 1. This case is impossible, as there do not exist 5 distincttypes of symbol.

Summing the numbers of the different types of words we have

1 + 30 + 90 + 180 + 360 + 240 = 901

distinct 5-symbol strings.

(b) The total number of strings will be 5! times the coefficient of x5 in the expan-sion of the exponential generating function(

1 +1

1!x1 +

1

2!x2 +

1

3!x3 +

1

4!x4 +

1

5!x5

)·(

1 +1

1!x1 +

1

2!x2 +

1

3!x3 +

1

4!x4

)·(

1 +1

1!x1 +

1

2!x2 +

1

3!x3

)·(

1 +1

1!x1 +

1

2!x2

)=

(1 +

1

1!x1 +

1

2!x2

)4

+

(1 +

1

1!x1 +

1

2!x2

)3

·(

3

3!x3 +

2

4!x4 +

1

5!x5

)+terms in x6 or higher powers

= 1 + 4x+ 8x2 +21

2x3 +

121

12x4 +

901

120x5 + higher power terms

Thus the number of words is 5! × 901120

= 901, which agrees with our earliercompuation by cases.

Page 200: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1172

E.4 Solved Problems from the Fourth 1998 Problem Assign-ment

1. Consider the recurrence with initial conditions

an+2 + 4an = 12 (n ≥ 0) (222)

a0 = 2 (223)

a1 = 4 (224)

(a) Referring to [17, Definition 5.2.1, p. 318], explain why this recurrence is linear ,but is not homogeneous .

(b) Defining the generating function a(x) =∞∑i=0

aixi, solve the recurrence, subject

to the stated initial conditions, by determining a(x) as a sum of ratios ofpolynomials in x, and by finding the MacLaurin expansion of that sum. [Hint:At some stages of that solution you may wish to expand a ratio of the form

c0+c1x2

c2+c3x2+c4x4 by treating x2 as the variable.]

Solution:

(a) The recurrence permits us to express an as a linear combination of precedingmembers of the sequence (where the coefficients are known constant functionsof n) to which is added a known function of n. Indeed,

an = −4an−2 + 12 (n ≥ 2). (225)

Because one of the summands — the term +12 — in equation (225) is not amultiple of some ai, the recurrence is inhomogeneous.

(b) We multiply (222) by xn+2 and sum over the range 0 ≤ n ≤ ∞, to obtain

∞∑n=0

an+2xn+2 + 4x2

∞∑n=0

anxn = 12

∞∑n=0

xn+2

⇔∞∑

m=2

amxm + 4x2

∞∑n=0

anxn = 12

∞∑n=0

xn+2

applying in the first sum a change of variable m = n+ 2

⇔ a(x)− a0 − a1x+ 4x2a(x) = 12x2

1− x

⇔ (1 + 4x2)a(x) = a0 + a1x+12x2

1− x

Page 201: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1173

⇒ (1 + 4x2)a(x) = 2 + 4x+12x2

1− xby (223), (224)

⇔ a(x) =2 + 4x

1 + 4x2+

12x2

(1− x)(1 + 4x2)

which is the desired expression of a(x) as a sum of rational polynomials. Wewill modify the procedure described in [17, Appendix 3, Example 10] in thatwe will not factorize the polynomial 1+4x2, since that would entail the use ofcomplex coefficients, and we can solve the problem more simply without thatfactorization. We will simply treat x2 as the variable where necessary. Then

2 + 4x

1 + 4x2= (2 + 4x)

∞∑r=0

(−4)rx2r

= 2∞∑

r=0

(−4)rx2r + 4∞∑

r=0

(−4)rx2r+1

We will have to use partial fractions in expanding the second term, however.Setting, temporarily, t = x2, and assuming

t

(1− t)(1 + 4t)=

A

1− t+

B

1 + 4t

=(1 + 4t)A+ (1− t)B

(1− t)(1 + 4t)

yields the polynomial identity

t = (1 + 4t)A+ (1− t)B ,

from which we determine, by assigning values t = 1, 14, that 1 = 5A and

−14

= 54B, so A = 1

5, B = −1

5, and

12x2

(1− x)(1 + 4x2)=

12x2(1 + x)

(1− x2)(1 + 4x2)

=12

5(1 + x)

(1

1− x2− 1

1 + 4x2

)=

12

5(1 + x)

(∞∑

r=0

x2r −∞∑

r=0

(−4)rx2r

)It follows that

a(x) =∞∑

r=0

(2(−4)r +

12

5− 12

5(−4)r

)x2r

Page 202: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1174

+∞∑

r=0

(4(−4)r +

12

5− 12

5(−4)r

)x2r+1

=∞∑

r=0

−2(−4)r + 12

5x2r +

∞∑r=0

8(−4)r + 12

5x2r+1

so

an =

−2(−4)

n2 +12

5n ≡ 0 (mod 2)

−2(−4)n+1

2 +125

n ≡ 1 (mod 2), i.e.

an =−2(−4)b

n+12 c + 12

5.

2. A hostess has invited 2n persons to a party, but knows that among them everyperson has precisely one enemy (distinct from herself/himself), and the relation ofbeing an enemy is symmetric. She wishes to seat the visitors in such a way thatmutual enemies are separated.

(a) If the persons are to be seated around a single round table with unmarkedchairs, in such a way that no person is immediately to the left or right ofher/his enemy, what is the number of distinct seatings? (The hostess mustalso be seated somewhere at the table.)

(b) Repeat the preceding, under the assumption that the hostess is not seated.

(c) In each case, verify your formula when n = 0, 1, 2 by listing the actual seatings,or by counting them in some other way.

Solution: Because of the large number of prohibited subseating configurations, thenatural way to attack this problem is using the Principle of Inclusion and Exclusion.Label the pairs of enemies xi and yi (i = 1, 2, ..., n).

(a) The total number of unrestricted seatings is (2n)!, since we are seating 2n+1persons around a round table. Define Ai to be the set of (prohibited) seatingsin which xi and yi are seated together (i = 1, 2, ..., n). Then |Ai| = 21(2n−1)!,since there are two orders in which the enemies could have been seated. Moregenerally, considering the adjacently seated enemies as one unit, we have

|Ai ∩ Aj| = 22(2n− 2)!

(i, j = 1, 2, ..., n; i 6= j); and, in general, the number of arrangements in theintersection of precisely r of the sets Ai is exactly 2r(2n− r)! (r = 0, 1, ..., n).By the Principle, the number of seatings is the alternating sum

n∑r=0

(2n− r)!(n

r

)2r(−1)r , (226)

Page 203: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1175

since there are(

nr

)ways of choosing a set of r violated adjacency conditions.

We verify formula 226 for n = 0, 1, 2.

n = 0: Here the hostess sits alone, in only one way.

n = 1: The formula yields a sum of 0. This corresponds to the impossibilityof separating the two enemies with only one separator around a roundtable.

n = 2: The formula yields a sum of 8. Think of the circular ordering of 5persons as being transformed into an oriented linear ordering of 4 personsby being “cut open” at the hostess. In this linear ordering persons x1

and y1 may not be adjacent, so they are either separated by one of x2

and y2, or by both of them. The latter case is impossible, as then x2 andy2 would be adjacent. Hence the oriented linear arrangement is of one ofthe forms x1 ∗ y1∗ or y1 ∗ x1∗ or ∗x1 ∗ y1 or ∗y1 ∗ x1; there are two waysin each case of placing x2 and y2 into the positions marked ∗.

(b) If n = 0, the number of seatings is 1 — the table is empty. Next, if n = 1, thetotal number of ways of seating 2 persons around an unlabelled round tableis (2 − 1)! = 1; but |A1| = (1 − 1)! = 1, the number of arrangements of oneobject around a round table. Note that in this case there is no power of 2 inthe formula, since there is no distinction between left and right. Inclusion-Exclusion yields the number 1 − 1 = 0 of permitted arrangements. Assumenow that n > 1. Analogously to the preceding, we have

number of unrestricted arrangements of 2n persons

= 20(2n− 1)! (n > 1)

|Ai| = 21(2n− 2)!

· · · = · · ·∣∣∣∣∣r⋂

j=1

Aij

∣∣∣∣∣ = 2r(2n− r − 1)!

By Inclusion-Exclusion, the number of permitted arrangements when n ≥ 2is

n∑r=0

(2n− r − 1)!

(n

r

)2r(−1)r (227)

We verify when n = 0, 1, 2.

n = 0: In the only seating the table is empty.

n = 1: It is impossible to seat two persons at a round table without theirsitting side-by-side.

Page 204: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1176

n = 2: Analogously to the argument earlier in the case n = 2, the two pairs ofenemies must be separated. Once we seat x1 and y1 in non-adjacent seats— and this can be done in only one way at a round table with unlabelledseats, the other two seats may be filled in just 2! = 2 ways. This agreeswith formula (227) when r = 2:

2∑r=0

(3− r)!(

2

r

)2r(−1)r = 3!− 2! · 2 · 2 + 1! · 1 · 22 = 6− 8 + 4 = 2

3. (cf. [17, Supplementary Exercise 6.2, p. 423]) Construct relations on the set

a, b, c, d

with each of the following properties, or prove that no such relation exists.

(a) reflexive and symmetric, but not transitive

(b) irreflexive42, symmetric, and transitive

(c) irreflexive, antisymmetric, and not transitive

(d) reflexive, neither symmetric nor antisymmetric, and transitive

(e) possessing none of the properties: reflexive, irreflexive, symmetric, antisym-metric, transitive.

Solution:

(a) This relation must contain (a, a), (b, b), (c, c), (d, d), as it is to be reflex-ive. In order to be intransitive, it must contain two sides of a trianglewithout the third. The smallest examples will have the following structure:R = (a, a), (b, b), (c, c), (d, d), (a, b), (b, a), (a, c), (c, a). (We had to includethe edges in reverse pairs, as the relation is to be symmetric.)

The largest example will be of the form R = A× A− (a, b), (b, a).(b) The smallest example is the empty relation, ? .

(c) A smallest example is R = (a, b), (b, c).(d) One example is R = (a, a), (b, b), (c, c), (d, d), (a, b), (b, a), (c, d)(e) One example is R = (a, a), (a, b), (b, a), (b, c)

4. (cf. [17, Supplementary Exercise 6.25, p. 424]) Let R(S) be a set consisting ofsome binary relations on a set S, i.e. R(S) ⊆ P(S × S). Define the relation 4 onR(S) by R1 4 R2 iff R1 ⊆ R2, where R1 and R2 are relations on S.

42A relation R on a set A is defined [17, p. 365] to be irreflexive if (∀a ∈ A)((a, a) /∈ R).

Page 205: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1177

(a) Show that (R(S), 4 ) is a poset.

(b) Taking S = a, b, c, and R(S) to be the set of posets on S, determine theHasse diagram for (R(S), 4 ).

Solution:

(a) Given any set, the relation ⊆ is a partial ordering. The details of a proof —which were expected here — can be found in [17, Example 6.6.3, p. 403].

(b) We must first determine the set of posets on S. There are 5 distinct types;we list them according to their Hasse diagrams.

r r r : Only the relation

R1 = (a, a), (b, b), (c, c)

r r

r

:

R2 = (a, a), (b, b), (c, c), (a, b)R3 = (a, a), (b, b), (c, c), (b, a)R4 = (a, a), (b, b), (c, c), (a, c)R5 = (a, a), (b, b), (c, c), (c, a)R6 = (a, a), (b, b), (c, c), (b, c)R7 = (a, a), (b, b), (c, c), (c, b)

r

r r

A

A

:

R8 = (a, a), (b, b), (c, c), (b, a), (c, a)R9 = (a, a), (b, b), (c, c), (c, b), (a, b)R10 = (a, a), (b, b), (c, c), (a, c), (b, c)

r

r r

A

A

:

R11 = (a, a), (b, b), (c, c), (a, b), (a, c)R12 = (a, a), (b, b), (c, c), (b, c), (b, a)R13 = (a, a), (b, b), (c, c), (c, a), (c, b)

Page 206: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1178

r

r

r

: These are the total orders:

R14 : a < b < c

R15 : a < c < b

R16 : b < c < a

R17 : b < a < c

R18 : c < a < b

R19 : c < b < a

The Hasse diagram for R(S) has four levels. At the bottom is R1; at thetop are R14 through R19. The second layer from the bottom consists of R2

through R7, and the level above it consists of R8 through R13. Every vertexin the second level is connected to 2 vertices in the level above it. From thatlevel every vertex is connected to two vertices in the top level. All otherconnections are obvious.

5. Determine all solutions ann=0,1,... to the recurrence

an+2 + 2an+1 − 3an = 0 (228)

which are also solutions of exactly one of the recurrences

an+2 − 2an+1 + an = (−3)n (229)

an+2 + an+1 − 6an = 2n (230)

Solution: As the auxiliary polynomial of (228) is t2 + 2t− 3, with roots 1 and −3,all solutions have the form

an = A1n +B(−3)n = A+B(−3)n (231)

This solution satisfies (229 iff 16B(−3)n = (−3)n for all n, i.e. iff B = 116

; it satisfies(230) iff −4A = 2n for all n, which is impossible. Thus we are seeking sequencessatisfying both of (228) and (229). These are all sequences

an = A+(−3)n

16(232)

where A is any constant.

Page 207: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1179

E.5 Solved Problems from the Fifth 1998 Problem Assignment

Students were advised that

“Students whose solutions demonstrate a serious attempt at solution willreceive full marks on the basis of the submission only. Full solutions will bedistributed and/or mounted on the Web.”

1. The converse of a directed graph G = (V,E) is defined to be the directed graphon the same vertex set, in which every directed edge (a, b) of G is replaced by adirected edge (b, a); that is, it is obtained from G by reversing the directions of alldirected edges. A digraph is self-converse if it is isomorphic to its converse.

(a) Prove or disprove: For digraphs without loops, (but possibly with edges inboth directions between distinct vertices), the complement of the converse isthe converse of the complement. (By complement of a digraph G = (V,E) wemean the graph G′ = (V,E) on the same vertex set whose edges are all theedges of the complete directed graph with vertex set V and with |V |(|V | − 1)edges (i.e. one in each direction between every pair of distinct vertices). Weare excluding loops from both G and its complement.)

(b) For each of the isomorphism types of digraphs on 3 vertices inclusive determinethe converse. (In considering only isomorphism types we are using the factthat isomorphism is an equivalence relation. You are asked to indicate thestructure of each digraph, but not to differentiate between two digraphs thatdiffer only in the way in which the vertices are labelled.)

(c) In your determination above indicate which pairs of digraphs are converses ofeach other, and which digraphs are self-converse.

Solution:

(a) Let’s denote the operation of taking the converse by C. For convenience wewill write e ∈ G to represent the fact that e is an edge of the digraph G. Then

(a, b) ∈ CG ⇔ (b, a) ∈ G⇔ (b, a) /∈ G⇔ ¬((b, a) ∈ G)

⇔ ¬((a, b) ∈ CG)

⇔ (a, b) ∈ CG

so the digraphs CG and CG have the same set of directed edges. (By definitionof complementation and the converse they have the same vertex sets.) So theyare one and the same digraph.

Page 208: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1180

(b), (c) By virtue of the preceding problem, it suffices to consider digraphs with atmost 1

2× 6 = 3 directed edges. We will describe the digraphs with up to

3 directed edges; the remainder of the catalogue can be compiled by takingcomplements. (Because of the difficulty of entering graphics into these notes,we will describe the digraphs in words and symbols; it would be much moreappealing to use sketches for small digraphs like these.)

0 edges. Only one digraph has 0 edges, and it is its own converse.

1 edge. Up to isomorphism there is only one digraph with one edge, and itis its own converse.

2 edges. There are four different digraphs with two edges. One of these hasa pair of edges in opposite directions, and it is its own converse. Theother three consist of an orientation of a simple path of length 2. Wherethe two edges are consistently directed, we have a self-converse digraph.In the other two cases the edges are either both directed to their commonincident vertex, or both directed away from their common incident vertex;each of these is the converse of the other.

3 edges. There are two digraphs containing a pair of oppositely directededges. In one of these the direction of the third edge is away from thecommon vertex with the other two, in the other it is towards that vertex;these two digraphs are mutually converse.The other digraphs consist of orientations of the triangle: one is the cycli-cally oriented triangle, and the other the transitively oriented triangle;each of these is self-converse.

2. Use Euler’s polyhedron formula [17, Theorem 1, p. 502] and the fact that a bipartitegraph has no triangles to prove that K3,3 is not planar.

Solution: The graph has v = 6 vertices, and e = 9 edges. If it were planar, thenthe number of faces in any embedding would be, by Euler’s polyhedron formula,9− 6 + 2 = 5. As the sum of the degrees of the regions would be twice the numberof edges, i.e. 2 × 9 = 18, the average degree of a region would be 18

5< 4, so, by

the Pigeonhole Principle, some region would be bounded by fewer than 4 edges.But this graph contains no cycles of length less than 4. From this contradiction weinfer that no embedding in the plane exists.

The preceding is a proof “from first principles” based directly on Euler’s PolyhedronFormula. One could also base a proof on the Corollary to that Theorem [17, p.504] that states that e ≤ 2v − 4 in a planar graph that contains no triangles.

3. (a) Show that the Petersen graph [17, Exercise 7.5.*56, p. 487] is not Hamiltonian,i.e. does not possess a Hamilton circuit. You may assume that (as shown in

Page 209: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1181

the lectures) the Peterson graph has 10 vertices, all of degree 3, and that itcontains no circuit of length less than 5.

(Hint: If the graph were Hamiltonian, we could label the vertices v1, v2, ...,v10 so that v1, v1v2, v2, v2v3, ..., v9v10, v10, v10v1 is a 10-gon. Then, if we wereto represent the 10-gon as a circle in the plane, the remaining 5 edges in thegraph can be represented as diagonals of this circle, joining the 10 boundarypoints in pairs. This proof uses a representation of the graph in the plane,wherein we are not concerned about whether edges cross in the representation,but were we will use the fact that crossing occur to prove the non-existenceof a Hamilton circuit. Consider two cases:

Case 1. All diagonals join a vertex to the diametrically oppositepoint on the (alleged) Hamilton circuit.

Case 2 In at least one case a vertex is joined to a point which is notdiametrically opposite.

Show that in either of these cases we arrive at a contradiction, so the hypoth-esis that there exists a 10-gon in the graph is unjustified.)

(b) Show by a direct application of Kuratowski’s Theorem [17, Theorem 2, p. 506](without using the Corollaries to [17, Theorem 1, p. 502]) that the Petersengraph is not planar.

Solution:

(a) Case 1. If diametrically opposite vertices were adjacent, we would have edgesv1v6, v2v7, etc. But then the graph would contain a quadrangle v1v6v7v2,and we know that the shortest circuit in a Petersen graph is a pentagon.

Case 2. Without limiting generality we may now assume that the vertex v1

is joined to some vertex other than v6; and, by hypothesis, it is also joinedto v10 and v2. It cannot be joined to v3 or v9, as these edges would giverise to a triangle; nor to v4 or v8, as these would give rise to a quadrangle.So the only available neighbours are v5 or v7; without limiting generality,assume that v1 is joined to v5. This reasoning applies to each of the pointsin the 10-gon: each of them must be connected either to the diametricallyopposite vertex, or to one of the two vertices on either side of that vertex.So v6 can only be connected to one of v1 (the diametrically oppositevertex), or v2, or v10; but the first of these alternatives is not available,as v1 already has degree 3. Nor could it be connected to v10, as thenwe would have a 4-gon v10v1v5v6, which is not present in the structureof the Petersen graph; thus the remaining adjacency of v10 is completelydetermined: v6v2 is an edge. But this also produces a 4-gon, namelyv1v2v6v5. So this second case also leads to a contradiction.

Page 210: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1182

(b) cf. [17, Example 8, pp. 506-507]

We conclude that the Petersen graph contains no Hamilton circuit.

4. In the graph Qn called the n-cube there are 2n vertices which can be labelled bythe 2n binary strings of length n. If we represent these vertices by vectors likex = (x1, x2, ..., xn), where each coordinate is 0 or 1, then two vertices will beadjacent iff their coordinate vectors differ in precisely one place.

(a) Prove by induction on n that Qn has, for n ≥ 2, a Hamilton circuit.

(Hint: Show how Qn+1 can be viewed as two “horizontal” copies of Qn, con-nected by “vertical” edges joining corresponding vertices. Then show how aHamilton circuit in each of these copies can be reduced to a Hamilton pathby erasing corresponding edges in the two copies, after which the two copiesare joined together by 2 “vertical” edges. In order to understand this hint, itis suggested that you try this out in R3 with two copies of a square, one inthe plane z = 0, and one in the plane z = 1.)

(b) Show that Qn is bipartite.

Solution:

(a) The base case is Q2 — the square, which is evidently Hamiltonian.

Suppose that Qn has a Hamilton circuit in which (x1, ..., xn) and (y1, ..., yn) aretwo successive vertices. Take two copies of Qn, each containing this Hamiltoncircuit, and add to the coordinates of the first copy an (n+1)st coordinate 0,and to the coordinates of vertices in the second copy an (n+ 1)st coordinate1. Erase the edges (x1, ..., xn, i)(y1, ..., yn, i) (i = 0, 1) and adjoin the edges(x1, ..., xn, 0)(x1, ..., xn, 1) and (y1, ..., yn, 0)(y1, ..., yn, 1) to create a Hamiltoncircuit in Qn+1. By induction all cubes on 22 or more vertices are Hamiltonian.(The 1-cube has the structure of K2, and is not Hamiltonian.)

(b) Let A denote the set of vertices whose coordinates contain an even numberof 1’s, and B the set whose coordinates contain an odd number of 1’s. Then,as the coordinates of two adjacent vertices differ by a 1 in one position only,vertices in A cannot be adjacent to each other, nor can vertices in B; so thegraph is bipartite.

Page 211: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1183

F Solutions to 1999 Assignment Problems

F.1 First 1999 Problem Assignment, with Solutions

Distribution Date: Wednesday, September 29th, 1999Solutions were to be submitted on Friday, September 24th, 1999

1. [19, Exercise 1.1.10] For each of the following sentences, determine whether an“inclusive” “or” or and “exclusive” “or” is intended. Explain your answer. [Note:This is a language problem, not a mathematical one: in some cases it is possibleto justify both possible types of “or”.]

(a) Experience with C++ or Java is required.

(b) Lunch includes soup or salad.

(c) To enter the county you need a passport or a voter registration card.

(d) Publish or perish.

Solution: In several of the parts we give arguments to justify either interpretationof the word “or”.

(a) The sentence appears to describe a minimum condition. We usually operateunder the postulate that the more experience one has, the better. In thatspirit, we would expect the intention here to be the “inclusive” “or”.

(b) Here we appear to have a maximum condition. If the sentence describes therights of an individual customer in an eating establishment, we would interpretthe intention to be the “exclusive” “or”.

The other interpretation is also plausible here. If one interprets the sentenceas part of a description of a nourishing lunch, then an individual might beencouraged to include both soup and salad, if she wished. In this interpetationwe have an “inclusive” “or”.

(c) The intention appears to be proof of citizenship, which could be demonstratedwith either document. If the intention is that the document be presented toan immigration officer, who can read a document and render a decision, thenone would interpret the “or” here as “inclusive”.

Another — far fetched — interpretation could be that the document is to beanalyzed by a machine, which is capable of reading only one document. Inthat case the “exclusive” “or” would apply.

(d) This aphorism is often used to describe the atmosphere for academic staff at aresearch university; “perish” means that the professor’s appointment will not

Page 212: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1184

be renewed. The intention must be read as the “inclusive” “or”, since thereare reasons other than the absence of research for not renewing an academicappointment (for example, “moral turpitude”).

2. (cf. [19, Exercise 1.1.16]) Write each of the following statements in the form “p→q”.

(a) I will remember to send you the address only if you send me an e-mail message.

(b) To be a citizen of this country it is sufficient that you were born in this country.

(c) If you keep your textbook, it will be a useful reference in your future courses.

(d) The Habs will win the Stanley Cup if their goalie plays well.

(e) The beach erodes whenever there is a storm.

(f) It is necessary to have a vaild password to log on to the server.

Solution: We may temporarily use a connective←, defined so that p← q iff q → p.

(a) (I will remember to send you the address)→ (you send me an e-mail message).

(b) (To be a citizen of this country) ← (you were born in this country). Equiva-lently,

(You were born in this country.) → (You are a citizen of this country.)

(c) (You keep your textbook.) → (It will be a useful reference in your futurecourses.)

(d) (The Habs will win the Stanley Cup)← (their goalie plays well). Equivalently,

(The Habs’ goalie plays well.) → (The Habs will win the StanleyCup.)

(e) (The beach erodes) ← (there is a storm). Equivalently,

(There is a storm.) → (The beach erodes.)

(f) (You have a valid password)← (You are able to log on to the server.) Equiv-alently,

(You are able to log on to the server.) → (You have a valid password.)

3. [19, Exercise 1.1.26] Determine the truth table for ((p→ q)→ r)→ s.

Solution: We denote truth by 1, falsity by 0. (We have chosen to order the rows ofthe table “lexicographically” — i.e. in the order of the binary words that describe

Page 213: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1185

the truth value assignments; many authors would give the data in the reverseorder.)

p q r s p→ q (p→ q)→ r ((p→ q)→ r)→ s0 0 0 0 1 0 10 0 0 1 1 0 10 0 1 0 1 1 00 0 1 1 1 1 10 1 0 0 1 0 10 1 0 1 1 0 10 1 1 0 1 1 00 1 1 1 1 1 11 0 0 0 0 1 01 0 0 1 0 1 11 0 1 0 0 1 01 0 1 1 0 1 11 1 0 0 1 0 11 1 0 1 1 0 11 1 1 0 1 1 01 1 1 1 1 1 1

4. [19, Exercise 1.3.22] Determine the truth value of each of the following statements,if the universe of discourse of each variable is the set of real numbers. Justify yourclaims.

(a) ∃x(x2 = 2)

(b) ∃x(x2 = −1)

(c) ∀x∃y(x2 = y)

(d) ∀x∃y(x = y2)

(e) ∃x∀y(xy = 0)

(f) ∃x∃y(x+ y 6= y + x)

(g) ∀x 6= 0∃y(xy = 1)

(h) ∃x∀y 6= 0(xy = 1)

(i) ∀x∃y(x+ y = 1)

(j) ∃x∃y(x+ 2y = 2 ∧ 2x+ 4y = 5)

(k) ∀x∃y(x+ y = 2 ∧ 2x− y = 1)

(l) ∀x∀y∃z(z = (x+ y)/2)

Page 214: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1186

Solution: Some of these statements will become more meaningful in course 189-340,where we consider algebraic systems which lack some of the familiar properties ofR.

(a) The statement asserts the existence of a square root of 2. Where the universeis R, this is TRUE – there are, in fact, two square roots. (Were the universeto be the rational numbers, the statement would be false.)

(b) Here the statement asserts the existence of a square root of −1. As all squaresof real numbers are non-negative, this statement is FALSE. (Were the universeto be, for example, the complex numbers, the truth value would be TRUE.)

(c) This statement is TRUE. More generally, if f : R→ R is any function, then∀x∃y(f(x) = y) is true, since, the codomain of the function is R.

(d) This statement asserts that all real numbers have a square root. This isFALSE for the universe R, as, for example, −1 is not a square.

(e) This statement is true; one solution — in fact, the only solution — is x = 0.

(f) This statement asserts that “addition of real numbers is non-commutative”.As commutativity is a basic property of the set R, the negation is FALSE.

(g) This statement asserts the existence, for every non-zero real number, of amultiplicative inverse. This statement is TRUE; the inverse is unique, and isusually denoted by 1

xor x−1. Note that the statement would not be true if

the universe were taken to be the set of 2× 2 real matrices.

(h) The reversal of the order of the quantifiers has completely changed the mean-ing of the statement. This statement asserts that there exists a real numberwhich can serve as multiplicative inverse for all non-zero reals. This is FALSE,since xy1 = 1 = xy2 ⇒ y1 = y2; thus, if we take distinct non-zero real numbersy1 and y2, their multiplicative inverses will have to be distinct.

(i) TRUE. For every x the real number 1− x has the desired property.

(j) The truth of the two equations would entail the truth of the equation obtainedby subtracting twice the first from the second, which is 0 = 1. From thiscontradiction we deduce that the conjunction is FALSE.

(k) Let x be fixed. The two equations respectively require that y = 2 − x andy = 2x−1. These two equations imply that 2−x = 2x−1, which implies thatx = 1. Except for the value x = 1, the conjunction of the two equations if false.Thus the universally quantified conjunction is FALSE, as there exist values ofx for which the two equations are not simultaneously true; for example, whenx = 0.

Page 215: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1187

(l) This statement asserts the existence in the given universe of a midpoint forany interval. While it is TRUE for the given universe R, it would not havebeen true for the universe consisting of the union of the two coordinate axesin R2, where addition is taken to be the usual vector addition.

5. [19, Exercise 1.3.24] Rewrite each of the following statements so that negationsappear only within predicates (that is, so that no negation is outside a quantifieror an expression involving logical connectives.) Show all intermediate steps.

(a) ¬∃y∃xP (x, y)

(b) ¬∀x∃yP (x, y)

(c) ¬∃y(Q(y) ∧ ∀x¬R(x, y))

(d) ¬∃y(∃xR(x, y) ∨ ∀xS(x, y))

(e) ¬∃y(∀x∃zT (x, y, z) ∨ ∃x∀zU(x, y, z))

Solution:

(a)

¬∃y∃xP (x, y) ⇔ ∀y¬∃xP (x, y)

⇔ ∀y∀x¬P (x, y)

(b)

¬∀x∃yP (x, y) ⇔ ∃x¬∃yP (x, y)

⇔ ∃x∀y¬P (x, y)

(c)

¬∃y(Q(y) ∧ ∀x¬R(x, y))

⇔ ∀y¬(Q(y) ∧ ∀x¬R(x, y))

⇔ ∀y(¬Q(y) ∨ ¬∀x¬R(x, y))

⇔ ∀y(¬Q(y) ∨ ∃x¬¬R(x, y)) de Morgan law

⇔ ∀y(¬Q(y) ∨ ∃xR(x, y)) Double negation law

(d)

¬∃y(∃xR(x, y) ∨ ∀xS(x, y))

⇔ ∀y¬(∃xR(x, y) ∨ ∀xS(x, y))

⇔ ∀y((¬∃xR(x, y)) ∧ (¬∀xS(x, y))) de Morgan law

⇔ ∀y((∀x¬R(x, y)) ∧ (∃x¬S(x, y)))

Page 216: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1188

(e)

¬∃y(∀x∃zT (x, y, z) ∨ ∃x∀zU(x, y, z))

⇔ ∀y¬((∀x∃zT (x, y, z)) ∨ (∃x∀zU(x, y, z)))

⇔ ∀y(¬(∀x∃zT (x, y, z)) ∧ (¬∃x∀zU(x, y, z))) de Morgan law

⇔ ∀y((∃x¬∃zT (x, y, z)) ∧ (∀x¬∀zU(x, y, z)))

⇔ ∀y((∃x∀z¬T (x, y, z)) ∧ (∀x∃z¬U(x, y, z)))

6. (a) (cf. [19, Exercise 1.3.30]) Use quantifiers to express the laws of distributivityof multiplication over addition of 2× 2 matrices with real entries.

(b) [19, Exercise 1.3.50] A real number x is called an upper bound of a set S ⊆ Rif x is greater than or equal to every member of S; x is the least upper boundof S if it is an upper bound which is less than or equal to every upper boundof S. It can be shown that, if the least upper bound exists, it is unique. (Onemay define, in an analogous way, a lower bound and the greatest lower bound .)

i. Using quantifiers, express the fact that x is an upper bound of S.

ii. Using quantifiers, express the fact that x is the least upper bound of S.

Solution:

(a) Distributivity of multiplication over addition is given by x(y+z) = xy+xz and(y+z)x = yx+zx, which must hold for all choices of x, y, z ∈ R. We must thustriply quantify both statements: ∀x∀y∀z(x(y + z) = xz + yz), ∀x∀y∀z((y +z)x = yx+ zx). Do we need both of these statements? Either of these wouldbe a consequence of the other and the commutative law of multiplication,which could be written as ∀x∀y(xy = yx); unfortunately, commutativity doesnot hold for the full set of 2 × 2 real matrices, so both “laws” are requiredhere. We could call the first statement “left distributivity” and the second“right distributivity”.

(b) i. We could write ∀s ∈ S(s ≤ x), which is an abbreviation for ∀s((s ∈ S)→(s ≤ x)).

ii. The statement (∀s ∈ S(s ≤ x)) ∧ ∀y((∀s ∈ S(s ≤ y)) → (x ≤ y)) is anabbreviation for (∀s((s ∈ S)→ (s ≤ x))) ∧ ∀y((∀s(s ∈ S)→ (s ≤ y))→(x ≤ y))

7. (a) Prove the following set equation:

(A ∩B)× (C ∩D) = (A× C) ∩ (B ×D)

UPDATED TO September 19, 2000

Page 217: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1189

(b) Carry out some experimentation to determine whether a statement of theform

(A ∪B)× (C ∪D) ? (A× C) ∪ (B ×D)

is always true, where ? is one of the relations ⊆, ⊇, =. If your experimentationsuggests that such a theorem is true, try to prove the theorem.

Solution:

(a)

(x, y) ∈ (A ∩B)× (C ∩D)

⇔ (x ∈ A ∩B) ∧ (y ∈ C ∩D) by definition of ×⇔ ((x ∈ A) ∧ (x ∈ B)) ∧ ((y ∈ C) ∧ (y ∈ D) by definition of ∩⇔ ((x ∈ A) ∧ (y ∈ C)) ∧ ((x ∈ B) ∧ (y ∈ D)

by associativity, commutativity of ∩⇔ ((x, y) ∈ A× C) ∧ ((x, y) ∈ B ×D) by definition of ×⇔ (x, y) ∈ (A× C) ∩ (B ×D) by definition of ∩

(b) Experimentation, or the use of Venn diagrams, suggests the general truth ofthe following inclusion:

(A ∪B)× (C ∪D) ⊇ (A× C) ∪ (B ×D) (233)

We can prove this inclusion as follows:

(x, y) ∈ (A× C) ∪ (B ×D)

⇔ ((x ∈ A) ∧ (y ∈ C)) ∨ ((x ∈ B) ∧ (y ∈ D)) definitions of ×,∪⇒ ((x ∈ A) ∧ (y ∈ C)) ∨ ((x ∈ B) ∧ (y ∈ D))

∨((x ∈ A) ∧ (y ∈ D)) ∨ ((x ∈ B) ∧ (y ∈ C))

(This last step is an instance of the “Rule of (Disjunctive) Amplification”,which states that p→ (p ∨ q) is a tautology (cf. Notes, §??).)

⇔ ((x ∈ A) ∧ (y ∈ C)) ∨ ((x ∈ A) ∧ (y ∈ D))

∨((x ∈ B) ∧ (y ∈ C)) ∨ ((x ∈ B) ∧ (y ∈ D)

commutativity, associativity of ∨⇔ ((x ∈ A) ∧ ((y ∈ C) ∨ (y ∈ D)) ∨ ((x ∈ B) ∧ ((y ∈ C) ∨ (y ∈ D))

distributivity of ∧ over ∨⇔ ((x ∈ A) ∨ (x ∈ B)) ∧ ((y ∈ C) ∨ (y ∈ D)) distributivity of ∧ over ∨⇔ (x ∈ A ∪B) ∧ (y ∈ C ∪D) definition of ∪⇔ (x, y) ∈ (A ∪B)× (C ∪D) definition of ×

Page 218: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1190

The student should be able to prove — by constructing a simple counterex-ample — that (233) is “best possible”, in the sense that we cannot replacethe symbol ⊇ by =.

8. Let bxc and dxe respectively represent43 the “floor” and “ceiling” functions, definedfor any x ∈ R by

bxc = maxn|(n ∈ Z) ∧ (n ≤ x) (234)

dxe = minn|(n ∈ Z) ∧ (n ≥ x) (235)

(a) Prove carefully that ∀x ∈ R

(⌊x2

⌋+

⌊x+ 1

2

⌋= bxc

). [Hint: Consider the

function f(x) =⌊

x2

⌋+⌊

x+12

⌋− bxc. Each of the three summands is constant

throughout intervals into which R can be decomposed. By examining theseintervals, you can determine a decomposition of R into intervals in whichall three of the summands are constant. This permits you to determine fcompletely.]

(b) It has been suggested that the following identity holds for the floor function:⌊x2

⌋·⌊x+ 1

2

⌋=

⌊x2

4

⌋. (236)

Is this an identity?

Solution:

(a) The function bxc is constant throughout intervals of the form m ≤ x < m+1;⌊x2

⌋is constant throughout intervals of the form 2m ≤ x < 2m + 2;

⌊x+1

2

⌋is

constant throughout intervals of the form 2m ≤ x+ 1 < 2m+ 2, equivalently,2m − 1 < x ≤ 2m + 1, where m ∈ Z. Thus the sum/difference of thesefunctions is constant throughout all intervals of the form

m ≤ x < m+ 1, (m ∈ Z). (237)

When 2n ≤ x < 2n + 1, f(x) =⌊

x2

⌋+⌊

x+12

⌋− bxc = n + n − 2n = 0; when

2n+ 1 ≤ x < 2n+ 2, f(x) =⌊

x2

⌋+⌊

x+12

⌋− bxc = n+ (n+ 1)− (2n+ 1) = 0.

As R decomposes into a union of intervals of these two types, the propertyholds throughout R.

43Older notations for these functions are respectively [x] and x; the floor function is/was oftencalled the greatest integer function.

Page 219: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1191

(b) All that was expected of students was to demonstrate that (236) is not anidentity, i.e. that there exist values of x for which it fails. In the followingsolution we determine precisely where equality holds: this solution is moreintricate than we would expect students in this course to provide, and isbeing supplied only for completeness.

i. When 0 ≤ 2n ≤ x < 2n+1,⌊

x2

⌋·⌊

x+12

⌋= n·n = n2, while n2 ≤ x2

4 < n2+n+ 14 .

So equality does indeed hold when x = 2n; in fact, equality holds in the interval2n ≤ x < 2

√n2 + 1, and fails to hold in the interval

2√

n2 + 1 ≤ x < 2n + 1 . (238)

When 1 ≤ 2n + 1 ≤ x < 2n + 2,⌊

x2

⌋·⌊

x+12

⌋= n(n + 1) = n2 + n, while

n2 + n + 14 ≤

x2

4 < n2 + 2n + 1. Here equality holds in the interval 2n + 1 ≤x < 2

√n2 + n + 1, and fails to hold in the interval

2√

n2 + n + 1 ≤ x < 2n + 2 . (239)

Thus (236) holds at all non-negative integer points, and also in the small in-tervals shown to the right of each non-negative integer point.

ii. For negative x the situation is more complicated, since squaring of inequalitiesbetween negative numbers reverses the inequalities!Suppose that

2n + 1 ≤ x < 2n + 2 < 0 . (240)

Then⌊x

2

⌋= n and

⌊x + 1

2

⌋= n + 1. Squaring of (240) yields (n + 1)2 < x2

4 ≤

n2 + n + 14 , so equality will hold in (236) iff n2 + n < x2

4 ≤ n2 + n + 14 , i.e. iff

2n + 1 ≤ x ≤ 2n√

1 + 1n .

Finally, suppose that2n ≤ x < 2n + 1 < 1 . (241)

Then⌊x

2

⌋= n =

⌊x + 1

2

⌋, so (236) holds only at the negative even integer

point x = 2n < 0, and not in a small interval to its right.

9. (a) Explain why the function f : R → R defined by x 7→ cosx is not invertible.Include, in your explanation, reference to the well known “inverse cosine”function cos−1 x (or arccosx), and to the fact that

∀x(cos(cos−1 x

)= x) . (242)

(b) The author of your textbook defines the set of natural numbers N to consistof all non-negative integers, including 0; many other authors do not include 0

Page 220: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1192

among the natural numbers. Show that the sets N and N − 0 can be putinto one-to-one correspondence. Conclude that an infinite set S is countablein the sense of the textbook iff there exists a bijection between S and the setof positive integers.

(c) (cf. [19, Exercise 1.7.36]) Show that the union of two disjoint infinite countablesets is countable. [Hint: Alternate the members of the two sets.]

Solution:

(a) The cosine is not invertible since, in particular, it is not injective. For example,the cosine assumes the same value — 0 — at all odd integer multiples of π

2. The

so-called “inverse cosine” function is the inverse of a restriction of the cosinewith a reduced codomain. More precisely, we may choose a reduced domainin which the function is indeed injective; the usual choice is the interval 0 ≤x ≤ π, although there are infinitely many other possibilities (e.g. 27π ≤ x ≤28π). The function cos−1 x has domain −1 ≤ x ≤ x; hence the compositioncos cos−1 has the same domain, −1 ≤ 1; but we have seen [19, p. 64] that thecomposition f f−1 of a function f with its inverse must have the propertythat f f−1 = ιcodomain of f ; here the codomain of the cosine was taken to be R.

This last objection is a technical one44: it would not have arisen if we haddefined f : R→ [−1, 1]. But even then the function would fail to be invertiblebecause of the failure of the second composition property, f−1 f = ιdomain of f .Because the function f is not injective, we cannot uniquely define a destinationfor, for example, 0 under any proposed inverse mapping f−1.

(b) Define the function f : N→ N−0 by n 7→ n+1. This function is injective,since f(n1) = f(n2) ⇒ n1 + 1 = n2 + 1 ⇒ n1 = n2. It is surjective since,n ∈ N− 0 ⇒ n > 0⇒ n− 1 ∈ N⇒ f(n− 1) = n, so n is in the image off .

only if: Suppose S is infinite and countable in the sense of the textbook.Then there exists a bijection g : S → N. The composition f g : S →N− 0 is also a bijection [19, Exercise 1,6,19].

only if: Suppose that h : S → N− 0 is a bijection. Then f−1 h : S → Nis a bijection, so S is infinite countable.

(c) Suppose that sets A and B are infinite countable. By definition, this meansthat there exist bijections between the sets and the non-negative integers; wewill indicate these bijections by calling the elements of the respective sets a0,a1, ..., am, ... and b0, b1, ..., bn, ... The bijection of the union with N is givenby 2n 7→ an and 2n+ 1 7→ bn (n = 0, 1, ...). This function is well defined,

44Another way of phrasing the last objection is that f is not surjective.

Page 221: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1193

since we have separately described the image of any integer, whether it beeven or odd; it is injective since the sets of evens and odds are disjoint, andsince distinct evens m1 and m2 are mapped to distinct points am1

2and am2

2,

and similarly distinct odds...; it is surjective since every an and every bn is inthe image.

The statement is true without the restrictions to disjoint and to infinite sets.

10. [22, Exercise 2.1.5] Let Q denote the rational numbers. Of the two proposals belowshow that one defines a function from Q×Q to Q, and the other does not.(a

b,c

d

)7→ a+ c

b+ d(243)(a

b,c

d

)7→ ad+ bc

bd(244)

(where, of course, b 6= 0 and d 6= 0).

Solution: There can be two kinds of problems here:

• Since rational numbers admit infinitely many expressions as fractions, we mustverify that the proposed definitions give the same value for all representations.

• A rational number ab

is an ordered pair in which the second member — thedenominator — cannot be zero; we must check that the proposed definitiondoes not map to points that could have zero denominator.

(243) fails to define a function since it violates both of these conditions. Forexample, the fraction 1

1is the same rational number as 2

2. If we take c

d= 2

3, then

a+cb+d

will be equal to either 34

or 45, depending on whether we take (a, b) = (1, 1)

or (a, b) = (2, 2). For a violation of the second condition, consider (a, b, c, d) =(1, 1,−1,−1). We are operating on the ordered pair of rational numbers (1, 1) inQ ×Q, where we choose to represent the first 1 in the form 1

1, and the second in

the form −1−1

. The proposed image is not a rational number!

But (244) is “well defined”. First observe that, if b and d are both non-zero,then their product will surely be non-zero.45 Next, suppose that a

b= e

fand

cd

= gh, so af = be and ch = dg. Then ad+bc

bd− eh+fg

fh= fh(ad+bc)−bd(eh+fg)

bdfh=

bedh−fdgh+dgbf−bhdebdfh

= 0bdfh

= 0, so ad+bcbd

= eh+fgfh

. This shows that the definitiondoes not depend upon the particular fraction representing the rational number; i.e.that the mapping is well defined. Of course, the mapping we have given is just thedefinition of the operation of addition of rational numbers.

45This property is not universally true: there are algebraic contexts in which the product of twonon-zero objects can be zero — for example, in the multiplication of 2× 2 matrices.

Page 222: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1194

F.2 Second 1999 Problem Assignment, with Solutions

Distribution Date: Wednesday, October 27th, 1999Solutions were to be submitted by Friday, October 8th, 1999Caveat lector! There could be misprints in these solutions.

1. (a) [21, Exercise 1.9.16] Show that every integer greater than 11 is the sum of twocomposite positive integers.

(b) Show that the preceding statement is “best possible”, in the sense that 11cannot be replaced by a smaller positive integer.

Solution:

(a) Case I: n is odd. Consider the integers 9 and n − 9. Since n is odd, andgreater than 11, n − 9 is even, and greater than 2, hence n − 9 is acomposite even number (as 2 is the only even prime); 9 is the smallestcomposite odd positive integer.

Case II: n is even. Consider the integers 4 and n − 4. As observed above,4 = 2 × 2 is composite; and n − 4 is even, and certainly greater than 2,so it also is composite.

(b) We tabulate the unordered additive partitions of 11 into two positive integers:

Smaller Summand Larger SummandComposite? Composite?

1 No 10 Yes2 No 9 Yes3 No 8 Yes4 Yes 7 No5 No 6 Yes

Thus none of these partitions has two composite summands.

2. For each of the following sets, write a single congruence which will be satisfied byits members, and by no other integers; or explain why the given set is not thesolution set of any congruence. (There is a method called the “Chinese RemainderTheorem” [19, §2.5] for systematically solving some of these cases. However, youare asked to use only methods of [19, §2.3] in solving this problem. This can include[19, Theorem 7, p. 122], which can be used to justify operations on congruencesthat resemble familiar reversible operations on equations and systems of equations.Some ingenuity may be needed in some of these cases, and, as is often the case,there may be more than one valid approach to the same problem.)

Page 223: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1195

(a) the set 2Z of all even integers

(b) the set of all odd integers

(c) the set of all integers which are congruent to 3 modulo 7, and also congruentto 1 modulo 5

(d) the set of all integers which are congruent to 3 modulo 7, congruent to 1modulo 5, and also congruent to -5 modulo 3

(e) the set of all integers which are congruent to 1 modulo 5 and also congruentto 1 modulo 7

(f) the set of all positive integers which are congruent to 3 modulo 7 and alsocongruent to 1 modulo 5

(g) the set of all integers which are both congruent to 1 modulo 10 and congruentto 4 modulo 14

Solution:

(a) x ≡ 0 (mod 2) is one such congruence; if m is any integer, then x ≡ 2m(mod 2) is a solution to this problem

(b) x ≡ 1 (mod 2); more generally, any congruence x ≡ 2m + 1 (mod 2) form ∈ Z.

(c) The solutions to the congruence x ≡ 3 (mod 7) are all integers x of the formx = 7m + 3. Imposing the condition that 7m + 3 ≡ 1 (mod 5), we obtainthat 7m ≡ −2 (mod 5). Multiplying by the congruence 3 ≡ 3 (mod 5) [19,Theorem 7, p. 122] (i.e. multiplying both sides of the given congruence by thesame integer 3) we obtain the congruence

21m ≡ −6 (mod 5) . (245)

Since 5 ≡ 0 (mod 5), −20m ≡ −4m · 0 (mod 5), i.e. −20m ≡ 0 (mod 5);adding this congruence to (245) yieldsm ≡ −6 (mod 5), som is an integer ofthe form m = −6+5n; hence x is an integer of the form x = 7(−6+5n)+3 =35n− 39. This can be written as a congruence:

x ≡ −39 (mod 35) (246)

Conversely, any integer x of the form 35n− 39 has remainder 4 when dividedby 7 and 3 when divided by 5. Thus the given set consists precisely of thesolutions to (246). (By adding one of the congruences 35 ≡ 35 (mod 35) or70 ≡ 70 (mod 35) we could express (246) in forms that might be considered“prettier”, e.g. x ≡ −4 (mod 35) or x ≡ 31 (mod 35).)

Page 224: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1196

(d) We have shown in the preceding part that the solutions to the first two con-gruences are precisely the set of integers of the form x = 35n− 39. Imposingthe condition that 35n− 39 ≡ −5 (mod 3) we have 35n ≡ 34 (mod 3), towhich we may add 36n ≡ 0 (mod 3) and then 0 ≡ 33 (mod 3) to obtain−n ≡ 1 (mod 3) so n ≡ 2 (mod 3), i.e. n is of the form 3t+ 2; then x is ofthe form 35(3t+ 2)− 39 = 105t+ 31; equivalently,

x ≡ 31 (mod 105) . (247)

Conversely, any integer congruent to 31 modulo 105 satisfies the 3 statedcongruences.

(e) This problem is easier to solve. Since x− 1 is divisible by both 5 and 7, it isdivisible by their product, 35; so the congruence is x ≡ 1 (mod 35). (Thisargument is valid only because the two given moduli are relatively prime.)

(f) The solutions to any single congruence are integers which are equally spacedthroughout the line; in particular, there will be negative integers among them.Thus, as we are asked to consider only positive solutions, we know that thesecannot be represented by a congruence.

(g) These two congruences are incompatible. Any integer which is congruent to1 modulo 10 will be odd; any integer congruent to 4 modulo 14 will be even.There is no congruence whose solution is the empty set.

3. Let us generalize the “Cæsar cipher” [19, pp. 124–125] as follows: The alphabetA consists of 28 = 256 characters (for example, an extension of the ASCII code),represented by the integers from 0 to 255. An affine cipher will be a functionλa,b : A→ A defined by x 7→ ax+ b (mod 256).

For the purposes of this problem you may assume [19, Theorem 3, p. 140], whichasserts that, for any relatively prime integers a and m, there exists an inverse a of amodulo m; that is, there exists an integer a such that the product aa is congruentto 1 modulo m. While you do not have available the algorithm provided in [19,§§2.4, 2.5] to find the inverse, you could always find it by systematically testing allintegers 0, 1, ..., m− 1, since its existence is assured.

(a) Such a cipher will be useful only if it is reversible — i.e. only if any twodistinct letters are encoded in distinct ways. Show that the cipher will not bereversible (i.e. an invertible function) if a is even.

(b) Show that the cipher will be reversible if a is odd.

(c) Find the decoding function when f(x) = 7x + 13. (Hint: We are tryingto solve the congruence f(x) ≡ 7x + 13 (mod 256) for x in terms of f(x).

Page 225: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1197

If we had the inverse of 7 modulo 256 we could multiply both sides of thecongruence by it to obtain the necessary information. But we don’t have theinverse, and have been instructed not to use the algorithm to find it. It isstill possible to multiply both sides of f(x) − 13 = 7x by a suitable integern1 and then reduce modulo 256 to obtain a more amenable congruence of theform n1(f(x) − 13) ≡ mx (mod 256); any number you multiply by shouldbe relatively prime to the modulus, 256, i.e. relatively prime to 2, i.e. odd,so that the operation will be reversible. Try to find a way to transform theequation so that ultimately it yields x in terms of f(x).)

(d) Show that if two ciphers λa,b and λa′,b′ (with a and a′ both odd) act in exactlythe same way on all letters in the alphabet A, then a ≡ a′ (mod 256) andb ≡ b′ (mod 256).

Solution:

(a) Suppose that a = 2c, where c ∈ Z, so f(x) = 2cx + b. If b is odd, then theimage of the function f will contain only at most the integers 1, 3, 5, . . . , 255modulo 256; or, when b is even, the image will contain only at most 0, 2, 4,. . . , 254 modulo 256. In either case f is not surjective, hence not invertible.

(b) If a is odd it has no common factor with — i.e. is relatively prime to 28 = 236.By the quoted theorem, there must exist a multiplicative inverse amodulo 256.Multiplying f(x) = ax+ b by a yields af(x) = 1x+ab, hence x = a(f(x)− b).Thus the inverse of λa,b is λa,−ab.

(c) (Following is one possible ad hoc attack on the problem.) We could findthe multiplicative inverse of 7 by successively trying 1, 2, . . . , 183 (whichhappens to be the inverse, since 183 · 7 = 1 + 5 · 256), but this could betedious. The hint suggested another approach; actually the hint is related tothe algorithm which appears in §2.4. Let us multiply both sides of the equationf(x) − 13 = 7x by an integer that will yield, on the right side, a coefficientwhich is positive, but smaller than 7. The best value here is 37, which is

⌈2567

⌉,

and it yields 37(f(x)− 13) = 259x ≡ 3x (mod 256). Now multiply by −85,to yield −85 ·37(f(x)−13) ≡ 1x (mod 256). Thus, reducing the coefficientsmodulo 256, we obtain x ≡ −73f(x) + 181 (mod 256), or, equivalently,x ≡ 183f(x) + 181.

(d) If ax+ b ≡ a′x+ b′ then

(a− a′)x ≡ −(b− b′) (mod 256) (248)

for all values of x. In particular, with x = 0, we have b ≡ b′. Then, withx = 1, we have a− a′ ≡ 0.

Page 226: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1198

4. Prove the validity of the rule of inference we have called “Resolution” using theHypothetical Syllogism and the logical equivalence (p→ q)⇔ ((¬p)∨q) [19, Table6, p. 18]

Solution: One solution is the following:

p ∨ q hypothesis (249)

(¬p) ∨ r hypothesis (250)

q ∨ p (249), commutativity of ∨ (251)

¬¬q ∨ p (251), double negation (252)

¬q → p (252), [19, Table 6, p. 18] (253)

p→ r (250), [19, Table 6, p. 18] (254)

¬q → r (253), (254), Hypothetical Syllogism (255)

) q ∨ r (255),[19, Table 6, p. 18] (256)

5. Modify the proof by contradiction in [19, Example 18, §3.1] to show that√

7 isirrational. Then explain carefully why your modifications could not be used toprove that

√9 is irrational.

Solution:

(a)

√7 is rational hypothesis (257)

(∃m,n ∈ Z)((√

7 = mn

)(257),

∧((m,n) = 1)) definition of “rational” (258)(√7 =

a

b

)∧ ((a, b) = 1) (258), (259)

Existential specification√

7 =a

bconj. simpl. of (259) (260)

a2 = 7b2 7 times square of (260) (261)

(a, b) = 1 conj. simpl. of (259) (262)

7|a2 (261) (263)

7|a (263),[19, Theorem 2,§2.3] (264)

c :=a

7(264), definition of c (265)

b2 = 7c2 (261),(265) (266)

7|b2 (266) (267)

Page 227: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1199

7|b (267),[19, Theorem 2,§2.3] (268)

7|(a, b) (264),(268) (269)

) F (262),(269) (270)

(b) Lines (264),(268) both represent invalid conclusions if we replace 7 by a non-prime: for example, it does not follow from 9|32 that 9|3.

6. [19, Exercise 3.1.68] Use the resolution rule of inference to prove the statement“You will win the lottery or you will be promoted,” given the three hypotheses,“You will quit your job or you will win the lottery,” “You will not quit your jobor you will find a better job,”, and “You will not find a better job or you will bepromoted.” [Hint: First define some elementary propositions p, q, ...; then expressthe hypotheses in terms of them.]

Solution: We define the following elementary propositions:

p = “You will quit your job”q = “You will win the lottery”r = “You will find a better job”s = “You will be promoted.”

Then we have the following proof:

p ∨ q hypothesis (271)

¬p ∨ r hypothesis (272)

¬r ∨ s hypothesis (273)

r ∨ q resolution of (272),(271) (274)

q ∨ s resolution of (274),(273) (275)

7. [19, Exercise 3.2.54] Show that, for any positive integer n, n lines “in generalposition” (i.e. no two of them are parallel, no three of them pass through the samepoint) in the plane R2 divide the plane into exactly n2+n+2

2regions. (Hint: Use the

fact that an n+ 1st line will cut all n lines, and thereby create n+ 1 new regions.)

Solution: Let P (n) denote the given proposition that n lines divide R2 inton2 + n+ 22 regions.

Basis Step: One line divides the plane into two regions, so P (1) is true.

Page 228: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1200

Induction Step: Let n be any positive integer. Suppose P (n) is true. Let linesL1, L2, ..., Ln+1 be given. By the induction hypothesis, L1, . . . , Ln divide R2

into n2+n+22

regions. Line Ln+1 meets each of the other lines, thereby cutting

off n+1 new regions. Thus the number of regions is, in all, n2+n+22

+(n+1) =n2+3n+4

2= (n+1)2+(n+1)+2

2. We have proved P (n)→ P (n+ 1).

It follows by the (First) Principle of Mathematical Induction that P (n) is true forall positive integers n.

8. A sequence ann=0,1,2,... of real numbers is defined recursively by a0 = a1 = 1,an+2 = 3an+1 + 2an (n = 0, 1, 2, ...). Later in the course we will be studying howto determine a general formula for an, but, for the purposes of this problem, youmust not use the methods we will be developing in [19, Chapter 5]. Your are nowasked to prove, using induction, that

1

23n < an <

1

24n (276)

for n ≥ 2.

Solution: (Using methods we will meet later in the course, the exact value of an

can be shown to be

an =1

2

((1− 1√

17

)(3 +√

17

2

)n

+

(1 +

1√17

)(3−√

17

2

)n)

As(

3−√

172

)is less than 1 in magnitude, its powers approach 0 with increasing n;

thus, for large n, an can be shown to be approximately equal to

1

2

(1− 1√

17

)(3 +√

17

2

)n

=1

2(3.5615...)n .)

We shall use the Second Principle of Mathematical Induction.

Basis Steps: By the recursive definition, a2 = 3a1 + 2a0 = 3 · 1 + 2 · 1 = 5, so1232 = 9

2< 5 < 1

242 and (276) is true for n = 2. This one case will not, however,

be enough to base the induction, since we will be using the recursive definition,which requires information about two successive members of the sequence.And, unfortunately, (the left inequality of) (276) is false when n = 1. Wewill verify the case n = 3 manually: a3 = 3a2 + 2a1 = 3 · 5 + 2 · 1 = 17, and1233 = 27

2< 17 < 32 = 1

243.

Page 229: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1201

(Let us be precise about what constitutes the basis step. We are taking n = 3to be that step. In the induction step below we will prove that the truth ofcases 3, 4, ..., n implies the truth for n + 1. This is a general argument forevery case but n = 3. In that one case the general argument given is notquite correct, although the implication (Case n = 3 → Case n = 4) is stilltrue. It is true not solely because of the single case n = 3, which is the statedhypothesis, but also because we have established the case n = 2 above.)

Induction Step: Suppose that (276) is true for n ≤ N , where N ≥ 3. In partic-ular, we have the two pairs of inequalities when n = N − 1 and n=N :

1

23N−1 < aN−1 <

1

24N−1 (277)

1

23N < aN <

1

24N (278)

Adding 2 times (277) to 3 times (278) yields

1

2

(2

9+

3

3

)3N+1 < aN+1 <

1

2

(2

16+

3

4

)4N+1 (279)

Hence

1

23N+1 <

1

2

(2

9+

3

3

)3N+1 < aN+1 <

1

2

(2

16+

3

4

)4N+1 <

1

24N+1 (280)

which is the instance n = N + 1 of (276).

9. Suppose R and S are relations on a set A. Prove or disprove each of the followingstatements:

(a) [19, Exercise 6.1.28(b)] If R and S are both reflexive, then R ∩ S is reflexive.

(b) [19, Exercise 6.1.28(e)] If R and S are both reflexive, then S R is reflexive.

(c) If R and S are both irreflexive, then R ∩ S is irreflexive. (A relation R isirreflexive if ∀a ∈ A((a, a) /∈ R).)

(d) If R and S are both antisymmetric, then R S is symmetric.

(e) If R and S are both transitive, then R S is transitive.

(f) If R is both symmetric and antisymmetric, then R is transitive.

Solution:

Page 230: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1202

(a)

R is reflexive hypothesis (281)

S is reflexive hypothesis (282)

a ∈ A hypothesis (283)

(a, a) ∈ R (281), (283) (284)

(a, a) ∈ S (282), (283) (285)

(a, a) ∈ R ∩ S (284), (285) (286)

) ∀x(x, x) ∈ R ∩ S (283), (285),existential generalization (287)

(b)

R is reflexive hypothesis (288)

S is reflexive hypothesis (289)

a ∈ A hypothesis (290)

(a, a) ∈ R (288), (290) (291)

(a, a) ∈ S (289), (291) (292)

(a, a) ∈ S ∩R (291), (292) (293)

) ∀x(x, x) ∈ R ∩ S (290), (293), existential generalization (294)

(c) We give a proof by contradiction. Suppose that for some a ∈ A, (a, a) ∈ R∩S.Then, by definition of ∩, (a, a) ∈ R and (a, a) ∈ S are both true. Both ofthese memberships contradict hypotheses of irreflexivity. From this contra-diction we conclude that ¬∃a((a, a) ∈ R ∩ S), which is logically equivalent to∀a((a, a) /∈ R ∩ S), which is the definition of irreflexivity for R ∩ S. (Notethat the hypotheses of the problem are stronger than needed: it would havesufficed to assume that some one of R and S is irreflexive, without hypothesesabout the other relation.)

(d) This claim is false. For one counterexample take A = a, b, R = (a, b),S = (a, a). Then R S = (a, b) = R, which is not symmetric.

(e) Let a = a, b, c, d, e, R = (d, b), (e, c), S = (a, d), (b, e). Then both Rand S are (vacuously) transitive. But RS = (a, b), (b, c), but (b, c) /∈ RS.Thus R S is not transitive. (This seems unnecessarily complicated. Is therea simpler counterexample?)

(f) Since R is symmetric, (a, b) ∈ R ⇒ (b, a) ∈ R. Since R is antisymmetric,(a, b) ∈ R ∧ (b, a) ∈ R ⇒ a = b. Hence (a, b) ∈ R ⇒ a = b. That is, the onlyelements of the relation R are contained in the “diagonal”, (a, a)|a ∈ A.

Page 231: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1203

The only pairs of elements of R of the form (a, b) and (b, c) will therefore be ofthe form (a, a) and (a, a); and transitivity would only require that (a, a) ∈ R.Thus the statement is TRUE.

F.3 Third 1999 Problem Assignment, with Solutions

Distribution Date: Wednesday, November 3rd, 1999Solutions were to be submitted on Friday, October 22nd, 1999

Caveat lector! There could be misprints and other errors in these draft solutions.(An updated version may be posted on the Web.)

1. (cf. [19, Exercise 4.1.18]) How many positive integers less than 1000

(a) are divisible by 7?

(b) are divisible by 7 but not by 11?

(c) are divisible by both 7 and 11?

(d) are divisible by exactly one of 7 and 11?

(e) are divisible by neither 7 nor 11?

(f) are divisible by either 7 or 11 (inclusive “or”)?

(g) have distinct digits?

(h) have distinct digits, and are even?

(i) are divisible by 12 but not by 14?

Hints:

• The numbers divisible by a non-zero integer m are equally spaced — m unitsapart — along the real line, starting at 0. This is a special case of [19, Theorem2.3.6], which implies that the solutions to the linear congruence

x ≡ b (mod m)

are all integers of the form x = b+ km, where k ranges over all of Z .

• Show all your work. It is difficult for the grader to determine your errors —the identification of which is the purpose of this exercise — if (s)he cannotsee precisely where your reasoning is defective. Getting the right answers isnot the main purpose of this exercise.

• If you have difficulty with this problem, try to first solve a simpler problem.For example, you might wish to consider integers between 1 and 23 in the scaleof 2, or integers between 1 and 33 in the scale of 3; in these cases you couldactually list all the integers, to determine whether your counts are correct.

Page 232: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1204

Solution:

(a) The number of positive integers in the interval 1 ≤ n < 1000 which are

divisible by 7 is precisely

⌊999

7

⌋= 142. The 143rd multiple would be 1001,

which is outside of the given interval; the floor function counts the number ofconsecutive subintervals of length 7, excluding intervals which are incomplete(like the interval from 994 to 999).

(b)

⌊999

7

⌋−⌊

999

77

⌋= 142− 12 = 130. Divisibility by both 7 and 11 is equivalent

to divisibility by the product, by virtue of the fact that 7 and 11 are relativelyprime.

(c)

⌊999

77

⌋= 12.

(d) If we add the numbers of multiples respectively of 7 and of 11 we will havecounted the integers divisible by both 7 and 11 twice. Hence the number ofintegers in the given interval which are divisible by exactly one of 7 and 11

is

⌊999

7

⌋+

⌊999

11

⌋− 2

⌊999

77

⌋= 142 + 90 − 24 = 208. (Although students

were expected to solve this problem “from first principles”, it can be seen as asimple application of a generalization of the Principle of Inclusion-Exclusion[19, §5.5]. )

(e) This will be the complement in 999 of the number of integers divisible by either7 and 11 which is determined in part 1f q.v.46; thus it is 999− 220 = 779.

(f) If we add the numbers of multiples respectively of 7 and of 11 we will havecounted the integers divisible by both 7 and 11 twice. Hence the number ofintegers in the given interval which are divisible by either or both of 7 and

11 is

⌊999

7

⌋+

⌊999

11

⌋−⌊

999

77

⌋= 142 + 90 − 12 = 220. (This is a simple

application of the Principle of Inclusion-Exclusion [19, §5.5]. )

(g) We can apply the Product Rule: Choose the units digit in 10 ways; choosethe tens digit in 9 ways, since no repetitions are permitted;... the hundredsin 8 ways. Thus the number of integers between 000 and 999 with distinctdigits is 10× 9× 8 = 720. The integer 000 has not been counted, as its digitsare not distinct. So the number of integers in the given interval with distinctdigits in a 3-digit decimal representation is 720. This is not the solution theauthor expected, as there are problems with the “leading zeros”. Specifically,

46Latin quod vide = which see

Page 233: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1205

we have not included any of the integers between 1 and 9, although they haveno repeated digits when written without leading zeros; and, between 10 and99, we have excluded all strings of the form 0x0, where x is one of 1, 2, ..., 9.Thus the answer expected is 720+9+9=738.

This problem indicates a frequent difficulty in combinatorial problems: thewording of the problem was slightly ambiguous. It seemed reasonable to treatthe problem as one of counting 3-digit strings, but, as seen above, this led toan unexpected answer.

Another approach to the expected solution would be to apply the Sum Rulefirst, by dividing the interval up into 1 ≤ n ≤ 9, 10 ≤ n ≤ 99, 100 ≤ n ≤ 999.Within each of these 3 intervals the Product Rule can be applied, yielding, forthe 3 intervals, 9, (9×9), (9×9×8), whose sum is 738. (In the product 9×9,the tens digit is chosen in 9 ways — from 1, 2, 3, 4, 5, 6, 7, 8, 9, and then theunits digit is chosen from the set 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 but must not be thesame as the tens digit; a similar rationale explains the product 9× 9× 8.)

(h) We will first try to generalize the second method used above. The number of1-digit integers will be 4 = |2, 4, 6, 8|. The 2-digit integers with an even tensdigit will be 4× 4 in number; while those with an odd tens digit will be 5× 5in number, for a total of 16 + 25 = 41. (A simpler way of determining thiswould have been to count the even integers between 10 and 98 — there are⌊

98

2

⌋−⌊

8

2

⌋= 49 − 4 = 45 — and then subtract the number with repeated

digits, i.e. |22, 44, 66, 88|.)But the counting of the even solutions between 100 and 999 is more compli-cated. One solution is to think of adding a digit to the left of one of 02, 04,06, 08 or of one of the 41 2-digit solutions. In most cases there are 7 possiblechoices for the hundreds digit. The exceptions are the 2-digit strings alreadycounted in which there is a zero present, i.e. 10, 20, 30, ..., 90, and 02, 04, 06,08; in any of which cases there are 8 possible choices for the hundreds digit.This yields (7× (41− 9)) + (8× (4 + 9)) = 328 integers.

In all we have 4 + 41 + 328 = 373.

Another approach would be to subtract from 738 the number of integers whichare odd. There are 5 1-digit such integers: 1, 3, 5, 7, 9. Among the 2-digitodd integers we choose the units digit first, in 5 ways, then the tens digit in8 ways to avoid repeated digits, giving 40 integers. Among the 3-digit oddintegers, we choose the units digit in 5 ways, the hundreds digit in 8 ways,and then the tens digit in 8 ways — since 0 is permitted only there, giving5× 8× 8 = 320. In all we have 738− (5 + 40 + 320) = 373 integers.

(i) This problem is slightly different from that of part 1b in that the two given

Page 234: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1206

integers are not relatively prime. The integers in the interval which are divis-ible by both 12 and 14 are not only those divisible by the product 12× 14; asdivisibility by 12 is equivalent to divisibility by 4 and by 3, and divisibility by14 is equivalent to divisibility by 2 and 7 (why?), divisibility by both 12 and14 is equivalent to the conjunction of these four conditions, i.e.

(4|n) ∧ (3|n) ∧ (2|n) ∧ (7|n) .

As (4|n)⇒ (2|n), (4|n)∧(3|n)∧(2|n)∧(7|n)⇒ (4|n)∧(3|n)∧(7|n). In this lastconjunction the three divisors are, indeed, relatively prime; divisibility by eachof 4, 3, 7 is equivalent to divisibility by their product, 84. Hence the number

of integers satisfying the conditions of this problem is

⌊999

12

⌋−⌊

999

84

⌋=

83− 11 = 72.

2. [19, Exercise 4.1.28] How many strings of eight English letters are there

(a) if any letters can be repeated?

(b) if no letters can be repeated?

(c) that start with the letter X, if letters can be repeated?

(d) that start with the letter X, if no letters can be repeated?

(e) that start and end with the letter X, if letters can be repeated?

(f) that start with the letters BO (in that order), if letters can be repeated?

(g) that start and end with the letters BO (in that order), if letters can be re-peated?

(h) that start or 47 end with the letters BO (in that order), if letters can berepeated?

Where the answers are very large, you need not reduce products or sums.

Solution:

(a) By the Product Rule there are 268 such words.

(b) Choose the first member of the string in 26 ways, the second in 25, ..., the 8thin 26-8+1=19 ways. The total number of words is the product, 26×25× ...×20× 19 =

26!

18!. This is what your textbook calls P (16, 8) = 62 999 928 000.

(c) Choose the 1st letter in 1 way, and each of the others in 26 ways; in all thereare 1× 267 = 8 031 810 176 words.

47inclusive or

Page 235: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1207

(d) The first letter is chosen in 1 way, and the others successively in 25, 24, ..., 19

ways, for a total number of25!

18!= 2 422 728 000 words.

(e) The beginning 2-letter string is chosen in 1 way, following which the other 6 let-ters are chosen each in 26 ways independently, for a total of 266 = 308 915 776words.

(f) Choose the beginning and end letters each in 1 way, and the intermediate 6letters in 266 = 308 915 776 ways.

(g) Choose the beginning 2-letter string and the final 2-letter string each in 1 way,and the intermediate 4 letters in 264 = 456 976 ways.

(h) The numbers of words that end with BO is equal to the number that startwith BO, computed above to be 266. Summing these, we must subtract thenumber of words that both start and end with BO, as they are counted twicein the sum: we obtain 2 (266)− 264 = 617 374 576.

3. [19, Exercise 4.2.4] A bowl contains 10 indistinguishable red balls and 10 indistin-guishable blue balls. A woman selects balls at random without looking at them.

(a) Carefully explaining your reasoning, determine how many balls she must selectto be sure of having at least three balls of the same colour?

(b) Carefully explaining your reasoning, determine how many balls she must selectto be sure of having at least three blue balls?

Solution:

(a) If she selects only 4 balls, it can happen that there are 2 reds and 2 blues; thusthe number selected must be at least 4 + 1 = 5. And, indeed, in a selection

of 5 balls, the majority colour will contain at least

⌈5

2

⌉= 3 balls.

(b) It could happen that all of the first 10 balls selected are red. More precisely,we see from the possible selection of 10 red balls and 2 blue balls, that theminimum she needs to select cannot be less than 12 + 1 = 13. And, indeed,if she selects 13 balls, even if all 10 red balls are among them, there will stillbe at least 3 blue balls.

4. [19, Exercise 4.3.60] In how many ways can a horse race with four horses finishif ties are possible.? (Note that, since ties are allowed, any numbers of the fourhorses may tie. This includes the possibility, for example, that two horses tie forfirst place, and the other two horses tie for second place.)

Page 236: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1208

Solution: As with many combinatorial problems, there is more than one way tointerpret the constraints, because of possible ambiguities in the wording.

(a) One interpretation would have the horses being indistinguishable: as thoughone was interested in counting only the possible configurations at the finish,not how 4 specific horses fared in the race. What we are counting here areordered additive partitions of 4 , i.e. decompositions of 4 into a sum of positiveintegers, where the order of the summands is relevant, as 4 = n1 +n2 +n3 + ...We can think of n1 as denoting the number of horses coming first, n2 as thenumber coming second, etc. These ordered partitions can be represented bybinary strings — i.e. words in the alphabet 0, 1 — in which there are 40’s (representing the 4 horses), and there are 1’s to act as separators of theparts. As the parts must contain positive numbers of horses, the 1’s maynot be adjacent. Moreover, the parts are never zero, so the first digit in thestring is a 0, and so is the last. An easy way to visualize this problem is thatthere is a sequence of 4 0’s, and we are to place 1’s into some or all of the 3spaces between successive 0’s — never more than one 1 in each place. But thisamounts to selecting a subset of the 3 possible locations between successive0’s: the number of subsets of a set of 3 objects is 23 = 8, and this must bethe number of ways in which the race can be finished.

(b) Another possible interpetation — the interpretation that the author of thetextbook intended — would have the 4 horses distinguishable: we are inter-ested in the outcome of a specific race with 4 named horses. Here we canfirst consider the same ordered partitions considered above. But now we haveto associate multiplicities with the various partitions, so it is not enough tocount them; for example, the partition 4 = 2 + 1 + 1, in which 2 horses tiefor 1st place, 1 comes second and the other comes in alone, is associated with(42

)(21

)(11

)= 12 outcomes of the race. But the multiplicities of the various

partitions is not always the same — for example, the 4-horse-tie can occur inonly 1 way (i.e.

(44

)ways); so we can’t solve this version of the problem by

multiplying the answer in the previous case by, for example, 4!.

We will list the ordered partitions, and compute the number of outcomes ineach case. We have chosen to order the cases by number of parts, and, withinthat classification, “lexicographically”.

4 = 4: As mentioned above, this case occurs in(44

)= 1 way.

4 = 1 + 3: Select the horse to come first in(41

)= 4 ways.

4 = 2 + 2: Select the two horses to come first in(42

)= 6 ways.

4 = 3 + 1: Select the three horses to come first in(43

)= 4 ways.

Page 237: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1209

4 = 1 + 1 + 2: Select the horse to come first in(41

)= 4 ways, then the horse to

come second in(4−11

)= 3 ways, then the horses to come last in

(4−22

)= 1

way. In all the number of choices is 4× 3 = 12.

4 = 1 + 2 + 1, 4 = 2 + 1 + 1: These cases will each yield the same count asthe preceding, i.e. 12 each.

4 = 1 + 1 + 1 + 1: Here we are counting the number of permutations of the 4horses, so the number is 4!.

Summing the above we have 1+(4+6+4)+(12+12+12)+24 = 75 differentoutcomes of the race.

This last case seems very complicated. In fact, it can be systematized. Whatwe are counting could be interpreted as the numbers of surjective functionsfrom a set of 4 elements (the horses) to sets of 1, 2, 3, or 4 elements. Thesenumbers are related to the so-called Stirling numbers of the second kind , whichcount such functions up to the labelling of the points in the codomain. If youapply the formula in [19, Theorem 5.6.1] for m = 4 and n = 1, 2, 3, 4, you cansee that the sum will be 1 + 14 + 36 + 24 = 75 again.

5. In how many ways can 27 different books be distributed to A, B, C so that A andC together may receive exactly twice as many as B?

Solution: [24, Problem #117] If we denote the numbers of books received by A,B,Crespectively by a, b, c, then we have

a+ c = 2b

a+ b+ c = 27

so a + c = 18, b = 9. The number of ways of selecting the books for B is

(27

9

);

the remaining 18 books may be partitioned between A and C in exactly 218 ways.

So the total number of distributions is, by the Product Rule,

(27

9

)218.

6. A pastry shop has twenty different kinds of pastry. The clerk is asked to pack a boxof six pastries, never including the same kind of pastry more than twice. In howmany ways can the box be packed (where the order of selection is not relevant)?

Solution: [24, Problem #207] Consider the possible unordered partitions of 6 whichrepresent the distributions of pastries selected. For each of these partitions we willdetermine the number of realizations with the 20 available types of pastries.

6 = 1 + 1 + 1 + 1 + 1 + 1: Select the pastries in(206

)= 232 560 ways.

Page 238: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1210

6 = 2 + 1 + 1 + 1 + 1: Select the pastry having multiplicity 2 in(201

)= 20 ways,

and the other 5 in(194

)= 77 520 ways.

6 = 2 + 2 + 1 + 1: Select the pastries having multiplicity 2 in(202

)= 190 ways, and

the other 2 in(182

)= 171 ways, for a total of 190× 171 = 32 490 selections.

6 = 3 + 1 + 1 + 1: This partition is impossible, as one part exceeds 2.

6 = 4 + 1 + 1, 6 = 3 + 2 + 1: These partitions are also impossible, as a part ex-ceeds 2.

6 = 2 + 2 + 2: Select the three types of pastries in(203

)= 1140 ways.

Partitions into one or two parts: In either of these cases one part will exceed,so these cases are impossible.

Summing, we obtain 38 760 + 77 520 + 29 070 + 1 140 = 146 490 selections.

This problem can be solved using (ordinary) generating functions. The enumeratorfor each of the types of pastries is 1 + t+ t2.

coefficient of t6 in (1 + t+ t2)20

= coefficient of t6 in (1− t3)20(1− t)−20

= coefficient of t6 in (1− 20t3 + 190t6) (1− t)−20

= coefficient of t6 in(1− 20t3 + 190t6

) ∞∑n=0

(19 + n

n

)tn

= coefficient of t6 in(1− 20t3 + 190t6

)·(

1 +

(22

3

)t3 +

(25

6

)t6)

= 1 ·(

25

6

)− 20 ·

(22

3

)+ 190 ·

(19

0

)= 177 100− 30 800 + 190 = 146 490

7. Determine the number of 4-letter words that can be made out of the letters ofthe words MCGILL COLLEGE, where no letter may be used more often than itappears in this population (for example, no more than 2 G’s may be used).

Solution: This population contains 4 L’s; 2 of each of C, G, E; and 1 of each of M,I, O.

(a) Solution by cases: We divide the words up according to the multiplicitiesof the letters chosen. We are looking at unordered partitions.

4=4: Choose the letters in(11

)= 1 way. There is only one such word, LLLL.

4=3+1: Choose the letter of multiplicity 3 from the set L in 1 way, andthe other letter in

(7−11

)= 6 ways. The chosen letters may be ordered in

4!3!1!

= 4 ways. There are 1× 6× 4 = 24 such words.

Page 239: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1211

4=2+2: Choose the letters from the set C,G,E,L in(42

)= 6 ways, and

order them in 4!2!2!

= 6 ways. There are 6× 6 = 36 such words.

4=2+1+1: Choose the letter which is to have multiplicity 2 in(41

)= 4 ways,

and the other two letters in(7−12

)= 15 ways; order the letters in 4!

2!1!1!= 12

ways. There are 4× 15× 12 = 720 such words.

4=1+1+1+1: Choose the letters in(74

)= 35 ways, and order them in 4! =

24 ways, for a total of 840 words of this type.

Summing, we find that there are 1 + 24 + 36 + 720 + 840 = 1621 words.

(b) Solution using exponential generating functions: The enumerator forL is 1+ t+ t2

2!+ t3

3!+ t4

4!; each of C, G, E has enumerator 1+ t+ t2

2!, and each of

M, I, O has enumerator 1 + t. The number of words is 4! times the coefficientof t4 in the expansion of the product, i.e. in the expansion of(

1 + t+t2

2!+t3

3!+t4

4!

)(1 + t+

t2

2!

)3

(1 + t)3

=

(1 + t+

t2

2+t3

6+t4

24

)·(

1 + 3t+9

2t2 + 4t3 +

9

4t4 + ...

)·(1 + 3t+ 3t2 + t3

)=

(1 + t+

t2

2+t3

6+t4

24

)·(

1 + 6t+33

2t2 +

55

2t3 +

123

4t4 + ...

)= ...+

1621

24t4 + ...

So the number of words is 24× 1621 = 1621.

F.4 Fourth 1999 Problem Assignment, with Solutions

Distribution Date: Friday, November 5th, 1999Solutions were to be submitted on Friday, November 5th, 1999

Caveat lector! There could be misprints and other errors in these draft solutions.(An updated version may be posted on the Web.)

In grading this assignment, the grader assigned grades as follows: Problem 2: 8;Problem 4: 10; Problem 5(c),5(d) 8 together; Problem 7: 12; Problem 8: 12. The other

problems were not graded.

Page 240: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1212

1. (cf. [19, Exercise 5.1.38]) Show by induction48 that the Fibonacci numbers, definedrecursively by

f0 = 0 (295)

f1 = 1 (296)

fn+2 = fn + fn+1 (n ≥ 0) (297)

also satisfy the recurrence

Pn : fn+4 = 3fn+2 − fn , (298)

and use this recurrence — without solving it explicitly — to prove that

fn ≡

0 (mod 3) if n ≡ 0 (mod 4)1 (mod 3) if n ≡ 1, 2, 7 (mod 8)2 (mod 3) if n ≡ 3, 5, 6 (mod 8)

(299)

for n ≥ 0.

Solution:

(a) Induction Proof of (298):

Basis Step: From the given initial conditions we determine that f2 = f1 +f0 = 1 + 0 = 1, f3 = f2 + f1 = 1 + 1 = 2, f4 = f3 + f2 = 2 + 1 = 3,f5 = f4 + f3 = 3 + 2 = 5. Hence f4 − 3f2 + f0 = 3 − 3 + 0 = 0, andf5 − 3f3 + f1 = 5 − 6 + 1 = 0, so (298) is satisfied for n = 0 and n = 1.The n = 0 case is the basis step; the n = 1 case will be needed in theInduction Step.

Induction Step: Let N ≥ 2, and suppose that (298) is true for all n suchthat 0 ≤ n < N ; it is actually sufficient to assume that

f(N−2)+4 = 3f(N−2)+2 − fN−2 (300)

f(N−1)+4 = 3f(N−1)+2 − fN−1 . (301)

Then summing these equations yields (298) for n = N , by virtue of (297)when N ≥ 2.In order to complete the induction step we must show that the truth of(298) for 0 ≤ n < 1 implies its truth for n = 1, more precisely, thatP0 → P1 is true. It is here that we apply our earlier establishment of P1.

Equation (298) yields a congruence modulo 3: fn+4 ≡ −fn (mod 3).

48Do not solve the recurrence (297) explicitly.

UPDATED TO September 19, 2000

Page 241: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1213

(b) Induction Proof of (299): First observe that, by two applications of (298),

fn+8 ≡ −fn+4 ≡ fn (mod 3) (302)

Our proof will be by induction on⌊

n8

⌋.

Basis Step: Earlier we computed fn for n ≤ 5. Continuing this computation,we observe that f6 = f5 + f4 = 5 + 3 = 8 ≡ 2 (mod 3), f7 = f6 + f5 =8 + 5 = 13 ≡ 1 (mod 3). From these and the earlier data we can verifythat (299) is true for 0 ≤ n ≤ 7. This is the case

⌊n8

⌋= 0.

Induction Step: Suppose that we have proved (299) for non-negative n suchthat

⌊n8

⌋= t, where t ≥ 0. Suppose now that

⌊n8

⌋= t + 1. Then⌊

n−88

⌋= t, and the induction hypothesis is that fn−8 has the desired

remainder modulo 3. But, by (302), fn ≡ fn−8 (mod 3), so (299) alsoholds for n. What we have proved is that the truth of the congruencesfor n = 8t + s, where 0 ≤ s ≤ 7 implies its truth for n = 8(t + 1) + s,(0 ≤ s ≤ 7).

It follows by the (First) Principle of Induction that the congruences hold forall non-negative n.

2. [19, Exercise 5.2.18] Solve the recurrence relation

an = 6an−1 − 12an−2 + 8an−3 (303)

with a0 = −5 (304)

a1 = 4 (305)

a2 = 88 (306)

Solution: The characteristic polynomial of (303) is r3 − 6r2 + 12r − 8, which canbe seen by trial to have a root r = 2.49 Dividing by r − 2 yields the factorizationr3 − 6r2 + 12r − 8 = (r − 2) (r2 − 4r + 4); the quadratic factor may be furtherfactorized as (r− 2)2, so that the characteristic polynomial factorizes as r3− 6r2 +12r − 8 = (r − 2)3. It follows that the “general” solution of (303) is

an =(αn2 + βn+ γ

)2n , (307)

where α, β, γ are constants to be determined. Imposing the three initial conditionsyields the system of equations

γ = −5

2α+ 2β + 2γ = 4

16α+ 8β + 4γ = 8849A “monic” polynomial will have, as integer roots, only divisors of its constant term: in this case the

only possible integer roots would be ±1, ±2, ±4, ±8; of course, there is no reason that the roots needto be integers — for example, the roots are not even rational in the case of the Fibonacci numbers!

Page 242: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1214

from which we conclude that α = 132, β = 1

2, γ = −5, and that the “particular”

solution of the given recurrence which satsfies the initial conditions is

an =(13n2 + n− 10

)2n−1 (n ≥ 0) .

3. (cf. [19, Exercise 5.2.26]) What is the general form of the particular solution of thelinear nonhomogeneous recurrence relation an = 6an−1 − 12an−2 + 8an−3 + F (n) if

(a) F (n) = n2?

(b) F (n) = 2n?

(c) F (n) = n2n?

(d) F (n) = (−2)n?

(e) F (n) = n22n?

(f) F (n) = n3(−2)n?

(g) F (n) = 3?

(h) F (n) = (4n2 − 2n+ 5)2n?

Solution: We have seen in Problem 2 above that the roots of the characteristicpolynomial are 2, 2, 2 — i.e. 2 with multiplicity 3. In all of these cases except thelast F (n) has the form nkan, where k is a non-negative integer, and a is a constant.By [19, Theorem 5.2.6] the particular form we seek will, in all of these cases, be theproduct of a polynomial and an. The polynomial factor is to have degree at leastk; this degree must be increased by 3 when a = 2; more precisely, the polynomialshould be multiplied by n3 when a = 2.

(a) When F (n) = n2 · 1n, a particular solution will be of the form (αn2 + βn1 +γ) · 1n, i.e. a polynomial of degree 2.

(b) When F (n) = 2n, a particular solution will be of the form αn3 · 2n.

(c) When F (n) = n · 2n, a particular solution will be of the form n3(αn+ β) · 2n,i.e. (αn4 + βn3)2n.

(d) When F (n) = (−2)n, a particular solution will be of the form α · (−2)n.

(e) When F (n) = n22n, a particular solution will be of the form n3(αn2 + βn1 +γ) · 2n.

(f) When F (n) = n3(−2)n, a particular solution will be of the form (αn3 +βn2 +γn+ δ) · (−2)n.

(g) When F (n) = 3 · 1n, a particular solution will be of the form α1n, i.e. aconstant.

Page 243: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1215

(h) When F (n) = (4n2−2n+5)2n, the form will be the same as in case 3e above;the presence of the lower degree terms does not introduce any additionalcomplication; nor does their absence in case 3e introduce any simplification.

4. (cf. [19, Exercise 5.2.18]) Solve the recurrence relation

an = 6an−1 − 12an−2 + 8an−3 + (n2 − 3) (308)

subject to (309)

a0 = −5 (310)

a1 = 4 (311)

a2 = 88 (312)

Solution: We first look for a particular solution of the form an = (αn2+βn+γ) ·1n,substituting this general expression into (308) to obtain, after regrouping by powersof n: αn2 + βn+ γ = (2α+ 1)n2 + (−12α+ 2β)n+ (30α− 6β + 2γ − 3); equatingcoefficients of corresponding powers of n yields

α = −1

−12α+ β = 0

30α− 6β + γ = 3

which we solve to obtain (α, β, γ) = (−1,−12,−39). Thus one particular solutionis a(p) = −n2 − 12n− 39. The general solution of (308) is therefore obtained fromthe general solution of the related homogeneous recurrence relation by adding thisparticular solution; i.e. it is

an =(αn2 + βn+ γ

)2n − (n2 + 12n+ 39) . (313)

It is on this function that we impose initial conditions (310), (311), (312), obtainingthe equations

(02α+ 0β + γ)− 39 = −5

(α+ β + γ)2− (1 + 12 + 39) = 4

(4α+ 2β + γ)4− (4 + 24 + 39) = 88

We obtain

(α, β, γ) =

(67

8,−115

8, 34

)so the particular solution that satisfies the initial conditions is

an =

(67

8n2 − 115

8n+ 34

)2n − (n2 + 12n+ 39) .

Page 244: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1216

5. [19, Exercise 5.4.6] Find a “closed form” for the generating function a(x) for thesequence an, where

(a) an = −1 for all n = 0, 1, 2, ...

(b) an = 2n for n = 1, 2, 3, 4, ..., and a0 = 0

(c) an = n− 1 for n = 0, 1, 2, ...

(d) an =1

(n+ 1)!for n = 0, 1, 2, ...

(e) an =

(n

2

)for n = 0, 1, 2, ...

(f) an =

(10

n+ 1

)for n = 0, 1, 2, ...

You may appeal to [19, Table 5.4.1, p. 343] if you wish, but it would be preferableif you knew from Calculus III how the series in the table are developed.

Solution:

(a) a(x) =∞∑

k=0

(−1)xk = − 1

1− x. (The last equation is, technically, valid only for

|x| < 1, if the generating function is interpreted as a real-valued function of areal variable. A “better” point of view for generating functions is to considerthem as “purely algebraic” objects, but this requires more sophistication thanwe can adopt at this time; it may be discussed in 189-340B. In the sequelwe will usually not concern ourselves with the intervals where equations likethe one above are valid, and will normally not even state the interval ofconvergence.)

(b) a(x) = 0x0 +∞∑

k=1

2kxk =∞∑

k=1

(2x)k =2x

1− 2x.

(c)

a(x) =∞∑

k=0

(k − 1)xk

=∞∑

k=0

(k + 1− 2)xk =∞∑

k=0

(k + 1)xk − 2∞∑

k=0

xk

=∞∑

k=0

d

dx

(xk+1

)− 2

1

1− x

Page 245: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1217

=d

dx

(∞∑

k=0

xk+1

)− 2

1− x

=d

dx

(∞∑

j=1

xj

)− 2

1− x

=d

dx

(1

1− x− 1

)− 2

1− x

=1

(1− x)2− 2

1− x

=2x− 1

(1− x)2

(In this development we are appealing to the theorem that the derivative ofa power series within its interval of convergence is the sum of the derivativesof the respective terms.)

(d)

a(x) =∞∑

k=0

1

(k + 1)!xk =

1

x

(∞∑

k=0

1

(k + 1)!xk+1

)

=1

x

(∞∑

j=1

1

j!xj

)

=1

x

(∞∑

j=0

1

j!xj − 1

)=ex − 1

x.

(While this last mentioned function is the intended solution, strictly speakingthe function is not defined at 0. However, it has what is called a “removablesingularity” there; if the value is defined to be the lim

x→0

ex−1x

, the extended

function can be shown to be “well behaved”. As for the limit, it is clear thatlimx→0

ex−1x

= limx→0

ex−e0

x−0= d

dxex evaluated at x = 0, i.e. e0, which is 1.)

(e)

a(x) =∞∑

k=0

(k

2

)xk = 0x0 + 0x1 +

∞∑k=2

(k

2

)xk =

∞∑j=0

(j + 2

2

)xj+2

= x2

∞∑j=0

(j + 2

2

)xj = x2 · 1

(1− x)3=

x2

(1− x)3.

Page 246: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1218

(f) Note that the generating function in this case will be a polynomial, sincean = 0 for all but a finite number of n. As a polynomial can be considered “inclosed form”, one response to this question would be to say that the function

a(x) =∞∑

k=0

(k

2

)xk is already in closed form. However, we can express it in a

more suggestive way, as follows:

a(x) =∞∑

k=0

(10

k + 1

)xk =

1

x

∞∑k=0

(10

k + 1

)xk+1

=1

x

∞∑j=1

(10

j

)xj

=1

x

(∞∑

j=0

(10

j

)xj − 1

)=

1

x

((1 + x)10 − 1

).

(This problem is like problem 5d above, in that the “closed form” we havegiven has a removable singularity at x = 0. Here again the limiting value asx→ 0 is a derivative, the value of

∣∣ ddx

((1 + x)10)∣∣x=0

, i.e. 10.)

6. [19, Exercise 5.4.18] Use generating functions to find the number of ways to select14 balls from a jar containing 100 red balls, 100 blue balls, and 100 green balls, sothat no fewer than 3 and no more than 10 blue balls are selected. Assume that theorder in which the balls are drawn does not matter.

Solution: (We are using t as the indeterminate of the generating function.) The

enumerator for the red balls is 1+ t+ t2 + ...+ t100 =1− t101

1− t; the same enumerator

applies to the green balls; but the enumerator for the blue balls is t3 + t4 + t5 + ...+

t10 =t3 − t11

1− t. The generating function for selecting balls with these constraints is

therefore

(1− t101

1− t

)2

· t3 − t11

1− t=

(1− 2t101 + t202)(t3 − t11)(1− t)3

. We therefore require

the coefficient of t14 in the expansion of (t3 − t11)(1− t)−3, i.e. in the expansion of

(t3 − t11)∞∑

k=0

(k + 2

2

)tk, which is

(11+2

2

)−(3+22

)= 78− 10 = 68.

7. [19, Exercise 5.4.38] Use generating functions to solve the recurrence relation ak =2ak−1 + 3ak−2 + 4k + 6 (k ≥ 2) with initial conditions a0 = 20, a1 = 60.

Solution: If we multiply both sides of the recurrence by xk, and sum over the range2 ≤ k <∞, we obtain the following equation for the ordinary generating function

Page 247: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1219

a(x) =∞∑

k=0

akxk:

a(x)− a0 − a1x = 2x(a(x)− a0) + 3x2a(x) +∞∑

k=2

4kxk + 6∞∑

k=2

xk

= 2x(a(x)− a0) + 3x2a(x) +16x2

1− 4x+

6x2

1− xfrom which it follows that

(1− 2x− 3x2)a(x) = a0 + (a1 − 2a0)x+16x2

1− 4x+

6x2

1− x

Multiplying both sides by (1− 2x− 3x2)−1 yields

a(x) =20(1 + x) + 16x2

1−4x+ 6x2

1−x

(1− 3x)(1 + x)

=20

1− 3x+

16x2

(1− 4x)(1− 3x)(1 + x)+

6x2

(1− 3x)(1 + x)(1− x)

To determine the coefficients ak we will need to find the expansions of the last twosummands in partial fractions. These compuations are not difficult, because eachof the 1st degree factors in the denominators appears with multiplicity 1. Thesecond summand requires that we determine constants A, B, C such that

16x2

(1− 4x)(1− 3x)(1 + x)=

A

1− 4x+

B

1− 3x+

C

1 + x.

Multiplying both sides by the product (1− 4x)(1− 3x)(1 + x) yields the equation

16x2 = A(1− 3x)(1 + x) +B(1− 4x)(1 + x) + C(1− 4x)(1− 3x) .

While the usual method of determining these constants would be to set up equationsbetween the coefficients of powers of x, we can apply a more efficient method here.Simply assign “convenient” values to x, in order to obtain equations satisfied bythe constants. This technique is always applicable, as the equation is an identityin x. Here it is convenient to choose for x values that make the three linear factorsvanish successively. So we set x equal to −1, 1

3, and 1

4, to obtain equations like

16 = C · 5 · 4, which implies that C = 45, and, in the same way, B = −4, A = 16

5.

In the same fashion we can determine the following partial fraction expansion forthe third summand:

6x2

(1− 3x)(1 + x)(1− x)=

34

1− 3x+

34

1 + x−

32

1− x.

Page 248: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1220

Combining these expansions yields

a(x) =20− 4 + 3

4

1− 3x+

45

+ 34

1 + x−

32

1− x+

165

1− 4x

=67

4

∞∑k=0

3kxk +31

20

∞∑k=0

(−1)kxk − 3

2

∞∑k=0

xk +16

5

∞∑k=0

4kxk

=∞∑

k=0

(67

43k +

31

20(−1)k − 3

2+

16

54k

)xk

so

ak =67

43k +

31

20(−1)k − 3

2+

16

54k

8. A coding system encodes messages using strings of letters from the following al-phabet: A = A,B,C,D,E, A codeword is valid if it satisfies all of the followingconditions:

(a) The number of A’s is even.

(b) The number of B’s is odd.

(c) There cannot be fewer than 1 C.

(d) There cannot be more than 1 D.

(e) There is no restriction on the number of E’s.

Use exponential generating functions to determine a formula for the number ofwords of length n. Verify the cases n = 1, 2, 3 by actually listing the valid code-words. [Hint: Observe that

∞∑k=0

1

(2k)!x2k =

ex + e−x

2

∞∑k=0

1

(2k + 1)!x2k+1 =

ex − e−x

2

The functions on the right side are known as the hyperbolic cosine and hyperbolicsine of x, and denoted respectively by coshx and sinhx. They have interestingproperties that we do not require for this problem. If you are interested, consultany good calculus book. You should meet these functions in Calculus II or CalculusIII.]

Page 249: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1221

Solution: The enumerator for A is∞∑

k=0

1

(2k)!x2k =

ex + e−x

2; the enumerator for B

is∞∑

k=0

1

(2k + 1)!x2k+1 =

ex − e−x

2. The enumerators for E and C respectively are

ex and ex − 1. The enumerator for D is 1 + x. It follows that the exponentialgenerating function for the numbers of codewords is(

ex + e−x

2

)·(ex − e−x

2

)· (ex − 1) · (1 + x) · ex

=1 + x

4

(e4x − e3x − 1 + e−x

)=

1 + x

4

(∞∑

k=0

4k − 3k + (−1)k

k!xk − 1

)

=1 + x

4

(∞∑

k=1

4k − 3k + (−1)k

k!xk

)

=1

4

(∞∑

k=1

4k − 3k + (−1)k

k!xk +

∞∑k=1

4k − 3k + (−1)k

k!xk+1

)

=1

4

(∞∑

k=1

4k − 3k + (−1)k

k!xk +

∞∑j=2

4j−1 − 3j−1 + (−1)j−1

(j − 1)!xj

)

=1

4

(∞∑

k=1

4k − 3k + (−1)k

k!xk +

∞∑k=2

4k−1 − 3k−1 + (−1)k−1

(k − 1)!xk

)

=1

4

∞∑k=2

(4k − 3k + (−1)k

)+ k

(4k−1 − 3k−1 + (−1)k−1

)k!

xk

Hence the number of words of length k is

k!

4·(4k − 3k + (−1)k

)+ k

(4k−1 − 3k−1 + (−1)k−1

)k!

=

(4k − 3k + (−1)k

)+ k

(4k−1 − 3k−1 + (−1)k−1

)4

and is valid only if k ≥ 2.

The number obtained for k = 1 is 0, which agrees with the fact that any wordmust have at least one C and at least one B, so there can be no words of length1. By the same reasoning, words of length 2 must be permutations of the letters

Page 250: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1222

B, C; there are 2! = 1 such words, which agrees with the value computed above.The value computed above for k = 3 is 15. As words of length 3 must contain atleast one B and at least one C, and the number of B’s must be odd, they containexactly one B’s. The third letter may only be one of C, D, E. The number ofpermutations of B,C,C is 3!

2!1!= 3, while the number of permutations in either of

the other cases is 3! = 6; so the number of words of length 3 is 6 + 6 + 3 = 15,which agrees with the computed value.

9. You are to determine the number of non-negative integer solutions (x1, x2, x3) tothe inequality

x1 + x2 + x3 ≤ n (314)

subject to the intersection of all the following conditions:

1 ≤ x1 < 3 (315)

2 ≤ x2 (316)

x3 ≤ 5 (317)

You are asked to solve the problem twice:

(a) First by using generating functions.

(b) Then by using the principle of inclusion and exclusion, without using gener-ating functions.

Solution: Before attempting the solution, we introduce a 4th “slack” variable, x4,defined by

x4 = n− x1 − x2 − x3 . (318)

The inequality in (314) is then equilvalent to solving the equation

x1 + x2 + x3 + x4 = n (319)

subject to the additional constraint

0 ≤ x4 (320)

(a) Solution using ordinary generating functions. We will use t as the indetermi-nate. The enumerators for x1, x2, x3, x4 respectively will be t + t2, t2 + t3 +t4 + ... = t2

1−t, 1 + t+ t2 + t3 + t4 + t5 = 1−t6

1−t, 1

1−t. The generating function for

the number of solutions is then the product,

(t+ t2) · t2

1− t· 1− t

6

1− t· 1

1− t

Page 251: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1223

= (t3 + t4)(1− t6)(1− t)−3

= (t3 + t4 − t9 − t10)∞∑

k=0

(k + 2

2

)tk

=∞∑

k=0

(k + 2

2

)tk+3 +

∞∑k=0

(k + 2

2

)tk+4

−∞∑

k=0

(k + 2

2

)tk+9 −

∞∑k=0

(k + 2

2

)tk+10

=∞∑

a=3

(a− 1

2

)ta +

∞∑b=4

(b− 2

2

)tb −

∞∑c=9

(c− 7

2

)tc −

∞∑d=10

(d− 8

2

)td

=∞∑

k=3

(k − 1

2

)tk +

∞∑k=4

(k − 2

2

)tk −

∞∑k=9

(k − 7

2

)tk −

∞∑d=10

(k − 8

2

)tk

= (t3 + 3t4 + 6t5 + 10t6 + 15t7 + 21t8 + 28t9)

+(t4 + 3t5 + 6t6 + 10t7 + 15t8 + 21t9)− t9

+∞∑

k=10

((k − 1

2

)+

(k − 2

2

)−(k − 7

2

)−(k − 8

2

))tk

= (t3 + 4t4 + 9t5 + 16t6 + 25t7 + 36t8 + 48t9)

+∞∑

k=10

(12k − 60)tk

Note that the formula 12k − 60 holds in the cases k = 8, 9 even though ourgeneral proof did not apply in those cases.

(b) Solution using inclusion-exclusion (without using generating functions). Firstlet us change variables in (319) to account for the lower bounds. We will definey1 = x1 − 1, y2 = x2 − 2, y3 = x3, y4 = x4. The transformed equation andconstraints are now

y1 + y2 + y3 + y4 = n− 3 (321)

0 ≤ y1 ≤ 1 (322)

0 ≤ y2 (323)

0 ≤ y3 ≤ 5 (324)

0 ≤ y4 (325)

Let us denote the set of all non-negative integer solutions to (321) alone by Ω;the set of solutions which violate the condition y1 ≤ 1, i.e. for which y1 ≥ 2 by

Page 252: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1224

A1; and the set of solutions which violate the condition y3 ≤ 5, i.e. for whichy3 ≥ 6 by A2.

i. First let us assume that n ≥ 8. We wish to count, for any n, the points inΩ−A1∪A2. By the Principle of Inclusion-Exclusion, we wish to determinethe value, for any n, of the alternating sum

|Ω| − |A1| − |A2|+ |A1 ∩ A2|

We proceed to compute each of these cardinalities.The unrestricted solutions in Ω can be identified with sequences of n− 30’s and 3 1’s (which serve as separators). Accordingly, their number is((n−3)+3

3

)=(

n3

).

To determine |A1|, define wi = yi (i = 2, 3, 4), w1 = y1 − 2, and countthe number of non-negative integer solutions to w1 + w2 + w3 + w4 =n − 3 − 2 = n − 5. By a similar argument to the preceding, this will be((n−5)+3

3

)=(

n−23

).

To determine |A2|, define zi = yi (i = 1, 2, 4) and z3 = y3 − 6. Thenumber of non-negative solutions to the equation z = z1 + z2 + z3 + z4 =(n− 3)− 6 = n− 9 is

((n−9)+3

3

)=(

n−63

).

Finally, to determine |A1 ∩ A2|, define u1 = y1 − 2, u2 = y2, u3 = y3 − 6,u4 = y4. The number of non-negative integers solutions to u1 + u2 + u3 +u4 = (n− 3)− 2− 6 = n− 11 is

((n−11)+3

3

)=(

n−83

). Then the number of

solutions of the original problem is(n

3

)−(n− 2

3

)−(n− 6

3

)+

(n− 8

3

)= 12(n− 5)

The preceding result applies only for n ≥ 8. For 6 ≤ n ≤ 7,

ii. Next suppose that 6 ≤ n ≤ 7. Here the Inclusion-Exclusion Principlegives us the difference

(n3

)−(

n−23

)−(

n−63

)= (n− 2)2 solutions.

iii. When 2 ≤ n ≤ 5, Inclusion-Exclusion gives(

n3

)−(

n−23

)= (n− 2)2 again.

iv. When 0 ≤ n ≤ 1 there are no solutions.

We see that the same values have been obtained as when we used generatingfunctions.

F.5 Fifth 1999 Problem Assignment, with Solutions

Distribution Date: Friday, December 3rd, 1999Solutions were to be submitted on Friday, November 26th, 1999

Caveat lector! There could be misprints and other errors in these solutions.

Page 253: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1225

1. Determine the number of binary relations R on a set A = a1, a2, ..., am of nelements, which have each of the following combinations of properties.

(a) R is not restricted in any way.

(b) R is not antisymmetric.

(c) R is not both symmetric and reflexive.

(d) R is symmetric and is not reflexive.

(e) R is symmetric and irreflexive.

(f) Suppose that A is the union of disjoint sets B and B, where |B| = r. Let R1

be the relation on B defined to be R ∩ (B × B). Now count the relations Ron A such that R1 is a symmetric relation on B.

Solution:

(a) For every a ∈ A and b ∈ A, we may or may not include the pair (a, b) inR. This decision is independent of our decision about any other ordered pair(a, b). We have n choices for a and again n choices for b (which may be thesame as a). The total number of relations is, therefore, the product of n2

factors, each equal to 2, i.e. it is 2n2

.

(b) First let us count the number of antisymmetric relations. For any a ∈ A,antisymmetry imposes no restriction on the ordered pair (a, a); so we have 2choices for each a ∈ A, independently; by the Product Rule, this introducesa factor of 2n. As for the pairs (a, b) and (b, a), where a 6= b, antisymmetrypermits any one of three possibilities:

• Neither (a, b), nor (b, a) is in R.

• Just one of (a, b) and (b, a) is in R — there are two possibilities here.

Equivalently, we must delete from the 2 × 2 possibilities of membership ornon-membership, the one forbidden combination: ((a, b) ∈ R) ∧ ((b, a) ∈ R).We thus have 3 choices for each of the symmetric off-diagonal pairs of points;the number of such pairs is 1

2(n2 − n). Multiplying these factors of 3 for

each pair introduces a factor of 3n2−n

2 . Hence the number of antisymmetric

relations is 2n3(n2).50 As the total number of binary relations on A is 2n, the

50We have chosen to write n2−n2 in the form of a binomial coefficient. This can also be seen by the

following alternative computations: add the numbers of elements in the upper half of the matrix MR

which represents R: 1 + 2 + ... + (n − 1); students should be familiar with the sum of the first n − 1integers — a result that can easily be proved by induction. Yet another way of observing this fact is tocount the number of ways of selecting two distinct elements a and b from A:

(n2

).

Page 254: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1226

number of non-antisymmetric relations is

2n2 − 2n3(n2) .

(c) First we will count the relations that are both reflexive and symmetric. Inthis case each of the off-diagonal pairs in MR contributes a factor of 2: eitherboth (a, b) and (b, a) are in R, nor neither. The diagonal pairs (a, a) must all

be present. So the number of relations of this type is 2(n2). It follows that the

complement of this set in the set of all relations has cardinality 2n2 − 2(n2).

(d) In this case there is a factor of 2 again for each off-diagonal pair; their product

is again 2(n2). As for the diagonal, we can include or exclude any of the pairs

(a, a) independently, with one exception: we cannot include them all, as thisis the case of reflexivity. This introduces a factor of 2n−1, so the total number

of such relations is 2(n2)+n − 2(n

2), which can be seen to equal 2(n+1

2 ) − 2(n2).

(e) The number here will be the same as in Problem 1c, as the diagonal entriesin the matrix MR are again completely determined.

(f) The number of relations R1 is 2(r+12 ). Outside of the r × r submatrix of MR

which corresponds to R1, there is no restriction on R. This means there aren2−r2 entries in the matrix that may be chosen independently, each in 2 ways.

Hence the total number of relations of this type is 2n2−r2 · 2(r+12 ) = 2n2−(r

2).

2. Determine the number of ternary (i.e. 3-ary) relations on a set A of n elements.

Solution: Every ordered triple of points of A may or may not be included, inde-pendently of the others. Accordingly the number of such relations is 2 raised tothe power of the cardinality of the set A× A× A, i.e. 2n3

.

3. Carefully compile a catalogue of all relations R on a set A of no more than 3points, such that R is both reflexive and transitive. You should list only theisomorphism classes — do not list two relations if one can be obtained from theother by relabelling the points. You may represent the relations by lists of orderedpairs, by matrices, or by digraphs. It is suggested that you order the relations1st by number of points; and, within that classification, by |R|. At every stage inthe development of your catalogue you should explain how you know you have allrelations.

Solution:

0 points: The only relation on 0 points is the empty relation ? , and it is bothreflexive and transitive, so it must be included in our catalogue.

Page 255: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1227

1 point: Suppose A = a. Any symmetric relation on A must contain (a, a),which is all of A × A. This relation is also (“trivially”) transitive. This casemust also be included in the catalogue.

2 points: Suppose A = a, b. To be reflexive, any relation on A must includeboth (a, a), and (b, b).

R contains 2 points: R = (a, a), (b, b) is “trivially” transitive.

R contains 3 points: If we adjoint one more pair, i.e. either (a, b) or (b, a),the relation remains trivially transitive. There is only one relation of thistype, up to the labelling of the points.

R contains 4 points: This is where R = A × A. It is unique, and it istransitive.

3 points: Taking A = a, b, c, where a, b, c are distinct, we must include (a, a),(b, b), (c, c), since R must be reflexive.

R contains 3 points: This is where R = (a, a), (b, b), (c, c). It is unique.

R contains 4 points: We may adjoint one point to R in only one way up tothe labelling of the points; we obtain R = (a, a), (b, b), (c, c), (a, b).

R contains 5 points: (a) Two points could be the two possible orderings oftwo distinct points of A, giving a relation of the form

R = (a, a), (b, b), (c, c), (a, b), (b, a) .

(b) If the two added points do not involve the same two distinct pointsof A, then they must not be such that the third side of a “transitivetriangle” would be needed and absent. Hence the two points added toR must either both be directed into the same point, or both away fromthe same point. We obtain either R = (a, a), (b, b), (c, c), (a, b), (c, b)or R = (a, a), (b, b), (c, c), (a, b), (a, c).

R contains 6 points: Suppose that two of the added points are the twoorientations of an unordered pair, like (a, b) and (b, a). Then, after rela-belling, the third would have to be either (a, c), or (c, a). Neither of therelations so constructed would be transitive, as the first would be lacking(b, c), and the second would be lacking (a, c). Thus there are no relationsof this type, and the only way in which 3 points can be added is if theyare orientations of the three sides of 4abc. There are only two ways oforienting a triangle — either transitively or cyclically ; in the latter case— like (a, b), (b, c), (c, a), transitivity would entail the addition of threemore ordered pairs: (b, a), (c, b), (a, c); so the only possible case is a tran-sitively ordered triangle, and that does indeed yield a transitive relation.

Page 256: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1228

Up to labelling, we thus obtain only one reflexive, transitive relation with6 pairs: R = (a, a), (b, b), (c, c), (a, b), (b, c), (a, c).

R contains 7 points: It is easier to analyze these cases by looking at thepairs that are missing.

(a) Could the missing pairs be the two orientations of a pair, as R =(a, a), (b, b), (c, c), (a, b), (b, a), (a, c), (c, a)? Here transitivity wouldimply, from the presence of (c, a) and (a, b), that (c, b) ∈ R. Fromthis contradiction we conclude that this case is impossible.

(b) Could the missing pairs constitute a path of lengh 2, as (a, b), (b, c)? IfR = (a, a), (b, b), (c, c), (b, a), (a, c), (c, a), (c, b)? Then transtitivitywould imply, from the presence of (a, c) and (c, b), that (a, b) ∈ R.This contradiction shows that this case is also impossible.

(c) The only remaining cases are where the missing two edges are bothdirected outward from the same point, or both directed into thesame point, as R = (a, a), (b, b), (c, c), (b, a), (c, a), (b, c), (c, b), R =(a, a), (b, b), (c, c), (a, b), (a, c), (b, c), (c, b)? These are both transi-tive.

R contains 8 points: By a suitable relabelling we can arrange that R =(a, a), (b, b), (c, c), (a, b), (a, c), (c, a), (b, c), (c, b). This is not transitive,as the presence of (b, c) and (c, a) should imply the presence of (b, a). Fromthis contradiction we conclude that there is no relation with 8 members.

R contains 9 points: This is the relation R = A × A which is obviouslyreflexive and transitive.

We list matrices representing the reflexive transitive relations on 1 to 3 points inFigure 3.

4. [19, Exercise 6.5.38] Determine whether or not the symmetric closure of the reflexiveclosure of the transitive closure of a relation is always an equivalence relation.

Solution: Note that the transitive closure is formed before the symmetrization. Itmay be that in the symmatrization operation a path of length 2 (a, b)(b, c) is createdfor which the diagonal (a, c) is missing. Here is a counterexample: Let A = a, b, cwhere a, b, c are distinct points. Define R = (a, b), (a, c) ∈ A × A. Then R isneither reflexive, nor symmetric, nor transitive. The transitive closure of R is Ritself, since there are no directed paths of length 2 to be considered. The reflexiveclosure of R is (a, b), (a, c), (a, a), (b, b), (c, c). This relation is not symmetric, butwe can symmetrize it by adjoining the reversals of all edges (except the loops whichare their own reversals), yielding (a, b), (a, c), (a, a), (b, b), (c, c), (b, a), (c, a). Thisrelation lacks both (b, c) and (c, b). Since it contains both (b, a) and (b, c), it is nottransitive.

Page 257: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1229

[1][

1 00 1

] [1 10 1

] [1 11 1

] 1 0 0

0 1 00 0 1

1 1 00 1 00 0 1

1 1 01 1 00 0 1

1 1 1

0 1 00 0 1

1 0 01 1 01 0 1

1 1 10 1 10 0 1

1 1 1

0 1 01 1 1

1 0 11 1 11 0 1

1 1 11 1 11 1 1

Figure 1: Reflexive Transitive Binary Relations on 1 to 3 Points

5. (cf. [19, Exercise 6.6.26]) The set S = 2, 4, 6, 9, 12, 18, 27, 36, 48, 60, 72 can beendowed with the structure of a poset in many ways. For example

• the partial ordering (actually, a total ordering) ≤ (defined on S ×S by x ≤ yiff y − x ∈ N)

• the partial ordering (also a total ordering) ≥ (defined on S × S by x ≥ y iffx− y ∈ N)

• the partial ordering | (defined on S × S by x | y iff ∃z ∈ N(y = xz))

• the partial ordering P consisting only of the reflexive pairs, P = (a, a)|a ∈S.

Answer each of the following questions for each of the 4 partial orderings we havegiven.

(a) Find the maximal elements.

(b) Find the minimal elements.

(c) Is there a greatest element?

(d) Is there a least element?

(e) Find all upper bounds of 2, 9.(f) Find the least upper bound of 2, 9, if it exists.

Page 258: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1230

(g) Find all lower bounds of 60, 72.(h) Find the greatest lower bound of 60, 72, if it exists.

(i) Draw the Hasse diagram.

Solution: It might be easier to solve some of these problems by drawing the Hassediagram first.

(a) Since ≤ and ≥ are both total orders, there is at most one maximal elementand at most one minimal in each case. The maximal element in ≤ is 72; themaximal element in ≥ is 2.

The maximal elements for | are 27, 48, 60, 72, since none of them dividesanother in the list. Finally, all elements of S are maximal for the relation P .

(b) The minimal element of ≤ is 2, and of ≥ is 72. The minimal elements of |are 2 and 9, since neither has a (distinct) divisor in the S. All elements areminimal for P .

(c) The greatest element for ≤ is its unique maximal element, 72; the greatestelement for ≥ is its unique maximal element (i.e. the unique minimal elementof ≤) 2. There is no greatest element for |, since any common multiple of 60and 72 would have to be a multiple of their “least common multiple”, 360.Nor is there a greatest element for P , since any points is related only to itself.

(d) The least element for ≤ is 2, and for ≥ is 72. There is no least element for |,since it would have to be a divisor of the greatest common divisor of 2 and 9,i.e. 1, and 1 /∈ S. Again, P has no least element, for the same reason as inthe preceding case.

(e) In ≤, all elements of S not less than 9 are upper bounds for 2 and 9; so theupper bounds are the members of 9, 12, 18, 27, 36, 48, 60, 72. In ≥ there isonly one upper bound for 2, and 9, and it is 2. In | the upper bounds willbe the common multiples of 2 and 9, i.e. multiples of their greatest commondivisor, which is 18. The multiples of 18 present in S are 18, 36, 72. In P theset 2, 9 has no upper bounds.

(f) In ≤ the least upper bound of 2, 9 is 9; in ≥ it is 2. In | it is 18, and in Pthere is none.

(g) In ≤ the lower bounds of 60, 72 are 2,4,6,9,12,18,27,36,48,60; in ≥ the onlylower bound is 72. In | the lower bounds will be common divisors, 2,4,6,12.In P there are no lower bounds for this set.

(h) In ≤ the greatest lower bound of 60, 72 is 60; in ≥ it is 72. In | it is 12. InP there is none.

Page 259: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1231

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

@

r

2r

9

r

4

r

60

r

12

r

18

r

6

r

36

r

27r

72

r40

Figure 2: The Hasse diagram for |, Problem 5i

(i) The Hasse diagram for ≤ is just 2 − 4 − 6 − 9 − 12 − 18 − 27 − 36 − 48 −60 − 72 written vertically, usually with the 2 at the bottom. The Hassediagram for ≥ would be the same, but with the 72 at the bottom and 2at the top. The Hasse diagram for P would consist of the members ofS = 2, 4, 6, 9, 12, 18, 27, 36, 48, 60, 72 all written, without connecting lines,horizontally. The Hasse diagram for | is

Page 260: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1232

G Solved Combinatorial Problems

G.1 Counting words formed from a given population of letters,not necessarily all different

1. Determine how many 9-letter words can be formed from all the letters of the wordRECESSION.

2. Determine how many 4-letter words can be formed from letters of the word RECES-SION; no letter may be used in a word more often than it appears in RECESSION.

3. Determine how many 4-letter words counted in the preceding part have the propertythat no 2 successive letters are identical.

4. (cf. [7, Exercise 6.4.1]) “A palindrome may be defined as a string that reads thesame forward and backward.” Determine the number of palindromes that may beformed from the letters of the word CLASSIFICATION, if no letter may be usedmore often than it appears in the given word. Otherwise there is no restrictionas to the length of the words. The “empty word”, consisting of 0 letters, will beaccepted also. Do not attempt to list all the palindromes!

5. Let m and n be any positive integers. Determine the number of binary words —i.e. sequences of 0’s and 1’s — consisting of m = 10 0’s and n = 10 1’s, in each ofthe following cases:

(a) no 2 1’s appear side-by-side

(b) no 2 1’s appear side-by-side and no 2 0’s appear side-by-side

(c) the first and last digits are the same

(d) the first and last digits are different

6. [7, Exercise 6.4.11] Find the number of words of length n formed using the threeletters a, b, and c, such that no two a’s appear in consecutive positions.

Solutions:

1. The multiplicities of letters available are: 2 each of E and S; one each of C, I, N,O, R. The number of permutations of 9 distinct symbols would be P (9, 9) = 9!. Tocount permutations where there are symbols which are identical, we must divideby a factorial for each of the sets of identical symbols — here by 2 factors of 2!.

Thus the number of distinct 9-letter words is9!

2!2!= 90270.

Page 261: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1233

2. We cannot simply take the number P (9, 4) and divide by a factor to allow formultiplicities, since the number of repeated factors depends upon the selection orcombination of letters chosen for the word. We decompose the problem into threeparts, according to the multiplicities, and then divide by the appropriate factorwhen multiplying by 4!.

(a) Multiplicities 2 + 2: The letters may be chosen in C(2, 2) = 1 way; then

ordered in P (4,4)2!2!

= 4!2!2!

= 6 ways; there are 1× 6 = 6 words of this type.

(b) Multiplicities 2+1+1: The letter of multiplicity 2 may be selected in C(2, 1) =2 ways; the letters to appear with multiplicity 1 may be selected from theremaining population of 6 letters in C(6, 2) = 15 ways. Note that in thiscase we may even use one of the two letters of multiplicity 2 not used. Thetotal number of selections is, therefore, 2 × 15 = 30; each selection admitsP (4,4)2!1!1!

= 12 arrangements; there are 30× 12 = 360 words of this type.

(c) Multiplicity 1 + 1 + 1 + 1: The letters may be chosen in C(7, 4) = 35 ways,then ordered in P (4, 4) = 24 ways; there are 35× 24 = 840 such words.

Adding, we find that there are altogether 6 + 360 + 840 = 1206 words.

[This problem can also be solved using exponential generating functions . Thenumber of words is 4! times the coefficient of x4 in the expansion of(

1 +x

1!

)5(

1 +x

1!+x2

2!

)2

.]

3. Words to be excluded occur in the 1st and 2nd cases counted above. Interpret eachof the multiple pairs as a single object consisting of two adjacent like letters. Thenumber of words with adjacent E’s is 3!

2!1!= 3 — where we permit the S’s to be

adjacent or not; similarly: the number of words with adjacent S’s is also 3; by thePrinciple of Inclusion and Exclusion, the number with either of these properties is3 + 3 − 2 = |A1| = 2 · 4! = 4, since there are precisely two words obtainable bypermuting the two-letter word EE and the two-letter word SS.

The second set of words to be deleted from our count appear in the second partabove: these are simply 2× 15× 3! = 180 in number. (Treat the two adjacent likeletters as one object being permuted in a set of 3.)

We subtract 4 + 180 from 1206, to obtain 1022 words that have no two adjacentlike letters.

4. The multiplicities of the letters available are

Page 262: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1234

multiplicity lettersI 3

A,C,S 2F,L,N,O,T 1

.

We consider two cases, according as there is a letter in the middle of the word ornot, i.e. according as the number of letters in the palindrome is odd or even.

Odd Length Palindromes: Each word may be decomposed into a middle letterand two subwords, one of which is the mirror image of the other; conversely, ifwe combine any word, its mirror image, and any letter to serve as the middle— subject to the multiplicity conditions — we obtain a palindrome of thistype. We may consider cases, according to the multiplicity of the letter chosenfor the middle:

Middle Letter I: Of the remaining letters, including 2 I’s, we must select aneven number of each. The letters available with positive even multiplicityare then A, C, I, S, each with multiplicity 2. The words we obtain may beput into 1-1 correspondence with those counted in the even case, below(think of deleting the middle letter I), and can be seen below to number(

4

4

)4! +

(4

3

)3! +

(4

2

)2! +

(4

1

)1! +

(4

0

)0! = 65

Middle Letter A, C, or S: In using A as the middle letter we eliminate itas a candidate for one of the pairs. Consequently the number of palin-dromes of this type is

3

((3

3

)3! +

(3

2

)2! +

(3

1

)1! +

(3

0

)0!

)= 48

Middle Letter F, L, N, O, or T: None of the middle letters here couldserve as part of the reflective pairs. Consequently, for each of the 5 choicesof middle letter there will be a set of palindromes which can be put intoone-to-one correspondence with the set of even palindromes, which wefind below to number 65. Consequently the number of palindromes ofthis type is 5× 65 = 325.

The total number of palindromes of odd length is therefore 65 + 48 + 325 =438.

Even Length Palindromes: Each of the palindromes of length 2n consists oftwo mirror images of a word of length n, which is not restricted; and everyword of length n can be paired with its mirror image to yield a palindrome.

Page 263: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1235

In considering the multiplicities of letters available, we must select the lettersin pairs: thus we may choose either 0 or 2 I’s, either 0 or 2 of each of A, C, S,and only 0 of each of F, L, N, O, T. The half-palindromes we create thereforecontain permutations of any of the letters A, C, I, S. Separating into disjointcases we have:

4 letters: Select the letters in(44

)ways and permute in 4! ways: 24 palin-

dromes

3 letters: Select the letters in(43

)ways and permute in 3! ways: 24 palin-

dromes

2 letters: Select the letters in(42

)ways and permute in 2! ways: 12 palin-

dromes

1 letter: Select the letter in(41

)ways and permute in 1! way: 4 palindromes

empty half-palindrome: Select the letter in(40

)ways (i.e. uniquely) and

permute in 0! = 1 way: 1 palindrome (the empty word

In all we have 24 + 24 + 12 + 4 + 1 = 65 palindromes of even length.

We find that there are 438 + 65 = 503 palindromes in all.

5. We shall solve this problem for general m and n, although students were asked toconsider only the case m = 10 = n.

(a) Consider 2 cases:

Last digit is 1: If we detach the last digit we obtain a word that can beconsidered as made up of 0’s and of 2-letter subwords 10; there will ben− 1 of the subwords 10, hence exactly m− (n− 1) 0’s aside from thosein the 2-letter subwords. We are permuting (n−1)+(m−n+1) objects,of which n − 1 are alike of one type and m − n + 1 are like of the othertype. We obtain

m!

(n− 1)!(m− n+ 1)!

=(

mn−1

)words of this type. It is necessary that m ≥ n−1. If m = n = 10,(

mn−1

)= 10.

Last digit is 0: These words can also be considered as arrangements of 0’sand 10’s: there are n 10’s and m − n other 0’s. The number of words istherefore

m!

n!(m− n)!

=(

mn

)words of this type. Here we require that m ≥ n. If m = n = 10,(

mn

)= 1.

Page 264: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1236

Combining the two, we have(

mn−1

)+(

mn

)=(

m+1n

). (The simplicity of this

solution suggests that there should be another possible attack on the problem.We could instead count words in m+ 1 0’s and n 1’s with the condition that1 is always followed by a 0. These words must end in a 0, and could be putinto 1-1 correspondence with the words we wish to count.)

(b) The successor of any 1 is a 0, and the successsor of any 0 is a 1. These wordstherefore are alternating strings of 1’s and 0’s. They can exist only when|m− n| ≤ 1. When m = n there will be two distinct words; when m = n− 1or m = n+1 there will be just one word, with the majority symbol appearingat the extremes.

(c) When the extreme symbol is a 0 we will be left with m−2 0’s and n 1’s, whichcan be arranged without restriction in

(m+n−2

n

)ways. When the extreme

symbol is a 1 we have, similarly,(

m+n−2n−2

)words. The number of these words

is therefore(m+ n− 2

n

)+

(m+ n− 2

m

)= 2×

(18

10

)when m = n = 10.

(d) There are two equinumerous cases, according as the first symbol is a 0 or a 1:in all we have 2

((m−1)+(n−1)

m−1

)words, i.e. 2

(189

)when m = n = 10.

This suggests another solution to the preceding case: it must be the comple-ment of this case in the set of all words, which are

(m+n

n

)in number. Thus

the number of solutions to the preceding case must be(m+ n

n

)− 2

(m+ n− 2

m− 1

)6. We begin by presenting a

Fallacious Solution: This attack is defective. Can you see what is wrong withit?

The total number of n-letter words without restrictions on the a’s is, by theProduct Rule, 3n. Let us try to count the words with adjacent a’s. Thedifficulty is in avoiding multiple counting of the words we wish to exclude.

Any “bad” word may be decomposed into 3 parts: the first appearance oftwo adjacent a’s (counting from the left), the a-less word which precedesthis first appearance, and the remaining unrestricted word. Conversely, anyconcatenation of a b − c-word, followed by aa, followed by an unrestrictedword of the appropriate number of letters will always yield one of the wordswe wish to count (and exclude). The three parts of this word may be chosen

Page 265: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1237

independently. Suppose that the first part consists of k letters; the number ofsuch words is exactly 2k. The middle word aa may be chosen in 1 way. Thefinal word may be chosen in 3n−k−2 ways. Thus the number of words we wishto exclude is

n−2∑k=0

2k3n−k−2 = 3n−2

n−2∑k=0

(2

3

)k

= 3n−2 ·1−

(23

)n−1

1− 23

= 3n−1 − 2n−1

and the number of words without adjacent a’s is

3n − 3n−1 + 2n−1

The error in the preceding argument is in the count of “bad” words: somehave been omitted. More precisely, it is assumed that the first appearance ofthe letter a, counting from the left, is in a pair aa. But this need not be thecase. For example, the word abaa is “bad”, but is still counted above. Casesof the type we have just described do not appear for n < 4, so the answerwould appear to be correct when verified for the first 3 cases.

Sketch of a correct solution. We shall define fn to be the number of words ina, b, c that have no adjacent a’s and end in an a; we define gn to be the numberof words in a, b, c that have no adjacent a’s and end in b or c, (n = 1, 2, ...).Then we have the following recurrences :

fn+1 = gn

gn+1 = 2(fn + gn)

(n = 1, 2, ...)

To see these relations, think of the operation of removing the last letter in aword. In the first case we obtain an acceptable word which does not end inan a; and, conversely, any such word can be extended one letter by adding ana. The second recurrence follows by similar reasoning. The problem reducesto solving these recurrences. It is easy to see that

fn+2 = 2fn+1 + 2fn

gn+2 = 2gn+1 + 2gn

Thus both sequences satisfy the same recurrence. The initial values can bedetermined heuristically to be

f1 = 1 f2 = 2 g1 = 2 g2 = 6

Page 266: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1238

Our interest is only in the sum hn = fn + gn, which can be seen to also satisfythe same recurrence, viz.

hn+2 = 2hn+1 + 2hn h1 = 1 + 2 = 3 h2 = 2 + 6 = 8

Systematic methods for solving recurrences of this type will be studied in [7,Chapter 8]. In conjunction with that study we shall see that the (ordinary)generating function f(x) =

∑fnx

n is

h(x) =3x+ 2x2

1− 2x− 2x2= (3x+ 2x2) · 1

1− (1 +√

3)x· 1

1− (1−√

3)x

=3x+ 2x2

2√

3

(1 +√

3

1− (1 +√

3)x− 1−

√3

1− (1−√

3)x

)

=3x+ 2x2

2√

3

∞∑n=1

((1 +

√3)n+1 − (1−

√3)n+1

)xn

from which we may conclude that

hn =1

2√

3

((5 + 3

√3)(1 +

√3)n−1 − (5− 3

√3)(1−

√3)n−1

)=

1

4√

3

((1 +

√3)n+2 − (1−

√3)n+2

)As n → ∞, the substracted term approaches zero; thus the numbers behaveapproximately like a constant multiple of (1 +

√3)n.

An elegant but difficult derivation of the recurrence. The words in a, b, ccan be generated by summing all powers of a+b+c; we can think of (1−a−b−c)−1 as their generating function; call this function H(a, b, c). We may thinkof these unrestricted words as having “grown” out of the restricted wordswithout adjacent a’s by replacing a, wherever it appears, by a+ a2 + a3 + ...,i.e. by the function a

1−a. Thus, if h(a, b, c) denotes the generating function for

the restricted words, we have the equation

h

(1

1− a, b, c

)= H(a, b, c)

Replacing a by x1+x

(obtained by solving the equation a1−a

= x) yields

h(x, b, c) = H

(x

1 + x, b, c

)=

1

1− x1+x− b− c

Page 267: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1239

But we are not interested in the words themselves, only in their numbers. Solet us set b = c = x, and simply look at the coefficients of powers of x:

h(x, x, x) =1 + x

1− 2x− 2x2(326)

The only reason why this is not identical with h(x) found earlier, is that wehave permitted the “empty” word, consisting of no letters. If we subtract 1from the right side of equation (326) we obtain

1 + x

1− 2x− 2x2− 1 =

3x+ 2x2

1− 2x− 2x2

as before.

G.2 Problems on inclusion-exclusion

1. Use the Principle of Inclusion and Exclusion to determine the number of ways inwhich 3 women and their 3 spouses may be seated around a round table, so thatno woman sits beside her spouse (on either side).

2. Determine the number of ways in which 3 women and their spouses may be seatedaround a round table so that no two women may sit opposite one another at thetable (i.e. with 2 persons between them on either side).

3. Showing all your work, use the Principle of Inclusion and Exclusion to determine— for any natural number n — the number of integers between 1 and 210n whichare divisible by all of 2, 5, or 7, but not divisible by 3.

Solutions:

1. The underlying set consists of all circular permutations, 5! in number. Let A1, A2,A3 be the subsets of permutations respectively in which the members of couples##1, 2, 3 sit side by side. Then |A1| = 2 · 4! = 48, etc.; |A1 ∩ A2| = 22 · 3! = 24,etc.; |A1 ∩ A2 ∩ A3| = 23 · 2! = 16. By the Principle of Inclusion and Exclusion,the number of arrangements in which some woman sits opposite her spouse is(3 · 48 − 3 · 24 + 16) = 88. Hence the number of circular permutations without awoman sitting beside her spouse is 5!− 88 = 120− 88 = 32.

2. We distinguish two cases, according as there exist two women sitting side by sideor not.

Page 268: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1240

(a) Where two women sit side by side, their opposite positions are occupied bymen, so the remaining vacant positions are beside these women; thus the onlyconfiguration possible here has three women side by side; and 3 men similarlyside by side. The women are arranged in a linear order, since there is one thatis distinguishable as the left-most, in P (3, 3) = 6 ways. Similarly, the men arearrangeable in 3! = 6 ways. We have altogether 3! × 3! = 36 permutations.The two groups are then arranged around the circle in (2− 1)! = 1 way.

(b) Otherwise no woman sits beside another woman; here the seating has analternation of women and men around the table. The women may be seatedin (3 − 2)! = 2 ways; then the men may be seated in the seats remainingfor them in 3! ways. (Note that in the case of the men we may use woman#1 as a reference point, so it is now a linear ordering rather than a circularordering.) This case gives rise to 2× 3! = 12 permutations.

We add 36 + 12, to obtain 48 permutations.

3. Define subset Ar to consist of those integers between 1 and 210n (inclusive) thatare divisible by r. An integer divisible by all of 2, 5, 7, will be divisible by 70, andconversely; an integer divisible by 2, 5, 7 but not 3 will be divisible by 70, but notby 210. As seen in [7, §1.9, Example 6], |A70| = 210n

70= 3n; |A210| = 210n

210= n. The

integers divisible by all of 2, 5, 7, but not by 3 will constitute the set A70 − A3 =A70 − A210. The application of the Principle of Inclusion and Exclusion here is atrivial one: Let D1 = A70 − A210, D2 = A210. Then

|D1 ∪D2| = |D1|+ |D2| − |D1 ∩D2|

i.e.|A70| = |A70 − A210|+ |A210| − |∅|

hence A70 − A210 = 210n70− 210n

210= 2n. The number of integers divisible by at least

one of 2, 5, 7 is

210n

(1

2+

1

5+

1

7

)−(

1

10+

1

35+

1

14

)+

1

70

= 138n . (327)

Let us count the integers integers between 1 and 210n which are divisible by atleast one of 2, 5, 7, and by 3; these will be the cases counted in (327) which shouldbe subtracted. One way to approach this problem is to define Br to be the numberof integers between 1 and 210n divisible by both 3 and r (r = 2, 5, 7). We obtainthe identical expression to the preceding, except that we apply the various fractionsto a set now consisting of 1

3· 210n:

1

3· 210n

(1

2+

1

5+

1

7

)−(

1

10+

1

35+

1

14

)+

1

70

= 46n . (328)

Page 269: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1241

Subtracting51 (328) from (327), we obtain

140n

(1

2+

1

5+

1

7

)−(

1

10+

1

35+

1

14

)+

1

70

= 92n .

G.3 A combinatorial identity

Let A and B be disjoint subsets of a set Ω such that |A| = m, |B| = n.

1. Show that there exists a bijection f : P(A) × P(B) −→ P(A ∪ B) such that|f(U, V )| = |U |+ |V |.

2. Using f , or otherwise, show that52 for any r,(m+ nr

)=

r∑s=0

(ms

)(n

r − s

)

Solutions:

1. Define f(U, V ) = U ∪ V . This mapping is onto. For, given any W ⊆ A ∪ B, setsW ∩ A and W ∩B are disjoint (since

(W ∩ A) ∩ (W ∩B) = W ∩ (A ∩B) = W ∩ ∅ = ∅ .)

Hence f(W ∩ A,W ∩ B) = (W ∩ A) ∪ (W ∩ B) = W ∩ (A ∪ B) = W . Show thatf is one-to-one.

2. The restriction of f to the pairs whose union has cardinality r is a one-to-onecorrespondence with the subsets of A ∪ B of cardinality r. Denote the cardinalityof A by s. By the Product Rule the number of pairs consisting of a subset ofA of cardinality A and a subset of B — necessarily of cardinality r − s — is(ms

)(n

r − s

). As sets in one-to-one correspondence have the same cardinality,

the sum of these products must equal

(m+ nr

).

(Note that this identity could be proved algebraically or analytically by comparingthe coefficients of xr on the two sides of the equation

(1 + x)m+n = (1 + x)m(1 + x)n .)

51which is again a simple application of the Principle of Inclusion and Exclusion52We are representing C(a, b) by the symbol

(ab

); this is normally read a choose b, or a binomial

b.

Page 270: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1242

G.4 Lattice paths

1. [7, Exercise 6.8.18] How many ways are there for a person to travel from thesouthwest corner to the northeast corner of an m×n grid? Enumerate all the wayspossible if the grid is 5 × 3. How many ways are there if the grid is 10 × 10 andno move may take the person below the main diagonal (those positions that are ksteps over and k steps up from the starting point where 1 ≤ k ≤ 10)?

Solution:

1. The problem is concerned with the number of paths in an m× n rectangular grid,in which all motion is either upward or to the right. The number of such paths isprecisely the number of (m+ n)−letter words built from m letters U (for up) andn letters R (for right), i.e. (

m+ nm

).

When the paths in an n × n square are restricted so as never to pass below thediagonal, the problem becomes more difficult, and is equivalent to the old problemof the “Catalan numbers” — the numbers of ways of dissecting a convex planepolygon with labelled vertices into triangles by means of its diagonals — in defer-ence to the work of E. Catalan, one of the mathematicians who published papers onthe subject in the Journal de Mathematiques Pures et Appliquees in the 1830’s.53

These numbers are usually evaluated by showing that a power series having themas coefficients (their ordinary generating function) satisfies a certain polynomialequation, which may be solved without difficulty. However, a very simple directevaluation may be based on the fact that the “illegal” paths may be put into one-to-one correspondence with the paths in a grid with dimensions (n− 1)× (n+ 1),

which number

(2nn− 1

), hence the total number of paths not descending below

the main diagonal is (2nn

)−(

2nn− 1

)=

1

n+ 1

(2nn

),

(cf. [13, pp. 163–164])

53The problem appears to have been posed by L. Euler to an amateur mathematician, J. A. v.Segner, who published a note on the subject in Latin in 1758–1759, in the Novi Commentarii AcademiæScientiarum Petropolitanæ 7, pp. 13-14.

Page 271: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1243

G.5 Partitions of labelled objects into labelled boxes

1. [7, Exercise 6.12.43] (In) “how many ways can 25 students be assigned to threedifferent lab sections, if each lab section has at least five students?

2. [7, Exercise 6.12.49] A 6-person committee is to be chosen from 16 universitystudents, of which 4 of the available persons are from each of the 4 classes. Howmany committees are possible if

(a) each class is represented

(b) no class has more than two representatives, and each class has at least onerepresentative.

Solutions:

1. If the problem had been concerned with indistinguishable students, but 3 distin-guishable lab sections, the number of partitions would be equal to the coefficientof x25 in the expansion of

(x5 + x6 + x7 + ...+ xn + ...)3

(It’s not important to truncate the series at x25, or at x15; in fact, it’s harmless toallow the series to be infinite — and the computations are simpler!) The functionis equal to x15 (1− x5)

−3. The coefficient we seek is then the coefficient of x10 in

the expansion of (1− x5)−3

, i.e. the coefficient of y3 in the expansion of (1− y)−3,i.e. 10.

The number of partitions (of distinguishable students) into (distinguishable) labsections having respectively i, j, and 25− i− j students is precisely(

25i

)(25− ij

).

What we require is the sum of these products as (i, j) ranges over all integer latticepoints in the first quadrant such that i + j ≤ 20 and i ≥ 5, j ≥ 5 — i.e. on theboundary of or inside a certain pentagonal region. This can be expressed as∑

i

∑j

25!

i!j!(25− i− j)!i ≥ 5 j ≥ 5

i+ j ≤ 20

The computations involved are unpleasant. Some compression is possible.

Page 272: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1244

(An approach using exponential generating functions would show that the numberwe seek is 25! times the coefficient of x25 in the MacLaurin series expansion of(

ex − 1− x

1!− x2

2!− x3

3!− x4

4!

)3

.)

2. (a) Denote the number of representatives selected from the jth class by ij (j =1, 2, 3, 4). Then, by the Product Rule, the total number of committees is(

4

i1

)(4

i2

)(4

i3

)(4

i4

)where the integer variables are restricted only by 4 ≥ ij ≥ 1 (j = 1, 2, 3, 4).Thus the number we seek may be viewed as the coefficient of x6 in the expan-sion of the product of four copies of[(

4

1

)x1 +

(4

2

)x2 +

(4

3

)x3 +

(4

4

)x4

]or[4x1 + 6x2 + 4x3 + x4

](329)

i.e. the coefficient of x2 in the expansion of

(4x0 + 6x1 + 4x2 + x3)4

= (16x0 + 48x1 + 68x2 + terms of higher degree)2

= 256x0 + 1536x1 + 4480x2 + terms of higher degree

giving a total number of committees of 4480.

This computation could be simplified, if we observe that expression (329) maybe expressed as (1 +x)4− 1 = (1 +x)16− 4(1 +x)12 + 6(1 +x)8− ..., in whichthe coefficient of x6 is

(166

)− 4(126

)+ 6(86

)= 4480.

(b) The only difference in this case is that, in place of the 4th power of (329), wetake the 4th power of (4x + 6x2). The coefficient of x6 in the expansion of(4x+ 6x2)4 is equal to the coefficient of x2 in the expansion of (4 + 6x)4, i.e.to(42

)4262 = 3456. (We can account for the difference of 1024 with the first

problem as follows: these are the cases in which 3 representatives are chosenfrom one class and 1 from each of the other 3 classes. A single representativefrom a class may be selected in 4 ways; and 3 representatives may be chosenin(43

)= again 4 ways. Thus we have 4 × 44, where the first factor 4 counts

the ways of selecting the class which contributes 3 rather than 1.)

Could we solve this problem without using generating functions? Of course. Wefirst observe (a fact which was proved in the course of the generating function

Page 273: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1245

approach) that the only unordered partitions of the representatives among theclasses are 6 = 2+2+1+1 and 6 = 3+1+1+1, before we assign the numbers tothe classes. For example, in part (b), only the first partition is possible, and it canbe realized in the

(42

)ways in which 2 classes may be selected as the contributors

of 2 representatives. The representatives are selected for each of those classes in(42

)= 6 ways, and for each of the other two classes in

(41

)= 4 ways. In all we have

6× 6× 6× 4× 4 = 3456.

G.6 Circular permutations

You are given the integers 0, 1, 2, ..., 9. The exercise is to arrange them around theedge of a disk subject to various conditions. Determine how many circular arrangementsthere are in each of the following cases. (The disk has a distinguishable top and bottom;the problem resembles the arrangement of persons around a circular table, rather thanthe arrangement of beads around a necklace, which can be turned over.)

1. No two integers which are adjacent in the arrangement are congruent modulo 5.

2. No two integers which are directly opposite one another in the arrangement arecongruent modulo 5.

3. Every integer is congruent to one of neighbours modulo 5.

Hint: You may wish to apply the Principle of Inclusion-Exclusion. First consider theproblem for a smaller number of pairs, and verify your solution by making a list of allarrangements.Solution: Observe that for each of the integers there is exactly one other that is congruentto it modulo 5. Thus the problem concerns the pairs 0, 5, 1, 6, 2, 7, 3, 8, 4, 9.

1. Let Ai denote the set of arrangements where integer i is adjacent to i + 5 (i =0, 1, 2, 3, 4). We wish to determine the number of circular arrangements whichexclude all those in the union ∪4

i=0Ai. By the Principle of Inclusion-Exclusion thenumber we seek is the alternating sum

(10− 1)!−∑|Ai|+

∑|Ai ∩ Aj| −

∑|Ai ∩ Aj ∩ Ak|

+∑|Ai ∩ Aj ∩ Ak ∩ A`| −

∑|Ai ∩ Aj ∩ Ak ∩ A` ∩ Am|

(330)

summed over all selections of conditions. For each i, Ai consists of the (9 − 1)!circular arrangements of 9 objects (among which is the pair i, i + 5, consideredas one object, since the two integers must be positioned side-by-side) — eachassociated with one of the 2! possible permutations of the two objects. By theProduct Rule this case gives rise to (9−1)!21 forbidden permutations. The number

Page 274: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1246

of selections of one condition Ai from among 5 is(51

). Continuing in this way, we

obtain as the number of arrangements we seek

(10− 1)! −(

5

1

)(9− 1)!21 +

(5

2

)(8− 1)!22 −

(5

3

)(7− 1)!23

+

(5

4

)(6− 1)!24 −

(5

5

)(5− 1)!25 = 112 512

2. Let Ai denote the set of arrangements where the integer i is opposite i + 5 (i =0, 1, 2, 3, 4). Again the number of arrangements is given by the alternating sum(330) summed over all selections of conditions. For each i, Ai consists of the(9− 1)! circular arrangements in which objects i and i+ 5 are opposite; these areequinumerous with the linear arrangements of 8 objects (excluding i and i+ 5) —we can think of the circle as being cut open at i, and simply suppress object i+ 5,since it will always appear in a fixed position at the middle of the linear sequence.Thus

|Ai| = (9− 1)!

In general, the enumeration of the cases in the intersection of k Ai’s is more com-plicated. Every one of the cases in such a forbidden intersection induces a partitionof the set of 10 integers into 5 subsets of 2 members each. The number of such par-titions — into unlabelled pairs in which k pairs have been specified is (10−2k)!

(2!)5−k(5−k)!:

the factor (5− k)! in the denominator derives from the requirement that the 5− kparts be unlabelled. Given these 5− k pairs, and the k specified pairs, all k pairsmay be arranged cyclically in (5− 1)! ways. Finally, looking at the four integers tothe immediate right of 0, each is from a different pair; the representative of eachof the 4 pairs may be chosen in 2 ways. Thus we have a product

4!24

(10!

2!55!−(

5

1

)8!

2!44!+

(5

2

)6!

2!33!−(

5

3

)4!

2!22!+

(5

4

)2!

2!11!−(

5

5

)0!

2!00!

)i.e. 4!24 × 406 = 208 896.

3. We know that for each integer there is just one other available to be its congruent-5-neighbour. Thus we may view the arrangements that are sought as being circulararrangements of 2-element ordered pairs, each of which consists of one of the 2!arrangements of the pair; in all we have 25(5− 1)! = 768 circular arrangements.

G.7 Counting ordered partitions of a positive integer

1. Showing all your work, determine the number of solutions to the equation y1 +y2 +y3 + y4 = n with the properties that

Page 275: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1247

(a) y1, y2, y3, y4 are positive integers

(b) y1 > 1, y2 > 2, y3 > 3, y4 > 4

2. We wish to determine, in two different ways, the number fn of ways of expressingan integer n as a sum of an even non-negative integer and an odd non-negativeinteger.

(a) Determine the ordinary generating function for the sequence f0, f1, ..., fn,.... Then determine a formula for fn. (Hints: The generating function can beexpanded into power series by first separating into partial fractions (as thoughyou were planning to integrate it); however, it can be found more easily byfirst finding another power series g(y) and then replacing y by a suitable powerof x. For this problem you will need to know the power series expansion of(1 − y)−n, where n is a positive integer. This can be assumed to be what isobtained by term-by-term differentiation of the equation

(1− x)−1 = 1 + x+ x2 + ...+ xn + ...

While these procedures can all be justified algebraically, in the present casethe various series are convergent for sufficiently small x, so familiar techniqueslearned in the calculus are quite acceptable.)

(b) Solve the problem directly, without using generating functions.

Solution:

1. Define zi = yi − i − 1 (i = 1, 2, 3, 4). Then the problem transforms into countingthe partitions of n − 2 − 3 − 4 − 5 = n − 14 into 4 labelled non-negative integersz1, z2, z3, z4. These partitions are equinumerous with the binary words formed from(n− 14) 0’s and 3 1’s (serving as separators):

(n−11

3

).

This problem could also be solved using ordinary generating functions. The seriescorresponding to yi is

xi+1 + xi+2 + xi+2 + ... = xi+1(1− x)−1 .

The number we seek will be the coefficient of xn in the expansion of

x2(1− x)−1 · x3(1− x)−1 · x4(1− x)−1 · x5(1− x)−1

i.e. the coefficient of xn−14 in the expansion of (1− x)−4. We know that

(1− x)−i−1 =∞∑i=0

(n+ 3

3

)xn

in which the coefficient of xn−14 is((n−14)+3

3

).

Page 276: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1248

2. (a) The odd summand is represented by the factor

x+ x3 + x5 + ... = x(1 + x2 + x4 + ...) =x

1− x2

while the even part is represented by the factor

1 + x2 + x4 + ... =1

1− x2.

Thus the ordinary generating function in this problem is

f(x) =∞∑

n=0

fnxn =

x

1− x2· 1

1− x2=

x

(1− x2)2

To determine the integers fi, i.e. the coefficients in the MacLaurin expansion off(x), it is not practical to proceed by differentiation, since the differentiationof the quotient x

(1−x2)up to the general nth derivative would be unpleasant.

We can proceed in several different ways:

Partial Fractions: If you had to integrate the function x(1−x2)2

, you could

first express it as a sum

x

(1− x2)2 =A+Bx

(1− x)2 +C + Ex

(1 + x)2

corresponding to the identity

x = (A+Bx)(1 + x)2 + (C + Ex)(1− x)2

We can determine the constants A, B, C, E by equating coefficients oflike powers of x, or by simply assigning to x sufficiently many distinctvalues to obtain a system of equations that can be solved:

x = 0 0 = A+ Cx = 1 1 = (A+B)4 + (C + E)0x = −1 −1 = (A−B)0 + (C − E)4x = 2 2 = (A+ 2B)9 + (C + 2E)1

yielding A = 14

= −C, B = 0 = E, so the partial fraction expansion is

x

(1− x2)2 =1

4

1

(1− x)2 −1

4

1

(1 + x)2

Page 277: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1249

The expansions of 1(1±x)2

could be obtained by differentiation. It is sim-

plest, however, to work with one of them and to obtain the other bysubstitution: starting with

1

1− y= 1 + y + ...+ yn + ...

differentiate r times term by term to obtain

r!

(1− y)r+1= r!y0 +

(r + 1)!

1!y1 + ...+

(r + n)!

n!yn + ...

so that

1

(1− y)r+1=

(r

r

)y0 +

(r + 1

r

)y1 + ...+

(r + n

n

)yn + ...

implying that

1

(1 + y)r+1=

(r

r

)y0 −

(r + 1

r

)y1 + ...+ (−1)n

(r + n

n

)yn + ... (331)

Taking r = 1 yields

f(x) =1

4

(1 + 2x+ 3x2 + 4x3 + ...+ (r + 1)xr + ...)

−(1− 2x+ 3x2 − 4x3 + ...+ (−1)r(r + 1)xr + ...)

=1x1 + 2x3 + 3x5 + 4x7 + ...+ (s+ 1)x2s+1 + ...

from which we may conclude that

fn =

0 n evens+ 1 n = 2s+ 1

(We could write⌈

n2

⌉instead of s+ 1.)

Substitution in Known Series: Rather than expanding by partial frac-tions, we could have replaced y by −x2 in (331), again with r = 1, toobtain

f(x) = x(1 + 2x2 + 3x4 + 4x6 + 5x8 + ...+ (n+ 1)x2n−2

)=

(1x1 + 2x3 + 3x5 + 4x7 + 5x9 + ...+ (n+ 1)x2n−1

)as before, without the labour of computing coefficients.

(b) Since n is to be the sum of an even and an odd part, n must be odd. Assoon as the even part 2x has been chosen, the odd part is then completelydetermined to be n − 2x. We need only determine the number of differentways of finding an even non-negative integer which is not greater than n. Thenumber of even non-negative integers which are not greater than n is exactly1 + bn2c; (the 1 comes from the summand 0, which is even).

Page 278: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1250

G.8 Counting vertex-labelled graphs

1. (a) You are given 4 points, labelled A, B, C, D. Determine the number of graphs(undirected, without loops or multiple edges) on the vertex set A,B,C,D.

(b) Isomorphism is an equivalence relation on the set of graphs determined above.Determine the equivalence classes under this relation, and list one member ofeach equivalence class.

(c) For four different equivalence classes above carry out a combinatorial discus-sion to determine the number of members in the class. (For example, oneclass consists of graphs consisting of the form • − • − • − •. Labels could beattached to the vertices here in exactly 4! ways, except that this would leadto double counting: for example, we want A− B − C −D to be the same asD − C −B −A. Thus the total number of members of this equivalence classis exactly 4!

2= 12.)

2. Prufer codes. The following description of a pair of algorithms is modified fromone in a text-book. You are to read the descriptions until you understand thealgorithms, then solve the problems which follow. The descriptions are not intendedto be elegant or lucid — you must learn to read text which is formulated in lessthan perfect language. You are unlikely to gain much from referring to the originaltext-book [12, p. 223, 6.22].

“Let T denote a tree with n vertices, labelled 1, 2, ..., n. Constructa sequence of integers, a1, a2, ..., an−2 as follows:

I. Let i = 1. Let T be the tree currently under examination.

II. Among all vertices of degree 1 in the tree currently under examina-tion, select the one with the smallest label. Remove the edge thatis incident with this vertex, and let ai equal the label of the othervertex with which this edge is incident.

III. The resulting tree in II becomes now the tree currently under exam-ination. Increase i by 1, repeat II until a sequence of n− 2 digits isformed.

The degree of the vertex with label i in T is equal to the number of timesthe letter i appears in a1, a2, ..., an−2 plus one. (Whenever an edge isdeleted, the degree of the ‘non-leaf’ vertex is decreased by 1. So, if thisvertex appears i times, its degree is decreased by i. Finally, this vertexis removed as a leaf or is left as one of the two connected vertices. Itsdegree is 1 in either case.)”

Following is an algorithm for reconstructing a vertex-labelled tree from a sequencea1, a2, ..., an−2 of labels:

Page 279: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1251

“Let d(i) be the degree of vertex i which can be calculated accordingto the preceding paragraph.

i. Set i = 1.

ii. Among all vertices whose present degree is 1, find the one, vi, withthe least name. Draw an edge connecting vi to vertex ai. Eliminatevertex vi from the list, and reduce deg(Ai) by 1.

iii. If i < n− 2, increase i by 1 and go to step ii. If i = n− 2, draw anedge between the two remaining vertices (of degree 1) and stop.”

It is claimed by the author that “the algorithm always yields a tree. Further-more, the tree yielded will be the only one which will produce the original numbersequence.”54 You are not asked to verify the validity of the algorithms.

(a) Apply the preceding theory (called Prufer coding of labelled trees) to showthat there are precisely 100,000,000 distinct trees with 10 vertices labelledwith distinct labels 1, 2, ..., 10.

(b) Determine the number of vertex-labelled trees having 15 vertices: 5 verticesof degree 2, 6 vertices of degree 1, and 4 vertices of degree 3.

(c) Compile a catalogue of the labelled trees of up to 4 vertices.

(d) Compile a catalogue of the isomorphism types of trees having 5 vertices. Foreach of these types determine the number of ways of assigning labels 1, 2, 3,4, 5 to its vertices. Verify that the sum of the various numbers of ways is 53.

Solutions:

1. (a) There are exactly(42

)edges that may or may not be chosen: may be thought

of as subsets of this set of available edges; i.e. the set of graphs correspondsto the power set of AB,AC,AD,BC,BD,CD (where XY = Y X). Thusthe number of graphs is 26 = 64.

(b)+(c) We will list the various equivalence classes in order of the number of edges.

0 edges: There is only one graph of this type.

1 edge: Choose the ends of the edge in(42

)= 6 ways. There is no restriction

on the other vertices: there are 6 graphs.

2 edges sharing a vertex: Choose the central vertex in(41

)= 4 ways, then

its two adjacent vertices in(4−12

)= 3 ways; the last vertex is then deter-

mined. There are 4× 3 = 12 graphs of this type.

54After the term is over, students who are interested in further reading on this subject could consult[15], [9, §2.3.4.4].

Page 280: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1252

2 edges not sharing a vertex: Choose one pair of adjacent vertices in(42

)ways; the other pair are then determined. This argument, however, dis-tinguishes between the edges — one is designated as that chosen first,while the other is then determined. Thus this could will include eachgraph twice. The number of graphs of this type is

(42

)/2 = 3.

3 edges forming a triangle: Choose the point not in the triangle in(41

)= 4

ways; the structure is then completely determined. There are 4 graphs ofthis type.

3 edges forming a path: We considered this earlier, and found that therewere 4!/2 = 12 such graphs.

3 edges forming a “star” (one central point adjacent to three oth-ers): Choose the centre of the star in

(41

)= 4 ways; the others are then

completely determined, so there are 4 graphs of this type.

We have listed above all cases with up to 3 edges. The graphs with 4 or moreedges can be associated with their complements, having 2 or fewer edges. Sothe total number will be

1 + 6 + 12 + 3 + 4 + 12 + 4 + 3 + 12 + 6 + 1 = 64

2. (a) The Prufer codes are (n − 2)-tuples of labels selected, with repetitions per-mitted, from the set of n labels 1, 2, ..., n for the vertices of an n-vertex tree.For any n there are precisely nn−2 available codes, hence nn−2 labelled trees.For n = 10 there are 100, 000, 000 labelled trees.

(b) In the Prufer code for these trees there will be 5 symbols appearing 2− 1 = 1time; 6 symbols appearing 1−1 = 0 times; and 4 symbols appearing 3−1 = 2times. The number of 13-permutations of 4 distinct symbols appearing twice,and 5 distinct symbols appearing once is P (13,13)

2!41!5= 13!

16. The number of ways

in which the symbols having these weights may be selected from a populationof 15 distinct labels is

C(15, 4)C(15− 4, 5) =

(154

)(115

)=

15!

4!11!

11!

5!6!=

15!

4!5!6!;

hence the total number of trees of this type is 15!13!4!5!6!24 .

(c) The isomorphism types can be determined recursively by adjoining a new leafto a tree with one fewer vertex. For n = 1, 2, 3 the only isomorphism type oftree is a path of length n− 1; for n = 4 there are 2 types: the path, and the“star” — a tree with one vertex of degree 3. We will not show the labelledtrees explicitly here. Their numbers of labellings can be determined easily:

Page 281: Notes Distributed to Students in Mathematics 189-240A (1999/2000)

Notes Distributed to Students in Mathematics 189-240A (2000/2001) 1253

n = 1: One label may be assigned in 1 way to one vertex.

n = 2: There are 2! 2-permutations of 2 distinct symbols; but the labelling ofany path may be associated with 2 such permutations, depending uponwhich leaf is chosen as “first”. The number of these labelled trees is2!/2 = 1.

n = 3: As in the preceding case, the number of labelled paths is 3!/2 = 3.

n = 4 (path): As in the preceding case, the number of labelled paths is4!/2 = 12.

n = 4 (star): The label for the vertex of degree 3 may be assigned in

C(3, 1) = 4

ways; the assignments of the other labels are then determined up to iso-morphism. There are thus 4 labellings of this type, which, with thelabellings of the path, yield 12 + 4 = 16 = 44−2 labelled trees.

(d) Using the algorithm described in the preceding part, we can see that thereare 3 isomorphism types: the path, the star, and a tree with one vertex ofdegree 3 from which emanate two paths of length 1 and one path of length 2.The number of paths is, as before 5!/2 = 60; the number of stars is, as beforeC(5, 1) = 5; in the remaining case the vertex of degree 3 may be labelled in5 ways, after which the labels for the two leaves that are one edge away fromit may be chosen in C(5 − 1, 2) = 6 ways; of the remaining 2 labels, one isselected to be assigned to the vertex of degree 2 — in C(2, 1) = 2 ways. Thistree can be labelled in 5× 6× 2 = 60 ways; in all, trees on 5 vertices can belabelled in 60 + 5 + 60 = 125 = 55−2 ways.