Lecture 12

We’ve developed techniques to find one solution. Euclid’s algorithm gives us that gcd(54,39)=gcd(1×39+15,39)=gcd(15,39)=gcd(39,15)=gcd(2×15+9,15)=gcd(9,15)=gcd(15,9)=gcd(1×9+6,9)=gcd(6,9)=gcd(9,6)=gcd(1×6+3,6)=gcd(3,6)=gcd(6,3)=gcd(2×3+0,3)=gcd(0,3)=3.\begin{aligned} \gcd(54,39) &{}= \gcd(1\times 39+15,39) {}= \gcd(15,39) {}= \gcd(39,15)\\ &{}= \gcd(2\times 15+9,15) {}= \gcd(9,15) {}= \gcd(15,9)\\ &{}= \gcd(1\times 9+6,9) {}= \gcd(6,9) {}= \gcd(9,6)\\ &{}= \gcd(1\times 6+3,6) {}= \gcd(3,6) {}= \gcd(6,3)\\ &{}= \gcd(2\times 3+0,3) {}= \gcd(0,3) {}= 3.\end{aligned} Then, we can work backwards to find a solution to 39x+54y=339x+54y = 3: 3=96=9(159)=2×915=2×(392×15)15=2×395×15=2×395×(5439)=7×395×54.\begin{aligned} 3 &{}= 9-6\\ &{}= 9-(15-9) {}= 2\times9-15\\ &{}= 2\times(39-2\times 15)-15 {}= 2\times39-5\times15\\ &{}= 2\times39-5\times(54-39) {}= 7\times39-5\times54.\end{aligned}

So 39×7+54×(5)=3,39\times 7 + 54\times (-5) = 3, and we multiply both sides by 4040 to get 39×280+54×(200)=120,39\times280 + 54\times(-200) = 120, or in other words, that x=280x=280, y=200y=-200 gives a solution.

Now, you might wonder whether this is the only solution.

There’s a way of analysing this. Suppose we have two solutions: 39x+54y=120and39x+54y=120.39x + 54y=120\qquad\text{and}\qquad 39x'+54y'=120. Subtracting, we get 39(xx)+54(yy)=0.39(x-x') + 54(y-y')=0. Dividing out by the greatest common divisor, we get 13(xx)+18(yy)=0,13(x-x') + 18(y-y')=0, or 13(xx)=18(yy).13(x-x') = -18(y-y'). This means that, as 1818 divides the right-hand side, then we also have 1813(xx)18\mid 13(x-x'). But since 1313 and 1818 are coprime, we have 18(xx)18\mid(x-x') by So we can write xx=18kx-x'=18k. But then we can solve to get yy=13ky-y'=-13k, and it’s easy to check that any such kk works.

Hence the general solution is x=28018k,y=13k200.x=280-18k,\qquad y=13k-200.

While I haven’t stated (and certainly haven’t proved) any theorems about it, this approach works perfectly well in general, as you can imagine.

Common divisors and the gcd

Here’s a useful result about common divisors.

Proposition

Let aa and bb be positive integers. Any common divisor of aa and bb is a divisor of the greatest common divisor.

Proof

If dad\mid a and dbd\mid b, then d(aqb)d\mid(a-qb) for any qq. Hence dd is a divisor of the numbers obtained after every step of Euclid’s algorithm, and so it is a divisor of the gcd.

We defined the gcd to be the greatest of all common divisors. This property is arguably a more natural one: this says that the gcd is somehow the “best” common divisor.

As an unexpected advantage, if we think of the gcd as being defined in this way, then we can get that gcd(0,0)=0\gcd(0,0)=0. This was undefined previously.

Modular arithmetic

Congruences

Repeatedly over the last few lectures (and the last few problem sheets) we have seen appearances of lots of things like:

All these things look pretty similar, and it’s time we got ourselves a language for discussing these things better.