CEMC Banner

Grade 9/10 Math Circles
Linear Diophantine Equations Part 1 - Solutions

Exercise Solutions

Exercise 1

Does the linear Diophantine equation 14x+35y=4 have a solution?

Exercise 1 Solution

Since 7 divides 14 and 35, but does not divide 4, this linear Diophantine equation has no solution.

Exercise 2

For a and b, verify that the important fact holds.

  1. a=9, b=6

  2. a=2, b=6

Exercise 2 Solution

  1. We saw in Example 4 that 9=61+3. Thus, q=1 and r=3. Notice that gcd(9,6)=3 and gcd(6,3)=3. Since gcd(a,b)=gcd(b,r), the important fact holds.

  2. We saw in Example 4 that 2=6(1)+4. Thus, q=1 and r=4. Notice that gcd(2,6)=2 and gcd(6,4)=2. Since gcd(a,b)=gcd(b,r), the important fact holds.

Exercise 3

Calculate gcd(427,616) using the Euclidean algorithm.

Exercise 3 Solution

Euclidean Algorithm Steps GCD Equality
As 427<616, set a=616 and b=427 gcd(427,616)=gcd(616,427)
Write 616=4271+189        (r=189) gcd(616,427)=gcd(427,189)
Write 427=1892+49          (r=49) gcd(427,189)=gcd(189,49)
Write 189=493+42            (r=42) gcd(189,49)=gcd(49,42)
Write 49=421+7               (r=7) gcd(49,42)=gcd(42,7)
Write 42=76+0                 (r=0) gcd(42,7)=gcd(7,0)=7

From the gcd equalities on the right hand side we see that gcd(427,616)=gcd(7,0)=7.

Exercise 4

Find integers x and y such that 427x+616y=7.

Exercise 4 Solution

From Exercise 3, the Euclidean algorithm gives (1)616=4271+189(2)427=1892+49(3)189=493+42(4)49=421+7(5)42=76+0 And so we have gcd(616,427)=7. Notice that this is our value of c in the equation. Working backwards, from equation (4) we have: 7=49142 Substituting for 42 using (3): 7=491(189349) Simplifying: 7=4491189 Substituting for 49 using (2): 7=4(4272189)1189 Simplifying: 7=4(427)9(189) Substituting for 189 using (1): 7=4(427)9(6161427) Simplifying: 7=13(427)9(616) That is, 427(13)+616(9)=7. Therefore, one solution is x=13, y=9. Check!

Exercise 5

Find integers x and y such that 427x+616y=91.

Exercise 5 Solution

From Exercise 3, we know that gcd(427,616)=7. Since 91=13×7, we know 7 divides 91 and so this linear Diophantine equation has a solution.

From Exercise 4, we know that 427(13)+616(9)=7 and so multiplying the entire equation by 13 gives 13(427(13)+616(9))=13(7)13(427(13))+13(616(9))=13(7)427(1313)+616(13(9))=91427(169)+616(117)=91 Thus, x=169, y=117 is a solution. Check!

Exercise 6

Find integers x and y such that 427x+616y=101.

Exercise 6 Solution

Since gcd(427,616)=7, and 7 does not divide 101, there is no solution to this linear Diophantine equation.

Problem Set Solutions

  1. Calculate the following gcds using the Euclidean algorithm.

    1. gcd(12,57)

    2. gcd(212,37)

    3. gcd(4389,2919)

    1. Using the Euclidean algorithm, we find (1)57=124+9(2)12=91+3(3)9=33+0 Thus, gcd(12,57)=3.

    2. Using the Euclidean algorithm, we find (1)212=375+27(2)37=271+10(3)27=102+7(4)10=71+3(5)7=32+1(6)3=13+0 Thus, gcd(212,37)=1.

    3. Using the Euclidean algorithm, we find (1)4389=29191+1470(2)2919=14701+1449(3)1470=14491+21(4)1449=2169+0 Thus, gcd(4389,2919)=21.

  2. For each of the following linear Diophantine equations, find a solution where x and y are integers, or explain why one does not exist.

    1. 4389x+2919y=21

    2. 4389x+2919y=231

    3. 212x37y=1

    4. 12x+57y=124

    5. 12x+57y=423

    1. Since gcd(4389,2919)=21, this linear Diophantine equation has a solution. To find a solution, we will work backwards through the steps in the Euclidean algorithm in our solution to Problem 1. 21=147011449from (3)=14701(291911470)from (2)=2147012919=2(438912919)12919from (1)=2438932919 That is, 4389(2)+2919(3)=21. Thus, one solution to the linear Diophantine equation 4389x+2919y=21 is x=2, y=3.

    2. Since gcd(4389,2919)=21 and 231=21×11, this linear Diophantine equation has a solution.

      From part (a), we know that 4389(2)+2919(3)=21 Multiplying both sides of the equation by 11: 11(4389(2)+2919(3))=11(21) or 4389(22)+2919(33)=231 Thus, a solution to the linear Diophantine equation 4389x+2919y=231 is x=22, y=33.

    3. This is equivalent to solving the linear Diophantine equation 212x+37(y)=1, or equivalently, 212x+37z=1, where y=z.

      From Problem 1, we know that gcd(212,37)=1, and so the linear Diophantine equation 212x+37z=1 has a solution. To find a solution, we will work backwards through the steps in the Euclidean algorithm in our solution to Problem 1. 1=723from (5)=72(1017)from (4)=37210=3(27210)210from (3)=327810=3278(37127)from (2)=1127837=11(212537)837from (1)=112126337=212(11)+37(63) Thus, one solution to the linear Diophantine equation 212x+37z=1 is x=11, z=63.

      Therefore, a solution to 212x37y=1 is x=11, y=63.

    4. Since gcd(12,57)=3, and 3 does not divide 124, there is no solution to this linear Diophantine equation where x and y are both integers.

    5. Since gcd(12,57)=3 and 423=3×141, this linear Diophantine equation has a solution. To find a solution, we will first work backwards through the steps in the Euclidean algorithm in our solution to Problem 1. 3=1219from (2)=121(57412)from (1)=512157 Thus, 12(5)+57(1)=3 Multiplying both sides of the equation by 141 gives, 141(12(5)+57(1))=141(3)12(1415)+57(141(1))=42312(705)+57(141)=423 Thus, one solution to the linear Diophantine equation 12x+57y=423 is x=705, y=141.

  3. Can 1000 be expressed as the sum of two integers, one of which is divisible by 11 and the other by 17? If so, find examples of such integers. If not, explain why.

    This problem is equivalent to asking if there is there a solution to the linear Diophantine equation 11x+17y=1000.

    We know that there is a solution only if gcd(11,17) divides 1000.

    Using the Euclidean algorithm, (1)17=111+6(2)11=61+5(3)6=51+1(4)5=15+0 Thus, gcd(11,17)=1. Since 1000 is divisible by 1, there is a solution to this linear Diophantine equation.

    We begin by first finding a solution to the linear Diophantine equation 11x+17y=1. Working backwards through our steps in the Euclidean algorithm, we have 1=615from (3)=61(1116)from (2)=26111=2(17111)111from (1)=217311 Thus, 11(3)+17(2)=1.

    Multiplying both sides of this equation by 1000 gives 1000(11(3)+17(2))=1000(1)11(31000)+17(21000)=100011(3000)+17(2000)=1000 Thus, one solution to the linear Diophantine equation 11x+17y=1000 is x=3000, y=2000.

    Therefore, 1000 can be expressed as the sum of 33000 (which is divisible by 11) and 34000 (which is divisible by 17).

  4. Can 1000 be expressed as the sum of two integers, one of which is divisible by 9 and the other by 12? If so, find examples of such integers. If not, explain why.

    This problem is equivalent to asking if there is a solution to the linear Diophantine equation 9x+12y=1000.

    We know that there is a solution only if gcd(9,12) divides 1000.
    By inspection, gcd(9,12)=3. Since 1000 is not divisible by 3, there is no integer solution to the linear Diophantine equation 9x+12y=1000.

    Therefore, 1000 cannot be expressed as the sum of two integers, one of which is divisible by 9 and the other by 12.

  5. Use the Euclidean algorithm to find a solution to 25x+10y=215, the linear Diophantine equation from Example 1 in the Lesson. Does your answer make sense in the context of the problem? If not, how can we find a solution that does make sense?

    When solving a linear Diophantine equation, our first step is always to find the gcd of the coefficients using the Euclidean algorithm: 25=10(2)+510=5(2)+0 We end the Euclidean algorithm to find that gcd(25,10)=5.

    Does 5 divide 215? Yes! This means that the linear Diophantine equation 25x+10y=215 has a solution. To find it, we work backwards through the Euclidean algorithm.

    Since our algorithm ended so quickly, it is easy to see that 5=2510(2).

    By multiplying both sides of this equation by 2155=43, we get 25(43)+10(86)=215

    The answer does not make sense in the context of the problem. This answer suggests that we should use 43 quarters and 86 dimes to total $2.15.

    What we are really looking for is a solution to the linear Diophantine equation 25x+10y=215 where both x and y are non-negative integers.

    One way to rectify this problem is the following: for every 5 dimes we are told to subtract, we just add 2 fewer quarters (since 5 dimes and 2 quarters both total 50 cents). So by taking away 36=2(18) quarters, we can add 90=5(18) dimes. This means that x=4336=7 and y=86+90=4 is another solution to the linear Diophantine equation 25x+10y=215 That is, Sara can buy the coffee with 7 quarters and 4 dimes. We will further discuss constraints like this in the second lesson on linear Diophantine equations.

  6. Find an integer n, which, when divided by 78 leaves a remainder of 37, and when divided by 29 leaves a remainder of 17.

    If n has a remainder of 37 when divided by 78, then by the division algorithm we can write (1)n=78x+37 for some integer x Likewise, the same n may be written as (2)n=28y+17 for some integer y Since n is the same in both equations, it must be the case that 78x+37=29y+17. By rearranging the terms, we arrive at the linear Diophantine equation 78x29y=20.

    If we can find a solution to this linear Diophantine equation, we can use equation (1) or (2) to obtain n.

    Our first step is to find gcd(78,29). Using the Euclidean algorithm, (3)78=29(2)+20(4)29=20(1)+9(5)20=9(2)+2(6)9=2(4)+1(7)2=1(2)+0

    Thus we know that gcd(78,29)=gcd(29,20)=gcd(20,9)=gcd(9,2)=gcd(2,1)=gcd(1,0)=1.

    We end the Euclidean algorithm to find that gcd(78,29)=1. Since 1 divides 20, a solution to the linear Diophantine equation 78x29y=20 exists. To find a solution, we have to work backwards through the Euclidean algorithm.

    From (6): 1=92(4) Substituting for 2 using (5): 1=9[209(2)](4) Simplifying: 1=9(9)20(4) Substituting for 9 using (4): 1=[2920(1)](9)20(4) Simplifying: 1=29(9)20(13) Substituting for 20 using (4): 1=29(9)[7829(2)](13) Simplifying: 1=78(13)+29(35) This means that 78(13)+29(35)=1.

    Multiplying both sides of the equation 78(13)+29(35)=1 by 20, the equation becomes 78(260)+29(700)=20 Or equivalently, 78(260)29(700)=20

    Hence, a solution to the linear Diophantine equation 78x29y=20 is x=260,y=700.

    We may now use either equation (1) or equation (2) to get n. By substituting x=260 into equation (1), we get n=20317.

    1. Suppose a, b, and c are given integers. If ax2+by2=c has a solution where x and y are integers, is it true that gcd(a,b) divides c? Why or why not?

    2. Suppose a, b, and c are given integers. If gcd(a,b) divides c, is it true that ax2+by2=c always has a solution where x and y are integers? Why or why not?

    1. Yes, this must be true. Suppose it is not true. That is, suppose c is not divisible by gcd(a,b). Let’s divide both sides of the equation ax2+by2=c by gcd(a,b). Since both a and b are divisible by gcd(a,b), after dividing by gcd(a,b), the left side can be written as nx2+my2 for some integers n and m. Thus, after dividing by gcd(a,b), we have nx2+my2=cgcd(a,b) Here, n, x, m, and y are integers, and so nx2+my2 is an integer. But cgcd(a,b) is not an integer, since c is not divisible by gcd(a,b). So this last equality is impossible! Therefore, if c is not divisible by gcd(a,b), there cannot be a solution to ax2+by2=c where x and y are integers. Thus, if there is a solution to ax2+by2=c where x and y are integers, it must be the case that gcd(a,b) divides c.

    2. No, this is not necessarily true. Consider when a=1, b=1, and c=3. We know that gcd(a,b)=gcd(1,1)=1. Also, c=3 is divisible by 1. However, there are no integers that satisfy the equation x2+y2=3.

    1. Use the division algorithm and the important fact to show that gcd(k+1,k)=1 for any integer k1.

    2. Use the division algorithm and the important fact to show that gcd(7k+6,6k+5)=1 for any integer k1.

    1. Recall from the important fact, that if a=bq+r, then gcd(a,b)=gcd(b,r). How can we use this to solve our problem?

      Well, we can write (k+1)=k(1)+1 Here k+1 is playing the role of a, k is playing the role of b, and 1 is playing the roles of q and r. Thus, gcd(k+1,k)=gcd(k,1)=1

    2. We’re going to try an approach similar to that in part (a). First, let’s use the division algorithm once to write (7k+6)=(6k+5)(1)+(k+1) Here, 7k+6 is playing the role of a, 6k+5 is playing the role of b, 1 is playing the role of q, and k is playing the role of r. We deduce from the important fact that gcd(7k+6,6k+5)=gcd(6k+5,k+1)

      Again, we’ll apply the division algorithm to our new pair to get (6k+5)=(k+1)(5)+k Now the roles of a,b,q and r are played by 6k+5, k+1, 5, and k, respectively. The important fact tells us that gcd(6k+5,k+1)=gcd(k+1,k)

      From part (a), we know that gcd(k+1,k)=1.

      Putting this all together, we get gcd(7k+6,6k+5)=gcd(6k+5,k+1)=gcd(k+1,k)=1