0% found this document useful (0 votes)
79 views10 pages

Math Strategies & Algorithms Guide

The document discusses strategies for winning a number marking game and algorithms for finding the greatest common divisor of two numbers. It also covers definitions, theorems, and examples related to divisibility and using multiple containers to measure various amounts of liquid.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views10 pages

Math Strategies & Algorithms Guide

The document discusses strategies for winning a number marking game and algorithms for finding the greatest common divisor of two numbers. It also covers definitions, theorems, and examples related to divisibility and using multiple containers to measure various amounts of liquid.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Homework assignment 2

Part 1: Winning Strategies

If player 1 crosses out a Prime number:

• Player 2 should immediately mark another prime number (or a number that does not share
GCF with player 1’s number) that is even.
• Player two simply mark a consecutive number.

If player 1 crosses out a Composite number:

• Player two simply mark a consecutive number.


• Player two can mark an even number that does share a GCF with player 1’s number.

Player 2 always has the chance two win

Part 2: The algorithm (Questions from the handout)

Question 1)

How the algorithm works: You start by subtracting the given numbers. (𝑎 − 𝑏 = 𝑐). The answer of
the next subtraction will be the absolute value of b minus c. In general, the answer of the next
subtraction will be |𝑏 − 𝑐| if the current equation is (𝑎 − 𝑏 = 𝑐).

Question 2)

One thing that noticed was the number in the last step is the greatest common divisor of the two
starting numbers. For example, the greatest common divisor of 429 and 182 is 13 and the last step
of the algorithm is 13 – 13. The greatest common divisor of 95 and 78 is 1 and the last step of the
algorithm is 1 – 1. See the table below:

Starting numbers Greatest common divisor Last step of the algorithm


182 and 429 13 13 – 13
78 and 95 1 1–1
177 and 303 3 3–3

So maybe this is a faster and easier way to figure out the GCD of two numbers rather than doing the
prime factorization of both the numbers and then figuring out the GCD: gcd (𝑎, 𝑏)
Question 3)

This algorithm is somewhat like playing the Euclid game. However, there is an additional rule in the
game: you can only mark the difference of the latest marked numbers. Also, the player who goes
second has to mark a smaller number than the number player 1 marked. See the game example
below, the starting numbers are 9 and 15:

• Player 1 : 15
• Player 2: 9
• Player 1: 6
• Player 2: 3

GAME OVER, PLAYER 2 WINS

The algorithm:

• 15 – 9 = 6
• 9–6=3
• 6–3=3
• 3–3=0

Question 4)

To produce the first line of the algorithm you divide the greater number divided by the smaller
number. The first line becomes:

Dividend = quotient ∗ divisor + remainder.


If want to figure out the next line if the current line is: 𝑎 = 𝑏 ∗ 𝑐 + 𝑑:
𝒄 𝒄
𝒄 = 𝒒𝒖𝒐𝒕𝒊𝒆𝒏𝒕 𝒐𝒇 ∗ 𝒅 + 𝒓𝒆𝒎𝒂𝒊𝒏𝒅𝒆𝒓 𝒐𝒇
𝒅 𝒅
For example, if the current line is 20 = 1 ∗ 17 + 3, the second line will be:
𝟏𝟕 𝟏𝟕
𝟏𝟕 = 𝒒𝒖𝒐𝒕𝒊𝒆𝒏𝒕 𝒐𝒇 ∗ 𝟑 + 𝒓𝒆𝒎𝒂𝒊𝒏𝒅𝒆𝒓 𝒐𝒇 = 𝟏𝟕 = 𝟓 ∗ 𝟑 + 𝟐
𝟑 𝟑
Trying it out with the pairs from question 1:

When the remainder is equal to 0, the algorithm stops. The number that is in the place of c is the
GCD of both the numbers.

Comparing and contrasting the two methods: The subtraction method is obviously slower than the
division one. This is because division is repeated subtraction.
Working with the numbers given in the hw 2: 494 and 2318

Long method:

• 2318 − 494 = 1824


• 1824 − 494 = 1330
• 1330 − 494 = 836
• 836 − 494 = 342
• 494 − 342 = 152
• 342 − 152 = 190
• 190 − 152 = 38
• 152 − 38 = 114
• 114 − 38 = 76
• 76 − 38 = 38
• 38 − 38 = 0
• GCD = 38

Short method:

• 2318 = 4 ∗ 494 + 342


• 494 = 1 ∗ 342 + 152
• 342 = 2 ∗ 152 + 38
• 152 = 4 ∗ 38 + 0
• GCD = 38

Conclusion: The greatest common divisor of 494 and 2318 of 38 OR gcd(494,2318) = 48.

Part 3: A definition and a Theorem

Definition example: If a is equal to 5 and b is equal to 15, the values substituted becomes: 5|15
which is true as 5 divides 15, 5 is a factor of 15 and 15 is a multiple of 5.

Definition example: If a is equal to 5 and b is equal to 35 then: 35 = 5𝑛. Here is n will be an integer
(7) and hence 5|35. If a equals to 6 and b equals 35 then: 35 = 6𝑛. Here n is not an integer and
hence 6|35 is not true.

Theorem example: If a is equal to 5, b is equal to 25 and c is equal to 15 then, 5|(15 + 25) and
5|(25 − 15) which is true as: 5|40 and 5|10.

Theorem proof: We have to use the definition to prove the theorem. The definition says that a | b if
and only if there exists an integer n such that na = b. We can define the other two variables in the
theorem: c and b in terms of a and two other variables. So, b would equal 𝑎𝑥 and c would equal 𝑎𝑦.
That means: 𝐼𝑓 𝑎|𝑎𝑥 𝑎𝑛𝑑 𝑎|𝑎𝑦 𝑡ℎ𝑒𝑛 𝑎|(𝑎𝑥 + 𝑎𝑦). Converting it into the division format:
𝑎𝑦 𝑎𝑥 𝑎𝑥 + 𝑎𝑦
𝐼𝑓 𝑎𝑛𝑑 𝑡ℎ𝑒𝑛
𝑎 𝑎 𝑎
Using the distributive property, we can simplify the 𝑎𝑥 + 𝑎𝑦 to 𝑎(𝑥 + 𝑦). That means that:
𝑎𝑦 𝑎𝑥 𝑎(𝑥 + 𝑦)
𝐼𝑓 𝑎𝑛𝑑 𝑡ℎ𝑒𝑛
𝑎 𝑎 𝑎
This is true because a is divisible by 𝑎(𝑥 + 𝑦) as the answer is 𝑥 + 𝑦 which is an integer. (An integer
plus an integer equals an integer). If quotient of two numbers is an integer than the numbers are
divisible by each other. We can do a similar thing for subtraction:
𝑎𝑦 𝑎𝑥 𝑎(𝑥 − 𝑦)
𝐼𝑓 𝑎𝑛𝑑 𝑡ℎ𝑒𝑛
𝑎 𝑎 𝑎
Here is divisible by 𝑎(𝑥 − 𝑦) as it gives us 𝑥 − 𝑦 as the answer, which is an integer. (An integer
minus an integer is an integer). If quotient of two numbers is an integer than the numbers are
divisible by each other.

Converse counter example: The converse will be that:

𝐼𝑓 𝑎|(𝑏 ± 𝑐) 𝑡ℎ𝑒𝑛 𝑎|𝑏 𝑎𝑛𝑑 𝑎|𝑐.


This statement is not true as it does not work for 𝑎 = 5, 𝑏 = 7 and 𝑐 = 8. Because:
5|15 but 5|7 and 5|8 is not true and 5|(8 − 7) is not true.

I actually forgot what you said about the two out of the three principles, can you please tell it to me
again?

Another Definition

Question 7) The above statement is saying that any other integer, c that divides two integers a and
b, will always be divisible by the gcd(a,b). In other words, c|d. This also means that d is a multiple of
c, which automatically means that c has to be greater than or equal to d, since a multiple of a
number can’t be smaller than that number. That is why 𝑐 ≤ d and c|d are equal to each other.

Part 4: Measurement Dilemma

Question 1)

Solution 1 (Note: In all the solutions, A stands for the smaller container and B stands for the larger
container. Here A = 5 cup container and B = 7 cup container):

• Fill B
• Transfer B to A
• Empty A
• Transfer B to A
• Fill B
• Transfer B to A
• Empty A
• Transfer B to A
• Fill B
• Transfer B to A
• Empty A

Solution 2:

• Fill A
• Transfer all of A to B
• Fill A
• Transfer all of A to B
• Empty B
• Transfer all of A to B
• Fill A
• Transfer all of A to B
• Empty B
• Transfer all of A to B
• Fill A
• Transfer all of A to B

Question 2)

When the third container can measure 8 cups, the three containers can measure amounts from one
cup all the way through 8 cups. See the ways how you can do so (in some cases you just need two of
the three containers):
Measuring 1 cup:

• Fill C
• Transfer C to B
• Empty B

Measuring 2 cups:

• Fill B
• Transfer B to A
• Empty A

Measuring 3 cups:

• Fill C
• Transfer C to A
• Empty A

Measuring 4 cups:

• Fill C
• Transfer C to B
• Empty B
• Transfer C to B
• Fill C
• Transfer C to A
• Empty A
• Transfer B to C

Measuring 5 cups (already possible)

Measuring 6 cups:

• Fill A
• Transfer all of A to B
• Fill A
• Transfer all of A to B
• Empty B
• Transfer all of A to B
• Fill A
• Transfer all of A to B
• Empty B
• Transfer all of A to B
• Fill A
• Transfer all of A to B

Measuring 7 and 8 cups (already possible).

If you can measure one cup in any container you can measure any amount that is less than or equal
to the greatest container. This is similar to the Euclid game, if you can cross out one, than you can
cross out any number that is less than the greater starting number.

Question 3)

In solution 1, I fill B thrice and empty A thrice. We can replace B by 7 and A by 5 and multiply the two
cup sizes by the number of times they are emptied or filled: 7 ∗ 3 = 21 𝑎𝑛𝑑 5 ∗ 3 = 15. Now since
we are emptying A and filling B we can subtract 15 by 21. The difference is 6 – which is the final
output – we have 6 cups in one container at the end.

In solution 2, I fill A four times and empty B two times. So, we can form a similar equation as last
time. We will have to subtract 7 ∗ 2 = 14 𝑓𝑟𝑜𝑚 5 ∗ 4 = 20, as I am filling the 5-cup container and I
am emptying the 7-cup container. When we subtract the two we get 6.

Transferring water form cups doesn’t make a difference to the total amount of water in both the
cups, only the filling and emptying does.

Question 4 and Question 5)

Trying it out with different container sizes

Containers used Cup sizes that I could measure


5 and 7 1 to 7
5 and 10 5 and 10
5 and 25 All the multiples of 5 till 25
8 and 11 1 to 8
9 and 12 All the multiples of 3 till 12
9 and 21 All the multiples of 3 till 21
6 and 10 All the multiples of 2 till 10
9 and 27 All the multiples of 9 till 27
X and y All the multiples of the GCF of x and y

My worked examples of each of the containers that I could measure

5 and 7

• Measuring one cup: Fill A, Transfer A to B, Fill A, Transfer A to B, Empty B, Transfer A to B,


Fill A, Transfer A to B, Empty B
• Measuring two cups: Fill B, Transfer B to A, Empty A
• Measuring three cups: Fill A, Transfer A to B, Fill A, Transfer A to B, Empty B
• Measuring four cups: Fill B, Transfer B to A, Empty A, Transfer B to A, Fill B, Transfer B to A,
Empty B.
• Measuring Five cups: already possible
• Measuring Six cups: Fill B, Transfer B to A, Empty A , Transfer B to A, repeat above steps
twice, Fill B, Transfer B to A, Empty A.
• Measuring Seven cups: Already possible

5 and 10

• Measuring five cups: Already Possible


• Measuring ten cups: Already possible

5 and 25

• Measuring five cups: Already Possible


• Measuring ten cups: Fill A, Transfer A to B, repeat the above steps twice
• Measuring fifteen cups: Fill A, Transfer A to B, repeat the above thrice
• Measuring twenty cups: Fill A, Transfer A to B, repeat the above four times
• Measuring twenty-five cups: Already Possible

8 and 11

• Measuring one cup: Fill B, Transfer B to A, Repeat the above steps twice, Empty A,
Transfer B to A, Fill B, Transfer B to A, Empty A, Transfer B to A, Empty A
• Measuring two cups:
• Measuring three cups: Fill B, Transfer B to A, Empty A
• Measuring four cups: Repeat the procedure for measuring one cup (Fill B, Transfer B to
A, Repeat the above steps twice, Empty A, Transfer B to A, Fill B, Transfer B to A, Empty
A, Transfer B to A, Empty A) Transfer B to A, Fill B, Transfer B to A, Empty A.
• Measuring five cups:
• Measuring six cups: Fill B, Transfer B to A, Repeat the above steps twice, Empty A
• Measuring seven cups: Repeat the procedure for measuring four cups (Fill B, Transfer B
to A, Repeat the above steps twice, Empty A, Transfer B to A, Fill B, Transfer B to A,
Empty A, Transfer B to A, Empty A, Transfer B to A, Fill B, Transfer B to A, Empty A.)
• Measuring eight cups: Already possible
• Measuring nine cups: Repeat the procedure for measuring six cups (Fill B, Transfer B to
A, Repeat the above steps twice, Empty A). Transfer B to A, Fill B, Transfer B to A.
• Measuring ten cups:
• Measuring eleven cups: Already possible

9 and 12

• Measuring three cups: Fill B, Transfer B to A, Empty A


• Measuring six cups: Repeat the procedure for measuring three cups (Fill B, Transfer B to A,
Empty A) Transfer B to A, Fill B, Transfer B to A, Empty A.
• Measuring nine cups: Already possible
• Measuring twelve cups: Already possible

9 and 21

• Measuring three cups: Fill B, (Transfer B to A, Empty A, repeat the portion in brackets
twice).
• Measuring six cups: Repeat the procedure for measuring fifteen cups, Transfer B to A, Empty
A.
• Measuring nine cups: Already possible.
• Measuring twelve cups: Fill B, Transfer B to A, Empty A
• Measuring fifteen cups: Repeat the procedure for measuring three cups (Fill B, (Transfer B to
A, Empty A, repeat the portion in brackets twice))Transfer B to A, Fill B, Transfer B to A,
Empty A.
• Measuring eighteen cups: Fill A, Transfer A to B, repeat the steps twice.
• Measuring twenty-one cups: Already possible.

6 and 10

• Measuring two cups: Repeat the procedure for measuring eight cups, Transfer A to
• Measuring four cups: Fill B, Transfer B to A, Empty A
• Measuring six cups: Already possible
• Measuring eight cups: Repeat the procedure for measuring four cups, Transfer B to A, Fill B,
Transfer B to A, Empty A.
• Measuring ten cups: Already possible

9 and 27

• Measuring nine cups: Already possible


• Measuring eight cups: Fill A, Transfer A to B, repeat twice.
• Mearing twenty-seven cups: Already possible.

The conjecture: A x-cup container and a y-cup contain can measure all amounts that are the
multiples of gcd (𝑥, 𝑦)

Stage 2

Question 6)

There were two answers to question 3, one answer was that I fill B thrice and empty A thrice and the
other solution was that I fill A four times and empty B 2 times. The expression 5𝑥 − 7𝑦 = 6, is just a
representation of the solutions. X stands for how many times you fill A and Y stands for how many
times your empty B (as there is a negative sign next to 7y).

Solution 1 will not be a solution to the equation as in solution one you are filling B not emptying it.
Solution 2 will work as you are filling A and emptying B. Here x will equal 4 and y will equal 2.

Step 1: 5 ∗ 4 − 7 ∗ 2 = 6 Step 2: 20 − 14 = 6 Step 3: 6 = 6

Question 7)

How to get one cup by suing a 5 cup contain and a 7-cup container: Fill A, Transfer A to B, Fill A,
Transfer A to B, Empty B, Transfer A to B, Fill A, Transfer A to B, Empty B. Now we repeat this
procedure six times. See the table below for more information (Let 18 be the value of x and let 12 be
the value of y):

How many times you Fill A in one go: 3 times


How many times your Empty B in one go: 2 times
How many times you Fill A in total: 3 ∗ 6 = 18 𝑡𝑖𝑚𝑒𝑠
How many times your Empty B in total: 2 ∗ 6 = 12 𝑡𝑖𝑚𝑒𝑠

Step 1: 5 ∗ 18 − 7 ∗ 12 = 6 Step 2: 90 − 84 = 6 Step 3: 6 = 6


So, it Is a solution!

Question 8)

The first thing that came to my mind was to add both the solutions up:

Value of X Value of Y
Solution 1: 4 2
Solution 2: 18 12
Sum of both the solutions: 22 14

The answer that I got when I substituted the value was:

𝑥 = 4 + 18, 𝑦 = 2 + 12
𝑆𝑡𝑒𝑝 1: 5 ∗ 22 − 7 ∗ 14 𝑆𝑡𝑒𝑝 2: 110 − 98 = 12
The answer is 12 which is half of 6. So,e4 if reduce the values of x and y by half their
22 14
value we should get the answer as 6: 𝑥 = ,𝑦 =
2 2

𝑆𝑡𝑒𝑝 1: 5 ∗ 11 − 7 ∗ 7 𝑆𝑡𝑒𝑝 2: 55 − 49 = 6

Question 9)

Patterns in my solutions:

Value X Difference in Value Y Difference in


consecutive values of consecutive values of
X Y
4 7 2 5
11 7 7 5
18 12
18 + 7 = 25 12 + 5 =17

I could see that the differences in the consecutive values of x, was always 7, and the difference
between the values of y was always 5. Using this pattern, I could create the next values of x and y by
adding 7 to 18 and 5 to 12 to get: 𝑥 = 25, 𝑦 = 17. Testing it out:

𝑆𝑡𝑒𝑝 1: 5 ∗ 25 − 7 ∗ 17 𝑆𝑡𝑒𝑝 2: 125 − 119 = 6


Using this I could come up with a formula for finding the value of x and y, here z can be any natural
number: 𝑥 = 7𝑧 + 4 𝑎𝑛𝑑 𝑦 = 5𝑧 + 2 So, there are an infinite number of solutions.

Testing it out for z = 7.

Proof of the formulae (First substituting the values of 𝒙 = 𝟕𝒛 + 𝟒 𝒂𝒏𝒅 𝒚 = 𝟓𝒛 + 𝟐 ):

𝑆𝑡𝑒𝑝 1: 5(7𝑧 + 4) − 7(5𝑧 + 2) = 6 𝑆𝑡𝑒𝑝 2: 35𝑧 + 20 − (35𝑧 + 14) = 6


𝑆𝑡𝑒𝑝 3: 35𝑧 − 35𝑧 + 20 − 14 = 6 𝑆𝑡𝑒𝑝 4: 20 − 14 = 6 𝑆𝑡𝑒𝑝 5: 6 = 6

Question 10)

Using the formula 𝑥 = 7𝑧 + 4 and 𝑦 = 5𝑧 + 2

𝑊ℎ𝑒𝑛 𝑧 = −1, 𝑥 = −3 𝑎𝑛𝑑 𝑦 = −3


𝑥 = 7 ∗ −1 + 4, 𝑥 = −3
𝑦 = 5 ∗ −1 + 2, 𝑦 = −3
𝑊ℎ𝑒𝑛 𝑧 = −2, 𝑥 = −10 𝑎𝑛𝑑 𝑦 = −8
𝑥 = 7 ∗ −2 + 4, 𝑥 = −10
𝑦 = 5 ∗ −2 + 2, 𝑦 = −8
I knew that in the equation 5𝑥 − 7𝑦, 𝑥 > 𝑦 while in the equation 7𝑥 − 5𝑦, 𝑥 ≤ 𝑦. This is all because
the solution has to be positive, and it also depends on which term comes first – the one with the
greater coefficient or the one with a smaller coefficient.

The solution 𝑥 = −3 𝑎𝑛𝑑 𝑦 = −3 for the expressions 5𝑥 − 7𝑦 = 6 can be converted to 𝑥 =


3 𝑎𝑛𝑑 𝑦 = 3 for the expression 7𝑥 − 5𝑦 = 6 and the values of x and y are equal. I checked the
values out and they satisfied the equation:

7 ∗ 3 − 5 ∗ 3 = 21 − 15 = 6
The solution 𝑥 = −10 𝑎𝑛𝑑 𝑦 = −8 for the expressions 5𝑥 − 7𝑦 = 6 can be converted to 𝑥 =
8 𝑎𝑛𝑑 𝑦 = 10 for the expression 7𝑥 − 5𝑦 = 6 and the values of x and y are equal. I checked the
values out and they satisfied the equation:

7 ∗ 8 − 5 ∗ 10 = 56 − 50 = 6
One of my solutions in question 1 was to fill B thrice and empty A thrice – but this solution could not
solve the equation: 5𝑥 − 7𝑦 = 6 as here you are filling A and emptying B. However, you can use the
solution in question 1 to solve the equation: 7𝑥 − 5𝑦 = 6 as here you are filling B and emptying A.

Stage 3

I could not make any progress on question 11. I just wanted to clarify, that when you say, “skip 5
dots”, do we start at one, skip 5 dots and land on 7 ? And then we skip 5 dots and land on 6?

You might also like