Section2.4The Bezout Identity

Subsection2.4.1Backwards with Euclid

Now, before we get to the third characterization of the gcd, we need to be able to do the Euclidean algorithm backwards. This is sometimes known as the Bezout identity, and it is worth doing some examples.

The previous exercises may have had one you solved, probably by trial and error. For instance, \[6=60\cdot (-2)+42\cdot 3\; .\]

The third characterization implies that doing this is always possible; \(gcd(a,b)=ax+by\) for some integers \(x\) and \(y\). Euclid backwards does this.

Sometimes it's good to write the Euclidean algorithm down one side of a table, and then go backwards up the other side of the table to obtain Bezout's identity. Here's an example with the gcd of 8 and 5; follow it from top left to the bottom and then back up the right side.

\(8=1\cdot 5+3\) \(8-1\cdot 5=3\) \(1=2\cdot 3-1\cdot 5=2\cdot (8-1\cdot 5)-1\cdot 5=2\cdot 8-3\cdot 5\)
\(5= 1\cdot 3+2\) \(5- 1\cdot 3=2\) \(1=3-1\cdot 2=3-1\cdot(5-1\cdot 3)=2\cdot 3-1\cdot 5\)
\(3=1\cdot 2+1\) \(3-1\cdot 2=1\) \(1=3-1\cdot 2\)
\(2=2\cdot 1+0\) Go up this column...

This question of Bezout's identity is implemented in Sage as xgcd(a,b), because this is also known as the eXtended Euclidean algorithm.

Or, \(6=-2\cdot 60+3\cdot 42\), as we saw above.

Try to get the xgcd/Bezout for \(gcd(1492,1066)\). You should get \(2=-5\cdot 1492+7\cdot 1066\).

Remark2.4.2

Sage note:
Do you remember what the [1] means? What do you think the [2] means in this context?

You might also want to do more than one linear combination, for variety. How might we get another such representation?

Example2.4.3Using Bezout to get another Bezout

We used the backwards Euclidean algorithm to see that \(6=-2\cdot 60+3\cdot 42\). Let's use that to get another.

  • Since \(6\) is itself a divisor of both 60 and 42, let's pick one (the smaller one!), 42, and write it as \(42=7\cdot 6\).
  • Then we can really write \[42=7\cdot 6=7\cdot (-2\cdot 60+3\cdot 42)\; ,\] since after all we just saw that was a way to represent \(6\)!
  • Now we plug this back into the original equation: \[6=-2\cdot 60+3\cdot 42=-2\cdot 60+3\cdot (7\cdot 6)=-2\cdot 60+3\cdot (7\cdot (-2\cdot 60+3\cdot 42))\]
If we simplify it out, that means \(6=-44\cdot 60+63\cdot 42\), which is indeed correct!

So, substituting a Bezout identity into itself yields more and more such identities. How many such identities are there? Is there a general form? That will be answered soon.

As another example, what makes finding \(gcd(42000,60000)\) so easy? Let's discuss.

If \(gcd(a,b)=d\), could you make a guess as to a formula for \(gcd(ka,kb)\) (for \(k>0\))? Can you prove it? (Hint: here is where our original definition or the Bezout version could be useful.)

Subsection2.4.2Proving the final characterization

Now let's prove the final characterization of GCD - namely, the least positive integer which can be written \(au+bv\) for integers \(u,v\).

  • Call \(c\) the smallest such \(au+bv\).
  • Clearly, any integer which divides \(a\) and \(b\) divides any such \(au+bv\), so it divides the smallest such \(au+bv=c\). In particular, the gcd of \(a\) and \(b\) (which we'll call \(d\)) divides \(c\). So by one of the facts above, \(d\leq c\).
  • On the other hand, we know from the backward Euclidean algorithm/Bezout identity that \(d\) can be written \(d=ax+by\) for some integers \(x\) and \(y\). Since \(c\) is the smallest such (positive) integer, \(c\leq d\).
  • The only way to avoid a contradiction is for \(d=c\)!

Subsection2.4.3Relatively Prime

There is one final thing that the linear combination version of the gcd can give us. It is something you may think is familiar, but which can arise very naturally from the Bezout identity.

When do \(a\) and \(b\) have greatest common divisor 1? From this point of view, it is precisely when you can write \(ax+by=1\) for some integers \(x\) and \(y\). That means, in fact, that you can write any integer as a (linear) combination of \(a\) and \(b\) if their gcd is 1!

This is a property I think people would have come up with no matter how the development of mathematics had gone; the pairs of integers such that you can write any number as a combination of them. We call these relatively prime numbers or coprime numbers.

Here are two interesting facts about coprime integers \(a\) and \(b\):

  • If \(a|c\) and \(b|c\), then \(ab|c\).
  • If \(a|bc\), then \(a|c\).
The first is not too hard to prove, if you think in terms of Bezout. It does need a little cleverness.
  • Remember that \(ax+by=1\) by definition.
  • So \(c=cax+cby\).
  • Now write \(c=kb\) and \(c=\ell a\), and substitute them in the opposite parts of the previous line.
  • This gives \(c=(kb)ax+(\ell a)by\), and \(ab\) definitely divides both parts of this, so it divides the whole thing by our earlier proposition about divisibility.

It's also useful to try to find counterexamples! Can you find place where \(gcd(a,b)\neq 1\), \(a|c\) and \(b|c\), but \(ab\) does not divide \(c\)?