CPSC 121: Models of Computation Assignment #4, due Thursday, March 16 th,2017at16:00

Size: px
Start display at page:

Download "CPSC 121: Models of Computation Assignment #4, due Thursday, March 16 th,2017at16:00"

Transcription

1 CPSC 121: Models of Computation Assignment #4, due Thursday, March 16 th,2017at16:00 [18] 1. Consider the following predicate logic statement: 9x 2 A, 8y 2 B,9z 2 C, P(x, y, z)! Q(x, y, z), where A, B, and C are sets and P and Q are predicates. There is not enough information about the domains and predicates to prove this theorem. Instead, lay out as much of the structure of a proof of this theorem as you can for each proof technique that we specified. Whenever you choose a specific value for a variable, specify what (if anything) this choice can depend on. Number each distinct step so it s easy for us to follow your proof structure (but we wouldn t normally write these numbers in an English-language proof like this). [7] a. Suppose that we are trying to prove this statement using a direct proof. [7] b. Suppose that we are trying to prove this statement using a proof by contrapositive. [4] c. Suppose that we are trying to prove this statement using a proof by contradiction. [6] 2. Alice has recently found a piece of paper that describes a new theorem. Unfortunately the piece of paper had gotten wet in the rain, and the ink had run o, so all that was readable is the following portion of a proof: Proof: Consider an unspecified real number m. Choose the real number n to be 1 m Consider two unspecified real numbers a and b. Assume that a b <n.... Therefore, f(a) f(b) < m. Based on this information, reconstruct the entire theorem that was being proved, and write it using predicate logic. [12] 3. Let a and b be positive integers. Suppose that d is the greatest common divisor of a and b, denoted gcd(a, b), Then d has the following two properties: 1. d is a common divisor of a and b. In other words, a is divisible by d and b is also divisible by d. 2. For all integers c, ifc is common divisor of both a and b, thenc is less than or equal to d.

2 Using the definition of the greatest common divisor, prove the two theorems below. [8] a. For any two positive integers a and b, b is divisible by a if and only if gcd(a, b) = a. Hint: To prove a biconditional, remember that it s equivalent to two conditionals. Prove each conditional separately! [4] b. For any two positive integers a and b, ifa>b, then gcd(a, b) = gcd(b, a b). Hint: One way to prove an equality is to show that the left hand side of the equation is less than or equal to the right hand side of the equation, and then to also prove that the right hand side of the equation is less than or equal to the left hand side of the equation. You will want to repeatedly apply the definition of the greatest common divisor in your proof. Translated into predicate logic, the theorem statement becomes 8a 2 Z +, 8b 2 Z +,a>b! gcd(a, b) = gcd(b, a b). We have completed the first half of the proof for you. Please fill in the second half of the proof. Proof: Consider two unspecified positive integers a and b. Assume that a>b. First, we will show that gcd(a, b) apple gcd(b, a b). We will show that gcd(a, b) is a common divisor of b and a b. By property 1 of gcd, gcd(a, b) dividesb. Now, we will show that gcd(a, b) dividesa b. By property 1 of gcd, gcd(a, b) divides both a and b. Let a = m gcd(a, b) and b = n gcd(a, b) wherem and n are integers. Then we have a b = m gcd(a, b) n gcd(a, b) = (m n) gcd(a, b). Since (m n) is an integer, gcd(a, b) dividesa b. Therefore, gcd(a, b) is a common divisor of b and a b. By property 2 of gcd, since a common divisor of b and a b must be less than or equal to the greatest common divisor of b and a b, gcd(a, b) is less than or equal to gcd(b, a b). Second, we will show that gcd(b, a b) apple gcd(a, b). Please complete this part of the proof. QED [16] 4. Recall that for any two functions f(n) and g(n), f(n) isino(g) if9c 2 R +, 9n 0 2 N, 8n 2 N,n n 0! f(n) apple cg(n). Using this definition, prove the following two theorems. [8] a. For any three functions f, g and h, prove that if f(n) isino(g) and g(n) is in O(h), then f(n) isino(h). Hint: If you assume that a statement such as 9x 2 D, P(x) is true, you cannot choose a specific value of D for which P (x) is true, unlike when proving an existential. Instead, you simply know that for some unspecified value x in D,

3 P (x) is true. (You don t know which value, and you only know that there is at least one such value. There may be more!) [8] b. Diane Ross, a computer scientist, has written an excellent algorithm whose execution requires 7n 3 +2n +6 steps, where n is the size the input. Prove that the number of steps of the algorithm 7n 3 +2n +6isNOT in O(n 2 ). Hint: You may want to negate the definition, and then prove the negation directly. [8] 5. Prove this theorem using a proof by contrapositive: For any integer y, ify 5 + 2y 3 +8y 3y 4 +3y 2 + 4, then y 0. [8] 6. Prove this theorem using a proof by contradiction: For any integers a, b, and c, if a 2 + b 2 = c 2,thena is even or b is even. Hint: Try to show that c 2 is divisible by 4 and not divisible by 4 at the same time. [8] 7. Convert the following DFA to a sequential circuit. You must write down a truth table and the corresponding propositions to justify the design of your sequential circuit. Make sure that your sequential circuit has an output, labeled accept, which is true when the DFA is in an accepting state. If you use the approach taught in lecture, then your sequential circuit should have 3 sub-circuits which produce the next states for the 3 states of the DFA. Please clearly label which subcircuit corresponds to which starting state of the DFA.

4 The remaining questions are for additional practice only. You should not hand them in. The solutions are included below. 1. For every non-negative integer x, bx/2c + dx/2e = x. Additional information: You will find the definitions of the floor and ceiling functions in your textbook. In Epp s fourth edition, the floor and ceiling functions are defined on page 191. In Epp s third edition, they are defined on page 165. These functions are defined on pages 149 (143) in Rosen s seventh (sixth) edition. You should break the proof down into two cases. Solution : Translated into predicate logic, this is: 8x 2 N, bx/2c + dx/2e = x. Musings and scratch work (this is not part of the proof, and you don t need to include it with your answer; it s just a way in which you might have come up with the solution we ll give): the floors and ceiling functions don t do anything when x/2 is already an integer, that is when x is even. If x/2 is not an integer, when x is odd, then they will round up or down. So maybe we can divide the proof into two cases: one when x is even, and one when x is odd? Proof: Consider an arbitrary non-negative integer x. If x is even, then x/2 is a non-negative integer, and so bx/2c = x/2 and dx/2e = x/2. Therefore bx/2c + dx/2e = x/2+x/2 =x. If x is odd, then x =2y + 1 for some non-negative integer y. Hence bx/2c = by+0.5c = y and dx/2e = dy+0.5e = y+1. Therefore bx/2c+dx/2e = y+y+1 = 2y +1=x. Since every non-negative integer is even or odd, this completes the proof of the theorem. QED 2. Prove that for every integer n, theproductn(n 2 1)(n + 2) is divisible by 4. Solution : Consider an unspecified integer n. Since n 2 1=(n 1)(n + 1), the product n(n 2 1)(n + 2) is equal to (n 1)n(n + 1)(n + 2). Since n 1, n, n + 1 and n + 2 are four consecutive integers, at least one of them is divisible by 4. Therefore so is their product. QED Note: the product is in fact divisible by 8. Can you see why?

5 3. Given an arbitrary positive integer n, we can find n consecutive positive integers that are all composite. Additional information: a number is composite if it is greater than 1, and is not prime. Hint: use a trick similar to one we used in class. Solution : Translated into predicate logic, this is: 8n 2 Z + 9x 2 Z + 8i 2 Z +,i apple n! Prime(x+i). Another acceptable and simpler, but slightly less formal, formulation would be 8n 2 Z + 9x 2 Z +, Prime(x+1)^ Prime(x+2)^ ^ Prime(x+n). Musings and scratch work: the only trick we used in class (up to the day where the assignment was posted) was using n! when we proved that there is always a prime number larger than any given integer. Now, n! is clearly not prime (as long as n 3). What about n! + 1? Hmmm... I don t know. But n! + 2 will be even, and not prime. And n! + 3? Well n! is divisible by 3, so n! + 3 is also divisible by 3. And this will be true until n! + n. But that s only n 1 consecutive composite integers, since we don t know if n!+n + 1 is composite or not. So what can we do? Use (n + 1)! instead! Proof: Consider an unspecified positive integer n. Choose x =(n + 1)!. We claim that the integers x + 2, x + 3,... x +(n + 1) are all composite. Indeed, let i be an integer between 2 and n + 1. Because x =(n + 1)! is divisible by i, x + i is also divisible by i, and hence x + i is not prime. QED 4. Prove that for every real number c we pick, there will be some positive integer n such that 4 n >c3 n. Hint: the inside back cover of your textbook contains a list of properties of exponents and logarithms. A web search for logarithm reference will also turn up many alternative resources. Solution : This theorem contains a universal quantifier, with an existential quantifier nested inside it. Hence, we start by considering an unspecified real number c. The case where c apple 0 is trivial, since then c3 n apple 0 < 4 n. So assume that c is positive. Now, we need to show how to choose a value of n for which 4 n >c3 n. Scratch work (not part of the answer as such, but you might have scribbled that on the back of the page): we want 4 n >c3 n.thatwillbesatisfiedaslongas4 n /3 n >c, which means as long as (4/3) n >c,thatis,aslongasn>log (4/3) c. Back to the proof: pick any integer n larger than log (4/3) c. For instance, 1+dlog (4/3) ce would do (recall that dxe is the smallest integer that is greater than or equal to x). Then (4/3) n > (4/3) log (4/3) c, which means that (4/3) n >cand hence 4 n /3 n >cwhich is the same as writing that 4 n >c3 n, as desired. QED 5. Prove that for every three non-zero integers a, b and c, at least one of the three products ab, ac, bc is positive. Hint: use a proof by contradiction.

6 Solution : We use a proof by contradiction. Suppose that none of the three products ab, ac and bc is positive. Because a, b and c are not zero, none of the three products is equal to 0, and so they must all be negative. The product of three negative values is negative, and hence (ab)(ac)(bc) < 0. However (ab)(ac)(bc) =a 2 b 2 c 2 =(abc) 2, and we know that (abc) 2 0. We have thus obtained a contradiction. Therefore at least one of the three products must be positive. QED 6. Suppose that you are given a group of n children, and that you want to divide them into two soccer teams. Unfortunately, there are pairs of children that do not like each other, and you need to make sure that two children who do not like one another do not end up on the same team. Prove that, if you can achieve this, then for every group of k children c 1,...,c k where c 1 does not like c 2, c 2 does not like c 3,...,c k 1 does not like c k, and c k does not like c 1,thenk must be even. Hint: use an indirect proof. Solution : We will not write a direct translation into predicate logic, because it would be rather ugly (or involve too many strange predicates such as CanMakeTeams). Musings and scratch work: The hint says to use an indirect proof, and there is an implication in the statement, so maybe we can try to use the contrapositive (it s simpler than a proof by contradiction)? So what will the teams look like if we have those children c 1,...,c k who can t stand one another as described? Yes, I see... Proof: We prove the contrapositive of the statement. That is, we show that if there is a group of k children c 1,...,c k where c 1 does not like c 2, c 2 does not like c 3,..., c k 1 does not like c k, and c k does not like c 1, and k is odd, then we will not be able to make the two teams. Suppose that we have this group of k children. Without loss of generality we assume that child c 1 is in team 1. This means that child c 2 is in team 2 (he/she can not be in the same team as c 1 ). Similarly, c 3 will be in team 1 and c 4 in team 2. Continuing with the same pattern, we get to child c k 1, who will be in team 2sincek 1 is even. But then we can not put child c k in team 1 (he/she doesn t like c 1 ), nor can we put c k in team 2 (he/she doesn t like c k 1 ). Hence there is no way to partition the group into two teams. QED 7. Can you draw a quadrilateral (4-sided figure) in which the sum of any two angles no matter which two you pick is less than 180? Explain how to do it, or prove that it can not be done. Hints: (1) the sum of the angles in a quadrilateral is always 360. (2) use a proof by contradiction. Solution : It can not be done. Let us call the angles of the quadrilateral a 1, a 2, a 3 and a 4. We know that the sum of the angles in a quadrilateral is 360. That is, a 1 + a 2 + a 3 + a 4 = 360

7 Let us now look at S =3a 1 +3a 2 +3a 3 +3a 4. On one hand S = (a 1 + a 2 )+(a 1 + a 3 )+(a 1 + a 4 )+(a 2 + a 3 )+(a 2 + a 4 )+(a 3 + a 4 ) < = 1080 Therefore S<1080. On the other hand S = 3(a 1 + a 2 + a 3 + a 4 )=3 360 which means that S = This is a contradiction, since S can not be both less than 1080 and equal to 1080 at the same time. QED

CPSC 121 Midterm 2 Friday November 13th, 2015

CPSC 121 Midterm 2 Friday November 13th, 2015 CPSC 121 Midterm 2 Friday November 13th, 2015 [10] 1. For each of the following statements: Rewrite the statement using predicate logic. Write down ALL of the proof strategies (from the list given below),

More information

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus)

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus) Math 30 Introduction to Proofs via Number Theory Robert Jewett (with small modifications by B. Ćurgus) March 30, 009 Contents 1 The Integers 3 1.1 Axioms of Z...................................... 3 1.

More information

1 Elementary number theory

1 Elementary number theory Math 215 - Introduction to Advanced Mathematics Spring 2019 1 Elementary number theory We assume the existence of the natural numbers and the integers N = {1, 2, 3,...} Z = {..., 3, 2, 1, 0, 1, 2, 3,...},

More information

CPSC 121: Models of Computation. Module 6: Rewriting predicate logic statements

CPSC 121: Models of Computation. Module 6: Rewriting predicate logic statements CPSC 121: Models of Computation Module 6: Rewriting predicate logic statements Module 6: Rewriting predicate logic statements Pre-class quiz #7 is due March 1st at 19:00. Assigned reading for the quiz:

More information

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

CSE 215: Foundations of Computer Science Recitation Exercises Set #4 Stony Brook University. Name: ID#: Section #: Score: / 4 CSE 215: Foundations of Computer Science Recitation Exercises Set #4 Stony Brook University Name: ID#: Section #: Score: / 4 Unit 7: Direct Proof Introduction 1. The statement below is true. Rewrite the

More information

Math Introduction to Advanced Mathematics

Math Introduction to Advanced Mathematics Math 215 - Introduction to Advanced Mathematics Number Theory Fall 2017 The following introductory guide to number theory is borrowed from Drew Shulman and is used in a couple of other Math 215 classes.

More information

UNIT-II NUMBER THEORY

UNIT-II NUMBER THEORY UNIT-II NUMBER THEORY An integer n is even if, and only if, n equals twice some integer. i.e. if n is an integer, then n is even an integer k such that n =2k An integer n is odd if, and only if, n equals

More information

CPSC 121: Models of Computation. Module 5: Predicate Logic

CPSC 121: Models of Computation. Module 5: Predicate Logic CPSC 121: Models of Computation Module 5: Predicate Logic Module 5: Predicate Logic Midterm 1: Friday February 9 th, 17:00 to 18:15 A to C (by last name): room DMP 310 D to K: room MATH 100 L to P: room

More information

Strategies for Proofs

Strategies for Proofs Strategies for Proofs Landscape with House and Ploughman Van Gogh Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois 1 Goals of this lecture A bit more logic Reviewing Implication

More information

1 Elementary number theory

1 Elementary number theory 1 Elementary number theory We assume the existence of the natural numbers and the integers N = {1, 2, 3,...} Z = {..., 3, 2, 1, 0, 1, 2, 3,...}, along with their most basic arithmetical and ordering properties.

More information

CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010

CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010 CS 3512, Spring 2011 Instructor: Doug Dunham Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010 Prerequisites: Calc I, CS2511 Rough course outline:

More information

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Final exam The final exam is Saturday March 18 8am-11am. Lecture A will take the exam in GH 242 Lecture B will take the exam

More information

Chapter 3. Set Theory. 3.1 What is a Set?

Chapter 3. Set Theory. 3.1 What is a Set? Chapter 3 Set Theory 3.1 What is a Set? A set is a well-defined collection of objects called elements or members of the set. Here, well-defined means accurately and unambiguously stated or described. Any

More information

Summary of Course Coverage

Summary of Course Coverage CS-227, Discrete Structures I Spring 2006 Semester Summary of Course Coverage 1) Propositional Calculus a) Negation (logical NOT) b) Conjunction (logical AND) c) Disjunction (logical inclusive-or) d) Inequalities

More information

Introduction to Programming in C Department of Computer Science and Engineering\ Lecture No. #02 Introduction: GCD

Introduction to Programming in C Department of Computer Science and Engineering\ Lecture No. #02 Introduction: GCD Introduction to Programming in C Department of Computer Science and Engineering\ Lecture No. #02 Introduction: GCD In this session, we will write another algorithm to solve a mathematical problem. If you

More information

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Final exam The final exam is Saturday December 16 11:30am-2:30pm. Lecture A will take the exam in Lecture B will take the exam

More information

Introduction to Sets and Logic (MATH 1190)

Introduction to Sets and Logic (MATH 1190) Introduction to Sets and Logic () Instructor: Email: shenlili@yorku.ca Department of Mathematics and Statistics York University Dec 4, 2014 Outline 1 2 3 4 Definition A relation R from a set A to a set

More information

Practice Problems: All Computer Science majors are people. Some computer science majors are logical thinkers. Some people are logical thinkers.

Practice Problems: All Computer Science majors are people. Some computer science majors are logical thinkers. Some people are logical thinkers. CSE 240, Fall, 2013 Homework 2 Due, Tuesday September 17. Can turn in class, at the beginning of class, or earlier in the mailbox labelled Pless in Bryan Hall, room 509c. Practice Problems: 1. Consider

More information

Assertions & Verification & Example Loop Invariants Example Exam Questions

Assertions & Verification & Example Loop Invariants Example Exam Questions 2014 November 27 1. Assertions & Verification & Example Loop Invariants Example Exam Questions 2. A B C Give a general template for refining an operation into a sequence and state what questions a designer

More information

ELEC-270 Solutions to Assignment 5

ELEC-270 Solutions to Assignment 5 ELEC-270 Solutions to Assignment 5 1. 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 7

More information

Lecture 19 Thursday, March 29. Examples of isomorphic, and non-isomorphic graphs will be given in class.

Lecture 19 Thursday, March 29. Examples of isomorphic, and non-isomorphic graphs will be given in class. CIS 160 - Spring 2018 (instructor Val Tannen) Lecture 19 Thursday, March 29 GRAPH THEORY Graph isomorphism Definition 19.1 Two graphs G 1 = (V 1, E 1 ) and G 2 = (V 2, E 2 ) are isomorphic, write G 1 G

More information

Assertions & Verification Example Exam Questions

Assertions & Verification Example Exam Questions 2009 November 23 Assertions & Verification Example Exam Questions 1. 2. A B C Give a general template for refining an operation into a sequence and state what questions a designer must answer to verify

More information

Discrete Mathematics Lecture 4. Harper Langston New York University

Discrete Mathematics Lecture 4. Harper Langston New York University Discrete Mathematics Lecture 4 Harper Langston New York University Sequences Sequence is a set of (usually infinite number of) ordered elements: a 1, a 2,, a n, Each individual element a k is called a

More information

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1 CS 70 Discrete Mathematics for CS Fall 2000 Wagner MT1 Sol Solutions to Midterm 1 1. (16 pts.) Theorems and proofs (a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are

More information

EDAA40 At home exercises 1

EDAA40 At home exercises 1 EDAA40 At home exercises 1 1. Given, with as always the natural numbers starting at 1, let us define the following sets (with iff ): Give the number of elements in these sets as follows: 1. 23 2. 6 3.

More information

PACKING DIGRAPHS WITH DIRECTED CLOSED TRAILS

PACKING DIGRAPHS WITH DIRECTED CLOSED TRAILS PACKING DIGRAPHS WITH DIRECTED CLOSED TRAILS PAUL BALISTER Abstract It has been shown [Balister, 2001] that if n is odd and m 1,, m t are integers with m i 3 and t i=1 m i = E(K n) then K n can be decomposed

More information

Caltech Harvey Mudd Mathematics Competition March 3, 2012

Caltech Harvey Mudd Mathematics Competition March 3, 2012 Team Round Caltech Harvey Mudd Mathematics Competition March 3, 2012 1. Let a, b, c be positive integers. Suppose that (a + b)(a + c) = 77 and (a + b)(b + c) = 56. Find (a + c)(b + c). Solution: The answer

More information

Slide Set 5. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Slide Set 5. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary Slide Set 5 for ENEL 353 Fall 207 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 207 SN s ENEL 353 Fall 207 Slide Set 5 slide

More information

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 9 Notes. Class URL:

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 9 Notes. Class URL: Notes slides from before lecture CSE 21, Winter 2017, Section A00 Lecture 9 Notes Class URL: http://vlsicad.ucsd.edu/courses/cse21-w17/ Notes slides from before lecture Notes February 8 (1) HW4 is due

More information

Lecture Notes 15 Number systems and logic CSS Data Structures and Object-Oriented Programming Professor Clark F. Olson

Lecture Notes 15 Number systems and logic CSS Data Structures and Object-Oriented Programming Professor Clark F. Olson Lecture Notes 15 Number systems and logic CSS 501 - Data Structures and Object-Oriented Programming Professor Clark F. Olson Number systems The use of alternative number systems is important in computer

More information

(d) If the moon shares nothing and the sun does not share our works, then the earth is alive with creeping men.

(d) If the moon shares nothing and the sun does not share our works, then the earth is alive with creeping men. Math 15 - Spring 17 Chapters 1 and 2 Test Solutions 1. Consider the declaratives statements, P : The moon shares nothing. Q: It is the sun that shares our works. R: The earth is alive with creeping men.

More information

Cardinality Lectures

Cardinality Lectures Cardinality Lectures Enrique Treviño March 8, 014 1 Definition of cardinality The cardinality of a set is a measure of the size of a set. When a set A is finite, its cardinality is the number of elements

More information

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM Name: Student ID: Signature: Section (circle one): George Steve Your signature acknowledges your understanding of and agreement

More information

Homework 1 CS 1050 A Due:

Homework 1 CS 1050 A Due: 9-4-08 Homework 1 CS 1050 A Due: 9-11-08 Every assignment will be due at the beginning of class. Recall that you can collaborate in groups and/or use external references, but you must acknowledge the group/references

More information

Introduction to Modular Arithmetic

Introduction to Modular Arithmetic Randolph High School Math League 2014-2015 Page 1 1 Introduction Introduction to Modular Arithmetic Modular arithmetic is a topic residing under Number Theory, which roughly speaking is the study of integers

More information

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully.

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully. CSC 165 H1 Term Test 2 / L5101 Fall 2011 Duration: Aids Allowed: 60 minutes none Student Number: Family Name(s): Given Name(s): Do not turn this page until you have received the signal to start. In the

More information

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.8 Application: Algorithms Copyright Cengage Learning. All rights reserved. Application:

More information

(Refer Slide Time 3:31)

(Refer Slide Time 3:31) Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 5 Logic Simplification In the last lecture we talked about logic functions

More information

Section 2.2: Introduction to the Logic of Quantified Statements

Section 2.2: Introduction to the Logic of Quantified Statements Section 2.2: Introduction to the Logic of Quantified Statements In this section, we shall continue to examine some of the fundamentals of predicate calculus. Specifically, we shall look at the negations

More information

CSE 311: Foundations of Computing. Lecture 8: Predicate Logic Proofs

CSE 311: Foundations of Computing. Lecture 8: Predicate Logic Proofs CSE 311: Foundations of Computing Lecture 8: Predicate Logic Proofs Last class: Propositional Inference Rules Two inference rules per binary connective, one to eliminate it and one to introduce it Elim

More information

Repetition Through Recursion

Repetition Through Recursion Fundamentals of Computer Science I (CS151.02 2007S) Repetition Through Recursion Summary: In many algorithms, you want to do things again and again and again. For example, you might want to do something

More information

MAT 243 Test 2 SOLUTIONS, FORM A

MAT 243 Test 2 SOLUTIONS, FORM A MAT 243 Test 2 SOLUTIONS, FORM A 1. [15 points] Calculate the following quantities: a. 17 mod 4 Solution: 17 17 4 = 17 4 4 = 1. 4 b. 17 div 4 17 Solution: = 4. 4 c. (( 1) mod 12) mod (27 div 5) Solution:

More information

Integers and Mathematical Induction

Integers and Mathematical Induction IT Program, NTUT, Fall 07 Integers and Mathematical Induction Chuan-Ming Liu Computer Science and Information Engineering National Taipei University of Technology TAIWAN 1 Learning Objectives Learn about

More information

Propositional Logic. Andreas Klappenecker

Propositional Logic. Andreas Klappenecker Propositional Logic Andreas Klappenecker Propositions A proposition is a declarative sentence that is either true or false (but not both). Examples: College Station is the capital of the USA. There are

More information

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points MC 0 GRAPH THEORY 0// Solutions to HW # 0 points + XC points ) [CH] p.,..7. This problem introduces an important class of graphs called the hypercubes or k-cubes, Q, Q, Q, etc. I suggest that before you

More information

The set consisting of all natural numbers that are in A and are in B is the set f1; 3; 5g;

The set consisting of all natural numbers that are in A and are in B is the set f1; 3; 5g; Chapter 5 Set Theory 5.1 Sets and Operations on Sets Preview Activity 1 (Set Operations) Before beginning this section, it would be a good idea to review sets and set notation, including the roster method

More information

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.6 Indirect Argument: Contradiction and Contraposition Copyright Cengage Learning. All

More information

2 Geometry Solutions

2 Geometry Solutions 2 Geometry Solutions jacques@ucsd.edu Here is give problems and solutions in increasing order of difficulty. 2.1 Easier problems Problem 1. What is the minimum number of hyperplanar slices to make a d-dimensional

More information

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Algorithms For Inference Fall 2014

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Algorithms For Inference Fall 2014 Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.438 Algorithms For Inference Fall 2014 Recitation-6: Hardness of Inference Contents 1 NP-Hardness Part-II

More information

Chapter Summary. Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms

Chapter Summary. Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms Chapter Summary Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms Section 5.1 Sec.on Summary Mathematical Induction Examples of Proof by Mathematical Induction Mistaken

More information

Discrete Mathematics Exam File Fall Exam #1

Discrete Mathematics Exam File Fall Exam #1 Discrete Mathematics Exam File Fall 2015 Exam #1 1.) Which of the following quantified predicate statements are true? Justify your answers. a.) n Z, k Z, n + k = 0 b.) n Z, k Z, n + k = 0 2.) Prove that

More information

Lemma (x, y, z) is a Pythagorean triple iff (y, x, z) is a Pythagorean triple.

Lemma (x, y, z) is a Pythagorean triple iff (y, x, z) is a Pythagorean triple. Chapter Pythagorean Triples.1 Introduction. The Pythagorean triples have been known since the time of Euclid and can be found in the third century work Arithmetica by Diophantus [9]. An ancient Babylonian

More information

ASSIGNMENT 4 SOLUTIONS

ASSIGNMENT 4 SOLUTIONS MATH 71 ASSIGNMENT SOLUTIONS 1. If F : X X is a function, define f (x) to be (f f)(x), and inductively define f k (x) (f f k 1 )(x) for each integer k. (So f (x) (f f )(x) f(f(f(x))) for instance.) We

More information

AXIOMS FOR THE INTEGERS

AXIOMS FOR THE INTEGERS AXIOMS FOR THE INTEGERS BRIAN OSSERMAN We describe the set of axioms for the integers which we will use in the class. The axioms are almost the same as what is presented in Appendix A of the textbook,

More information

Divisibility Rules and Their Explanations

Divisibility Rules and Their Explanations Divisibility Rules and Their Explanations Increase Your Number Sense These divisibility rules apply to determining the divisibility of a positive integer (1, 2, 3, ) by another positive integer or 0 (although

More information

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS What is discrete? Sets (Rosen, Chapter 2) TOPICS Discrete math Set Definition Set Operations Tuples Consisting of distinct or unconnected elements, not continuous (calculus) Helps us in Computer Science

More information

Topic 10 Part 2 [474 marks]

Topic 10 Part 2 [474 marks] Topic Part 2 [474 marks] The complete graph H has the following cost adjacency matrix Consider the travelling salesman problem for H a By first finding a minimum spanning tree on the subgraph of H formed

More information

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.3 Direct Proof and Counterexample III: Divisibility Copyright Cengage Learning. All rights

More information

MATH 139 W12 Review 1 Checklist 1. Exam Checklist. 1. Introduction to Predicates and Quantified Statements (chapters ).

MATH 139 W12 Review 1 Checklist 1. Exam Checklist. 1. Introduction to Predicates and Quantified Statements (chapters ). MATH 139 W12 Review 1 Checklist 1 Exam Checklist 1. Introduction to Predicates and Quantified Statements (chapters 3.1-3.4). universal and existential statements truth set negations of universal and existential

More information

Chapter 18 out of 37 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M. Cargal.

Chapter 18 out of 37 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M. Cargal. Chapter 8 out of 7 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M. Cargal 8 Matrices Definitions and Basic Operations Matrix algebra is also known

More information

Algorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48

Algorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48 Algorithm Analysis (Algorithm Analysis ) Data Structures and Programming Spring 2018 1 / 48 What is an Algorithm? An algorithm is a clearly specified set of instructions to be followed to solve a problem

More information

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.3 Direct Proof and Counterexample III: Divisibility Copyright Cengage Learning. All rights

More information

Problem. Prove that the square of any whole number n is a multiple of 4 or one more than a multiple of 4.

Problem. Prove that the square of any whole number n is a multiple of 4 or one more than a multiple of 4. CHAPTER 8 Integers Problem. Prove that the square of any whole number n is a multiple of 4 or one more than a multiple of 4. Strategy 13 Use cases. This strategy may be appropriate when A problem can be

More information

(Refer Slide Time 6:48)

(Refer Slide Time 6:48) Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 8 Karnaugh Map Minimization using Maxterms We have been taking about

More information

Euclid's Algorithm. MA/CSSE 473 Day 06. Student Questions Odd Pie Fight Euclid's algorithm (if there is time) extended Euclid's algorithm

Euclid's Algorithm. MA/CSSE 473 Day 06. Student Questions Odd Pie Fight Euclid's algorithm (if there is time) extended Euclid's algorithm MA/CSSE 473 Day 06 Euclid's Algorithm MA/CSSE 473 Day 06 Student Questions Odd Pie Fight Euclid's algorithm (if there is time) extended Euclid's algorithm 1 Quick look at review topics in textbook REVIEW

More information

Computer Science 236 Fall Nov. 11, 2010

Computer Science 236 Fall Nov. 11, 2010 Computer Science 26 Fall Nov 11, 2010 St George Campus University of Toronto Assignment Due Date: 2nd December, 2010 1 (10 marks) Assume that you are given a file of arbitrary length that contains student

More information

Lecture 2: Analyzing Algorithms: The 2-d Maxima Problem

Lecture 2: Analyzing Algorithms: The 2-d Maxima Problem Lecture 2: Analyzing Algorithms: The 2-d Maxima Problem (Thursday, Jan 29, 1998) Read: Chapter 1 in CLR. Analyzing Algorithms: In order to design good algorithms, we must first agree the criteria for measuring

More information

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture Homework 1 Due Date: Wednesday 11/26/07 - at the beginning of the lecture Problems marked with a [*] are a littlebit harder and count as extra credit. Note 1. For any of the given problems make sure that

More information

Bulgarian Math Olympiads with a Challenge Twist

Bulgarian Math Olympiads with a Challenge Twist Bulgarian Math Olympiads with a Challenge Twist by Zvezdelina Stankova Berkeley Math Circle Beginners Group September 0, 03 Tasks throughout this session. Harder versions of problems from last time appear

More information

Slides for Lecture 15

Slides for Lecture 15 Slides for Lecture 5 ENEL 353: Digital Circuits Fall 203 Term Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary October, 203 ENEL 353 F3 Section

More information

Conditionals !

Conditionals ! Conditionals 02-201! Computing GCD GCD Problem: Compute the greatest common divisor of two integers. Input: Two integers a and b. Output: The greatest common divisor of a and b. Exercise: Design an algorithm

More information

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan MATH 22 Lecture M: 10/14/2003 MORE ABOUT FUNCTIONS Form follows function. Louis Henri Sullivan This frightful word, function, was born under other skies than those I have loved. Le Corbusier D ora innanzi

More information

(Refer Slide Time: 01.26)

(Refer Slide Time: 01.26) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture # 22 Why Sorting? Today we are going to be looking at sorting.

More information

This Lecture. We will first introduce some basic set theory before we do counting. Basic Definitions. Operations on Sets.

This Lecture. We will first introduce some basic set theory before we do counting. Basic Definitions. Operations on Sets. Sets A B C This Lecture We will first introduce some basic set theory before we do counting. Basic Definitions Operations on Sets Set Identities Defining Sets Definition: A set is an unordered collection

More information

Lecture Notes, CSE 232, Fall 2014 Semester

Lecture Notes, CSE 232, Fall 2014 Semester Lecture Notes, CSE 232, Fall 2014 Semester Dr. Brett Olsen Week 11 - Number Theory Number theory is the study of the integers. The most basic concept in number theory is divisibility. We say that b divides

More information

One of the most important areas where quantifier logic is used is formal specification of computer programs.

One of the most important areas where quantifier logic is used is formal specification of computer programs. Section 5.2 Formal specification of computer programs One of the most important areas where quantifier logic is used is formal specification of computer programs. Specification takes place on several levels

More information

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.2 Direct Proof and Counterexample II: Rational Numbers Copyright Cengage Learning. All

More information

The divide and conquer strategy has three basic parts. For a given problem of size n,

The divide and conquer strategy has three basic parts. For a given problem of size n, 1 Divide & Conquer One strategy for designing efficient algorithms is the divide and conquer approach, which is also called, more simply, a recursive approach. The analysis of recursive algorithms often

More information

Integers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not.

Integers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not. What is an INTEGER/NONINTEGER? Integers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not. What is a REAL/IMAGINARY number? A real number is

More information

Unit 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers

Unit 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers Contents STRAND B: Number Theory Unit 7 Number System and Bases Student Text Contents Section 7. Number System 7.2 Binary Numbers 7.3 Adding and Subtracting Binary Numbers 7.4 Multiplying Binary Numbers

More information

(Refer Slide Time 5:19)

(Refer Slide Time 5:19) Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology, Madras Lecture - 7 Logic Minimization using Karnaugh Maps In the last lecture we introduced

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures Spring 2019 Alexis Maciel Department of Computer Science Clarkson University Copyright c 2019 Alexis Maciel ii Contents 1 Analysis of Algorithms 1 1.1 Introduction.................................

More information

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION Copyright Cengage Learning. All rights reserved. SECTION 5.5 Application: Correctness of Algorithms Copyright Cengage Learning. All rights reserved.

More information

UNM - PNM STATEWIDE MATHEMATICS CONTEST XLI. February 7, 2009 Second Round Three Hours

UNM - PNM STATEWIDE MATHEMATICS CONTEST XLI. February 7, 2009 Second Round Three Hours UNM - PNM STATEWIDE MATHEMATICS CONTEST XLI February 7, 009 Second Round Three Hours (1) An equilateral triangle is inscribed in a circle which is circumscribed by a square. This square is inscribed in

More information

Recitation 4: Elimination algorithm, reconstituted graph, triangulation

Recitation 4: Elimination algorithm, reconstituted graph, triangulation Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.438 Algorithms For Inference Fall 2014 Recitation 4: Elimination algorithm, reconstituted graph, triangulation

More information

Is the statement sufficient? If both x and y are odd, is xy odd? 1) xy 2 < 0. Odds & Evens. Positives & Negatives. Answer: Yes, xy is odd

Is the statement sufficient? If both x and y are odd, is xy odd? 1) xy 2 < 0. Odds & Evens. Positives & Negatives. Answer: Yes, xy is odd Is the statement sufficient? If both x and y are odd, is xy odd? Is x < 0? 1) xy 2 < 0 Positives & Negatives Answer: Yes, xy is odd Odd numbers can be represented as 2m + 1 or 2n + 1, where m and n are

More information

COMP3121/3821/9101/ s1 Assignment 1

COMP3121/3821/9101/ s1 Assignment 1 Sample solutions to assignment 1 1. (a) Describe an O(n log n) algorithm (in the sense of the worst case performance) that, given an array S of n integers and another integer x, determines whether or not

More information

ANALYSIS OF ALGORITHMS

ANALYSIS OF ALGORITHMS ANALYSIS OF ALGORITHMS Running Time Pseudo-Code Asymptotic Notation Asymptotic Analysis Mathematical facts T(n) n = 4 Input Algorithm Output 1 Average Case vs. Worst Case Running Time of an Algorithm An

More information

CpSc 421 Final Solutions

CpSc 421 Final Solutions CpSc 421 Final Solutions Do any eight of the ten problems below. If you attempt more than eight problems, please indicate which ones to grade (otherwise we will make a random choice). This allows you to

More information

CPSC 121 Sample Final Examination December 2013

CPSC 121 Sample Final Examination December 2013 CPSC 121 Sample Final Examination December 2013 Name: Student ID: Signature: You have 150 minutes to write the 11 questions on this examination. A total of 98 marks are available. Justify all of your answers.

More information

Geometry Definitions, Postulates, and Theorems. Chapter 3: Parallel and Perpendicular Lines. Section 3.1: Identify Pairs of Lines and Angles.

Geometry Definitions, Postulates, and Theorems. Chapter 3: Parallel and Perpendicular Lines. Section 3.1: Identify Pairs of Lines and Angles. Geometry Definitions, Postulates, and Theorems Chapter : Parallel and Perpendicular Lines Section.1: Identify Pairs of Lines and Angles Standards: Prepare for 7.0 Students prove and use theorems involving

More information

Prepared by Sa diyya Hendrickson. Package Summary

Prepared by Sa diyya Hendrickson. Package Summary Introduction Prepared by Sa diyya Hendrickson Name: Date: Package Summary Exponent Form and Basic Properties Order of Operations Using Divisibility Rules Finding Factors and Common Factors Primes, Prime

More information

1 Leaffix Scan, Rootfix Scan, Tree Size, and Depth

1 Leaffix Scan, Rootfix Scan, Tree Size, and Depth Lecture 17 Graph Contraction I: Tree Contraction Parallel and Sequential Data Structures and Algorithms, 15-210 (Spring 2012) Lectured by Kanat Tangwongsan March 20, 2012 In this lecture, we will explore

More information

Lecture 3 Algorithms with numbers (cont.)

Lecture 3 Algorithms with numbers (cont.) Advanced Algorithms Floriano Zini Free University of Bozen-Bolzano Faculty of Computer Science Academic Year 2013-2014 Lecture 3 Algorithms with numbers (cont.) 1 Modular arithmetic For cryptography it

More information

CS/COE 0447 Example Problems for Exam 2 Spring 2011

CS/COE 0447 Example Problems for Exam 2 Spring 2011 CS/COE 0447 Example Problems for Exam 2 Spring 2011 1) Show the steps to multiply the 4-bit numbers 3 and 5 with the fast shift-add multipler. Use the table below. List the multiplicand (M) and product

More information

Solutions. (a) Claim: A d-ary tree of height h has at most 1 + d +...

Solutions. (a) Claim: A d-ary tree of height h has at most 1 + d +... Design and Analysis of Algorithms nd August, 016 Problem Sheet 1 Solutions Sushant Agarwal Solutions 1. A d-ary tree is a rooted tree in which each node has at most d children. Show that any d-ary tree

More information

1 / 43. Today. Finish Euclid. Bijection/CRT/Isomorphism. Fermat s Little Theorem. Review for Midterm.

1 / 43. Today. Finish Euclid. Bijection/CRT/Isomorphism. Fermat s Little Theorem. Review for Midterm. 1 / 43 Today Finish Euclid. Bijection/CRT/Isomorphism. Fermat s Little Theorem. Review for Midterm. 2 / 43 Finding an inverse? We showed how to efficiently tell if there is an inverse. Extend euclid to

More information

Announcements. CS243: Discrete Structures. Strong Induction and Recursively Defined Structures. Review. Example (review) Example (review), cont.

Announcements. CS243: Discrete Structures. Strong Induction and Recursively Defined Structures. Review. Example (review) Example (review), cont. Announcements CS43: Discrete Structures Strong Induction and Recursively Defined Structures Işıl Dillig Homework 4 is due today Homework 5 is out today Covers induction (last lecture, this lecture, and

More information

1. Chapter 1, # 1: Prove that for all sets A, B, C, the formula

1. Chapter 1, # 1: Prove that for all sets A, B, C, the formula Homework 1 MTH 4590 Spring 2018 1. Chapter 1, # 1: Prove that for all sets,, C, the formula ( C) = ( ) ( C) is true. Proof : It suffices to show that ( C) ( ) ( C) and ( ) ( C) ( C). ssume that x ( C),

More information

Solutions to the Second Midterm Exam

Solutions to the Second Midterm Exam CS/Math 240: Intro to Discrete Math 3/27/2011 Instructor: Dieter van Melkebeek Solutions to the Second Midterm Exam Problem 1 This question deals with the following implementation of binary search. Function

More information