CMPSCI 250: Introduction to Computation
David Mix Barrington
This is the home page for CMPSCI 250.
CMPSCI 250 is the undergraduate core course in
discrete mathematics and will deal with logic, elementary number theory,
proof by induction, recursion on trees, search algorithms,
counting, and probability.
Instructor Contact Info:
David Mix Barrington, 210 CMPSCI
building, 545-4329, office hours Tues, Wed, Thu, and Fri 11-12 am.
I generally answer my email fairly
TA Contact Info: Siddharth Srivastava, email@example.com, 5-2502. Office hours in LGRT 220, Mon 4-5
and Tue 2:30-3:30.
The course is primarily intended for undergraduates in computer science
and related majors such as mathematics or computer engineering. CMPSCI 187
(programming with data structures) and MATH 132 (Calculus II) are corequisites
and in fact most students in the course have already taken both.
The course will meet for three lecture meetings a week, MWF 2:30-3:20
in ELAB 323.
There is one discussion section, meeting Wednesday 1:25-2:15, also in ELAB
This will consist of students solving specific
problems alone or in groups and handing answers in, so that missing a discussion
will incur a grade penalty. (Note that there is no discussion meeting
on Wed 5 September, the first day of class.)
There is also an honors section for the course called CMPSCI H11,
a one-credit seminar
intended for undergraduates in Commonwealth College (but open to non-CC
students as well if there is room). In this we will read
Hofstadter's Godel, Escher, Bach and discuss how it relates to the
topic of the main course. The seminar will meet on Fridays 1:25-2:15 in room
343 of the computer science building, beginning 14 September.
Announcements (21 December 2007):
- (21 Dec) I have posted the final exam
and its solution. I have also completed and
posted grades -- if you urgently need to know your grade before it is
on SPIRE, please email me.
The scale on the final was A = 112, B = 91, C = 70, D = 49, F = 28. The
30 scores were:
- A+: 118
- A: 112, 112
- A-: 105, 103, 102
- B+: 99. 98. 96
- B: 92, 92
- B-: 85, 83
- C+: 80. 80, 78
- C: 72, 70
- C-: 66, 63, 60
- D+: 56, 54, 53
- D: 48, 46
- D-: 44
- F: 35, 28, 28
For final grades, I gave two A's, two A-'s, six B+'s, one B, four B-'s,
six C+'s, four C's, one C-, two D+'s, and two D's among the 30 people who took
the final. The students who got grades below C should repeat the course before
taking anything that has CMPSCI 250 as a prerequisite.
Thanks to all of you for your hard work and your company through the
semester. Happy holidays!
- (15 Dec) I will be in my office 1-4 p.m. on Monday 17 December. I will
also be reading email through the weekend.
- (15 Dec) Here is the outline of the material for the test that I presented
last Friday. Each of the twenty bullet points will have about equal emphasis
in my planning of the final exam, so most but not all of them will show up:
- Part I: Logic
- Definitions: Sets, Strings, Propositions, Operators
- Boolean Logic: Propositional Proofs
- Predicate Logic: Quantifier Proofs
- More Definitions: Relations, Functions, One-to-One, Onto, Equivalence
Relations, Partial Orders
- Part II: Number Theory and Induction
- Primes and Divisibility
- Euclidean Algorithm, Inverse Theorem, Chinese Remainder, Unique
- Definition of the Naturals, Ordinary Induction, Variants
- Applications of Induction: Graphs/Paths, Problem Solving
- Part III: Graphs, Trees, and Search
- Graphs, Adjacency Matrices, Path/Matrix Theorem
- Trees, Recursive Definitions
- Breadth-First and Depth-First Search, in General and on Graphs
- Uniform-Cost and A-Star Search
- Part IV: Counting and Probability
- Basic Counting: Sum and Product Rules
- Double Counting and Inclusion/Exclusion
- First and Second Problems (Sequences and No-Repeat Sequences)
- Third Problem: Counting Subsets, Applications to Poker Hands
- Fourth Problem: Counting Multisets
- Basic Probability, Applying Counting Rules
- Expected Value and Variance
- Binomial Distribution and the Normal Approximation
I also mentioned a specific type of problem combining probability with other
sections of the course. For example, I might give you a propositional formula
(a compound proposition) and ask you the probability that it is true given that
each atomic variable is set true or false with equal probability. Or I might
say that a binary relation R on a set of n elements is set by flipping a coin to
determine the value of each proposition R(i,j), and ask you the probability that
R is a partial order.
- (10 Dec) The final exam next week will consist of about 40% from the
last quarter of the course (Chapters 6 and P), 20% from the third quarter
(Chapter T and parts of 8), 20% from the second quarter (Chapters 3 and 4)
and 20% from the first quarter (Chapters 1 and 2). The final exams from
the last three times I taught the course are about the right length and
difficulty, but they include material on Chapters 9 and 10 that we didn't do
this year. Here is specific information on which questions on which exams
would be fair game this year:
- Spring 2006 Final Exam:
Question 1 is off-topic for Fall 2007. For Question 2, parts (a) and (b) are
ok but (c) and (d) are off-topic. Question 3 is off-topic. Question 4 is fine.
Note that the main induction proof on this exam is 1(d) -- the Fall 2007 exam
will certainly have at least one induction proof.
- Spring 2005 Final Exam:
Question 1 is fine. Question 2(a) is fine, 2(b) is marginal because we only
briefly talked about regular expressions, and 2(c) is off-topic. Question 3
is fine. For Question 4, parts (a) and (b) are fine because they are just
logic questions and don't depend on the meaning of the predicates. Parts (c)
and (d), which do depend on the meaning, are off-topic.
Fall 2004 Final Exam:
Questions 1 and 2 are off-topic. Question 3 is fine. Question 4 parts (a) and
(b) are fine, (c) and (d) are off-topic. Questions 5 and 6 are fine.
Fall 2004 Practice Exam:
Questions 1 and 2 are off-topic. Question 3 is ok except that it depends on
languages defined by regular expressions. Such simple regular expressions as
these are fair game, though I would also define the languages in English if I
used them this year. Questions 4 and 5 are fine.
- (7 Dec) Today in class I mentioned
post by economist Brad Delong, on the expected value of a particular game
involving drawing balls from a hat. The case with two white balls and three
black balls is interesting and easier to analyze by hand than that of four
white balls and six black balls.
- (6 Dec) The solutions to Discussion #9
and Discussion #10 (yesterday's) have been posted.
- (27 Nov) The last two homework assignments have been posted.
Homework #7 is all group problems, and
Homework #8 is all individual problems. I've also
added some corrections, some relevant to the homework, to the
- (27 Nov) I've now graded all the exams. The scores and their letter
- A+: 95, 94, 94
- A: 89
- A-: none
- B+: 80, 80, 77, 75, 75
- B: 74, 73, 72
- B-: 68, 64
- C+: 61, 60, 60, 59, 59, 58, 58
- C: 55
- C-: 49, 46, 45
- D+: 44, 43, 41, 39
- D: none
- D-: 32
- F: 8
The median was a 60. As I said in class, those with C- or even D+ test
averages still have a chance at a C for the course if their discussion and
homework grades bring them up. Also, the final exam will count for 50% of the
total grade rather than 25%, if this is to your benefit.
- (26 Nov) The third exam is up -- solutions will
follow soon. I handed back graded exams today, except for the three people who
took it today. The scale is A = 90, C = 54, and I am not giving a makeup as I
did for the first two. (Statistics will follow when I've graded those other
- (26 Nov) As we decided in class today, Homework #7 will be all group
problems and Homework #8
will be all individual problems. Both will be due at the
end of the last day of classes, Friday 14 December, in class. Paper solutions
will be given out then. I will post the two assignments shortly, probably
- (15 Nov) The practice exam solution
is now posted. The scale on this would have been about A = 90, C = 60,
contrary to what was posted on the exam itself.
- (15 Nov) As I noted by email, I cannot make my office hours tomorrow
(Fri 16 Nov) because of a faculty retreat. The lecture and honors class
will occur as normal. If you have to miss lecture for the student strike
or any other reason, read sections T.6 and T.7 carefully and try to talk to
someone who was in class.
- (14 Nov) I've posted the practice exam
for the third midterm. Please email me if you anticipate a conflict for the
exam next Tuesday evening. I'll post solutions for the practice exam on
- (12 Nov) The Q&A section now has two questions
and answers on HW#5 -- one was emailed to you, and the other is a correction
of my syntax for creating a two-dimensional array in Problem 8.2.4.
- (9 Nov) Because the material of this section of the course is new,
previous third midterms from my offerings of 250 are not a good guide for the
third midterm here (which is on Tuesday night, 20 November). I hope to post
a practice test by next Tuesday, similar in content, length and difficulty to
the actual test.
- (9 Nov) I've posted the notes for this week's
discussion and the assignment for HW#5 (all group
questions, due next Wednesday) and HW#6 (all
individual questions, due Monday 19 November). These two aassignments are
shorter than the others (60 points rather than 100) but will be weighted the
same -- 3% of your final grade each, unless they are the worst of your eight
HW's (dropped) or the next worst (weighted 2%).
- (1 Nov) I've posted notes for yesterday's discussion
- (1 Nov) I've graded the makeups from yesterday. The good news is that six
people got perfect scores, adding to the three who got those two questions
perfect on the original midterm. The bad news is that about half the 25 people
who took the makeup had no improvement at all (the half that did gained an
average of five points each).
I'll go over these proofs again in class on Friday, along with finishing the
discussion of the Path/Matrix Theorem and its applications (section 8.3). So
material from Chapter T will start Monday, with or without the book. (The start
of the Chapter T material is also covered to some extent in sections 4.10 and
8.11, which you do have.) Some common errors on the makeup (and the induction
problems on the original:
- People wrote that P(n) was "for all naturals n, something happens for n".
But the whole point of the induction is that P(n) is just "something happens
for n", and the goal of your proof is to show ∀n:P(n). Only in a strong
induction does the thing you're trying to prove include a quantifier -- Q(n)
- I gave a lot of credit to people who got everything but the algebra, but
there were many people who thought they had everything but the algebra but
didn't. Before doing the algebra in the first problem, you needed to (1) prove
the base case, (2) state both P(n) and P(n+1), (3) state that G(n+1) = G(n)
+ F(3n+4), using the definition of G, (4) apply the inductive hypothesis to
get G(n+1) = (1/2)F(3n+3) + F(3n+4), and (5) indicate that your goal is to show
this right-hand side equal to (1/2)F(3n+6). Similarly, on the second problem
you needed to prove P(2) and P(3), state P(n-1), P(n), and P(n+1), and indicate
how to use the two inductive hypotheses in P(n+1). Then you've reduced
it to algebra.
- Lots of people were making insane claims about the Fibonacci numbers,
like F(3n+3) = 3F(n+1). The key point about these proofs is that you use
only the facts about the concepts that you are given. You don't know
anything about the Fibonacci numbers except what was given on the test paper
and what you can prove from that.
- It was actually possible to prove the second identity, F(n+2) + F(n-2) =
3F(n), without induction. Some of the perfect scores on this question in fact
gave trivial (but correct) proofs for "Q(n) → P(n+1)" by just proving
P(n+1) -- this was still a valid inductive step. Usually, though, you want to
be sure that you have used the IH in your proof, because usually it's needed.
(Though "trivial", the non-inductive proof was more complicated than the
inductive proof I had in mind.)
- (29 Oct) I'm interested in any feedback you want to give me as I revise
the homework groups -- do you want to keep one of your current partners, or
not keep them? The simplest thing is simply to assign completely new groups
based on performance so far in the course, but if you'd like to request keeping
a current partner let me know and I will see. I'm planning to announce the
new groups before Wednesday's discussion.
- (29 Oct) A reminder that today is the W-drop date, the last day to
drop a course without special permission from your academic dean. If you are
doing badly in this course, you should know that I am fairly generous in giving
D's rather than F's to students who continue in a course to the end. The only
really good reason to drop the course, if you are a major or minor who must pass
it eventually, is if you can redirect the effort to other courses and thereby do
Note that if you miss today's deadline and still want to drop, there may be
options. I'm an academic advisor as well as your instructor and I'd be happy
to discuss your individual case in person or by email.
- (29 Oct) Further ground rules on the makeup on Wednesday. You will
have an hour. There will be two 20-point questions. Both will be induction
proofs on naturals (no string inductions or inductions on paths). There may
be strong induction, induction on the odds or evens, or induction starting
after 0, as in Section 4.4. At least one of the two problems will
involve Fibonacci numbers.
- (29 Oct) There were 31 completed second midterms, with scaled letter grades
as follows (this is before any improvements from the makeup):
- A+: 97, 93
- A: none
- A-: 82
- B+: 80, 76, 76
- B: 72, 71, 69, 69
- B-: 66, 66, 65, 65
- C+: 62, 62, 62, 60, 58, 57, 57
- C: 54
- C-: 49, 48, 45
- D+: 40, 40, 40
- D: 36, 34
- D-: 32, 27
- F: 15
- (29 Oct) I've posted the second midterm
and its solution. The scale will be A=90 and C=54 --
I will give aggregate scores after I have graded the makeups taken today.
I was disappointed with the scores on Questions 1 and 2, so once again I will
offer a second chance at similar questions, during the scheduled lecture
period on Wednesday 31 October. (We'll delay the lecture material by one
period, since the next course packet is not ready yet.) As with the makeup
for the first exam, this is entirely optional and can only help you. If your
total score on the 40-point makeup is higher than your score on Questions 1 and
2 of the original exam, I will replace your original score by the average of the
- (29 Oct) The HW#5 assignment will not be ready until Wednesday or perhaps
even Friday, since it will come from parts of the book that are not yet ready.
There will be some questions from Chapter 8, which I may give you earlier.
- (24 Oct) Several students have conflicts with the scheduled evening exam
tomorrow night. I will offer a makeup during 9:00 a.m. through noon on Monday
29 October -- come to my office and I will give you a two-hour window. Please
email me if you want this option, explaining why (exam conflict, medical
- (24 Oct) I need to cancel my office hours for Friday 26 October. I will
be around after class until 4:30 in my office.
- (24 Oct) I have posted solutions for today's
- (18 Oct) I have posted solutions for yesterday's
- (16 Oct) I've graded the makeup tests and recorded the new scores - these
will be handed back tomorrow. There were 21 students who took the midterm, and
they averaged a gain of about five points each. (The four students who did not
improve on their original scores did not thereby lose any points.)
- (6 Oct) I've decided to give you two more days to complete HW#3, so it
is now due Friday 12 October in class. I've also just posted
the HW#4 assignment, which is due on Wednesday 24
October in class, the day before the second midterm. Once again we plan to
give out solutions to HW#4 at the time you hand it in, but of course we won't
have it graded until after the exam.
- (5 Oct) I have posted the solution to Discussion
#4 from last Wednesday. Note that one of the homework problems is very
similar to the last problem of the discussion.
- (5 Oct) The next piece of textbook, Chapters 4 and 8, will be available
at Collective Copies starting tomorrow morning as course packet #77 for $15.
The final course packet (Chapters T, 6, and part of P) will be available at
the end of October.
- (5 Oct) There is a correction to problem 2.10.5 on HW#2 -- see the
errata page. This is the same error that I emailed you
- (5 Oct) I now know of only two students who have not found their
homework groups. If two of you cannot find the third by this point, you should
operate as a two-person group, but please let me know by email if this has
happened. If you are the third person, you will need to meet with your group
to get credit -- let me or Siddharth know if you need help.
- (2 Oct) Here's a breakdown of all 34 scores on the first midterm:
- A+ (1): 96
- A (3): 95, 94, 91
- A- (2): 88, 87
- B+ (3): 83, 80, 79
- B (3): 76, 74, 72
- B- (1): 66
- C+ (4): 65, 53, 62, 61
- C (4): 58, 58, 56, 54
- C- (3): 53, 51, 50
- D+ (4): 47, 44, 44, 44
- D (2): 41, 39
- F (4): 24, 19, 17, 13
The D's and F's should talk to me if you haven't already. There is no
reason that any of you can't pass, and if you stay with the course and don't
pass I am likely to give you a C- or D rather than an F (which would still mean
that you would repeat the course to use it for the major, with only the new
grade being used for your GPA). The only reason to drop at this point would be
if the effort needed to continue in the course would have too negative an
effect on your other courses.
- (2 Oct) I've posted the third homework assignment,
due a week from tomorrow, Wed 10 October. This is half individual and half
group -- here are the twelve groups:
- Group A: Mitchell, Nguyen, Wheeler
- Group B: Amirault, Delorie, Esposito
- Group C: Mohiuddin, Roy, Walsh
- Group D: Flamand, Lecesse, Mazur
- Group E: Alves, Phelps, Pulsford
- Group F: Frontino, Pullen, Wagner
- Group G: Clark, Slinski, Wexler-Romig
- Group H: Day, Monska, Salnikov
- Group I: Chernick, Pellerin, Yuen
- Gtoup J: Gummeson, Kirby, Levitin
- Group K: Carmosino, Kimball, Price
- Group L: Greenwood, Kanjilal, Pacifico
Please let me know by email if there is a member of your group you haven't
contacted by the end of the day tomorrow (Wednesday). Note that discussion
groups will continue to be assigned randomly for each discussion.
- (1 Oct) Graded HW#1 papers were returned in class today. The scale was
A = 90, B = 72, C = 54, D = 36, F = 18. Please try to be more careful in your
future submissions to make your handwriting readable and to indicate which
problem you are attempting to answer where. This might mean recopying after you
first answer the problems.
- (1 Oct) HW#3 will be the first homework with a group component. Half
the questions will be individual (so that each student will hand in a separate
paper) and half will be group (with one paper handed in by a group of two or
three people). Groups will be assigned and announced here, probably
tomorrow. Both components will be due Wed 10 Oct in class.
- (1 Oct) Because I was disappointed with the overall performance on
Questions 2 and 3 on the exam (the propositional proof and the predicate proof)
I'm going to give you another chance at that type of question. We have a Monday
schedule on Tuesday 9 October, on which I had planned to give you a day off
because I will be in Germany. (Siddharth will lecture on Wed 10 Oct and Fri
12 Oct -- there will be no discussion or honors class that week). What I will
do on 9 October is have an optional retest, where you will have an hour to do
a question similar to #2 and a question similar to #3. If it helps you,
I will recompute your Test #1 grade to have the retest average with your
original #2 and #3. (So you could gain up to 20 points on Test #1, depending on
how badly you did on #2 and #3.)
- (1 Oct) I've just posted the first midterm
and its solution. Graded exams were distributed in
class today -- if you did not get yours I will have it at office hours and in
class. The scale for this midterm is A = 93, B = 75, C = 57, D = 39, F = 21
(the number given is the middle of the grade range, so that a 93 maps to 4.0).
I'll have more detailed stats on the results soon.
- (28 Sept) The university has scheduled our final exam for 1:30-3:30 on
Tuesday 18 December in ELAB 303 (at the other end of ELAB from our classroom).
- (26 Sept) I've posted solutions for Discussion
- (26 Sept) Paper solutions for HW#2 were handed out in lecture class today.
I'm sorry that I haven't been able to get HW#1 graded for you yet, but we
should get that done shortly and be able to get back on a regular schedule for
grading. I will probably have the midterms graded by Monday.
- (26 Sept) The exam tomorrow night is in ECSC 119 -- ECSC is the building
just south of the computer science building with the large curved silver wall.
We start at 7:00 and you have two hours. Note that several people will take
the exam late due to conflicts, so please do not discuss the exam with anyone
until Monday's class unless you saw them take the exam with you. Thanks -- the
fact that I can consider students to be mostly trustworthy is what allows me to
be flexible with makeup exams.
- (21 Sept) I've posted solutions for Discussion
- (20 Sept) I've started a Q&A page for HW#2.
- (20 Sept) A few students have asked me for suggested references beyond
the textbook. A good guide to proof techniques is How to Read and Do Proofs
by Daniel Solow, ISBN 0-471-51004-1. It goes through equational and
deductive sequence proofs, and the four proof rules for quantifiers, in much
more detail and with more examples than I have in my book. The list price is
around $40 but someone purports to be selling it new for $10 at Amazon...
- (19 Sept) There's an error in one of the HW#2 problems
-- the correction is on the assignment page and on
the errata page.
- (19 Sept) Siddharth will be away from this Friday through next Wednesday:
I will have office hours in my office during his scheduled times on Monday
24 and Tuesday 25 September, along with my normal hours.
- (14 Sept) I have posted the HW#2 assignment in
case you want to start on it early. It is due Wed 26 September, the day before
the first midterm. I plan to distribute paper solutions to HW#2 as I collect
your submissions in lecture class that day.
- (13 Sept) I have posted solutions to Discussion #1
. Hardly anyone got to the program correctness questions, which was all
right, but please look at the solutions to these questions to get an idea of
how one might argue that a program is partially correct and that it terminates.
- (10 Sept) If you are planning to take the course and you are not registered
for it on SPIRE, please fix this (and let me know if you need help). If you
haven't filled out an information sheet, please do -- I will have more at
today's lecture. Finally, the honors section will meet 1:25-2:15 Fridays in
a room to be determined. The honors assignment for this Friday is to (1) register on
SPIRE for CMPSCI H11, (2) buy Godel, Escher, Bach by Hofstadter at any
physical or online bookstore, and (3) read the Introduction, Chapter 1 and the
first two dialogues (through page 45).
- (10 Sept) I have posted and answered two student
questions on HW#1. One of them led to a slight edit in Problem 1.4.5 (h)
which you may find on the new page for errata in the
textbook. I'll discuss this in lecture today.
- (7 Sept) I've now posted the requirements and
grading page, the homework assignment index page, and the
HW#1 assignment, due in class a week from Monday.
- (5 Sept) I enjoyed meeting you all today. Good news -- I have Siddharth's
office hours now. Bad news -- the "Chapters 1-4" packet from Collective Copies
actually contains only Chapters 1-3, due to my error. You should still get it,
and I will get Chapter 4 there before we start using it.
- (2 Sept) The first class will be at 2:30 Wed 5 September, in ELAB 323.
There is no discussion meeting on Wednesday, but I will be in ELAB
323 at 1:25 to answer any questions about the course or do general undergraduate
advising. I will also be keeping my newly announced office hours (TuWThF 11-12)
- (2 Sept) The textbook for the first half of the course, Chapters 1-4 of
my draft book, will be available at
Collective Copies in downtown Amherst (71 S. Pleasant st., on the west side
of the common near Hastings), starting Tuesday morning 4 September. The cost is
$21, and the second half cost will be comparable. If you have a copy of those
chapters from the Spring 2006 offering of the course, they will be the same --
copies from earlier semesters will be of steadily less use. Note also that
Collective Copies are closed to retail business until Tuesday morning.
- (29 Aug) The syllabus is now up in a
preliminary version. I plan to give the first half of the textbook (chapters
1-5) to Collective Copies tomorrow, and I will announce here when it is
available. Previous versions of these chapters will be fine if you can find
them from other students. The current plan is for the third quarter of the
course to use new material and for the fourth quarter to use chapters 9 and 10
of my book, basically unchanged from previous versions.
- (27 Jul) Welcome to the preliminary version of the web site for CMPSCI
250 for Fall 2007. I am setting up the bare bones of the web site today.
In most respects the course will run like the Spring
2005 version of CMPSCI 250. One difference is in the syllabus -- the
third quarter of the course will deal with recursion on trees and search
algorithms rather than counting and probability as in previous versions of
CMPSCI 250. The text will be largely the same as was used in Spring 2006 and
Spring 2005, except that there will be a new chapter for the new material.
The new texts are not available yet -- I will post here when they are ready.
Last modified 21 December 2007