# CMPSCI 250: Introduction to Computation

### Spring, 2005

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, combinatorics, graphs, finite automata, regular languages, and a brief introduction to Turing machines.

Instructor Contact Info: David Mix Barrington, 210 CMPSCI building, 545-4329, office hours Monday 10-12, Thursday 1-3.

TA Contact Info: Nadia Ghamrawi, office hours Tuesday 4-5, Wednesday 3-4 in LGRT 220.

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 1:25-2:15 in Lederle A301 (the low-rise).

There are two discussion sections, one meeting Monday 2:30-3:20 and and the other Wednesday 11:15-12:05, both in Lederle A203. These will consist of students solving specific problems alone or in groups and handing answers in, so that missing these classes will incur a grade penalty.

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 meets Fridays 11:15-12:05 in Room 140, Computer Science Building, starting Friday 4 February.

Important Course Material:

Announcements (19 May 2005):

• (19 May) Ok, I've now calculated grades for the final and for the course. On the final I stayed with the announced scale of A=110 and C=70. There were 48 people who took the exam:
• 7 A+: 130, 129, 124, 121, 117, 116, 116
• 2 A: 113, 107
• 2 A-: 104, 102
• 5 B+: 97, 96, 95, 94, 94
• 9 B: 93, 92, 90, 90, 90, 90, 89, 88, 88
• 4 B-: 84, 83, 82, 81
• 6 C+: 78, 78, 78, 77, 76, 75
• 5 C: 73, 72, 71, 71, 69
• 5 C-: 65, 65, 65, 63, 62
• 3 F: 40, 39, 36

For overall grades in the course, with a little generous rounding I wound up giving C or better to all but the three people who failed the final. They each got D+ or D and should repeat the course before continuing with 311 or anything else that requires 250. Overall distribution was:

• 4 A+ (reported to SPIRE as A)
• 2 A
• 4 A-
• 2 B+
• 11 B
• 8 B-
• 8 C+
• 5 C
• 0 C-
• 2 D+ (neither at all close to a C-)
• 1 D

So I am now willing to email out grades. (Someone suggested putting them on the yahoo group with student-id's, unfortunately I'm not willing to bet your grades on the privacy of the group.) Give me an email to reply to and I will do so. If it's not in the next half-hour or so it will be later tonight.

• (17 May) I've just posted the final exam and its solution. I have not finished grading the finals yet. Sometime tomorrow or (more likely) Thursday, I will announce that I have final grades available. You may email me for your grade at that time, and pick up your final from me if you can find me in my office. (I expect to be around through this week.)
• (13 May) Graded HW#7's are available in the CMPSCI main office, which is open until 5:00 pm today. I've also emptied my backpack of other graded work, like the last few discussions (but not Discussion #11, which I have yet to grade). I'll bring the whole box of stuff, along with the midterms that weren't picked up, to the exam tomorrow.
• (12 May) HW#8 solutions are avialable at Nadia's site. Graded HW#7's may be ready in the main office tomorrow -- I will let you know.
• (10 May) A student has pointed out that Problem 9.8.5 makes no sense, since the construction of the chapter is to make a λ-NFA and I only gave you a class definition for a DFA. So the question is withdrawn, and full credit for HW#8 is only 90 points. (The eventual scale will be adjusted accordingly.) Sorry for the mistake, and that I didn't catch it earlier.
• (6 May) I've posted the first question and answer for HW#8, which deals with the correction to Figure 10.3 on page 10-6 that we found in lecture today.
• (6 May) I was asked in lecture today about the final exam. It will be similar to the practice and real final from last fall. About half of it will cover the last quarter of the course (since Midterm #3) and the rest will cover the first three quarters of the course. If I can think of good questions to deal with last-quarter and earlier topics simultaneously, I will use them.
• (4 May) I have posted solutions for last week's Discussion #10 and this week's Discussion #11.
• (4 May) Graded HW#6's were returned in lecture today. Scale was A=85, C=55.
• (2 May) I have just posted the HW#8 assignment. It is due a week from Wednesday, 11 May, either in class or to the CMPSCI main office by 4:00 p.m. (it's difficult for the staff if people are rushing to hand in homework just as they're trying to close up shop).
• (1 May) I've just answered two more HW#7 questions on the q&a page. Sorry these are so late, but the department web server had some kind of problem this morning and I couldn't change the web pages. The last student question revealed that I did not ask what I intended to in Problem 9.3.5 -- I meant you to prove "∀u:∀w:∃v: uv≡Lw" rather than what I said. If you prove the easier statement I asked it will be fine -- see the answer to the question that I posted. Or you could answer the question I meant to ask, if you have time.
• (28 Apr) I got some good questions on HW#7 in my office hours today -- answers are posted on the Q&A pages.
• (25 Apr) Here are more detailed results on the third midterm. There were 49 exams, distributed as follows:
• A+ (95-105): 5, top was 105, second was 99
• A (90-94): 9
• A- (85-89): 7
• B+ (80-84): 3 (including the median, a 79)
• B (75-79): 4
• B- (70-74): 2
• C+ (65-69): 7
• C (60-64): 2
• C- (55-59): 6
• D+ (50-54): 1
• D (45-49): 1
• F (0-44): 2 (26 and 30)
• (24 Apr) OK, the HW#7 assignment is now posted.
• (24 Apr) I've posted the third midterm and its solution. I'll post complete stats tomorrow after I've graded one more exam, but in general people did pretty well. The median so far is 77, a B. There are 21 of 48 A- or better, and only four D+ or below. The scale is A=92, C=62. I made two mistakes in drawing up the exam. The first, which was noticed, was that in 3 (b) it is possible to get 20 in Blackjack by an ace and a nine as well as by two tens or face cards. The second, which I caught only when adding the scores, is that there are only 95 ordinary points plus ten extra credit, because Question 4 is 20 points though it says 25 on the front page. (One student got a perfect 105, the next highest was 99.)
• (24 Apr) The HW7 assignment will be posted shortly. It will be due a week from tomorrow, so I will try to keep it short.
• (20 Apr) Remember that tomorrow is a Monday schedule. I will hold my Monday office hours 10-12, and will have an optional review session for the exam during class time, 1:25-2:15 in LGRC 301. The exam is 6-8 p.m. in the same room in Goessman.
• (17 Apr) I've posted two questions and answers on HW#6, though one is a typo in the book (not in a Problem) and the other is actually an unrelated problem. I hope that people have started on the homework -- if you email me questions I can post the answers...
• (17 Apr) I've decided that Thursday's lecture will be a review session for the exam. On Wednesday I will cover parts of sections 8.1, 8.2, and 8.3, leaving out the one-step distance matrices and Floyd's algorithm (hence all of 8.3.3). For the test you should be ready for a problem like Question 5 on last term's real exam.
• (15 Apr) Nadia noticed that the Risk problem, 7.6.3 in this term's brown book and thus assigned for HW#6, was Problem 7.6.2 in last term's book. So if you have the yellow book, make sure you're doing the right problem...
• (13 Apr) I have posted the Discussion #9 solution, from earlier this week.
• (13 Apr) The campus-wide protests planned for 21 April may affect the schedule for this course. I don't plan to move the exam that evening, but we may replace the lecture with an optional review session in the same time and place. No student will be penalized in any way for participating in the protests.
• (11 Apr) I have posted the HW#6 assignment, due Wed 20 April.
• (11 Apr) Note the abnormalities in the schedule next week. Mon 18 April is a holiday, and Thu 21 April has a Monday schedule. There is no discussion that week, but two lectures and our third midterm. The timing clearly limits how much material from the last two lectures (20 and 21 April) will be covered on the test.
• (10 Apr) I have answered another question on the question and answer page for HW#5.
• (6 Apr) The scale for the second midterm was A=93, B=75, C=57, D=39, F=21, with pluses and minuses as appropriate. (So 96+ is A+, 90-95 A, 84-89 A-, and so forth with six-point intervals.) The fifty scores were as follows:
• 100's: 104, 104, 104, 102, 100
• 90's: 95, 94, 92, 92
• 80's: 89, 87, 86, 86, 84, 81, 80
• 70's: 78, 76, 74, 74, 73, 71, 71, 70
• 60's: 69, 69, 69, 68, 65, 64, 63, 62, 61, 61, 60, 60
• 50's: 56, 55, 52, 50
• 40's: 46, 45, 43, 41, 41
• 30's: 39, 33, 33
• 20's: 29, 20

So the median was 69, and the mean was 68.

• (6 Apr) The scale for HW#4 (returned in lecture today) was 75=A, 70=A-, 65=B+, and so forth. (It is lower than usual because the Hasse diagram question was judged (by me) in retrospect to have been too hard.) The papers not picked up are in an envelope in the pickup box in the CMPSCI main office.
• (6 Apr) I've posted the first question and answer on HW#5 and I will add more answers as questions come in. I will try to also keep up with the Yahoo group but if you want to make sure that I see a question, email it directly to me.
• (6 Apr) The Discussion #8 solutions are up. I hope to get caught up on the other web postings tonight.
• (1 Apr) The text and solutions to the second midterm are now available.
• (1 Apr) I hope to have the midterms graded over the weekend.
• (1 Apr) I've just adjusted some of the remaining homework deadlines on the homework assignment index page. In particular, HW#5 is now up and is and due a week from Monday (11 Apr), rather than 8 Apr as it said before.
• (30 Mar) I mistakenly said on the Yahoo group that tomorrow night's exam is in the new engineering building -- in fact it is in Goessman 20, the same room as the first exam, from 6-8 p.m. -- the third midterm will be in Goessman 20 as well.
• (30 Mar) I've sent the fall 2004 exams and solutions, and the discussion solutions, by email to the yahoo group "umass12818". When the main server www.cs.umass.edu is down, as it has been frequently over the past few days, you can still get to Nadia's homework solutions at:

mas.cs.umass.edu/~ghamrawi/250sol

This site is password protected with username "student" and password "open250".

• (30 Mar) Congratulations to the four CMPSCI students who won all four of the cash prizes in the Math department's prize exam. Second-place winner Shaohan Hu is in 250 this term, and third-place winner Daniel Arpino and fourth-place winner Jesse Winn took 250 with me last term.
• (29 Mar) I've written the exam -- the subject matter is similar to the two practice tests. Two hints: Study the solutions to the recent discussions, and do not expect any questions about dogs.
• (29 Mar) The web site was flaky again today. Please note that the problem hasn't affected my email, so you can still communicate with me in that direction.
• (28 Mar) I'm sorry that this site was unavailable over the weekend -- there were "hardware memory problems" on www.cs.umass.edu which have now been fixed (say our tech people). Nadia has written solutions for HW#4, and they are now available at her site. In retrospect, problem 4.9.4 was too hard for the assignment, though you should have a look at the solution. So the scale will probably be 80=A again, though we will decide this after they are graded.
• (23 Mar) The solution to Discussion #6 is now up.
• (23 Mar) Graded HW#3 papers were returned in class today. The scale was 80=A, 65=B, 50=C, 35=D, 20=F. High was 92, mean 54.
• (22 Mar) I just made some minor corrections in the HTML version of last fall's second midterm. Remember that our second midterm is a week from Thursday.
• (22 Mar) Did anyone pick up my copy of the textbook on Monday? It has my name in pen on the top right of the front cover...
• (22 Mar) I have posted the first three questions and answers on HW#4.
• (22 Mar) The second half of the textbook is ready at Collective Copies. It has a brown cover, includes Chapters 6-10 and answers to the exercises from those chapters, costs \$28.50, and is a little bigger than the first half. The first lecture out of Chapter 6 will be a week from Friday, right after the second midterm.
• (22 Mar) A reminder that if you don't pick up your hw and discussion when I return it in class, you can get it from the 250 pickup box in the CMPSCI main office. The Discussion #3's are there now -- I had misplaced them until recently. Exams have to be picked up directly from me.
• (11 Mar) Several people have emailed me about their having to miss class today (when HW#3 is due) for travel considerations. It's always fine to hand in hw's before they are due, either under the door of my office or to my mailbox in the CMPSCI main office. The latter is open 8:30-5:00 on weekdays and Pauline at the front desk can make sure your paper gets to me. If you do have to miss today's class, read Section 4.7 carefully and feel free to email me or Nadia with any questions.
• (10 Mar) There is a slight error in Problem 3.1.5 (b) that may cause some confusion. It should say "for any natural z, z is a common factor of x and y if and only if z divides xy and xy/z is a common multiple of x and y". As written, the statement might appear to say something about large common multiples that do not fit this pattern. For example, 120 is a common multiple of 15 and 12, but 15*12/120 is not even a natural and so is not a common factor.
• (9 Mar) The Discussion #5 solution and the HW#4 assignment are now up. The latter is due Friday 25 March in class, so you have just over a week of class time to work on it.
• (8 Mar) The deadline for HW#3 has been extended to Friday, 11 March, in class. The HW#4 assignment will be posted today and will still be due as originally planned, Friday 25 March (the Friday after break).
• (3 Mar) Solutions to this week's discussion are now up. Also I have started a Q&A page for HW#3.
• (2 Mar) Graded HW#2's were handed back in class. The scale will be the same as for HW#1, with A = 85, B = 70, C = 55, D = 40. Extra credit points are written separately on the papers, so for example if your paper is marked "85" with a small "(4)" then you earned 4 extra credit points and your score is 89.
• (2 Mar) I will post solutions for Discussion #2 either tonight or tomorrow morning, sorry I didn't get to it this afternoon.
• (1 Mar) The Google event I mentioned has been scrubbed due to weather, along with everything else at the University today. I'll be in my office this afternoon if anyone wants to talk in person or by email.
• (28 Feb) I meant to announce in class today that various people from Google will be here (CMPSCI 150) tomorrow (Tue) at 4:00 to give a presentation on what working at Google is like. These include a recent B.S. CMPSCI graduate of UMass.
• (28 Feb) Ok, the exams are graded and will be handed back in lecture today. There was good news and bad news. The good news was that only five people scored below 61 -- since I moved the middle of the "C" range down to 63, this means there were only five grades below C (three D- and two F). The bad news was problem 4b which no one got completely right although I gave 14/15 and 13/15 to two people who had the right argument with minor mistakes. I gave a lot of partial credit on this, up to 9/15 for showing a good understanding of how the argument should go. The big problem seemed to be people taking invalid steps and convincing themselves they had something when they didn't. Knowing what is not valid is particularly important in more abstract proofs, because it will often lead to the only valid move. We'll see more of these proofs as the semester goes on -- perhaps having more content behind them will make them more accessible.

The top score was only 94, with the median (and the mean) a 71. I moved the scale down from the A = 93 and C = 69 on the exam instructions, to A = 90 and C = 63. The detailed breakdown is thus:

```   A+ (93-100):  1
A  (88-92):   5
A- (84-87):   3
B+ (79-83):   8
B  (75-78):   4
B- (70-74):   7
C+ (66-69):  10
C  (61-65):   8
C- (57-60):   0
D+ (52-56):   0
D  (48-51):   0
D- (43-47):   3
F  ( 0-42):   2
```

The five below-passing people should talk to me individually. They should at least consider dropping, but bear in mind (1) this test is only 15% of the grade, or possibly only 10% if counting the final as 50% turns out to be to your advantage, and (2) the way I work things I'm very unlikely to give an F, as opposed to a D, to someone who sticks through the course the whole way but just doesn't get it. A D counts for credits and can be repeated for a new grade.

• (25 Feb) I've posted the HW#3 assignment. It is due a week from Wednesday, although the hw page used to say that HW#3 was due next Friday. Graded HW#2's will probably be returned this coming Wednesday.
• (25 Feb) The first exam and its solution are now available in the exam directory. I hope to grade the midterms over the weekend.
• (22 Feb) I've now written up the test, which will be 6-8 p.m. Thursday in Goessman 20. Here are a few hints:
1. The exam will be somewhat shorter than last year's
2. There is very little material from Chapter 3 on the test
3. The definitions from sections 2.8-2.11 are very important
4. At least one question involves dogs
• (22 Feb) I forgot to mention it, but solutions to hw#2 are available on Nadia's site. In general she will have these up shortly after the due date of the assignment.
• (17 Feb) Between office hours and email I have learned of a few more mistakes in the text, which have been added to the errata page. One is important for the homework: In problem 2.9.5 on page 2-38, the ``f ° g" in part (c) and the ``g ° h" in part (d) should be switched.
• (16 Feb) The solutions to this week's discussion are posted. Note that there is no discussion next week, on either Monday or Wednesday, because of the holiday on Monday.
• (14 Feb) There is another correction to HW#2: Problem 2.9.5 has no part (e), so it is part (d) that is extra credit.
• (14 Feb) I have fallen almost a full lecture behind as of today. On Wednesday we will complete sections 2.10 and 2.11, on Friday 3.1, and on the following Wednesday 3.3, with 3.4 discussed briefly if possible. This will be reflected on the test, which will be mostly about Chapters 1 and 2 but will touch on 3.1 and 3.3. By the way, you can see the practice and real exams from last term, and their solutions, using the web site for last term.
• (14 Feb) Nadia has set up a site for homework solutions and has posted the HW#1 solutions there. This site is password-protected, with username "student" and initial password "open250" -- we will change the password later and announce it in lecture.
• (12 Feb) The solutions to Discussion #2 are posted, and the graded discussions will be returned in lecture on Monday.
• (10 Feb) There are two corrections on the HW#2 assignment: Problem 2.6.3 is assigned rather than 2.6.2, and there is a typo in Problem 2.1.6. Thanks to the students who caught these!
• (9 Feb) I thought it might be useful to write down the example from today's lecture, which is not in the book:
• Premises:
• I: All dogs like walks. (∀x:W(x))
• II: All poodles are smaller than Ebony. (∀x:P(x)→S(x,e))
• III: If one dog is smaller than a second, and the second is smaller than a third, then the first dog is smaller than the third. (∀x:∀y:∀z:(S(x,y)∧S(y,z))→S(x,z))
• IV: Ebony is smaller than some Rottweiler. (∃y:R(y)∧S(e,y))
• V: Holly is a poodle. (P(h))
• Proof of: "There exists a Rottweiler that is larger than some poodle who likes walks" (∃a:∃b:R(a)∧S(b,a)∧P(b)∧W(b))
1. P(h) (premise V)
2. W(h) (specification, premise I)
3. P(h) → S(h,e) (specification, premise II)
4. S(h,e) (modus ponens, lines 1 and 3)
5. R(r) ∧ S(e,r) (instantiation, premise IV, r is a new variable)
6. R(r) (separation)
7. S(e,r) (separation, line 5)
8. S(h,e) ∧ S(e,r) (conjunction, lines 4 and 7)
9. (S(h,e) ∧ S(e,r)) → S(h,r) (specification, premise III)
10. S(h,r) (modus ponens, lines 8 and 9)
11. R(r) ∧ S(h,r) ∧ P(h) ∧ W(h) (conjunction, lines 6, 10, 1, and 2)
12. ∃a:∃b:R(a)∧S(b,a)∧P(b)∧W(b) (existence)
• (8 Feb) The HW#2 assignment is posted, due a week from Friday. There are now three answered questions on the q&a page for HW#1.
• (4 Feb) The solution to Discussion #1 is now up. I will try to grade these over the weekend.
• (2 Feb) The first meeting of the honors section will be this Friday at 11:15. It will not be in LGRT 1114, the assigned room -- I have moved it to room 140 in the Computer Science Building (first floor, on the Governors Ave. side).
• (31 Jan) I've gotten the first email question on HW#1, and I'll add more as I get them.
• (28 Jan) A Yahoo discussion group for this course has been established here.
• (28 Jan) I have added a page for errors discovered in the current edition of the textbook. None of the errors discovered so far have affected the homework -- if (when) future ones do, they will also be noted on the homework assignment page and probably be the subject of questions and answers.
• (27 Jan) Nadia and I have set our office hours, M 10-12 and Th 1-3 for me, Tu 4-5 and We 3-4 for her. Mine are in my office (210 CMPSCI) and hers are in the TA consulting room, LGRT 220.
• (27 Jan) I've created the homework assignment page which has the due dates of the eight homeworks and will have links to each assignment as it is written. The first assignment is now posted, due Wed 9 February. The earlier you start on it, the more time there is to ask questions. I'll put any interesting answers I have to your questions in the question and answer directory.
• (26 Jan) I have asked to have the "permission of instructor" requirement taken off of CMPSCI H11, so that the eight or so students from today's lecture may add it on SPIRE without doing an override. This may take a day or two to take effect, keep trying. The first Honors meeting will be Fri 4 February. The assignment for that meeting is to get the book Hofstadter's Godel, Escher, Bach and if possible read Chapter 1.
• (25 Jan) As promised, we now have the locations, Lederle A301 for lecture and Lederle A203 for discussions.
• (25 Jan) The location of the class meetings is still undisclosed but the Registrar's Office is promising to tell us by 5:00 pm today. Remember that there is no discussion meeting tomorrow, 26 January, just the lecture meeting at 1:25 pm.
• (25 Jan) The textbook for the first half of the course is now available at Collective Copies, at 71 S. Pleasant Street in downtown Amherst. Ask for course packet #56. It costs \$25.50 -- there will be another volume for the second half of the course, for about the same price, available in the next week or two. Note that I am making no money on this -- the price covers only the copying cost.
• (24 Jan) The textbook will once again be a draft of my book, A Mathematical Foundation for Computer Science. We will use the third draft, which will be available soon (watch this space) at Collective Copies in downtown Amherst. The third draft is fairly similar to the second but will have solutions to all the Exercises (though not to the Problems on the homework) and will correct a number of errors. If you have the second draft (in four volumes) you may be able to get by if you refer to someone else for the details of the homework.

There are three other books you may also want to consider buying. Rosen's Discrete Mathematics and its Applications is a commonly used textbook for this course and covers most of our material -- you may find it useful as an alternate presentation of some topics. But Rosen is not in any way a required text for this course -- one student got the contrary impression from the Follett web site! Hofstadter's Godel, Escher, Bach is the primary text for the honors section and is the sort of book every computer scientist ought to read -- it will enhance your understanding of the course material and vice versa. Finally, Solow's How to Read and Do Proofs is an explication of the mathematical method at a somewhat lower level that ours, and may be useful if you are currently very uncomfortable with the concept of proof.

• (24 Jan) I've just put up the premilinary web page. The only real information available so far is the course requirements and syllabus. The course will run very similarly to last fall's version, so you might find that web site useful.

Last modified 19 May 2005