His earliest work dealt mainly with mathematical subjects, and especially with quaternions (q.v.), of which he may be regarded as the leading exponent after their originator, Hamilton.
He was the author of two text-books on them - one an Elementary Treatise on Quaternions (1867), written with the advice of Hamilton, though not published till after his death, and the other an Introduction to Quaternions (1873), in which he was aided by Professor Philip Kelland (1808-1879), who had been one of his teachers at Edinburgh.
In addition, quaternions was one of the themes of his address as president of the mathematical section of the British Association in 1871.
Among his articles may be mentioned those which he wrote for the ninth edition of this Encyclopaedia on Light, Mechanics, Quaternions, Radiation and Thermodynamics, besides the biographical notices of Hamilton and Clerk Maxwell.
For the subjects of this general heading see the articles ALGEBRA, UNIVERSAL; GROUPS, THEORY OF; INFINITESIMAL CALCULUS; NUMBER; QUATERNIONS; VECTOR ANALYSIS.