You are on page 1of 2

Math 109 - Homework #6 Selected Solutions

Professor: Bejenaru
TA: Robert Won

1. Prove that if an integer n is the sum of two squares (n = a2 + b2 for a, b Z) then n = 4q or


n = 4q + 1 or n = 4q + 2 for some q Z. Deduce that 1234567 cannot be written as the sum of
two squares.

Proof. By homework problem 15.5, either a2 = 4p1 or a2 = 4p1 + 1 for some p1 Z. Similarly,
b2 = 4p2 or b2 = 4p2 + 1. Then we must have that

a2 + b2 = 4p1 + 4p2 = 4(p1 + p2 ) or


a2 + b2 = 4p1 + 1 + 4p2 = 4(p1 + p2 ) + 1 or
a2 + b2 = 4p1 + 4p2 + 1 = 4(p1 + p2 ) + 1 or
a2 + b2 = 4p1 + 1 + 4p2 + 1 = 4(p1 + p2 ) + 2.

So setting q = p1 + p2 , we conclude that n = 4q or n = 4q + 1 or n = 4q + 2.


Since 1234567 = 4 3086541 + 3, it cannot be written as a sum of two squares. 

3. Use the result of Question 2 (a2 is divisible by 5 a is divisible by 5) to prove that there
does not exist a rational number whose square is 5.

Proof. Suppose for contradiction that there existed a rational number whose square is 5. Write this
rational as p/q where p, q Z and gcd(p, q) = 1. Then p2 /q 2 = 5. Since p2 = 5q 2 , p2 is divisible
by 5, so by Question 2, we have that p is divisible by 5. Hence, p = 5r for some r Z. But then
p2 = (5r)2 = 25r 2 and so 25r 2 = 5q 2 q 2 = 5r 2 . Now by the same logic, q is divisible by 5. But
this is a contradiction, since gcd(p, q) = 1, but both are divisible by 5. 

4. Prove that there is no rational number whose square is 98.

Proof. Suppose for contradiction there existed a rational number whose square is 98. Again, write
this rational as p/q where p, q Z and gcd(p, q) = 1. Since p2 /q 2 = 98, p2 = 98q 2 is even. But
we proved in Problems I.7 that if p2 is even then p is even. So p = 2r for some r Z and hence
4r 2 = 98q 2 . So 2r 2 = 49q 2 . The left-hand side is even, so the right-hand side is even, hence q 2
must be even. But since q 2 is even, q is even. This is a contradiction, since gcd(p, q) = 1 but p and
q are both even. 

I will always provide full solutions to graded homework exercises. If I think I left something too unclear during
section, or if many students are having trouble with the same thing, I will post solutions to those problems as well.

1
6. Use the Euclidean algorithm to find the greatest common divisors of (i) 165 and 252, (ii)
4284 and 3480.

Proof. For (i),

252 = 165 1 + 87
165 = 87 1 + 78
87 = 78 1 + 9
78 = 9 8 + 6
9=61+3
6=32+0

so gcd(165, 252) = 3.
For (ii),

4284 = 3480 1 + 804


3480 = 804 4 + 264
804 = 264 3 + 12
264 = 12 22 + 0

so gcd(4284, 3480) = 12. 

7. Let un be the nth Fibonacci number. Prove that the Euclidean algorithm takes precisely n
steps to prove that gcd(un+1 , un ) = 1.

Proof. Note: This problem is not quite true, as stated. There are a few ways you can modify the
statement to make it true. We could prove that it takes n 1 steps for all n 2. Or we could
reindex the Fibonacci sequence so u0 = 1, u1 = 1, and prove the result for all n 1. Ill do the
latter.
Proceed by induction on n. For the base case, u1 = 1, u2 = 2. So the Euclidean algorithm

1 = 12+0

takes exactly 1 step to prove gcd(u2 , u1 ) = 1.


Now suppose the Euclidean algorithm takes k steps to prove gcd(uk+1 , uk ) = 1 for some k 1.
Now uk+2 = uk+1 + uk and 0 < uk < uk+1 (since uk+1 = uk + uk1 ). So performing the Euclidean
algorithm to find gcd(uk+2 , uk+1 ), the first step of the algorithm will be

uk+2 = uk+1 + uk .

But now this reduces to finding gcd(uk+1 , uk ), which will take an additional k steps by the induction
hypothesis. Hence, the Eucliean algorithm will take exactly k + 1 steps to find gcd(uk+2 , uk+1 ). 

You might also like