William Trail's father was the Reverend William Trail (1712-1756) who was Minister of St Monance in Fife. His mother was Mary Trail (1731-1756) who was the daughter of the Revd Robert Trail, minister of Panbride. Both his parents died in 1756 of a malignant fever.
Trail entered at Marischal College, Aberdeen in 1759 where his father had studied. He then studied under Simson at Glasgow from 1763 and he was awarded an M.A. in 1766. In the same year he was appointed to the Chair of Mathematics at Marischal College, Aberdeen. He won this post in competition with Playfair and Robert Hamilton. Ponting describes the competition in :-
The Town Council, apparently determined to avoid any grounds for complaint ..., despite the opinion of the Principal and Masters that a sufficiently qualified person might be found locally, arranged an open competition for the chair in August 1766. Four examiners, from St Andrews, Glasgow, King's and Marischal, were chosen to test the six candidates who had first to submit 'sufficient Attestations of their moral Characters' to the Town Clerk. The trial covered a detailed list of mathematical topics and included any original work. The order of both proposing and answering oral questions was decided by lot and names were cut off written papers by a clerk before the examiners received them. For an ordeal which lasted eleven days, the victims must have been relieved that 'As the Examinators apprehend the presence of Spectators may be apt to disconcert the Candidates and even to hurt the attention of the Examinators, they are of opinion the Trial should be in the presence of the Examinators and their Clerk only'. Marks awarded ranged from 16 to 126, the top score and appointment going to William Trail, a young man newly graduated from Glasgow. The runners up, with 119 and 90 respectively, were Robert Hamilton, who joined the staff later and John Playfair, afterwards professor at Edinburgh. Details of Hamilton's actual questions may be found in the University archives.
Ponting goes on to give some details in  of Trail's time teaching at Aberdeen:-
Although Trail began his duties in October, the Town Council paid his annual £50 professorial salary only from Whitsunday 1767, retaining the balance to defray 'the great expense incurred by the comparative Tryal of the Candidates'. Meanwhile he presumably had to live on his class fees, estimated at about £70 for the session. By this time the earlier system of appointing post graduate teaching bursars to help with arithmetic and elementary geometry had been abandoned as no longer necessary. Trail, responsible for all Mathematics, taught 'above twelve times a week'.
While holding this post he was awarded the degrees of DD and LLD from Aberdeen in 1774. While holding the chair at Aberdeen, Trail published Elements of Algebra... :-
His widely used Elements of Algebra, which he published for his students in 1770, ranged from first principles to equations of all orders and included applications to problem solving, physics and geometry.
Details of the latter part of Trail's time in Aberdeen are then given in :-
In 1776, at Trail's request, John Garioch, a physician in Aberdeen, was appointed his assistant and successor. Garioch died six months later and was not replaced. During the session 1778 - 9, in Trail's absence, the higher branches of mathematics were taught by Patrick Copland, Professor of Natural Philosophy since 1775.
He resigned the Chair of Mathematics at Marischal College in 1779 on obtaining a preferment in the Irish Church being appointed Chancellor of Down and Connor, Ireland. He married Lady Frances Charteris in 1799. Despite his new career in the Church, Trail did retain an interest in mathematics :-
His continuing interest in mathematics was shown in an account of the life and work of his former Glasgow professor, Robert Simson, published in 1812. He died in 1831 aged eighty-four.
He was described as:-
... a man of great capacity... entirely extinguished... by the sinecure emoluments of the Irish Church .
The Royal Society of Edinburgh was founded in 1783 and Trail was a Founder Member, elected on 17 November 1783.
Article by: J J O'Connor and E F Robertson