A mathematician is a pattern searcher, someone who tries to find logic and structure in the chaotic world that we inhabit. This is key to the way that we memorize things. Memory depends on identifying pattern and structure to help our brains store a condensed programme from which to regenerate the stored memory.

Take these sequences:

1234543212345

1235813213455

1113213336473

To memorize them you need to find some structure inside the numbers which spares you having to remember each number individually. In the first sequence, the pattern is obvious. The second sequence might at first sight appear harder, but as soon as you spot the underlying logic it becomes as easy to memorize as the first. By pulling the numbers apart and noticing that each number is the sum of the two previous numbers, this simple algorithm provides a way to generate the sequence ad infinitum. They are a famous set called the Fibonacci numbers – a sequence that can be seen in nature as a code by which shells and flowers grow. The third sequence offers little structure to help you. Random by definition, they are the UK lottery numbers for 19 December 2007.

I have a terrible memory for names and dates and random information that I can make no logical sense of. In history I haven't a clue what date Queen Elizabeth I died and if you told me it was 1603 I'd forget it ten minutes later; in French I always had difficulty recalling all the different forms of the irregular verb *aller*; in Chemistry was it potassium or sodium that burns purple? But in mathematics I could reconstruct everything from the patterns and logic I'd identified in the subject. Spotting patterns replaced the need for a good memory.

A classic example of the use of patterns to store memories pertains to a famous story of the precocious young Mozart. At the age of 14 Mozart's father took his son on a grand tour of Europe. They arrived in Rome at Easter just in time to hear a rare performance of Allegri's *Miserere*. Composed in 1638, the Pope at the time so loved the piece that he decreed that it should only be sung during holy week. No manuscripts were allowed to leave the Vatican and excommunication awaited anyone who tried to make a transcript.

Mozart sat and listened transfixed as the music bounced around the Sistine Chapel. As the piece reached its climax and the castrati singers soared off into the heights, the Pope dramatically fell to his knees to end the service. Once back in their lodgings, Mozart couldn't get the piece out of his head. It's said that he wrote out a complete manuscript of the 12-minute piece from memory, returning the next day to check how accurate the manuscript was. It required only minor corrections.

For some, this story is an illustration of Mozart's amazing memory. But I don't think so at all. For me it is an indication of Mozart's fantastic ability to decompose and understand the underlying structure of the music. His mathematical mind used the patterns he heard in Allegri's composition to produce a musical algorithm to generate the piece. Suddenly you need only a small amount of memory, because the pattern generates the rest of the sequence.

The same principle is at work in many of the codes used to store and preserve data. Compression software is looking for patterns across data in order to find efficient ways to store information. Instead of using up valuable memory storing a string of a million alternating 0s and 1s, the software can spot the pattern and stores a much shorter file which just describes the recipe or programme for outputting the million numbers "0101...01".

This principle is used as a measure of complexity or randomness in data. A random sequence of numbers will be one where the programme to store the data is no shorter than actually storing the data directly. There is no way to compress it if there is no underlying pattern to the numbers.

Mathematics is also key to preserving the integrity of data as it is transmitted around the world. When our voice is changed into a digital signal it often gets corrupted as it is bounced from one satellite to another. But the data is encoded in a way that means that a corrupted message still retains enough information to reconstruct the original. The encoding is chosen so that a memory of what the message should have been is identifiable in the corrupted data. And the key to these special codes is symmetry.

For example if you want to transmit a black-and-white image then you could send a 1 to denote a black pixel and 0 a white pixel. But any interference which occurs which changes a 0 to a 1 could never be identified and corrected. However, if you send 000s and 111s instead, and the message 110 is received, the likelihood is that one error occurred in transmission and the original message was actually 111. This is a fairly simple code but the mathematics of symmetry has provided sophisticated codes which allow much more efficient detection and correction of errors. They are implemented in nearly every setting where data is stored digitally: satellite images, mobile phone conversations, MP3 players.

The power of symmetry to create such efficient codes depends on the strong interrelationship that is set up across an object with symmetry. In an Arabic carpet, if you know what is happening in three corners of the design then you can often use the symmetry of the design to recreate the pattern in the fourth corner.

Anyone who is memorizing something is applying a distinctly mathematical side of their brain. Memory requires finding patterns, connections, associations and logic in the data that we are trying to store. Whether we are aware of it or not, we are all mathematicians at heart.