Solve the diophantine equation 71x +29y = 101
1.Euclidean algorithm
71 = 29*2 + 13
29 = 29*2 + 3
13 = 3*4 + 1
3 = 3*1 + 0
GCD(71,29) = 1
2. Write as linear equation (Euclidean algorithm backwards)
1 = 13 - 4*3
3 = 29 - 2*13
13 = 71 - 2*29
1 = 13 - 4*3 =
= 13 -4*(29 - 2*13)
= 9*13 -4*29
= 9*(71-2*29)-4*29
= 9*71 - 22*29
1 = 9*71 - 22*29 -> (write in the form 71x +29y = 101)
71(9) + 29(-22) = 1
71(909) + 29(-2222) = 101
71*909 + 29*(-2222) + 29*71n - 71*29n = 101
71(909-29n) + 29(-2222 + 71n) = 101
x = 909 - 29n
y = -2222 + 71n
Now that's my solution. But the correct solution should be:
x = -29n - 19
y = 71n + 50