Practice Midterm Exam Solutions

Similar documents
x P(x) x P(x) CSE 311: Foundations of Computing announcements last time: quantifiers, review: logical Inference Fall 2013 Lecture 7: Proofs

CSE 311: Foundations of Computing I Autumn 2014 Practice Final: Section X. Closed book, closed notes, no cell phones, no calculators.

CSE 311: Foundations of Computing. Lecture 14: Induction

The following techniques for methods of proofs are discussed in our text: - Vacuous proof - Trivial proof

Logic, Sets, and Proofs

cse 311: foundations of computing Fall 2015 Lecture 6: Predicate Logic, Logical Inference

Math 10850, fall 2017, University of Notre Dame

Tools for reasoning: Logic. Ch. 1: Introduction to Propositional Logic Truth values, truth tables Boolean logic: Implications:

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

Adam Blank Spring 2017 CSE 311. Foundations of Computing I

Fall 2015 Lecture 14: Modular congruences. cse 311: foundations of computing

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014

Math 3336: Discrete Mathematics Practice Problems for Exam I

Midterm Exam Solution

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

Today. Proof using contrapositive. Compound Propositions. Manipulating Propositions. Tautology

Proofs. Chapter 2 P P Q Q

A. Propositional Logic

Proofs. Chapter 2 P P Q Q

Boolean Algebra and Proof. Notes. Proving Propositions. Propositional Equivalences. Notes. Notes. Notes. Notes. March 5, 2012

1 Direct Proofs Technique Outlines Example Implication Proofs Technique Outlines Examples...

Math Final Exam December 14, 2009 Page 1 of 5

MAT 243 Test 1 SOLUTIONS, FORM A

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

1. Consider the conditional E = p q r. Use de Morgan s laws to write simplified versions of the following : The negation of E : 5 points

Do not start until you are given the green signal

Do not open this exam until you are told to begin. You will have 75 minutes for the exam.

Name: Mathematics 1C03

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics. Introductory Notes in Discrete Mathematics Solution Guide

The Process of Mathematical Proof

DISCRETE MATH: FINAL REVIEW

CHAPTER 2 BOOLEAN ALGEBRA

Math 13, Spring 2013, Lecture B: Midterm

Chapter 1 : The language of mathematics.

CSE 215: Foundations of Computer Science Recitation Exercises Set #5 Stony Brook University. Name: ID#: Section #: Score: / 4

CSE 311 Lecture 28: Undecidability of the Halting Problem. Emina Torlak and Kevin Zatloukal

Logic and Proof. Aiichiro Nakano

Number Theory Math 420 Silverman Exam #1 February 27, 2018

Switches: basic element of physical implementations

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

Writing proofs for MATH 61CM, 61DM Week 1: basic logic, proof by contradiction, proof by induction

Proofs: A General How To II. Rules of Inference. Rules of Inference Modus Ponens. Rules of Inference Addition. Rules of Inference Conjunction

MATH 2001 MIDTERM EXAM 1 SOLUTION

(3,1) Methods of Proof

Discrete Mathematics and Probability Theory Summer 2014 James Cook Midterm 1 (Version B)

Lab 1 starts this week: go to your session

Administrative Notes. Chapter 2 <9>

8. Given a rational number r, prove that there exist coprime integers p and q, with q 0, so that r = p q. . For all n N, f n = an b n 2

a. See the textbook for examples of proving logical equivalence using truth tables. b. There is a real number x for which f (x) < 0. (x 1) 2 > 0.

Midterm 1. Your Exam Room: Name of Person Sitting on Your Left: Name of Person Sitting on Your Right: Name of Person Sitting in Front of You:

Mathematics 220 Midterm Practice problems from old exams Page 1 of 8

Fall 2014 CMSC250/250H Midterm II

1. Given the public RSA encryption key (e, n) = (5, 35), find the corresponding decryption key (d, n).

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

Proofs. Introduction II. Notes. Notes. Notes. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

MATH 215 Final. M4. For all a, b in Z, a b = b a.

2.2: Logical Equivalence: The Laws of Logic

Midterm 2 Sample Introduction to Higher Math Fall 2018 Instructor: Linh Truong

Logic Overview, I. and T T T T F F F T F F F F

CITS2211 Discrete Structures Proofs

Quiz 1, Mon CS 2050, Intro Discrete Math for Computer Science

(e) Commutativity: a b = b a. (f) Distributivity of times over plus: a (b + c) = a b + a c and (b + c) a = b a + c a.

CSE 1400 Applied Discrete Mathematics Proofs

University of Ottawa CSI 2101 Midterm Test Instructor: Lucia Moura. March 1, :00 pm Duration: 1:15 hs

REVIEW PROBLEMS FOR SECOND 3200 MIDTERM

CS1800 Discrete Structures Fall 2017 October, CS1800 Discrete Structures Midterm Version A

Review Problems for Midterm Exam II MTH 299 Spring n(n + 1) 2. = 1. So assume there is some k 1 for which

MTH 310, Section 001 Abstract Algebra I and Number Theory. Sample Midterm 1

University of Ottawa CSI 2101 Midterm Test Instructor: Lucia Moura. February 9, :30 pm Duration: 1:50 hs. Closed book, no calculators

Chapter 2. Mathematical Reasoning. 2.1 Mathematical Models

Propositional Logic. Spring Propositional Logic Spring / 32

CS173 Lecture B, September 10, 2015

1) Let h = John is healthy, w = John is wealthy and s = John is wise Write the following statement is symbolic form

CSE 20 DISCRETE MATH WINTER

Math 230 Final Exam, Spring 2008

CSE 20 DISCRETE MATH SPRING

Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques

Discrete Mathematics Exam File Spring Exam #1

CS 70 Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1 Solutions

MATH CSE20 Homework 5 Due Monday November 4

COMP Intro to Logic for Computer Scientists. Lecture 15

University of California, San Diego Department of Computer Science and Engineering CSE 20. Solutions to Midterm Exam Winter 2018

CMPSCI 250: Introduction to Computation. Lecture 11: Proof Techniques David Mix Barrington 5 March 2013

Preparing for the CS 173 (A) Fall 2018 Midterm 1

CSE 311: Foundations of Computing. Lecture 7: Logical Inference

1. Introduction to commutative rings and fields

Proof by contrapositive, contradiction

Chapter 1. Logic and Proof

Practice Test III, Math 314, Spring 2016

CSC 125 :: Final Exam May 3 & 5, 2010

Announcements. Exam 1 Review

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z:

CHAPTER III BOOLEAN ALGEBRA

CSE 20 Discrete Math. Algebraic Rules for Propositional Formulas. Summer, July 11 (Day 2) Number Systems/Computer Arithmetic Predicate Logic

Math.3336: Discrete Mathematics. Proof Methods and Strategy

1. From Lewis Carroll: extract a pair of premises and finish the conclusion.

Logic and Proofs. (A brief summary)

Tutorial Obtain the principal disjunctive normal form and principal conjunction form of the statement

Math 109 HW 9 Solutions

Transcription:

CSE 311: Foundations of Computing I Practice Midterm Exam Solutions Name: Sample Solutions ID: TA: Section: INSTRUCTIONS: You have 50 minutes to complete the exam. The exam is closed book. You may not use cell phones or calculators. All answers you want graded should be written on the exam paper. If you need extra space, use the back of a page. Make sure to mention that you did though. The problems are of varying difficulty. If you get stuck on a problem, move on and come back to it later. Problem Points Score Problem Points Score 1 20 5 5 2 15 6 10 3 10 7 20 4 20 Σ 100 Page 1 of 10

Basic Techniques. This part will test your ability to apply techniques that have been explicitly identified in lecture and reinforced through sections and homeworks. Remember to show your work and justify your claims. 1. To Logic... or Not To Logic [20 points] (a) (5 points) Choose a meaning of P (x, y, z) such that x y z P (x, y, z) is false, but x y z P (x, y, z) is true. Solution: Let the domain be N. Let P (x, y, z) be x 0 y z. Then, the first statment is false, because, while x 0 for everything in the domain, there is no largest number in the domain. However, the second statement is true, because x 0 and z = y satisfies the second part. (b) (5 points) In the domain of integers, using any standard mathematical notation (but no new predicates), define Prime(x) to mean x is prime. Solution: Prime(x) x 2 y ((1 y x y x) (y = x y = 1)) Let the predicates D(x, y) mean team x defeated team y and P (x, y) mean team x has played team y. Give quantified formulas with the following meanings: (c) (5 points) Every team has lost at least one game. Solution: x y D(y, x) (d) (5 points) There is a team that has beaten every team it has played. Solution: x y (P (x, y) D(x, y)) Page 2 of 10

2. Obvious Induction Problem [15 points] Prove for all n N that the following identity is true: where x R, x 1. Solution: 1. Let P(n) be the statement We go by induction on n. n i=0 n i=0 x i = 1 xn+1 1 x x i = 1 xn+1 for all n N. 1 x 2. Base Case: When n = 0, P(0) is true, because since x 1, 0 i=0 x i = x 0 = 1 = 1 x1 1 x. 3. Induction Hypothesis: Suppose P (k) is true for some k N. 4. Induction Step: We see that k+1 x i = i=0 k x i + x k+1 i=0 = 1 xk+1 1 x + xk+1 [By the IH] = (1 xk+1 ) + (1 x)x k+1 1 x = 1 xk+2 1 x which is what we wanted to show in the induction step. 5. Thus, we have proven P(n) for all n N by induction. [Taking out the last term] [Algebra] [Simplifying] Page 3 of 10

3. 311 is Prime! [10 points] Find all solutions in the range 0 x < 311 to the modular equation: Solution: First, we compute the gcd of 311 and 12. 12x 5 (mod 311) 311 = 25 12 + 11 12 = 1 11 + 1 11 = 11 1 + 0 so gcd(311, 12) = 1 and hence we finish the Extended Euclidean Algorithm using: Now, backwards substituting: 11 = 311 25 12 1 = 12 11 1 1 = 12 1 11 = 12 1 (311 25 12) = 26 12 1 311 So, the multiplicative inverse of 12 modulo 311 is 26. Now, we have the modular equation 12(26) 1 (mod 311). Multiplying both sides by 5, we get: So, x = 130. 12(26 5) 5 (mod 311) 12(130) 5 (mod 311) Page 4 of 10

4. Even Circuits Are Fun [20 points] The function multiple-of-three takes in two inputs: (x 1 x 0 ) 2 and outputs 1 iff 3 (x 1 x 0 ) 2. (a) (5 points) Draw a table of values (e.g. a truth table) for multiple-of-three. Solution: x 1 x 0 multiple-of-three 0 0 1 0 1 0 1 0 0 1 1 1 (b) (5 points) Write multiple-of-three as a sum-of-products. Solution: multiple-of-three = (x 1x 0) + (x 1 x 0 ) (c) (5 points) Write multiple-of-three as a product-of-sums. Solution: multiple-of-three = (x 1 + x 0)(x 1 + x 0 ) (d) (5 points) Write multiple-of-three as a simplified expression (don t bother explaining what rules you re using). Solution: multiple-of-three = (x 1 + x 0 ) + (x 1 x 0 ) 5. Irrationally Rational [5 points] Recall the definition of irrational is that a number is not rational, and that Rational(x) p q x = p q Integer(p) Integer(q) q 0 For this question, you may assume that π is irrational. Disprove that if x and y are irrational, then x + y is irrational. Solution: Note that π is irrational, and multiplying by 1 maintains irrationality (because if it didn t, then we could find p, q by multiplying by 1, getting p, q, and choosing p and q). Finally, note that π + ( π) = 0, which is rational. Page 5 of 10

6. Rationally Irrational [10 points] Recall the definition of irrational is that a number is not rational, and that Rational(x) p q x = p q Integer(p) Integer(q) q 0 Prove that if x and y are rational and x 7, then is rational. x 7 Solution: Short solution: Suppose x, y are rational and x 7. Then by definition x = p/q for some integers p and q with q 0. Therefore x 7 = p/q 7 = p 7q. Since x 7, we have p 7q 0. It follows that 1 x 7 = q p 7q y 2 q y2 is rational since q and p 7q are integers and p 7q 0. Now since = y y 1 x 7 x 7 is the product of three rational numbers. In class, we showed that the product of rational we see that y2 x 7 numbers is also rational. Since y and 1 are both rational, the product y y 1 = y2 is also rational x 7 x 7 x 7 as required. Longer solution not assuming what was done in class: Suppose x, y are rational and x 7. Then by definition x = p/q for some integers p and q with q 0 and y = r/s for some integers r and s for s 0. Therefore x 7 = p/q 7 = p 7q q. Since x 7, we have p 7q 0. Also y 2 = (r/s) 2 = r2 s 2. Therefore y 2 x 7 = r2 s 2 p 7q q = r 2 q s 2 (p 7q). Since s 0 and p 7q 0 we have s 2 (p 7q) 0. Also, since r and q are integers r 2 q is an integer and since s, p, and q are integers s 2 (p 7q) is an integer. Therefore y2 is quotient of integers x 7 r2 q and s 2 (p 7q), the latter of which is 0. Thus, it follows that y 2 x 7 is rational. Page 6 of 10

A Moment s Thought! This section tests your ability to think a little bit more insightfully. The approaches necessary to solve these problems may not be immediately obvious. Remember to show your work and justify your claims. 7. Gotta m [20 points] We say that k is a square modulo m iff there is some integer j such that k j 2 (mod m). Let T = {m : m = n 2 + 1 for some integer n}. (a) (8 points) Prove that if m T, then 1 is a square modulo m. Solution: Let m be an arbitrary element of T. Then, m = n 2 + 1 for some integer n by definition of T. Therefore, m (n 2 + 1). So, n 2 1 (mod m), which means 1 is a square modulo m. (b) (12 points) Prove that for all integers m and k, if m T and k is a square modulo m then k is also a square modulo m. Solution: Let m be an arbitrary element of T, and suppose that k is a square modulo m. Then, k j 2 (mod m) for some integer j. Multiplying both sides of the congruence by 1, we get k ( 1)j 2 (mod m). From (a), we know that n 2 1 (mod m). Thus, we have k n 2 j 2 (mod m). So, k (nj) 2 (mod m), which means k is a square modulo m. Page 7 of 10

CSE 311: Foundations of Computing I Logical Equivalences Reference Sheet Identity p T p p F p Domination p T T p F F Idempotency p p p p p p Commutativity p q q p p q q p Associativity (p q) r p (q r) (p q) r p (q r) Distributivity p (q r) (p q) (p r) p (q r) (p q) (p r) Absorption p (p q) p p (p q) p Negation p p T p p F DeMorgan s Laws (p q) p q (p q) p q Double Negation p p Law of Implication p q p q Contrapositive p q q p

CSE 311: Foundations of Computing I Boolean Algebra Axioms (and Some Theorems) Axioms Closure Commutativity a + b is in B a b is in B a + b = b + a a b = b a Associativity a +(b + c) =(a + b)+c a (b c) =(a b) c Identity a +0=a a 1=a Distributivity a +(b c) =(a + b) (a + c) a (b + c) =(a b)+(a c) Complementarity a + a 0 =1 a a 0 =0 Theorems Null Idempotency X +1=1 X + X = X X 0=0 X X = X Involution (X 0 ) 0 = X Uniting X Y + X Y 0 = X (X + Y ) (X + Y 0 )=X Absorbtion X + X Y = X (X + Y 0 ) Y = X Y X (X + Y )=X (X Y 0 )+Y = X + Y DeMorgan (X + Y + ) 0 = X 0 Y 0 (X Y ) 0 = X 0 + Y 0 + Consensus (X Y )+(Y Z)+(X 0 Z) =X Y + X 0 Z (X + Y ) (Y + Z) (X 0 + Z) =(X + Y ) (X 0 + Z) Factoring (X + Y ) (X 0 + Z) =X Z + X 0 Y X Y + X 0 Z =(X + Z) (X 0 + Y )

CSE 311: Foundations of Computing I Axioms & Inference Rules Excluded Middle A A Direct Proof A B A B Modus Ponens A A B B Intro A B A B Elim A B A B Intro A A B B A Elim A B A B Intro P (c) for some c x P (x) Elim x P (x) P (a) for any a Intro Let a be arbitrary... P (a) x P (x) (If no other name in P depends on a) Elim x P (x) P (c) for some special c list dependencies for c