Brain scans show a complex string of numbers and letters in mathematical formula 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 center 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.

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.

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.

It is a personal favourite of Prof David Percy from theInstitute 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”.

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 this beauty of maths was missing from schools and yet amazing things could be shown with even primary school mathematical ability.