9. The Pails of Water Problem

Similar documents
8 Primes and Modular Arithmetic

The Euclidean Algorithm

Kevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm

8 Divisibility and prime numbers

Chapter 11 Number Theory

Intermediate Math Circles March 7, 2012 Linear Diophantine Equations II

MATH 13150: Freshman Seminar Unit 10

26 Integers: Multiplication, Division, and Order

Activity 1: Using base ten blocks to model operations on decimals

MATH10040 Chapter 2: Prime and relatively prime numbers

Math Workshop October 2010 Fractions and Repeating Decimals

Grade 6 Math Circles March 10/11, 2015 Prime Time Solutions

GCDs and Relatively Prime Numbers! CSCI 2824, Fall 2014!

Grade 7/8 Math Circles Fall 2012 Factors and Primes

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University

4.2 Euclid s Classification of Pythagorean Triples

SOLUTIONS FOR PROBLEM SET 2

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

GREATEST COMMON DIVISOR

Factoring Whole Numbers

DIVISIBILITY AND GREATEST COMMON DIVISORS

Greatest Common Factor and Least Common Multiple

Prime Factorization 0.1. Overcoming Math Anxiety

15 Prime and Composite Numbers

Section 4.2: The Division Algorithm and Greatest Common Divisors

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

5544 = = = Now we have to find a divisor of 693. We can try 3, and 693 = 3 231,and we keep dividing by 3 to get: 1

Previously, you learned the names of the parts of a multiplication problem. 1. a. 6 2 = 12 6 and 2 are the. b. 12 is the

The Fundamental Theorem of Arithmetic

Today s Topics. Primes & Greatest Common Divisors

Working with whole numbers

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

MATH 289 PROBLEM SET 4: NUMBER THEORY

The last three chapters introduced three major proof techniques: direct,

SAT Math Facts & Formulas Review Quiz

MATH 22. THE FUNDAMENTAL THEOREM of ARITHMETIC. Lecture R: 10/30/2003

Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may

No Solution Equations Let s look at the following equation: 2 +3=2 +7

Math Circle Beginners Group October 18, 2015

CONTENTS 1. Peter Kahn. Spring 2007

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

Homework until Test #2

Lesson 4. Factors and Multiples. Objectives

Calculate Highest Common Factors(HCFs) & Least Common Multiples(LCMs) NA1

Lecture 13 - Basic Number Theory.

Rational Exponents. Squaring both sides of the equation yields. and to be consistent, we must have

The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

LAMC Beginners Circle: Parity of a Permutation Problems from Handout by Oleg Gleizer Solutions by James Newton

Mathematical Induction. Mary Barnes Sue Gordon

MACM 101 Discrete Mathematics I

NUMBER SYSTEMS. William Stallings

POLYNOMIAL FUNCTIONS

Section 4.1 Rules of Exponents

Unit 6 Number and Operations in Base Ten: Decimals

Math 319 Problem Set #3 Solution 21 February 2002

Week 13 Trigonometric Form of Complex Numbers

Playing with Numbers

CISC - Curriculum & Instruction Steering Committee. California County Superintendents Educational Services Association

6.1 The Greatest Common Factor; Factoring by Grouping

of Nebraska - Lincoln

z 0 and y even had the form

Pre-Calculus II Factoring and Operations on Polynomials

Session 6 Number Theory

RSA and Primality Testing

Grade 6 Math Circles. Binary and Beyond

5-1 NUMBER THEORY: DIVISIBILITY; PRIME & COMPOSITE NUMBERS 210 f8

Mathematical Induction

Continued Fractions and the Euclidean Algorithm

SECTION 10-2 Mathematical Induction

MATH 60 NOTEBOOK CERTIFICATIONS

CS 103X: Discrete Structures Homework Assignment 3 Solutions

1. The Fly In The Ointment

Solving Rational Equations

( ) FACTORING. x In this polynomial the only variable in common to all is x.

Factorizations: Searching for Factor Strings

Handout #1: Mathematical Reasoning

Stupid Divisibility Tricks

MATH 537 (Number Theory) FALL 2016 TENTATIVE SYLLABUS

3. Mathematical Induction

s = s = s =

An Innocent Investigation

A Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions

Congruent Number Problem

3.1. RATIONAL EXPRESSIONS

How do you compare numbers? On a number line, larger numbers are to the right and smaller numbers are to the left.

Exponents and Radicals

Introduction to Programming (in C++) Loops. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC

Example. Introduction to Programming (in C++) Loops. The while statement. Write the numbers 1 N. Assume the following specification:

FACTORING OUT COMMON FACTORS

11 Ideals Revisiting Z

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

SUM OF TWO SQUARES JAHNAVI BHASKAR

Discrete Mathematics, Chapter 4: Number Theory and Cryptography

Computation Strategies for Basic Number Facts +, -, x,

Handout NUMBER THEORY

Not for resale. 4.1 Divisibility of Natural Numbers 4.2 Tests for Divisibility 4.3 Greatest Common Divisors and Least Common Multiples

Quotient Rings and Field Extensions

FACTORS, PRIME NUMBERS, H.C.F. AND L.C.M.

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

Transcription:

9. The Pails of Water Problem You have a 5 and a 7 quart pail. How can you measure exactly 1 quart of water, by pouring water back and forth between the two pails? You are allowed to fill and empty each pail as many times as needed. [Try to solve this problem before reading further!] Here is one solution: 5-quart 7-quart Explanation 0 0 both pails start out empty 5 0 fill 5-quart pail 0 5 empty 5-quart pail into 7 5 5 fill 5-quart pail a second time 3 7 pour 2 quarts from 5-quart pail to fill up 7 3 0 empty 7-quart pail 0 3 transfer 3 quarts from 5-quart pail into 7 5 3 fill 5-quart pail a third time 1 7 pour 4 quarts from 5-quart pail to fill up 7 1 0 empty 7-quart pail a second time. This leaves exactly one quart in the 5-quart pail. Notice that we filled the 5-quart pail three times and emptied the 7-quart pail twice. A little thought convinces us that the method given above can be written more succintly as: 3 5 2 7 = 1. Now suppose you wish to obtain one quart with a 7-quart and a 19-quart pail. [Try this before reading further!] The secret is to fill the 19-quart pail two times from the 7-quart pail, thereby effectively converting the 19-quart pail into a 5-quart pail. The associated equation is 5 = 19 2 7. But we know how to solve the problem with quart sizes of 7 and 5. So we can use our previous solution for 5 and 7 to get a solution for 7 and 19. Here s how it works: 12

9. THE PAILS OF WATER PROBLEM 13 1 = 3 5 2 7 solution for 5 and 7 = 3 (19 2 7) 2 7 substituting 5 = 19 2 7 = 3 19 6 7 2 7 expand the parentheses = 3 19 8 7 gather the 7 s together The solution is to fill the 19-quart pair three times, a total of 57 quarts, and empty it into the 7-quart pail eight times, a total of 56 quarts. The difference is precisely 1 quart. Let s solve the Pails of Water Problem (POW) with the numbers 100 and 77. First, we divide 77 into 100. Since 77 goes into 100 one time, with remainder 23, we write 23 = 100 77 and record this equation for later use. Now we have reduced the POW problem to the numbers 77 and 23. But these numbers are still too big; it is not obvious how to get 1 from the numbers 77 and 23. So we reduce again. The smaller number 23 goes into 77 three times, with remainder 8. Write this as 8 = 77 3(23). Can we solve POW with 23 and 8? Yes! 3 8 1 23 = 1. Now we substitute the previous remainder equations to work our way back to the original numbers 100 and 77: 1 = 3(8) 23 solution with 8 and 23 = 3(77 3(23)) 23 substitute 8 = 77 3(23) = 3(77) 9(23) 23 expand the first parentheses = 3(77) 10(23) gather the 23 s together = 3(77) 10(100 77) substitute 23 = 100 77 = 3(77) 10(100) + 10(77) expand the second parentheses = 13(77) 10(100) gather the 77 s together. We can easily check our solution 13 77 10 100 = 1 with a calculator: 13 77 = 1001 and we know (without a calculator) that 10 100 = 1000. In general, suppose you want to solve the POW problem with two numbers, a and b. Let s say that a is smaller than b. If you can t think of the solution right away because the

14 numbers are too large, reduce the problem to two smaller numbers, by dividing the smaller number a into b, getting a quotient q and a remainder r. Write this as r = b q a. Record this equation as you will need it later. The original POW problem a and b reduces to solving POW with the numbers r and a. You can write this reduction as (a,b) (r,a). If the numbers r and a are still too big, reduce again, by dividing r into a. Eventually you will reach two numbers that you can do in your head. Starting with this easy solution, carefully work backwards, substituting the remainder equations you previously recorded, until you reach a solution using the original numbers a and b. The method described in this section for solving the pails of water problem is called the Euclidean algorithm. An algorithm is a set of steps for completing some task. (No, the word is not named after Bill Clinton s vice president.) A recipe from a cookbook is a good example of an algorithm. This particular procedure dates back over two thousand years ago to the Greek mathematician Euclid, who also founded plane geometry. Question #31. You cannot obtain 1 quart of water with 6 and 10 quart pails. Why not? What is the smallest amount you can obtain? Question #32. Solve POW in your head: (a) 10 and 19; (b) 7 and 9; (c) 11 and 8 Question #33. Another solution with 5 and 7 is: 3 7 4 5 = 1. Show how to get this solution from the solution 3 5 2 7 = 1. Hint: add and subtract 5 7. Question #34. Solve POW with (1) 31 and 9 (2) 54 and 37. (3) 2519 and 377 (4) make up your own problem 10. Greatest Common Divisor b. Definition 1.1. Suppose d a and d b. Then d is called a common divisor of a and Example: Common divisors of 14 and 18 are ±1, ±2.

10. GREATEST COMMON DIVISOR 15 Question #35. Does any pair of integers a and b always have at least one common divisor? Question #36. If you know that a and b have infinitely many common divisors, what must be true about a and b? Definition 1.2. If a and b are not both 0, then the largest positive common divisor g of a and b is called the greatest common divisor of a and b. Notation: Write d = gcd(a,b) or just g = (a,b). Example: gcd(14, 18) = 2. Exercise #37. Find the greatest common divisor of (1) 36 and 22 (2) 100 and -30. (3) 15 and 28 (4) 0 and 28 (5) make up your own problem Notation: When gcd(a,b) = 1 we say that a and b are relatively prime or that a is relatively prime to b. Another way of saying this is to assert that a and b share no common factors. Example. 144 and 35 are relatively prime, while 21 and 35 are not. Theorem #38. Fact: If a 0 and b and q are integers, then the common divisors of a and b are the same as the common divisors of a and b+qa. (That is, d is a common divisor of a and b if and only if d is a common divisor of a and b+qa.) In particular, (a,b) = (a,b+qa). As an immediate consequence, we have Fact: If a 0 and b = qa+r, then (a,b) = (a,r). Problem #39. Using the previous theorem and succesive applications of the Division Algorithm, devise a method for computing the gcd of a and b. Exercise #40. Compute (12471, 149751).

16 Exercise #41. Compute (12345, 67890). If your method reminds you of the POW problem, you are not having an out-of-body deja-vu experience. The method for find gcd s and the method for solving POW are essentially the same technique. Both are called the Eulclidean Algorithm. (The POW method is sometimes called the extended Euclidean Algorithm.) Question #42. Back to the pails of water problem. What do you think is the smallest amount of water you can obtain from pails of size a and b? Exercise #43. Find integers x and y such that 12345x+67890y = (12345,67890).