CSC236H Lecture 1 Ilir Dema September 12, 2017
Outline Course Introduction On mathematical proofs Mathematical Induction
Welcome to CSC236 CSC236 is your first CS-theory course
Welcome to CSC236 This course is much more CS than CSC108 (and maybe even CSC148) We re going to study Program correctness Program efficiency How to design efficient algorithms
Welcome to CSC236 What you learn in this course is going to be very useful!
Evaluation Pre-lecture reading quizzes (5%) Class participation (5%) Two tests (better one worth 18%, other worth 12%) Final exam (45%) Five problem sets (15%)
Huh? I Can t Sleep in Class?
Huh? I Can t Sleep in Class? Please don t. Class participation is worth 5% But that s not the most important reason Most important reason: learning is enhanced when we are actively engaged in and questioning the material You will have opportunities to solve and discuss solutions to problems rather than watching me solve problems for you
How Lectures Work We are using a technique called Peer Instruction (PI) I present a short summary of a key topic and then ask a question You think about it for a minute or two, on your own (no talking just yet, please) You anonymously report your answers using your clicker Then, you discuss that same question with a small group of your neighbors, trying to convince them of your reasoning and reach consensus You report your revised answers, and we discuss as a class
How Lectures Work... On occasion we will extend this pattern e.g. I might ask you a follow-up question but with no group discussion e.g. I might make up new questions on the spot if I notice difficulties I ll clearly indicate what we are doing for each question
What s the Point? Helps you assess your own understanding Did you answer correctly? Why did you choose your answer? Why are the other answers incorrect? Helps you think through the ideas of other students Explanations of other students (correct or incorrect) can help you gain a better understanding of the topic Lets me know where difficulties are arising, and how to address them
Where s the Evidence? A team of researchers, has researched PI in CS since 2010 That s eight years of research We have studied student learning, retention of knowledge, attitudes, comparisons to traditional lecture-based courses, benefits of individual thinking, benefits of group discussion... you name it PI simply works better than traditional lecture
How we will use Clickers Please purchase an i>clicker remote for this course (can buy from bookstore) Please register it on Quercus. How-to available on course web site. I ll ask questions on the screen during lecture, to which you can respond with your clicker After discussion, I ll display a graph with the class results on the screen We ll discuss the questions and answers You get points for participating
How to Vote Make sure that the clicker is powered on A blue Power light will appear at the top of the remote When I ask a question in class (and start the timer), select A, B, C, D, or E as your vote Green light: your vote was sent AND received Red light: error! Vote again! You can always change your vote while the timer is going your last vote is the one that counts
Clicker Tips If you bought a used clicker, replace all AAA batteries Don t use Duracell as they are TOO short for the casing Don t use rechargeable batteries. They harm the clicker Register your clicker before our next class Before using a new clicker for the first time, pull the plastic tab out of the battery compartment Bring your clicker to every class. Make sure it is on before voting!
Sample Clicker Question What did you do this summer? A. Nothing B. I had a crappy job C. I had a good job D. I took courses E. I prepared for CSC236 and I think that Ilir might look at these responses so I am choosing this one
Reading Quizzes Before each lecture, you ll complete a short reading quiz online Why? You have to be prepared for class for our discussions to be productive I can then focus on difficult parts of the material and new examples I will not teach you the course notes in class (you know how to read!)
Participation and Reading Quiz Grading You are graded on the quality of your participation in class, not on the correctness of your answers You are graded on reasonable completion of reading quizzes, not on the correctness of your answers In this course, we use an absolute grading scale (no bell-curve) I want you to feel comfortable discussing and understanding ideas with other students
Problem Sets Problem sets are due approximately every two weeks You can work individually or in a group of at most 3 students Problem sets contain an unmarked preliminary exercise. Please do that early!
Submission Policy LaTeX is a system for typesetting documents Many computer scientists, mathematicians, physicists, etc. use LaTeX I am requiring you to submit all problem sets using LaTeX You must submit both your.tex source and resulting.pdf file Please check the course website for useful introductory resources
Academic Integrity - when you are bad vs. good
Academic Integrity tips You all know what I expect by now Do not discuss problem sets outside of your group Please don t help others by helping them solve the problem sets! Please don t put others in awkward positions by asking them for help on a problem set What you can do to help Discuss examples from lecture and the course materials Discuss preliminary questions
Tutorials Tutorial attendance is not required for marks But it is a great way to practice course material with the support of a TA and other students! TAs can help you understand course material and work through examples and previous problem sets Feel free to bring questions!
Course Materials CSC236 Lecture Notes is our core text for the course, available for free from the course web site. We will follow it closely Additional readings as indicated on the course web site.
Course Decisions
Course Decisions We will refer back to these! In this course: If not specified, our proofs are on the natural numbers 0, 1,..., n log n means log base 2 of n. The default base is 2! Use of limits for proving bounds is not allowed Regular expressions must use only syntax introduced in this course
Outline Course Introduction On mathematical proofs Mathematical Induction
Beauty in a proof
Outline Course Introduction On mathematical proofs Mathematical Induction
Predicates Definition Given a set X, we will call predicate any boolean valued function defined on X. Examples Let X = {a, b,..., z}. For any letter x X let V (x) = x is a vowel. Let Q be the rationals. For any rational r Q let B(r) = r > 10 10. Let N be the natural numbers. Forall n N let P(n) = n is a multiple of 3. Note: Every predicate defined on a set speicifies a subset of that set.
ConcepTest Which of the following is not a predicate? A. P 1 (n) : n i=0 i = n(n+1) 2 B. P 2 (n) : n is prime or is equal to the product of two or more primes C. P 3 (n) : n is a perfect square D. These are all predicates
Predicates are good for...
... many CS aspects. How do we know the following code is using the correct formula to achieve its goal? def sum_odd(n): '''Computes sum of first n odd numbers''' return n*n Let P(n) = Sum of first n odd numers is n 2 Claim. n N P(n). Franceso Maurolico proved this claim in 1575 using a novel proof technique, called mathematical induction.
Mathematical Induction
Let s visualize it. P(n) : n-th domino falls backwards Note P(n) makes sense for n > 0. We are given P(1) falls backwards is true. If P(K) falls, then P(k + 1) will fall. We conclude all dominos fall backwards.
Principle of Mathematical Induction What is it? Principle of Mathematical Induction is a proof method used to prove universially quantified statements about a predicate that depends on natural numbers. Given a predicate P(n) and b the smallest natural number where P is defined, we prove n N n b P(n) Proof steps: (Base Case) Prove P(b). (Inductive Step) Prove n N, n b (P(n) P(n + 1)) Then the Principle of Mathematical Induction implies n N n b P(n)
Principle of Mathematical Induction Why does it work? Principle of Mathematical Induction is based in the following axiomatic property of natural numbers (Peano, 1889): If a set S satisfies the following: 1. Contains the integer b 2. For all integers k, if k S then k + 1 S as well. Then S contains all integers greater or equal than b.
Mathematical Induction Proof Recipe We are given a problem that depends on a natural number, want to use proof by induction. Here is what we need to do: 1. Identify and write down the predicate that depends on a natural number. Let b be the smallest number the predicate is defined. 2. Prove the base case P(b). 3. Let n be a generic natural number b. 4. Assume P(n) holds. Derive P(n + 1). 5. Conclude the property speicifed by the given problem holds. Q: If at least one the steps (above) fails, can we conclude the specified property does not hold?
Mathematical Induction Proof Example Assuming we have an unlimited supply of coins of face value 3 and 5, prove that any integer amount 8 can be paid using only those two denominations. 1. Predicate: P(n) = An integer money amount 8 can be paid using only coins of face value 3 and 5. 2. Base case: P(8) : 8 = 5 + 3 so base case holds. 3. Let n be a generic natural number 8. 4. Assume P(n) holds. Derive P(n + 1). 5. There are two cases: 5.1 The set of coins used to pay n contains a 5. Remove 5 and two coins of 3. Then we see n + 1 can be paid using only 3-s and 5-s. 5.2 No coin of 5 present. Since n 8 and there is no 5, it remains n 9 so it must contain at least three 3-s. Remove three 3-s and add two 5-s. Again we see n + 1 can be paid uisng only 3-s and 5-s.
ConcepTest We want to prove that P(n) is true for all integers n b. Which is not a valid proof? A. (1) Prove P(b); (2) prove, for all n b, P(n) P(n + 1) B. (1) Prove P(b); (2) prove, for all n > b, P(n 1) P(n) C. (1) Prove P(b); (2) prove, for all n b + 3, P(n) P(n + 1) D. (1) Prove P(b); (2) prove, for all n b + 3, P(n 3) P(n 2) E. More than one of the above is invalid
Exercise 1 Exercise 1 on handout.