MAT 243 Test 2 SOLUTIONS, FORM A

Similar documents
MAT 243 Test 2 SOLUTIONS, FORM A

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

Fall 2017 Test II review problems

Number Theory Basics Z = {..., 2, 1, 0, 1, 2,...} For, b Z, we say that divides b if z = b for some. Notation: b Fact: for all, b, c Z:

Induction. Induction. Induction. Induction. Induction. Induction 2/22/2018

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

Exercises Exercises. 2. Determine whether each of these integers is prime. a) 21. b) 29. c) 71. d) 97. e) 111. f) 143. a) 19. b) 27. c) 93.

Homework #2 Solutions Due: September 5, for all n N n 3 = n2 (n + 1) 2 4

CSE 20 DISCRETE MATH. Fall

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

then the hard copy will not be correct whenever your instructor modifies the assignments.

Math 109 HW 9 Solutions

CS1800: Mathematical Induction. Professor Kevin Gold

Part I, Number Systems. CS131 Mathematics for Computer Scientists II Note 1 INTEGERS

4 Powers of an Element; Cyclic Groups

Definition For a set F, a polynomial over F with variable x is of the form

4 Number Theory and Cryptography

1 Overview and revision

With Question/Answer Animations. Chapter 4

Try the assignment f(1) = 2; f(2) = 1; f(3) = 4; f(4) = 3;.

NOTES ON SIMPLE NUMBER THEORY

Chapter 1. Greatest common divisor. 1.1 The division theorem. In the beginning, there are the natural numbers 0, 1, 2, 3, 4,...,

Ch 4.2 Divisibility Properties

Chapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices. Integers & Algorithms (2.5)

Homework #2 solutions Due: June 15, 2012

All variables a, b, n, etc are integers unless otherwise stated. Each part of a problem is worth 5 points.

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013

Chapter 4 Finite Fields

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()

Number Theory Proof Portfolio

Algebra for error control codes

Input Decidable Language -- Program Halts on all Input Encoding of Input -- Natural Numbers Encoded in Binary or Decimal, Not Unary

Name CMSC203 Fall2008 Exam 2 Solution Key Show All Work!!! Page (16 points) Circle T if the corresponding statement is True or F if it is False.

Number theory (Chapter 4)

2301 Assignment 1 Due Friday 19th March, 2 pm

3 The fundamentals: Algorithms, the integers, and matrices

Discrete Math in Computer Science Solutions to Practice Problems for Midterm 2

CPSC 467b: Cryptography and Computer Security

Algorithmic number theory. Questions/Complaints About Homework? The division algorithm. Division

Proof Techniques (Review of Math 271)

A Few Examples of Limit Proofs

5. Use a truth table to determine whether the two statements are equivalent. Let t be a tautology and c be a contradiction.

COMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635

4. Number Theory (Part 2)

STEP Support Programme. Hints and Partial Solutions for Assignment 17

1. Introduction to commutative rings and fields

Solutions to Assignment 1

Direct Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

CPSC 467: Cryptography and Computer Security

CPSC 518 Introduction to Computer Algebra Asymptotically Fast Integer Multiplication

. As the binomial coefficients are integers we have that. 2 n(n 1).

Divisibility. Chapter Divisors and Residues

Standard forms for writing numbers

Divisibility = 16, = 9, = 2, = 5. (Negative!)

Number Theory and the abc Conjecture

#26: Number Theory, Part I: Divisibility

2.3 In modular arithmetic, all arithmetic operations are performed modulo some integer.

Mathematical Induction

cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications

THE DIVISION THEOREM IN Z AND F [T ]

CSE 311: Foundations of Computing. Lecture 12: Two s Complement, Primes, GCD

NAME (1 pt): TA (1 pt): Name of Neighbor to your left (1 pt): Name of Neighbor to your right (1 pt):

*EXAM 1 Answer key* EECS 203 Spring 2016

Solutions to Problem Set 4 - Fall 2008 Due Tuesday, Oct. 7 at 1:00

Four Basic Sets. Divisors

CPSC 518 Introduction to Computer Algebra Schönhage and Strassen s Algorithm for Integer Multiplication

Number theory (Chapter 4)

2 Elementary number theory

CS2800 Questions selected for fall 2017

22. The Quadratic Sieve and Elliptic Curves. 22.a The Quadratic Sieve

a = qb + r where 0 r < b. Proof. We first prove this result under the additional assumption that b > 0 is a natural number. Let

Introduction to Number Theory. The study of the integers

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

For your quiz in recitation this week, refer to these exercise generators:

Solving recurrences. Frequently showing up when analysing divide&conquer algorithms or, more generally, recursive algorithms.

1. Introduction to commutative rings and fields

Elementary Properties of the Integers

Divisibility in the Fibonacci Numbers. Stefan Erickson Colorado College January 27, 2006

Solutions to MAT 117 Test #3

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

Discrete Mathematics GCD, LCM, RSA Algorithm

The Chinese Remainder Theorem

Solutions to Practice Final

1 Recommended Reading 1. 2 Public Key/Private Key Cryptography Overview RSA Algorithm... 2

DIVISIBILITY AND GREATEST COMMON DIVISORS

Continuing discussion of CRC s, especially looking at two-bit errors

CS280, Spring 2004: Prelim Solutions

MATH Dr. Halimah Alshehri Dr. Halimah Alshehri

MATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology.

Basic Algorithms in Number Theory

Math 412, Introduction to abstract algebra. Overview of algebra.

Algebra. Modular arithmetic can be handled mathematically by introducing a congruence relation on the integers described in the above example.

Encryption: The RSA Public Key Cipher

LECTURE NOTES IN CRYPTOGRAPHY

Homework 7 solutions M328K by Mark Lindberg/Marie-Amelie Lawn

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5

Number Theory Solutions Packet

Chapter 5. Number Theory. 5.1 Base b representations

Big , and Definition Definition

Transcription:

MAT Test SOLUTIONS, FORM A 1. [10 points] Give a recursive definition for the set of all ordered pairs of integers (x, y) such that x < y. Solution: Let S be the set described above. Note that if (x, y) S, then there are five neighboring ordered pairs which are also in S: (x + 1, y + 1), (x, y + 1), (x 1, y + 1), (x 1, y), and (x 1, y 1). (If (x, y) = (0, 1), then (x, y 1), (x + 1, y 1) and (x + 1, y) are not in S.) This gives you the recursive part. The next step is to determine which elements of S cannot be obtained from another element in S using the rules above; (0, 1) is one such ordered pair (although there are others). Every ordered pair in S can be reached from (0, 1) by the recursive part, so a description for S is: (1) (0, 1) S. () If (x, y) S, then (x + 1, y + 1), (x, y + 1), (x 1, y + 1), (x 1, y), (x 1, y 1) S. () Finiteness: Every element of S is obtained by applying () a finite number of times. Note that (0, 1) can be replaced with (a, a + 1) for any integer a, and that part () must include (x+1, y+1) and (x 1, y 1) and at least one of the other three points, so other answers were possible. Grading: + points (each) for conditions (1) and (), + points for condition (). Grading for partial credit: + points (total) for not giving a set of ordered pairs.. [10 points] Convert () 10 to base 6. Solution: Repeatedly divide by 6, repeating with the remainder, until the quotient is zero: = 0 6 + 0 = 6 6 + 6 = 1 6 + 0 1 = 0 6 + 1 Now take the remainders in reverse order, to get (10) 6. Grading: +7 points for the repeated division, + points for putting the remainders together.. [10 points] Convert (1000111000111111) to base. Solution: The easiest way to do this is to break up the number into groups of two (since = ), starting from the right, then convert each digit to base : ( 10 00 0 11 10 00 0 11 11 11 so the answer is (00). Grading: +5 points for splitting up the binary number, +5 points for converting each digit. )

MAT Test SOLUTIONS, FORM A. [10 points] Find a function g(x) such that (n 5 + log(5 n ))( n + n ) is O(g(n)) and g(x) is as simple and small as possible. Solution: In the first factor, n 5 grows faster than log(5 n ) = n log 5, so the first factor is O(n 5 ). In the second factor, n grows faster than n, so the second factor is O( n ). The product will grow as the product of these two functions, or O(n 5 n ). ) (n 5 + log(5 n ))( + n } n 5 {{ n } n 5 n Grading: Done on a 0 5 7 10-point basis. Grading for common mistakes points for forgetting to multiply n 5 by n ; points for leaving a constant in the answer. 5. [15 points] Use mathematical induction to show that for n 0. Solution: Let P (n) be the predicate n k k = + [n ] n n k k = + [n ] n. To prove P (n) for all n 0, you need to prove two things: First, P (0) is true, because the two sides of the equation are Now, assume that P (m) is true; that is, 0 k k = 0 + [ 0 ] 0 = 0 m k k = + [m ] m. The goal is to prove P (m + 1), which is (m+1) k k = + [(m + 1) ] (m+1). This is done by manipulating the sum, and using the assumption that P (m) is true: m+1 k k = m k k + (m + 1) m+1 = + (m ) m + (m + 1) m+1 = + (m 1) m+1 + (m + 1) m+1 = + (m) m+1 = + [(m + 1) ] m+1. Hence, P (m) does imply P (m + 1). By the principle of mathematical induction, P (n) is true for all nonnegative integers n. Grading: +5 points for checking the initial case, +5 points for setting up the inductive argument, +5 points for doing the algebra.

6. Let m = 151 and n = 9. MAT Test SOLUTIONS, FORM A a. [10 points] Use the Euclidean Algorithm to find gcd(m, n). Solution: Use repeated division: 9 = 151 + 51 151 = 51 + 117 51 = 117 + 0 The GCD is the last nonzero remainder, which is 117. Graded on a 0 5 7 10-point basis. Grading for common mistakes: +5 points (total) for finding the prime factorization. b. [10 points] Find the Bézout coefficients for m and n; that is, find integers a and b such that am + bn = gcd(m, n). Solution: This builds on your answer to part (a), so fortunately most people got that right. Start off by taking the second equation and solving for 117: 117 = 151 51 Now take the first equation and solve it for 51, and then substitutate that into the equation right above this text. Thus the coefficients are 9 and. = 151 (9 151) = 9 151 9 Grading: + points for solving each equation, and + points for substitution.

MAT Test SOLUTIONS, FORM A 7. [15 points] Evaluate the following quantities. a. mod 7 Answer:. b. mod 7 Answer: 5. ( = 7 + 5.) c. (0 mod 1) div (11 mod 6) Solution: This is 7 div 5 = 1. Grading for common mistakes: points for bad division (non-integer answers, etc.) 8. [10 points] Let S be the set of strings defined recursively by (1) λ S; () If x S, then 1x S and x0 S; () Only these strings are in S. Use structural induction to prove that S does not contain any string x in which a 0 occurs to the left of a 1 in x. (Hence, for instance, 01110 S.) Solution: A full solution looks like something along these lines: Suppose that x S. If x = λ, then x does not contain a 0 to the left of a 1, because x has no characters. If x = 1y, where y S, then we may assume that y does not contain a 0 to the left of a 1. Now x cannot contain a 0 to the left of a 1, because that 0 would have to be part of the string y, as well as the 1 which is to the right of that 0. Hence, in this case, x does not contain a 0 to the left of a 1. If x = y0, where y S, then we may assume that y does not contain a 0 to the left of a 1. The string x cannot contain a 0 to the left of a 1, because the 1 would have to be part of the string y, as well as the 0 to the left of that 1. Hence, in this case, x does not contain bad, either. Hence, by induction, no element of S contains a 0 to the left of a 1. Grading: + points for the base case, + points for each induction case, + points for the final sentence. Grading for common mistakes: +5 points (total) if several examples were done. 5

MAT Test SOLUTIONS, FORM B 1. [10 points] Give a recursive definition for the set of all ordered pairs of integers (x, y) such that x y. Solution: Let S be the set described above. Note that if (x, y) S, then there are five neighboring ordered pairs which are also in S: (x + 1, y + 1), (x + 1, y), (x + 1, y 1), (x, y 1), and (x 1, y 1). (If (x, y) = (0, 0), then (x 1, y), (x 1, y + 1) and (x, y + 1) are not in S.) This gives you the recursive part. The next step is to determine which elements of S cannot be obtained from another element in S using the rules above; (0, 0) is one such ordered pair (although there are others). Every ordered pair in S can be reached from (0, 0) by the recursive part, so a description for S is: (1) (0, 0) S. () If (x, y) S, then (x + 1, y + 1), (x + 1, y), (x + 1, y 1), (x, y 1), (x 1, y 1) S. () Finiteness: Every element of S is obtained by applying () a finite number of times. Note that (0, 0) can be replaced with (a, a) for any integer a, and that part () must include (x+1, y+1) and (x 1, y 1) and at least one of the other three points, so other answers were possible. Grading: + points (each) for conditions (1) and (), + points for condition (). Grading for partial credit: + points (total) for not giving a set of ordered pairs.. [10 points] Convert () 10 to base 7. Solution: Repeatedly divide by 7, repeating with the remainder, until the quotient is zero: = 7 + 5 = 7 + 6 = 0 7 + Now take the remainders in reverse order, to get (65) 7. Grading: +7 points for the repeated division, + points for putting the remainders together.. [10 points] Convert (1100110000110001) to base 8. Solution: The easiest way to do this is to break up the number into groups of three (since = 8), starting from the right, then convert each digit to base 8: ( 1 1 100 110 6 000 0 110 6 001 1 so the answer is (16061) 8. Grading: +5 points for splitting up the binary number, +5 points for converting each digit. )

MAT Test SOLUTIONS, FORM B. [10 points] Find a function g(x) such that (n + log(n + 1))(n! + n ) is O(g(n)) and g(x) is as simple and small as possible. Solution: In the first factor, n grows faster than log(n + 1), so the first factor is O(n ). In the second factor, n! grows faster than n, so the second factor is O(n!). The product will grow as the product of these two functions, or O(n n!). (n + log(n + 1) )(n! + n ) n n! n n! Grading: Done on a 0 5 7 10-point basis. Grading for common mistakes: points for forgetting to multiply n by n!; points for leaving a constant in the answer. 5. [15 points] Use mathematical induction to show that n k k = [ n + ] n for n 0. Solution: Let P (n) be the predicate n k k = + [ n you need to prove two things: First, P (0) is true, because the two sides of the equation are 0 k k = 0 [ 0 + ] 0 = 0 Now, assume that P (m) is true; that is, m k k = [ m + ] m. The goal is to prove P (m + 1), which is (m+1) k k = + [ (m + 1) ] n. To prove P (n) for all n 0, ] (m+1). This is done by manipulating the sum, and using the assumption that P (m) is true: m+1 m k k = k k + (m + 1) m+1 = [ m + ] m + (m + 1) m+1 = [ m + 1 ] m+1 + (m + 1) m+1 = [ m + + ] m+1 = [ m + + + ] m+1 = [ (m + 1) + ] m+1. Hence, P (m) does imply P (m + 1). By the principle of mathematical induction, P (n) is true for all nonnegative integers n. Grading: +5 points for checking the initial case, +5 points for setting up the inductive argument, +5 points for doing the algebra.

6. Let m = 1 and n = 105. MAT Test SOLUTIONS, FORM B a. [10 points] Use the Euclidean Algorithm to find gcd(m, n). Solution: Use repeated division: 105 = 1 + 71 1 = 71 + 57 71 = 57 + 0 The GCD is the last nonzero remainder, which is 57. Graded on a 0 5 7 10-point basis. Grading for common mistakes: +5 points (total) for finding the prime factorization. b. [10 points] Find the Bézout coefficients for m and n; that is, find integers a and b such that am + bn = gcd(m, n). Solution: This builds on your answer to part (a), so fortunately most people got that right. Start off by taking the second equation and solving for 57: 57 = 1 71 Now take the first equation and solve it for 71, and then substitutate that into the equation right above this text. Thus the coefficients are 1 and. = 1 (105 1) = 1 1 105 Grading: + points for solving each equation, and + points for substitution.

MAT Test SOLUTIONS, FORM B 7. [15 points] Evaluate the following quantities. a. 5 mod Answer: 1 b. 5 mod Answer:. ( 5 = 7 +.) c. ( mod 1) div (17 mod 6) Solution: This equals 11 div 5 =. Grading for common mistakes: points for bad division (non-integer answers, etc.) 8. [10 points] Let S be the set of strings defined recursively by (1) λ S; () If x S, then 0x S and x1 S; () Only these strings are in S. Use structural induction to prove that S does not contain any string x in which a 0 occurs to the right of a 1 in x. (Hence, for instance, 01110 S.) Solution: A full solution looks like something along these lines: Suppose that x S. If x = λ, then x does not contain a 0 to the right of a 1, because x has no characters. If x = 0y, where y S, then we may assume that y does not contain a 0 to the right of a 1. Now x cannot contain a 0 to the right of a 1, because that 1 would have to be part of the string y, as well as the 0 which is to the right of that 1. Hence, in this case, x does not contain a 0 to the right of a 1. If x = y1, where y S, then we may assume that y does not contain a 0 to the right of a 1. The string x cannot contain a 0 to the right of a 1, because the 0 would have to be part of the string y, as well as the 1 to the left of that 0. Hence, in this case, x does not contain bad, either. Hence, by induction, no element of S contains a 0 to the right of a 1. Grading: + points for the base case, + points for each induction case, + points for the final sentence. Grading for common mistakes: +5 points (total) if several examples were done. 5