## Maths in a minute: Algorithms

The word "algorithm" has probably got more usage over the last few years than it has in its entire history. It is often associated with artificial intelligence and sometimes comes with a bit of a scary undertone. But what exactly is an algorithm?

The word itself is derived from the name of a person, the mathematician, astronomer and general polymath Muḥammad ibn Mūsā al-Khwārizmī who lived around the turn of the 9th century. When some of his books were translated in the 12th century, his name was Latinised to "alghoarismi "or "algorismi" — and that's where the word "algorithm" comes from.

A page from al-Khwārizmī's book *Algebra*.

An algorithm is simply a list of instructions that enable you to complete a task. A detailed cooking recipe is an algorithm, and so are (or at least should be) instructions to put together flatpack furniture. In maths terms, long division is an algorithm that enables you to divide one number by another, and the sieve of Eratosthenes is an algorithm for finding prime numbers.

Algorithms have been around ever since people have been able to communicate lists of instructions to each other, but they've really come into their own in the age of computers. When we communicate instructions to fellow humans, we often leave out things we consider obvious — for example, if a cooking recipe requires eggs, we don't normally specify that the eggs need to be broken. No human in their right mind would put unbroken eggs into a cake. Computers, however, do not have the brains or life experience to infer what's obvious, so a computer program has to be a water tight algorithm where every single step is clearly defined.

When we talk about algorithms today, it's usually computer programs we mean. A small number of these programs involve something called *machine learning*, or specifically *deep learning*.
In this case an algorithm (which is still a clear list of instructions) adjusts itself in response to data sets it has been shown so it develops the ability to spot patterns in data that humans might find hard to spot. It can then apply this ability to other data sets to make predictions or generate outputs, such as a suggestion for someone's online shopping.

Machine learning is so surprisingly powerful that people think of it as a form of artificial intelligence — it's what powers the *large language models* that give us things like ChatGTP and it's also behind other forms of generative AI (along with more mundane things such as online shopping suggestions).

Coming back to the general notion of an algorithm though, it doesn't have to be sophisticated or scary. It can literally just be about making an omlette.

### Further reading

To find out more about machine learning, see

- Maths in a minute: Machine learning and neural networks
- What is machine learning?
- Maths in a minute: Deep learning
- All our content on machine learning

For some lovely examples of some other types of algorithm, see

*This article was produced as part of our collaboration with the Isaac Newton Institute for Mathematical Sciences (INI) – you can find all the content from the collaboration here. *

*
The INI is an international research centre and our neighbour here on the University of Cambridge's maths campus. It attracts leading mathematical scientists from all over the world, and is open to all. Visit www.newton.ac.uk to find out more. *