Mathematician and wartime codebreaker.

Born: June 30, 1923 in Glasgow; Died May 14, 2014 in Warwick.

PROFESSOR Murray Macbeath, who has died aged 90, was one of the foremost mathematicians of his generation whose brilliance led him from the Bletchley Park code-breaking centre to the highest levels of academia.

He was one of the youngest chairs of mathematics when he arrived at Dundee University and was on good terms with Albert Einstein, whom he met and got to know while undertaking his PhD at Princeton.

Professor Macbeath's published work, Elementary Vector Algebra, became a set text for schools and universities throughout the UK and is still widely read today, despite being long out of print.

But while renowned for his formidable intellect and considerable wisdom, there was much more to this sometimes kilted academic who thought nothing of cycling 100 miles and running marathons when he could have been using his bus pass.

Alexander Murray Macbeath (he was always known as Murray) was born in Glasgow, the eldest of four children. Both his parents were Highlanders and he learned Gaelic from a young age. He was raised in Belfast where his father Alec was professor of logic and metaphysics at Queen's University, and where he himself gained a BA (Hons) during the Second World War.

He was then selected to join the spirited team of young geniuses at Bletchley Park, where, having become fluent in Japanese, he specialised in cracking that enemy's military codes. Speaking of the heat generated by the giant and primitive Colossus computer, he once joked: "This caused the young ladies to be often scantily dressed."

After being released from war service, he gained an MA (Hons) from Clare College, Cambridge, followed by a Commonwealth Fund fellowship to Princeton University for his PhD, where John Nash, immortalised in the film A Beautiful Mind, was a contemporary.

While he was there, he also got to know Einstein, the emeritus professor at Princeton. During this time, Professor Macbeath became an early pioneer of the gap year, travelling around the US by car with two friends before returning to the UK and Clare College, as a senior fellow. There he met his wife Julie, at the Cambridge Strathspey and Reel Club.

His first academic post was as a lecturer at Keele University, before becoming one of the youngest professors to be awarded the chair of mathematics at the University of Dundee. In 1963, he became professor of mathematics at Birmingham University, where he stayed until 1979.

In 1966, he took another gap year; this time a sabbatical to California Institute of Technology at Pasadena. His family accompanied him and enjoyed the adventure of driving across the US from west to east at the end of their stay. Highlights included campsite tornados in Wyoming and returning to the UK on one of the last voyages of the Queen Mary.

Professor Macbeath, who had a gentle manner and well-developed sense of fun, was widely admired by his students as an inspirational lecturer and tutor, with the rare ability to convey complex subject matter clearly and concisely. A keen athlete, he would regularly swim, work out at the gym and cycle to work at Birmingham University, often accompanied by his son Ian, who was at school nearby, as well as undertaking jaunts of more than 100 miles with his other son Peter, a keen racing cyclist.

He moved back to the US in 1979, to take the chair of mathematics at Pittsburgh University. While they were there, he and his wife made many lifelong friends at the Scottish Country Dance Society, participating regularly in demonstrations and competitions. He also found sufficient energy to run the Pittsburgh Marathon at the age of 60.

He retired to Tayport, Fife, in 1990, and latterly Wellesbourne in Warwickshire. Despite retirement, the lure of his calling proved too strong and he retained an office at Warwick University, where he was emeritus professor of mathematics. He attended academic conferences well into his 80s and enjoyed toasting the haggis with a good single malt on Burns Night, resplendent in full Highland dress at Lighthorne village hall. He and his wife were enthusiastic dancers and often led the less nimble-footed villagers around the hall.

His friend from that time, Noel Hunter, recalled advertising the inaugural meeting of the Lighthorne Caledonian Society and the first Burns Supper ever held in the village. "Far from showing any affront to this Sassenach impertinence, Murray embraced the idea and he even loaned me a kilt," Mr Hunter said. "He became president of the fledgling Lighthorne Caledonian Society and presided over all of our Burns suppers since 1995, including in January this year.

"At the end of our first Burns Night, he came to me and said, with a serious expression, 'I've been to Burns Nights all over the world but this is the best I've ever been to.' I was much relieved, but Julie informed me that the previous one they attended was in Buffalo in the US, held in temperance conditions and the haggis was toasted in tomato juice. Murray had not been amused, so we didn't have much to beat."

Despite suffering two strokes in later life, his high spirits never dampened, even during his recovery. Bored with the hospital's strict no alcohol policy, he sneaked out one evening in pyjamas and dressing gown to avail himself, as he later confessed, of a wee dram. Unable to find a pub within walking distance, he had to settle for an off-licence instead. Astonished nursing staff later confiscated the can of beer he was sharing with a patient in the same ward.

He also entertained staff and patients by singing rousing renditions of The Mountains of Mourne, Molly Malone and Waltzing Matilda.

Despite increasing frailty, he was able to celebrate his 90th birthday flying birds of prey at the Cotswold Falconry Centre before travelling 400 miles by car to attend the memorial service for his sister Catriona last September. Here, he re-established contact with his cousin Frank after a gap of many years and the two remained in close contact until Frank's death, a few weeks before his own.

He is survived by his wife of 62 years, Julie, and sons Ian and Peter.