50 Mathematical Ideas You Really Need to Know

(Marcin) #1

15 Euclid’s algorithm


Al-Khwarizmi gave us the word ‘algebra’, but it was his ninth-century book on arithmetic
that gave us the word ‘algorithm’. Pronounced ‘Al Gore rhythm’ it is a concept useful to
mathematicians and computer scientists alike. But what is one? If we can answer this
we are on the way to understanding Euclid’s division algorithm.


Firstly, an algorithm is a routine. It is a list of instructions such as ‘you do this
and then you do that’. We can see why computers like algorithms because they
are very good at following instructions and never wander off track. Some
mathematicians think algorithms are boring because they are repetitious, but to
write an algorithm and then translate it into hundreds of lines of computer code
containing mathematical instructions is no mean feat. There is a considerable risk
of it all going horribly wrong. Writing an algorithm is a creative challenge. There
are often several methods available to do the same task and the best one must
be chosen. Some algorithms may not be ‘fit for purpose’ and some may be
downright inefficient because they meander. Some may be quick but produce the
wrong answer. It’s a bit like cooking. There must be hundreds of recipes
(algorithms) for cooking roast turkey with stuffing. We certainly don’t want a
poor algorithm for doing this on the one day of the year when it matters. So we
have the ingredients and we have the instructions. The start of the (abbreviated)
recipe might go something like this:



  • Fill the turkey cavity with stuffing

  • Rub the outside skin of the turkey with butter

  • Season with salt, pepper and paprika

  • Roast at 335 degrees for 3½ hours

  • Let the cooked turkey rest for ½ hour

Free download pdf