Image copyright Thinkstock

Brain scans show a complex string of numbers and letters in mathematical formulae can evoke the same sense of beauty as artistic masterpieces and music from the greatest composers.

Mathematicians were shown "ugly" and "beautiful" equations while in a brain scanner at University College London.

The same emotional brain centres used to appreciate art were being activated by "beautiful" maths.

The researchers suggest there may be a neurobiological basis to beauty.

The likes of Euler's identity or the Pythagorean identity are rarely mentioned in the same breath as the best of Mozart, Shakespeare and Van Gogh.

The study in the journal Frontiers in Human Neuroscience gave 15 mathematicians 60 formula to rate.

One of the researchers, Prof Semir Zeki, told the BBC: "A large number of areas of the brain are involved when viewing equations, but when one looks at a formula rated as beautiful it activates the emotional brain - the medial orbito-frontal cortex - like looking at a great painting or listening to a piece of music."

The more beautiful they rated the formula, the greater the surge in activity detected during the fMRI (functional magnetic resonance imaging) scans.

"Neuroscience can't tell you what beauty is, but if you find it beautiful the medial orbito-frontal cortex is likely to be involved, you can find beauty in anything," he said.

A thing of great beauty

Image copyright SPL Image caption Euler's identity: Does it get better than this?

To the untrained eye there may not be much beauty in Euler's identity, but in the study it was the formula of choice for mathematicians.

At first you don't realise the implications it's a gradual impact, perhaps as you would with a piece of music and then suddenly it becomes amazing as you realise its full potential. Prof David Percy, Institute of Mathematics and its Applications

It is a personal favourite of Prof David Percy from the Institute of Mathematics and its Applications.

He told the BBC: "It is a real classic and you can do no better than that.

"It is simple to look at and yet incredibly profound, it comprises the five most important mathematical constants - zero (additive identity), one (multiplicative identity), e and pi (the two most common transcendental numbers) and i (fundamental imaginary number).

"It also comprises the three most basic arithmetic operations - addition, multiplication and exponentiation.

"Given that e, pi and i are incredibly complicated and seemingly unrelated numbers, it is amazing that they are linked by this concise formula.

"At first you don't realise the implications it's a gradual impact, perhaps as you would with a piece of music and then suddenly it becomes amazing as you realise its full potential."

He said beauty was a source of "inspiration and gives you the enthusiasm to find out about things".

Image copyright SPL Image caption The hugely influential theoretical physicist Paul Dirac said: "What makes the theory of relativity so acceptable to physicists in spite of its going against the principle of simplicity is its great mathematical beauty. This is a quality which cannot be defined, any more than beauty in art can be defined, but which people who study mathematics usually have no difficulty in appreciating."

Mathematician and professor for the public understanding of science, Marcus du Sautoy, said he "absolutely" found beauty in maths and it "motivates every mathematician".

He said he loved a "small thing [mathematician Pierre de] Fermat did". He showed that any prime number that could be divided by four with a remainder of one was also the sum of two square numbers.

So 41 is a prime, can be divided by four with one left over and is 25 (five squared) plus 16 (four squared).

"So if it has remainder one it can always be written as two square numbers - there's something beautiful about that.

"It's unexpected why should the two things [primes and squares] have anything to do with each other, but as the proof develops you start to see the two ideas become interwoven like in a piece of music and you start to see they come together.

He said it was the journey not the final proof that was exciting "like in a piece of music it's not enough to play the final chord".

He said this beauty of maths was missing from schools and yet amazing things could be shown with even primary school mathematical ability.

In the study, mathematicians rated Srinivasa Ramanujan's infinite series and Riemann's functional equation as the ugliest of the formulae.